gambit: add tco support

This commit is contained in:
Francois-Rene Rideau 2023-08-06 18:23:32 -04:00
parent 5c5bdd7b93
commit e15380be99
2 changed files with 13 additions and 5 deletions

View file

@ -1,6 +1,11 @@
{ gccStdenv, lib, git, openssl, autoconf, pkgs, makeStaticLibraries, gcc, coreutils, gnused, gnugrep,
src, version, git-version, stampYmd ? 0, stampHms ? 0,
gambit-support, optimizationSetting ? "-O1", gambit-params ? pkgs.gambit-support.stable-params }:
{ gccStdenv, lib, pkgs,
git, openssl, autoconf, gcc, coreutils, gnused, gnugrep,
makeStaticLibraries,
src, version, git-version,
stampYmd ? 0, stampHms ? 0,
gambit-support,
optimizationSetting ? "-O1",
gambit-params ? pkgs.gambit-support.stable-params }:
# Note that according to a benchmark run by Marc Feeley on May 2018,
# clang is 10x (with default settings) to 15% (with -O2) slower than GCC at compiling
@ -45,6 +50,7 @@ gccStdenv.mkDerivation rec {
"--enable-shared"
"--enable-absolute-shared-libs" # Yes, NixOS will want an absolute path, and fix it.
"--enable-openssl"
"--enable-dynamic-clib"
#"--enable-default-compile-options='(compactness 9)'" # Make life easier on the JS backend
"--enable-default-runtime-options=${gambit-params.defaultRuntimeOptions}"
# "--enable-rtlib-debug" # used by Geiser, but only on recent-enough gambit, and messes js runtime
@ -62,6 +68,7 @@ gccStdenv.mkDerivation rec {
# "--enable-coverage"
# "--enable-inline-jumps"
# "--enable-char-size=1" # default is 4
# "--enable-march=native" # Nope, makes it not work on machines older than the builder
] ++ gambit-params.extraOptions
# Do not enable poll on darwin due to https://github.com/gambit/gambit/issues/498
++ lib.optional (!gccStdenv.isDarwin) "--enable-poll";

View file

@ -16,12 +16,13 @@ rec {
--replace "echo > stamp.h;" "(echo '#define ___STAMP_VERSION \"${git-version}\"'; echo '#define ___STAMP_YMD ${toString stampYmd}'; echo '#define ___STAMP_HMS ${toString stampHms}';) > stamp.h;";
'';
modules = true;
extraOptions = [];
#extraOptions = [];
extraOptions = ["--enable-trust-c-tco" "CFLAGS=-foptimize-sibling-calls"];
};
unstable-params = stable-params // {
stable = false;
extraOptions = ["--enable-trust-c-tco"];
extraOptions = ["--enable-trust-c-tco"]; # "CFLAGS=-foptimize-sibling-calls" not necessary in latest unstable
};
export-gambopt = params : "export GAMBOPT=${params.buildRuntimeOptions} ;";