about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/vlang
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-08-14 00:20:49 +0000
committerAlyssa Ross <hi@alyssa.is>2019-08-14 00:23:16 +0000
commit4999a38db7c5de0ea9f514a12ecd4133cce647f3 (patch)
treebbb659ab07fda4c9b98053499b7e3f046ac6d5dc /nixpkgs/pkgs/development/compilers/vlang
parentf9abd30e11337cf07034f2cc8ad1691aa4a69386 (diff)
parent8746c77a383f5c76153c7a181f3616d273acfa2a (diff)
downloadnixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.gz
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.bz2
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.lz
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.xz
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.tar.zst
nixlib-4999a38db7c5de0ea9f514a12ecd4133cce647f3.zip
Merge commit '8746c77a383f5c76153c7a181f3616d273acfa2a'
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/vlang')
-rw-r--r--nixpkgs/pkgs/development/compilers/vlang/default.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/vlang/default.nix b/nixpkgs/pkgs/development/compilers/vlang/default.nix
new file mode 100644
index 000000000000..cbccca34b413
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/vlang/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchFromGitHub, glfw, freetype, curl }:
+
+stdenv.mkDerivation rec {
+  pname = "vlang";
+  version = "0.1.16";
+
+  src = fetchFromGitHub {
+    owner = "vlang";
+    repo = "v";
+    rev = "${version}";
+    sha256 = "08zgwy9ac3wa5ixy8rdw6izpn1n1c3ydb9rl8z8graw0bgv719ma";
+  };
+
+  # V compiler source translated to C for bootstrap.
+  vc = fetchFromGitHub {
+    owner = "vlang";
+    repo = "vc";
+    rev = "${version}";
+    sha256 = "0k6c7v3r3cirypsqbaq10qlgg41v19rsnc1ygam4il2p8rsmfwz3";
+  };
+
+  enableParallelBuilding = true;
+  buildInputs = [ glfw freetype curl ];
+
+  buildPhase = ''
+    runHook preBuild
+    cc -std=gnu11 -w -o v $vc/v.c -lm
+    ./v -prod -o v compiler
+    # -fPIC -pie required for examples/hot_code_reloading
+    make CFLAGS+="-fPIC -pie" thirdparty
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/{bin,lib/vlang,share/vlang}
+    cp -r examples $out/share/vlang
+    cp -r {vlib,thirdparty} $out/lib/vlang
+    cp v $out/lib/vlang
+    ln -s $out/lib/vlang/v $out/bin/v
+    runHook postInstall
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://vlang.io/";
+    description = "Simple, fast, safe, compiled language for developing maintainable software";
+    license = licenses.mit;
+    maintainers = with maintainers; [ chiiruno ];
+    platforms = platforms.all;
+  };
+}