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{
5 gccStdenv,
6 fetchurl,
7 autoconf,
8 gcc,
9 coreutils,
10 gambit-support,
11 ...
12}:
13# As explained in build.nix, GCC compiles Gambit 10x faster than Clang, for code 3x better
14
15gccStdenv.mkDerivation {
16 pname = "gambit-bootstrap";
17 version = "4.9.5";
18
19 src = fetchurl {
20 url = "https://gambitscheme.org/4.9.5/gambit-v4_9_5.tgz";
21 sha256 = "sha256-4o74218OexFZcgwVAFPcq498TK4fDlyDiUR5cHP4wdw=";
22 };
23
24 buildInputs = [ autoconf ];
25
26 configurePhase = ''
27 export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \
28 CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \
29 XMKMF=${coreutils}/bin/false
30 unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS
31 ./configure --prefix=$out/gambit
32 '';
33
34 buildPhase = ''
35 # Copy the (configured) sources now, not later, so we don't have to filter out
36 # all the intermediate build products.
37 mkdir -p $out/gambit ; cp -rp . $out/gambit/
38
39 # build the gsc-boot* compiler
40 make -j$NIX_BUILD_CORES bootstrap
41 '';
42
43 installPhase = ''
44 cp -fa ./gsc-boot $out/gambit/
45 '';
46
47 forceShare = [ "info" ];
48
49 meta = gambit-support.meta // {
50 description = "Optimizing Scheme to C compiler, bootstrap step";
51 };
52}