forked from diku-dk/futhark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
68 lines (61 loc) · 2.14 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This default.nix builds a tarball containing a statically linked
# Futhark binary and some manpages. Likely to only work on linux.
#
# Just run 'nix-build' and fish the tarball out of 'result/'.
{ compiler ? "ghc883",
suffix ? "nightly",
commit ? "" }:
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
futhark =
pkgs.haskell.lib.overrideCabal
(pkgs.haskell.lib.addBuildTools
(pkgs.haskell.packages.${compiler}.callPackage ./futhark.nix { })
[ pkgs.python37Packages.sphinx ])
( _drv: {
isLibrary = false;
isExecutable = true;
enableSharedExecutables = false;
enableSharedLibraries = false;
enableLibraryProfiling = false;
configureFlags = [
"--ghc-option=-optl=-static"
"--ghc-option=-split-sections"
"--extra-lib-dirs=${pkgs.ncurses.override { enableStatic = true; }}/lib"
"--extra-lib-dirs=${pkgs.glibc.static}/lib"
"--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
"--extra-lib-dirs=${pkgs.zlib.static}/lib"
"--extra-lib-dirs=${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
];
postBuild = (_drv.postBuild or "") + ''
make -C docs man
'';
postInstall = (_drv.postInstall or "") + ''
mkdir -p $out/share/man/man1
cp docs/_build/man/*.1 $out/share/man/man1/
mkdir -p $out/share/futhark/
cp LICENSE $out/share/futhark/
'';
}
);
in pkgs.stdenv.mkDerivation rec {
name = "futhark-" + suffix;
version = futhark.version;
src = tools/release;
buildInputs = [ futhark ];
buildPhase = ''
cp -r skeleton futhark-${suffix}
cp -r ${futhark}/bin futhark-${suffix}/bin
mkdir -p futhark-${suffix}/share
cp -r ${futhark}/share/man futhark-${suffix}/share/
chmod +w -R futhark-${suffix}
cp ${futhark}/share/futhark/LICENSE futhark-${suffix}/
[ "${commit}" ] && echo "${commit}" > futhark-${suffix}/commit-id
tar -Jcf futhark-${suffix}.tar.xz futhark-${suffix}
'';
installPhase = ''
mkdir -p $out
cp futhark-${suffix}.tar.xz $out/futhark-${suffix}.tar.xz
'';
}