blob: cbccca34b41393001a2a9720b68b34fde742ed12 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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;
};
}
|