vlang: 0.1.18 -> 0.1.21 (#70297)

This commit is contained in:
チルノ 2019-10-03 15:47:40 -05:00 committed by Dmitry Kalinkin
parent 3a887ed60d
commit 0910bb3043

View File

@ -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 { stdenv.mkDerivation rec {
pname = "vlang"; pname = "vlang";
version = "0.1.18"; version = "0.1.21";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "vlang"; owner = "vlang";
repo = "v"; repo = "v";
rev = version; rev = version;
sha256 = "0js92v2r1h4vaaha3z1spgi7qynlmr9vls41gxp284w4yhnjzv15"; sha256 = "0npd7a7nhd6r9mr99naib9scqk30209hz18nxif27284ckjbl4fk";
}; };
# V compiler source translated to C for bootstrap. # 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 { vc = fetchFromGitHub {
owner = "vlang"; owner = "vlang";
repo = "vc"; repo = "vc";
rev = version; rev = "950a90b6acaebad1c6ddec5486fc54307e38a9cd";
sha256 = "0qx1drs1hr94w7vaaq5w8mkq7j1d3biffnmxkyz63yv8573k03bj"; sha256 = "1dh5l2m207rip1xj677hvbp067inw28n70ddz5wxzfpmaim63c0l";
}; };
enableParallelBuilding = true; enableParallelBuilding = true;
buildInputs = [ glfw freetype openssl ]; buildInputs = [ glfw freetype openssl ]
++ stdenv.lib.optional stdenv.hostPlatform.isUnix upx;
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
cc -std=gnu11 $CFLAGS -w -o v $vc/v.c -lm $LDFLAGS cc -std=gnu11 $CFLAGS -w -o v $vc/v.c -lm $LDFLAGS
./v -prod -o v compiler ./v -prod -cflags `$CFLAGS` -o v compiler
make thirdparty # 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 {} ';'
runHook postBuild runHook postBuild
''; '';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/{bin,lib/vlang,share/vlang} mkdir -p $out/{bin,lib,share}
cp -r examples $out/share/vlang cp -r examples $out/share
cp -r {vlib,thirdparty} $out/lib/vlang cp -r {vlib,thirdparty} $out/lib
cp v $out/lib/vlang cp v $out/lib
ln -s $out/lib/vlang/v $out/bin/v ln -s $out/lib/v $out/bin/v
runHook postInstall runHook postInstall
''; '';