Merge pull request #80224 from fare-patches/fare
Update Gambit and Gerbil, fix #78921
This commit is contained in:
commit
3ee1e3b2c0
5 changed files with 91 additions and 53 deletions
pkgs/development/compilers
|
@ -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
|
||||
'';
|
||||
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 ];
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue