nixpkgs/pkgs/development/compilers/vlang/default.nix

51 lines
1.2 KiB
Nix
Raw Normal View History

2019-08-23 08:56:42 +02:00
{ stdenv, fetchFromGitHub, glfw, freetype, openssl }:
2019-07-29 20:36:27 +02:00
stdenv.mkDerivation rec {
pname = "vlang";
2019-08-23 08:56:42 +02:00
version = "0.1.18";
2019-07-29 20:36:27 +02:00
src = fetchFromGitHub {
owner = "vlang";
repo = "v";
2019-09-09 01:38:31 +02:00
rev = version;
2019-08-23 08:56:42 +02:00
sha256 = "0js92v2r1h4vaaha3z1spgi7qynlmr9vls41gxp284w4yhnjzv15";
2019-07-29 20:36:27 +02:00
};
# V compiler source translated to C for bootstrap.
vc = fetchFromGitHub {
owner = "vlang";
repo = "vc";
2019-09-09 01:38:31 +02:00
rev = version;
2019-08-23 08:56:42 +02:00
sha256 = "0qx1drs1hr94w7vaaq5w8mkq7j1d3biffnmxkyz63yv8573k03bj";
2019-07-29 20:36:27 +02:00
};
enableParallelBuilding = true;
2019-08-23 08:56:42 +02:00
buildInputs = [ glfw freetype openssl ];
2019-07-29 20:36:27 +02:00
buildPhase = ''
runHook preBuild
2019-08-23 08:56:42 +02:00
cc -std=gnu11 $CFLAGS -w -o v $vc/v.c -lm $LDFLAGS
2019-07-29 20:36:27 +02:00
./v -prod -o v compiler
2019-08-23 08:56:42 +02:00
make thirdparty
2019-07-29 20:36:27 +02:00
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;
};
}