diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2020-02-28 15:00:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-28 15:00:39 +0000 |
commit | 3ee1e3b2c05d6e93ad1697b3ca4f3fdbd97daf4c (patch) | |
tree | 235aa2c5c9ca4ece9b7f44b8a7246975bc85e02f /pkgs/development/compilers | |
parent | 695c1339b8a962871bb646eae4ff5cd79e5d6814 (diff) | |
parent | 4ee219ef8ebf8f3b60106156d2f6a81a156b25fe (diff) | |
download | nixlib-3ee1e3b2c05d6e93ad1697b3ca4f3fdbd97daf4c.tar nixlib-3ee1e3b2c05d6e93ad1697b3ca4f3fdbd97daf4c.tar.gz nixlib-3ee1e3b2c05d6e93ad1697b3ca4f3fdbd97daf4c.tar.bz2 nixlib-3ee1e3b2c05d6e93ad1697b3ca4f3fdbd97daf4c.tar.lz nixlib-3ee1e3b2c05d6e93ad1697b3ca4f3fdbd97daf4c.tar.xz nixlib-3ee1e3b2c05d6e93ad1697b3ca4f3fdbd97daf4c.tar.zst nixlib-3ee1e3b2c05d6e93ad1697b3ca4f3fdbd97daf4c.zip |
Merge pull request #80224 from fare-patches/fare
Update Gambit and Gerbil, fix #78921
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r-- | pkgs/development/compilers/gambit/bootstrap.nix | 6 | ||||
-rw-r--r-- | pkgs/development/compilers/gambit/build.nix | 85 | ||||
-rw-r--r-- | pkgs/development/compilers/gambit/unstable.nix | 8 | ||||
-rw-r--r-- | pkgs/development/compilers/gerbil/build.nix | 39 | ||||
-rw-r--r-- | pkgs/development/compilers/gerbil/unstable.nix | 8 |
5 files changed, 92 insertions, 54 deletions
diff --git a/pkgs/development/compilers/gambit/bootstrap.nix b/pkgs/development/compilers/gambit/bootstrap.nix index f00a8b6efc91..2fb9e3ce2fc4 100644 --- a/pkgs/development/compilers/gambit/bootstrap.nix +++ b/pkgs/development/compilers/gambit/bootstrap.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, autoconf, ... }: +{ stdenv, fetchurl, autoconf, gcc, coreutils, ... }: stdenv.mkDerivation { pname = "gambit-bootstrap"; @@ -12,6 +12,10 @@ stdenv.mkDerivation { buildInputs = [ autoconf ]; configurePhase = '' + export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \ + CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \ + XMKMF=${coreutils}/bin/false + unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS ./configure --prefix=$out ''; diff --git a/pkgs/development/compilers/gambit/build.nix b/pkgs/development/compilers/gambit/build.nix index 7a3324d75602..e17241b6d98d 100644 --- a/pkgs/development/compilers/gambit/build.nix +++ b/pkgs/development/compilers/gambit/build.nix @@ -1,4 +1,19 @@ -{ stdenv, git, openssl, autoconf, pkgs, makeStaticLibraries, version, src }: +{ stdenv, git, openssl, autoconf, pkgs, makeStaticLibraries, version, gcc, src, coreutils }: + +# 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 +# Gambit output, producing code that is 3x slower. IIRC the benchmarks from Gambit@30, +# the numbers were still heavily in favor of GCC in October 2019. +# Thus we use GCC over clang, even on macOS. + +# Also note that I (fare) just ran benchmarks from https://github.com/ecraven/r7rs-benchmarks +# with Gambit 4.9.3 with -O1 vs -O2 vs -Os on Feb 2020. Which wins depends on the benchmark. +# The fight is unclear between -O1 and -O2, where -O1 wins more often, by up to 17%, +# but sometimes -O2 wins, once by up to 43%, so that overall -O2 is 5% faster. +# However, -Os seems more consistent in winning slightly against both -O1 and -O2, +# and is overall 15% faster than -O2. As for compile times, -O1 is fastest, +# -Os is about 29%-33% slower than -O1, while -O2 is about 40%-50% slower than -O1. +# Overall, -Os seems like the best choice, and that's what we now use. stdenv.mkDerivation rec { pname = "gambit"; @@ -7,38 +22,48 @@ stdenv.mkDerivation rec { bootstrap = import ./bootstrap.nix ( pkgs ); - # Use makeStaticLibraries to enable creation of statically linked binaries - buildInputs = [ git autoconf bootstrap openssl (makeStaticLibraries openssl)]; + # 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. + buildInputs = [ git autoconf bootstrap openssl ]; + + configureFlags = [ + "--enable-single-host" + "--enable-c-opt=-Os" + "--enable-gcc-opts" + "--enable-shared" + "--enable-absolute-shared-libs" # Yes, NixOS will want an absolute path, and fix it. + "--enable-poll" + "--enable-openssl" + "--enable-default-runtime-options=f8,-8,t8" # Default to UTF-8 for source and all I/O + # "--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" + # "--enable-track-scheme" + # "--enable-high-res-timing" + # "--enable-max-processors=4" + # "--enable-multiple-vms" + # "--enable-dynamic-tls" + # "--enable-multiple-threaded-vms" # when SMP branch is merged in + # "--enable-thread-system=posix" # default when --enable-multiple-vms is on. + # "--enable-profile" + # "--enable-coverage" + # "--enable-inline-jumps" + # "--enable-char-size=1" # default is 4 + ]; configurePhase = '' - options=( - --prefix=$out - --enable-single-host - --enable-c-opt=-O2 - --enable-gcc-opts - --enable-shared - --enable-absolute-shared-libs # Yes, NixOS will want an absolute path, and fix it. - --enable-poll - --enable-openssl - --enable-default-runtime-options="f8,-8,t8" # Default to UTF-8 for source and all I/O - #--enable-debug # Nope: enables plenty of good stuff, but also the costly console.log + export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \ + CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \ + XMKMF=${coreutils}/bin/false + unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS + ./configure --prefix=$out ${builtins.concatStringsSep " " configureFlags} - #--enable-multiple-versions # Nope, NixOS already does version multiplexing - #--enable-guide - #--enable-track-scheme - #--enable-high-res-timing - #--enable-max-processors=4 - #--enable-multiple-vms - #--enable-dynamic-tls - #--enable-multiple-vms - #--enable-multiple-threaded-vms ## when SMP branch is merged in - #--enable-thread-system=posix ## default when --enable-multiple-vms is on. - #--enable-profile - #--enable-coverage - #--enable-inline-jumps - #--enable-char-size=1" ; default is 4 - ) - ./configure ''${options[@]} + # OS-specific paths are hardcoded in ./configure + substituteInPlace config.status \ + --replace /usr/local/opt/openssl/lib "${openssl.out}/lib" \ + --replace /usr/local/opt/openssl@1.1/lib "${openssl.out}/lib" + ./config.status ''; buildPhase = '' diff --git a/pkgs/development/compilers/gambit/unstable.nix b/pkgs/development/compilers/gambit/unstable.nix index d855b83f0afc..4c33c83c67b1 100644 --- a/pkgs/development/compilers/gambit/unstable.nix +++ b/pkgs/development/compilers/gambit/unstable.nix @@ -1,13 +1,13 @@ { stdenv, callPackage, fetchFromGitHub }: callPackage ./build.nix { - version = "unstable-2019-07-21"; -# git-version = "4.9.3-109-g3b5f74fa"; + version = "unstable-2020-02-24"; +# git-version = "4.9.3-979-gc69e9f70"; src = fetchFromGitHub { owner = "feeley"; repo = "gambit"; - rev = "3b5f74fae74b2159e3bf6923f29a18b31cc15dcc"; - sha256 = "07cb0d8754dqhxawkp5dp4y0bsa9kfald4dkj60j5yfnsp81y5mi"; + rev = "c69e9f70dfdc6545353b135a5d5e2f9234f1e1cc"; + sha256 = "1f69n7yzzdv3wpnjlrbck38xpa8115vbady43mc544l39ckklr0k"; }; inherit stdenv; } diff --git a/pkgs/development/compilers/gerbil/build.nix b/pkgs/development/compilers/gerbil/build.nix index e2ab09764827..21c2936fa0f8 100644 --- a/pkgs/development/compilers/gerbil/build.nix +++ b/pkgs/development/compilers/gerbil/build.nix @@ -3,9 +3,6 @@ openssl, zlib, sqlite, libxml2, libyaml, libmysqlclient, lmdb, leveldb, postgresql, version, git-version, gambit, src }: -# TODO: distinct packages for gerbil-release and gerbil-devel -# TODO: make static compilation work - stdenv.mkDerivation rec { pname = "gerbil"; inherit version; @@ -32,19 +29,23 @@ stdenv.mkDerivation rec { substituteInPlace "$f" --replace '"gsc"' '"${gambit}/bin/gsc"' done substituteInPlace "etc/gerbil.el" --replace '"gxc"' "\"$out/bin/gxc\"" - - cat > etc/gerbil_static_libraries.sh <<EOF -#OPENSSL_LIBCRYPTO=${makeStaticLibraries openssl}/lib/libcrypto.a # MISSING! -#OPENSSL_LIBSSL=${makeStaticLibraries openssl}/lib/libssl.a # MISSING! -ZLIB=${makeStaticLibraries zlib}/lib/libz.a +''; + +## TODO: make static compilation work. +## For that, get all the packages below to somehow expose static libraries, +## so we can offer users the option to statically link them into Gambit and/or Gerbil. +## Then add the following to the postPatch script above: +# cat > etc/gerbil_static_libraries.sh <<EOF +# OPENSSL_LIBCRYPTO=${makeStaticLibraries openssl}/lib/libcrypto.a # MISSING! +# OPENSSL_LIBSSL=${makeStaticLibraries openssl}/lib/libssl.a # MISSING! +# ZLIB=${makeStaticLibraries zlib}/lib/libz.a # SQLITE=${makeStaticLibraries sqlite}/lib/sqlite.a # MISSING! # LIBXML2=${makeStaticLibraries libxml2}/lib/libxml2.a # MISSING! # YAML=${makeStaticLibraries libyaml}/lib/libyaml.a # MISSING! -MYSQL=${makeStaticLibraries libmysqlclient}/lib/mariadb/libmariadb.a +# MYSQL=${makeStaticLibraries libmysqlclient}/lib/mariadb/libmariadb.a # LMDB=${makeStaticLibraries lmdb}/lib/mysql/libmysqlclient_r.a # MISSING! -LEVELDB=${makeStaticLibraries lmdb}/lib/libleveldb.a -EOF - ''; +# LEVELDB=${makeStaticLibraries leveldb}/lib/libleveldb.a +# EOF buildPhase = '' runHook preBuild @@ -52,6 +53,14 @@ EOF # Enable all optional libraries substituteInPlace "src/std/build-features.ss" --replace '#f' '#t' + # Enable autodetection of a default GERBIL_HOME + for i in src/gerbil/boot/gx-init-exe.scm src/gerbil/boot/gx-init.scm ; do + substituteInPlace "$i" --replace '(getenv "GERBIL_HOME" #f)' "(getenv \"GERBIL_HOME\" \"$out\")" + done + for i in src/gerbil/boot/gxi-init.scm src/gerbil/compiler/driver.ss src/gerbil/runtime/gx-gambc.scm src/std/build.ss src/tools/build.ss ; do + substituteInPlace "$i" --replace '(getenv "GERBIL_HOME")' "(getenv \"GERBIL_HOME\" \"$out\")" + done + # gxprof testing uses $HOME/.cache/gerbil/gxc export HOME=$$PWD @@ -71,7 +80,7 @@ EOF export GERBIL_HOME=$out case "\$1" in -:*) GSIOPTIONS=\$1 ; shift ;; esac if [[ \$# = 0 ]] ; then - exec ${gambit}/bin/gsi \$GSIOPTIONS \$GERBIL_HOME/lib/gxi-init \$GERBIL_HOME/lib/gxi-interactive - ; + exec ${gambit}/bin/gsi \$GSIOPTIONS \$GERBIL_HOME/lib/gxi-init \$GERBIL_HOME/lib/gxi-interactive - else exec ${gambit}/bin/gsi \$GSIOPTIONS \$GERBIL_HOME/lib/gxi-init "\$@" fi @@ -85,8 +94,8 @@ EOF description = "Gerbil Scheme"; homepage = "https://github.com/vyzo/gerbil"; license = stdenv.lib.licenses.lgpl2; - # NB regarding platforms: only actually tested on Linux, *should* work everywhere, - # but *might* need adaptation e.g. on macOS. Please report success and/or failure to fare. + # NB regarding platforms: regularly tested on Linux, only occasionally on macOS. + # Please report success and/or failure to fare. platforms = stdenv.lib.platforms.unix; maintainers = with stdenv.lib.maintainers; [ fare ]; }; diff --git a/pkgs/development/compilers/gerbil/unstable.nix b/pkgs/development/compilers/gerbil/unstable.nix index 5f0347aa9a66..eb78eed35ee9 100644 --- a/pkgs/development/compilers/gerbil/unstable.nix +++ b/pkgs/development/compilers/gerbil/unstable.nix @@ -1,15 +1,15 @@ { stdenv, callPackage, fetchFromGitHub, gambit, gambit-unstable }: callPackage ./build.nix { - version = "unstable-2019-11-15"; - git-version = "0.15.1-461-gee22de62"; + version = "unstable-2020-02-27"; + git-version = "0.16-DEV-493-g1ffb74db"; #gambit = gambit-unstable; gambit = gambit; src = fetchFromGitHub { owner = "vyzo"; repo = "gerbil"; - rev = "ee22de628a656ee59c6c72bc25d7b2e25a4ece2f"; - sha256 = "1n1j596b91k9xcmv22l72nga6wv20bka2q51ik2jw2vkcw8zkc1c"; + rev = "1ffb74db5ffd49b4bad751586cef5e619c891d41"; + sha256 = "1szmdp8lvy5gpcwn5bpa7x383m6vywl35xa7hz9a5vs1rq4w2097"; }; inherit stdenv; } |