diff --git a/pkgs/development/compilers/gambit/bootstrap.nix b/pkgs/development/compilers/gambit/bootstrap.nix index a29f45a4e7a5..753938e95aa3 100644 --- a/pkgs/development/compilers/gambit/bootstrap.nix +++ b/pkgs/development/compilers/gambit/bootstrap.nix @@ -6,11 +6,11 @@ gccStdenv.mkDerivation { pname = "gambit-bootstrap"; - version = "4.9.3"; + version = "4.9.5"; src = fetchurl { - url = "http://www.iro.umontreal.ca/~gambit/download/gambit/v4.9/source/gambit-v4_9_3.tgz"; - sha256 = "1p6172vhcrlpjgia6hsks1w4fl8rdyjf9xjh14wxfkv7dnx8a5hk"; + url = "https://gambitscheme.org/4.9.5/gambit-v4_9_5.tgz"; + sha256 = "sha256-4o74218OexFZcgwVAFPcq498TK4fDlyDiUR5cHP4wdw="; }; buildInputs = [ autoconf ]; diff --git a/pkgs/development/compilers/gambit/build.nix b/pkgs/development/compilers/gambit/build.nix index 029225629154..9481078fd941 100644 --- a/pkgs/development/compilers/gambit/build.nix +++ b/pkgs/development/compilers/gambit/build.nix @@ -1,5 +1,5 @@ { gccStdenv, lib, git, openssl, autoconf, pkgs, makeStaticLibraries, gcc, coreutils, gnused, gnugrep, - src, version, git-version, + 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, @@ -26,6 +26,7 @@ gccStdenv.mkDerivation rec { bootstrap = gambit-support.gambit-bootstrap; nativeBuildInputs = [ git autoconf ]; + # TODO: if/when we can get all the library packages we depend on to have static versions, # we could use something like (makeStaticLibraries openssl) to enable creation # of statically linked binaries by gsc. @@ -39,11 +40,14 @@ gccStdenv.mkDerivation rec { "--enable-targets=${gambit-params.targets}" "--enable-single-host" "--enable-c-opt=${optimizationSetting}" + "--enable-c-opt-rts=-O2" "--enable-gcc-opts" "--enable-shared" "--enable-absolute-shared-libs" # Yes, NixOS will want an absolute path, and fix it. "--enable-openssl" + #"--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 # "--enable-debug" # Nope: enables plenty of good stuff, but also the costly console.log # "--enable-multiple-versions" # Nope, NixOS already does version multiplexing # "--enable-guide" @@ -58,9 +62,9 @@ gccStdenv.mkDerivation rec { # "--enable-coverage" # "--enable-inline-jumps" # "--enable-char-size=1" # default is 4 - ] ++ - # due not enable poll on darwin due to https://github.com/gambit/gambit/issues/498 - lib.optional (!gccStdenv.isDarwin) "--enable-poll"; + ] ++ gambit-params.extraOptions + # Do not enable poll on darwin due to https://github.com/gambit/gambit/issues/498 + ++ lib.optional (!gccStdenv.isDarwin) "--enable-poll"; configurePhase = '' export CC=${gccStdenv.cc}/bin/${gccStdenv.cc.targetPrefix}gcc \ @@ -71,31 +75,35 @@ gccStdenv.mkDerivation rec { XMKMF=${coreutils}/bin/false unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS - ${gambit-params.fix-stamp git-version} + ${gambit-params.fixStamp git-version stampYmd stampHms} ./configure --prefix=$out/gambit ${builtins.concatStringsSep " " configureFlags} # OS-specific paths are hardcoded in ./configure substituteInPlace config.status \ - --replace "/usr/local/opt/openssl@1.1" "${lib.getLib openssl}" \ - --replace "/usr/local/opt/openssl" "${lib.getLib openssl}" + ${lib.optionalString (gccStdenv.isDarwin && !gambit-params.stable) + ''--replace "/usr/local/opt/openssl@1.1" "${lib.getLib openssl}"''} \ + --replace "/usr/local/opt/openssl" "${lib.getLib openssl}" ./config.status ''; buildPhase = '' - # Make bootstrap compiler, from release bootstrap + # The MAKEFLAGS setting is a workaround for https://github.com/gambit/gambit/issues/833 + export MAKEFLAGS="--output-sync=recurse" + echo "Make bootstrap compiler, from release bootstrap" mkdir -p boot cp -rp ${bootstrap}/gambit/. boot/. chmod -R u+w boot cd boot cp ../gsc/makefile.in ../gsc/*.scm gsc/ + echo > include/stamp.h # No stamp needed for the bootstrap compiler ./configure for i in lib gsi gsc ; do (cd $i ; make -j$NIX_BUILD_CORES) ; done cd .. cp boot/gsc/gsc gsc-boot - # Now use the bootstrap compiler to build the real thing! + echo "Now use the bootstrap compiler to build the real thing!" make -j$NIX_BUILD_CORES from-scratch ${lib.optionalString gambit-params.modules "make -j$NIX_BUILD_CORES modules"} ''; @@ -107,6 +115,7 @@ gccStdenv.mkDerivation rec { ''; doCheck = true; + dontStrip = true; meta = gambit-support.meta; } diff --git a/pkgs/development/compilers/gambit/default.nix b/pkgs/development/compilers/gambit/default.nix index 8f77daa4173b..cb4f5f9501ca 100644 --- a/pkgs/development/compilers/gambit/default.nix +++ b/pkgs/development/compilers/gambit/default.nix @@ -1,10 +1,10 @@ { callPackage, fetchurl }: callPackage ./build.nix rec { - version = "4.9.3"; + version = "4.9.5"; git-version = version; src = fetchurl { - url = "http://www.iro.umontreal.ca/~gambit/download/gambit/v4.9/source/gambit-v4_9_3.tgz"; - sha256 = "1p6172vhcrlpjgia6hsks1w4fl8rdyjf9xjh14wxfkv7dnx8a5hk"; + url = "https://gambitscheme.org/4.9.5/gambit-v4_9_5.tgz"; + sha256 = "sha256-4o74218OexFZcgwVAFPcq498TK4fDlyDiUR5cHP4wdw="; }; } diff --git a/pkgs/development/compilers/gambit/gambit-support.nix b/pkgs/development/compilers/gambit/gambit-support.nix index be745367ec03..f78c99a50700 100644 --- a/pkgs/development/compilers/gambit/gambit-support.nix +++ b/pkgs/development/compilers/gambit/gambit-support.nix @@ -3,37 +3,38 @@ rec { stable-params = { stable = true; - defaultRuntimeOptions = "f8,-8,t8"; - buildRuntimeOptions = "f8,-8,t8"; - fix-stamp = git-version : ""; - targets = "java,js,php,python,ruby"; - modules = false; - }; - - unstable-params = { - stable = false; defaultRuntimeOptions = "iL,fL,-L,tL"; buildRuntimeOptions = "i8,f8,-8,t8"; - fix-stamp = git-version : '' + targets = "js"; # arm,java,js,php,python,riscv-32,riscv-64,ruby,x86,x86-64 + #fixStamp = _: _: _: ""; + fixStamp = git-version: stampYmd: stampHms: '' + echo "Fixing timestamp recipe in Makefile" substituteInPlace configure \ --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;"; ''; - targets = "arm,java,js,php,python,riscv-32,riscv-64,ruby,x86,x86-64"; # eats 100% cpu on _digest - modules = false; + modules = true; + extraOptions = []; + }; + + unstable-params = stable-params // { + stable = false; + extraOptions = ["--enable-trust-c-tco"]; }; export-gambopt = params : "export GAMBOPT=${params.buildRuntimeOptions} ;"; gambit-bootstrap = import ./bootstrap.nix ( pkgs ); - meta = { + meta = with lib; { description = "Optimizing Scheme to C compiler"; homepage = "http://gambitscheme.org"; - license = lib.licenses.lgpl21; # dual, also asl20 - # NB regarding platforms: continuously tested on Linux, - # tested on macOS once in a while, *should* work everywhere. - platforms = lib.platforms.unix; - maintainers = with lib.maintainers; [ thoughtpolice raskin fare ]; + license = licenses.lgpl21Only; # dual, also asl20 + # NB regarding platforms: continuously tested on Linux x86_64 and regularly tested on macOS x86_64. + # *should* work everywhere. + platforms = platforms.unix; + maintainers = with maintainers; [ thoughtpolice raskin fare ]; }; } diff --git a/pkgs/development/compilers/gambit/unstable.nix b/pkgs/development/compilers/gambit/unstable.nix index a689991a1e13..26761d67d35d 100644 --- a/pkgs/development/compilers/gambit/unstable.nix +++ b/pkgs/development/compilers/gambit/unstable.nix @@ -1,13 +1,15 @@ { callPackage, fetchFromGitHub, gambit-support }: callPackage ./build.nix { - version = "unstable-2020-09-20"; - git-version = "4.9.3-1234-g6acd87df"; + version = "unstable-2023-07-30"; + git-version = "4.9.5-3-ge059fffd"; + stampYmd = 20230730; + stampHms = 151945; src = fetchFromGitHub { - owner = "feeley"; + owner = "gambit"; repo = "gambit"; - rev = "6acd87dfa95bfca33082a431e72f023345dc07ee"; - sha256 = "0a3dy4ij8hzlp3sjam4b6dp6yvyz5d7g2x784qm3gp89fi2ck56r"; + rev = "e059fffdfbd91e27c350ff2ebd671adefadd5212"; + sha256 = "0q7hdfchl6lw53xawmmjvhyjdmqxjdsnzjqv9vpkl2qa4vyir5fs"; }; gambit-params = gambit-support.unstable-params; }