summary refs log tree commit diff
path: root/pkgs/development/compilers/vlang/default.nix
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2019-08-01 09:44:06 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2019-08-01 09:44:06 +0200
commit4ca8e53e1ddb2f2f1e5520be33654c33481faae0 (patch)
tree94896f54f338cc97a1e43adf3dcbdff15d5a512c /pkgs/development/compilers/vlang/default.nix
parent59ac7e16347e2e841e24d3dd959b9fc5dab5fdc8 (diff)
parent55e4555b77ff7506579c1d4f5d9b562ca6e853b4 (diff)
downloadnixpkgs-4ca8e53e1ddb2f2f1e5520be33654c33481faae0.tar
nixpkgs-4ca8e53e1ddb2f2f1e5520be33654c33481faae0.tar.gz
nixpkgs-4ca8e53e1ddb2f2f1e5520be33654c33481faae0.tar.bz2
nixpkgs-4ca8e53e1ddb2f2f1e5520be33654c33481faae0.tar.lz
nixpkgs-4ca8e53e1ddb2f2f1e5520be33654c33481faae0.tar.xz
nixpkgs-4ca8e53e1ddb2f2f1e5520be33654c33481faae0.tar.zst
nixpkgs-4ca8e53e1ddb2f2f1e5520be33654c33481faae0.zip
Merge staging-next into staging
Diffstat (limited to 'pkgs/development/compilers/vlang/default.nix')
-rw-r--r--pkgs/development/compilers/vlang/default.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/development/compilers/vlang/default.nix b/pkgs/development/compilers/vlang/default.nix
new file mode 100644
index 00000000000..cbccca34b41
--- /dev/null
+++ b/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;
+  };
+}