2020-03-21 05:52:59 +01:00
|
|
|
# This derivation is a reduced-functionality variant of Gambit stable,
|
|
|
|
# used to compile the full version of Gambit stable *and* unstable.
|
2017-06-29 04:11:56 +02:00
|
|
|
|
2020-03-21 05:52:59 +01:00
|
|
|
{ gccStdenv, lib, fetchurl, autoconf, gcc, coreutils, gambit-support, ... }:
|
|
|
|
# As explained in build.nix, GCC compiles Gambit 10x faster than Clang, for code 3x better
|
|
|
|
|
|
|
|
gccStdenv.mkDerivation {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "gambit-bootstrap";
|
2019-02-08 06:06:01 +01:00
|
|
|
version = "4.9.3";
|
2017-06-29 04:11:56 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-02-08 06:06:01 +01:00
|
|
|
url = "http://www.iro.umontreal.ca/~gambit/download/gambit/v4.9/source/gambit-v4_9_3.tgz";
|
|
|
|
sha256 = "1p6172vhcrlpjgia6hsks1w4fl8rdyjf9xjh14wxfkv7dnx8a5hk";
|
2017-06-29 04:11:56 +02:00
|
|
|
};
|
|
|
|
|
2018-11-21 16:19:58 +01:00
|
|
|
buildInputs = [ autoconf ];
|
2017-06-29 04:11:56 +02:00
|
|
|
|
2021-12-22 16:14:51 +01:00
|
|
|
# disable stackprotector on aarch64-darwin for now
|
|
|
|
# build error:
|
|
|
|
# ```
|
|
|
|
# /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].
|
|
|
|
# ldr x2, [x2, ___stack_chk_guard];momd
|
|
|
|
# ^
|
|
|
|
# ```
|
|
|
|
hardeningDisable = lib.optionals (gccStdenv.isAarch64 && gccStdenv.isDarwin) [ "stackprotector" ];
|
|
|
|
|
2017-06-29 04:11:56 +02:00
|
|
|
configurePhase = ''
|
2020-02-16 01:26:35 +01:00
|
|
|
export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \
|
|
|
|
CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \
|
|
|
|
XMKMF=${coreutils}/bin/false
|
|
|
|
unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS
|
2020-03-21 05:52:59 +01:00
|
|
|
./configure --prefix=$out/gambit
|
2017-06-29 04:11:56 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
# Copy the (configured) sources now, not later, so we don't have to filter out
|
|
|
|
# all the intermediate build products.
|
2020-03-21 05:52:59 +01:00
|
|
|
mkdir -p $out/gambit ; cp -rp . $out/gambit/
|
2017-06-29 04:11:56 +02:00
|
|
|
|
|
|
|
# build the gsc-boot* compiler
|
2020-03-21 05:52:59 +01:00
|
|
|
make -j$NIX_BUILD_CORES bootstrap
|
2017-06-29 04:11:56 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-12-22 16:17:45 +01:00
|
|
|
cp -fa ./gsc-boot $out/gambit/
|
2017-06-29 04:11:56 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
forceShare = [ "info" ];
|
|
|
|
|
2020-03-21 05:52:59 +01:00
|
|
|
meta = gambit-support.meta // {
|
2017-06-29 04:11:56 +02:00
|
|
|
description = "Optimizing Scheme to C compiler, bootstrap step";
|
|
|
|
};
|
|
|
|
}
|