From e15380be99e317ed513db3b2a81f715d544d4eb8 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Sun, 6 Aug 2023 18:23:32 -0400 Subject: [PATCH] gambit: add tco support --- pkgs/development/compilers/gambit/build.nix | 13 ++++++++++--- .../development/compilers/gambit/gambit-support.nix | 5 +++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/gambit/build.nix b/pkgs/development/compilers/gambit/build.nix index 9481078fd941..33391c156969 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 f78c99a50700..6e42b9252f24 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} ;";