nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# This derivation is a reduced-functionality variant of Gambit stable,
2# used to compile the full version of Gambit stable *and* unstable.
3
4{ gccStdenv, lib, fetchurl, autoconf, gcc, coreutils, gambit-support, ... }:
5# As explained in build.nix, GCC compiles Gambit 10x faster than Clang, for code 3x better
6
7gccStdenv.mkDerivation {
8 pname = "gambit-bootstrap";
9 version = "4.9.3";
10
11 src = fetchurl {
12 url = "http://www.iro.umontreal.ca/~gambit/download/gambit/v4.9/source/gambit-v4_9_3.tgz";
13 sha256 = "1p6172vhcrlpjgia6hsks1w4fl8rdyjf9xjh14wxfkv7dnx8a5hk";
14 };
15
16 buildInputs = [ autoconf ];
17
18 # disable stackprotector on aarch64-darwin for now
19 # build error:
20 # ```
21 # /private/tmp/nix-build-gambit-bootstrap-4.9.3.drv-0/ccbOVwnF.s:207:15: error: index must be an integer in range [-256, 255].
22 # ldr x2, [x2, ___stack_chk_guard];momd
23 # ^
24 # ```
25 hardeningDisable = lib.optionals (gccStdenv.isAarch64 && gccStdenv.isDarwin) [ "stackprotector" ];
26
27 configurePhase = ''
28 export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \
29 CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \
30 XMKMF=${coreutils}/bin/false
31 unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS
32 ./configure --prefix=$out/gambit
33 '';
34
35 buildPhase = ''
36 # Copy the (configured) sources now, not later, so we don't have to filter out
37 # all the intermediate build products.
38 mkdir -p $out/gambit ; cp -rp . $out/gambit/
39
40 # build the gsc-boot* compiler
41 make -j$NIX_BUILD_CORES bootstrap
42 '';
43
44 installPhase = ''
45 cp -fa ./gsc-boot $out/gambit/
46 '';
47
48 forceShare = [ "info" ];
49
50 meta = gambit-support.meta // {
51 description = "Optimizing Scheme to C compiler, bootstrap step";
52 };
53}