aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/compilers/vlang/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/vlang/default.nix')
-rw-r--r--nixpkgs/pkgs/development/compilers/vlang/default.nix31
1 files changed, 18 insertions, 13 deletions
diff --git a/nixpkgs/pkgs/development/compilers/vlang/default.nix b/nixpkgs/pkgs/development/compilers/vlang/default.nix
index f72ec089054..fba11a06a6e 100644
--- a/nixpkgs/pkgs/development/compilers/vlang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/vlang/default.nix
@@ -1,42 +1,47 @@
-{ stdenv, fetchFromGitHub, glfw, freetype, openssl }:
+{ stdenv, fetchFromGitHub, glfw, freetype, openssl, upx ? null }:
+
+assert stdenv.hostPlatform.isUnix -> upx != null;
stdenv.mkDerivation rec {
pname = "vlang";
- version = "0.1.18";
+ version = "0.1.21";
src = fetchFromGitHub {
owner = "vlang";
repo = "v";
rev = version;
- sha256 = "0js92v2r1h4vaaha3z1spgi7qynlmr9vls41gxp284w4yhnjzv15";
+ sha256 = "0npd7a7nhd6r9mr99naib9scqk30209hz18nxif27284ckjbl4fk";
};
# V compiler source translated to C for bootstrap.
+ # Use matching v.c release commit for now, 0.1.21 release is not available.
vc = fetchFromGitHub {
owner = "vlang";
repo = "vc";
- rev = version;
- sha256 = "0qx1drs1hr94w7vaaq5w8mkq7j1d3biffnmxkyz63yv8573k03bj";
+ rev = "950a90b6acaebad1c6ddec5486fc54307e38a9cd";
+ sha256 = "1dh5l2m207rip1xj677hvbp067inw28n70ddz5wxzfpmaim63c0l";
};
enableParallelBuilding = true;
- buildInputs = [ glfw freetype openssl ];
+ propagatedBuildInputs = [ glfw freetype openssl ]
+ ++ stdenv.lib.optional stdenv.hostPlatform.isUnix upx;
buildPhase = ''
runHook preBuild
cc -std=gnu11 $CFLAGS -w -o v $vc/v.c -lm $LDFLAGS
- ./v -prod -o v compiler
- make thirdparty
+ ./v -prod -cflags `$CFLAGS` -o v compiler
+ # Exclude thirdparty/vschannel as it is windows-specific.
+ find thirdparty -path thirdparty/vschannel -prune -o -type f -name "*.c" -execdir cc -std=gnu11 $CFLAGS -w -c {} $LDFLAGS ';'
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
+ mkdir -p $out/{bin,lib,share}
+ cp -r examples $out/share
+ cp -r {vlib,thirdparty} $out/lib
+ cp v $out/lib
+ ln -s $out/lib/v $out/bin/v
runHook postInstall
'';