forked from snazzy-d/sdc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
31 lines (28 loc) · 779 Bytes
/
default.nix
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
{ lib, stdenv, dmd, nasm, llvmPackages, dflags ? null}:
stdenv.mkDerivation
{ name="sdc";
src= lib.cleanSource ./.;
nativeBuildInputs = [dmd llvmPackages.bintools];
preBuild= let
dflagsDecl = if dflags == null then "" else "DFLAGS=\"${dflags}\"";
in
''
makeFlagsArray+=(NATIVE_DMD_IMPORTS="-I${dmd}/include/dmd" ${dflagsDecl})
'';
buildInputs = [nasm llvmPackages.libllvm];
installPhase =
''
mkdir $out
cp -r bin $out/bin
cp -r lib $out/lib
rm sdlib/*.mak
mkdir $out/include
cp -r sdlib $out/include/sdc
dd >$out/bin/sdc.conf << EOF
{
"includePath": ["$out/include/sdc", "."],
"libPath": ["$out/lib"],
}
EOF
'';
}