Commit 8743ae87 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

gambit: tweak support

parent f427e60c
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -5,7 +5,8 @@
  stampYmd ? 0, stampHms ? 0,
  gambit-support,
  optimizationSetting ? "-O1",
  gambit-params ? pkgs.gambit-support.stable-params }:
  gambit-params ? pkgs.gambit-support.stable-params,
  rev ? git-version }:

# 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
@@ -30,6 +31,11 @@ gccStdenv.mkDerivation rec {
  inherit src version git-version;
  bootstrap = gambit-support.gambit-bootstrap;

  passthru = {
    inherit src version git-version rev stampYmd stampHms optimizationSetting openssl;
  };


  nativeBuildInputs = [ git autoconf ];

  # TODO: if/when we can get all the library packages we depend on to have static versions,
@@ -47,6 +53,7 @@ gccStdenv.mkDerivation rec {
    "--enable-c-opt=${optimizationSetting}"
    "--enable-c-opt-rts=-O2"
    "--enable-gcc-opts"
    "--enable-trust-c-tco"
    "--enable-shared"
    "--enable-absolute-shared-libs" # Yes, NixOS will want an absolute path, and fix it.
    "--enable-openssl"
@@ -70,6 +77,9 @@ gccStdenv.mkDerivation rec {
    # "--enable-char-size=1" # default is 4
    # "--enable-march=native" # Nope, makes it not work on machines older than the builder
  ] ++ gambit-params.extraOptions
    # TODO: pick an appropriate architecture to optimize on on x86-64?
    # https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gcc/i386-and-x86-64-Options.html#i386-and-x86-64-Options
    # ++ lib.optional pkgs.stdenv.isx86_64 "--enable-march=core-avx2"
    # Do not enable poll on darwin due to https://github.com/gambit/gambit/issues/498
    ++ lib.optional (!gccStdenv.isDarwin) "--enable-poll";

+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

callPackage ./build.nix rec {
  version = "4.9.5";
  git-version = version;
  git-version = "v${version}";
  src = fetchurl {
    url = "https://gambitscheme.org/4.9.5/gambit-v4_9_5.tgz";
    sha256 = "sha256-4o74218OexFZcgwVAFPcq498TK4fDlyDiUR5cHP4wdw=";
+5 −4
Original line number Diff line number Diff line
@@ -13,16 +13,17 @@ rec {
        --replace "$(grep '^PACKAGE_VERSION=.*$' configure)" 'PACKAGE_VERSION="v${git-version}"' \
        --replace "$(grep '^PACKAGE_STRING=.*$' configure)" 'PACKAGE_STRING="Gambit v${git-version}"' ;
      substituteInPlace include/makefile.in \
        --replace "echo > stamp.h;" "(echo '#define ___STAMP_VERSION \"${git-version}\"'; echo '#define ___STAMP_YMD ${toString stampYmd}'; echo '#define ___STAMP_HMS ${toString stampHms}';) > stamp.h;";
        --replace "\$\$(\$(GIT) describe --tag --always | sed 's/-bootstrap\$\$//')" "v${git-version}" \
        --replace "echo > stamp.h;" "(echo '#define ___STAMP_VERSION \"v${git-version}\"'; echo '#define ___STAMP_YMD ${toString stampYmd}'; echo '#define ___STAMP_HMS ${toString stampHms}';) > stamp.h;";
      grep -i ' version=\|echo..#define ___STAMP_VERSION' include/makefile.in # XXX DEBUG -- REMOVE ME
    '';
    modules = true;
    #extraOptions = [];
    extraOptions = ["--enable-trust-c-tco" "CFLAGS=-foptimize-sibling-calls"];
    extraOptions = ["CFLAGS=-foptimize-sibling-calls"];
  };

  unstable-params = stable-params // {
    stable = false;
    extraOptions = ["--enable-trust-c-tco"]; # "CFLAGS=-foptimize-sibling-calls" not necessary in latest unstable
    extraOptions = []; # "CFLAGS=-foptimize-sibling-calls" not necessary in latest unstable
  };

  export-gambopt = params : "export GAMBOPT=${params.buildRuntimeOptions} ;";