about summary refs log tree commit diff
path: root/pkgs/development/compilers/gambit
diff options
context:
space:
mode:
authorFrancois-Rene Rideau <fare@tunes.org>2023-08-06 18:23:32 -0400
committerFrancois-Rene Rideau <fare@tunes.org>2023-08-06 18:27:26 -0400
commite15380be99e317ed513db3b2a81f715d544d4eb8 (patch)
treeab5f92e0d7e56d545ad57cb487fd92d67df2c98e /pkgs/development/compilers/gambit
parent5c5bdd7b938b0e055e980faa95f6fab1a2112fab (diff)
gambit: add tco support
Diffstat (limited to 'pkgs/development/compilers/gambit')
-rw-r--r--pkgs/development/compilers/gambit/build.nix13
-rw-r--r--pkgs/development/compilers/gambit/gambit-support.nix5
2 files changed, 13 insertions, 5 deletions
diff --git a/pkgs/development/compilers/gambit/build.nix b/pkgs/development/compilers/gambit/build.nix
index 9481078fd9411..33391c1569692 100644
--- a/pkgs/development/compilers/gambit/build.nix
+++ b/pkgs/development/compilers/gambit/build.nix
@@ -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";
diff --git a/pkgs/development/compilers/gambit/gambit-support.nix b/pkgs/development/compilers/gambit/gambit-support.nix
index f78c99a507004..6e42b9252f24b 100644
--- a/pkgs/development/compilers/gambit/gambit-support.nix
+++ b/pkgs/development/compilers/gambit/gambit-support.nix
@@ -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} ;";