From 9456522528a118d9eeb078a77064a4f85ae9b887 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Sat, 21 Mar 2020 00:52:59 -0400 Subject: [PATCH 1/6] Refactor Gambit support Refactor the build rule: - Put files in $out/gambit instead of $out. - Make the optimization setting easy to override. - Make use of gccStdenv more explicit at this level. - Support new-style runtime options for forcing UTF-8 I/O. - Override the PACKAGE_VERSION and PACKAGE_STRING with git version. - Note that the license is lgpl21, not lpgl2 (Note: also dual asl20). - Try and fail to meaningfully add missing runtimeDeps. - Build using NIX_BUILD_CORES. --- .../compilers/gambit/bootstrap.nix | 22 +++---- pkgs/development/compilers/gambit/build.nix | 63 +++++++++++-------- pkgs/development/compilers/gambit/default.nix | 6 +- .../compilers/gambit/gambit-support.nix | 33 ++++++++++ .../development/compilers/gambit/unstable.nix | 6 +- pkgs/top-level/all-packages.nix | 3 +- 6 files changed, 89 insertions(+), 44 deletions(-) create mode 100644 pkgs/development/compilers/gambit/gambit-support.nix diff --git a/pkgs/development/compilers/gambit/bootstrap.nix b/pkgs/development/compilers/gambit/bootstrap.nix index 2fb9e3ce2fc..ec963ab3b8d 100644 --- a/pkgs/development/compilers/gambit/bootstrap.nix +++ b/pkgs/development/compilers/gambit/bootstrap.nix @@ -1,6 +1,10 @@ -{ stdenv, fetchurl, autoconf, gcc, coreutils, ... }: +# This derivation is a reduced-functionality variant of Gambit stable, +# used to compile the full version of Gambit stable *and* unstable. -stdenv.mkDerivation { +{ gccStdenv, lib, fetchurl, autoconf, gcc, coreutils, gambit-support, ... }: +# As explained in build.nix, GCC compiles Gambit 10x faster than Clang, for code 3x better + +gccStdenv.mkDerivation { pname = "gambit-bootstrap"; version = "4.9.3"; @@ -16,29 +20,25 @@ stdenv.mkDerivation { 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 + ./configure --prefix=$out/gambit ''; buildPhase = '' # Copy the (configured) sources now, not later, so we don't have to filter out # all the intermediate build products. - mkdir -p $out ; cp -rp . $out/ + mkdir -p $out/gambit ; cp -rp . $out/gambit/ # build the gsc-boot* compiler - make bootstrap + make -j$NIX_BUILD_CORES bootstrap ''; installPhase = '' - cp -fa ./ $out/ + cp -fa ./ $out/gambit/ ''; forceShare = [ "info" ]; - meta = { + meta = gambit-support.meta // { description = "Optimizing Scheme to C compiler, bootstrap step"; - homepage = "http://gambitscheme.org"; - license = stdenv.lib.licenses.lgpl2; - platforms = stdenv.lib.platforms.unix; - maintainers = with stdenv.lib.maintainers; [ thoughtpolice raskin fare ]; }; } diff --git a/pkgs/development/compilers/gambit/build.nix b/pkgs/development/compilers/gambit/build.nix index e17241b6d98..fc71128eb37 100644 --- a/pkgs/development/compilers/gambit/build.nix +++ b/pkgs/development/compilers/gambit/build.nix @@ -1,11 +1,13 @@ -{ stdenv, git, openssl, autoconf, pkgs, makeStaticLibraries, version, gcc, src, coreutils }: +{ gccStdenv, lib, git, openssl, autoconf, pkgs, makeStaticLibraries, gcc, coreutils, gnused, gnugrep, + src, version, git-version, + 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 # 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%, @@ -13,29 +15,34 @@ # 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. +# +# Overall, -Os seems like the best choice, but I care more about compile-time, +# so I stick with -O1 (in the defaults above), which is also the default for Gambit. + +gccStdenv.mkDerivation rec { -stdenv.mkDerivation rec { pname = "gambit"; - inherit version; - inherit src; - - bootstrap = import ./bootstrap.nix ( pkgs ); + inherit src version git-version; + bootstrap = gambit-support.gambit-bootstrap; # 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 ]; + # TODO: patch gambit's source so it has the full path to sed, grep, fgrep? Is there more? + # Or wrap relevant programs to add a suitable PATH ? + #runtimeDeps = [ gnused gnugrep ]; + configureFlags = [ "--enable-single-host" - "--enable-c-opt=-Os" + "--enable-c-opt=${optimizationSetting}" "--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-default-runtime-options=${gambit-params.defaultRuntimeOptions}" # "--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" @@ -53,11 +60,17 @@ stdenv.mkDerivation rec { ]; configurePhase = '' - export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \ - CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \ + 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} + + ${gambit-params.fix-stamp git-version} + + ./configure --prefix=$out/gambit ${builtins.concatStringsSep " " configureFlags} # OS-specific paths are hardcoded in ./configure substituteInPlace config.status \ @@ -69,28 +82,26 @@ stdenv.mkDerivation rec { buildPhase = '' # Make bootstrap compiler, from release bootstrap mkdir -p boot && - cp -rp ${bootstrap}/. boot/. && + cp -rp ${bootstrap}/gambit/. boot/. && chmod -R u+w boot && cd boot && - cp ../gsc/makefile.in ../gsc/*.scm gsc && # */ + cp ../gsc/makefile.in ../gsc/*.scm gsc/ && # */ ./configure && - for i in lib gsi gsc ; do (cd $i ; make ) ; done && + 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! - make -j2 from-scratch + make -j$NIX_BUILD_CORES from-scratch + ''; + + postInstall = '' + mkdir $out/bin + cd $out/bin + ln -s ../gambit/bin/* . ''; doCheck = true; - meta = { - description = "Optimizing Scheme to C compiler"; - homepage = "http://gambitscheme.org"; - license = stdenv.lib.licenses.lgpl2; - # NB regarding platforms: only actually tested on Linux, *should* work everywhere, - # but *might* need adaptation e.g. on macOS. - platforms = stdenv.lib.platforms.unix; - maintainers = with stdenv.lib.maintainers; [ thoughtpolice raskin fare ]; - }; + meta = gambit-support.meta; } diff --git a/pkgs/development/compilers/gambit/default.nix b/pkgs/development/compilers/gambit/default.nix index 303f6a30aad..8f77daa4173 100644 --- a/pkgs/development/compilers/gambit/default.nix +++ b/pkgs/development/compilers/gambit/default.nix @@ -1,10 +1,10 @@ -{ stdenv, callPackage, fetchurl }: +{ callPackage, fetchurl }: -callPackage ./build.nix { +callPackage ./build.nix rec { version = "4.9.3"; + git-version = version; src = fetchurl { url = "http://www.iro.umontreal.ca/~gambit/download/gambit/v4.9/source/gambit-v4_9_3.tgz"; sha256 = "1p6172vhcrlpjgia6hsks1w4fl8rdyjf9xjh14wxfkv7dnx8a5hk"; }; - inherit stdenv; } diff --git a/pkgs/development/compilers/gambit/gambit-support.nix b/pkgs/development/compilers/gambit/gambit-support.nix new file mode 100644 index 00000000000..0e78831f2e4 --- /dev/null +++ b/pkgs/development/compilers/gambit/gambit-support.nix @@ -0,0 +1,33 @@ +{ pkgs, lib }: + +rec { + stable-params = { + defaultRuntimeOptions = "f8,-8,t8"; + buildRuntimeOptions = "f8,-8,t8"; + fix-stamp = git-version : ""; + }; + + unstable-params = { + defaultRuntimeOptions = "iL,fL,-L,tL"; + buildRuntimeOptions = "i8,f8,-8,t8"; + fix-stamp = git-version : '' + substituteInPlace configure \ + --replace "$(grep '^PACKAGE_VERSION=.*$' configure)" 'PACKAGE_VERSION="v${git-version}"' \ + --replace "$(grep '^PACKAGE_STRING=.*$' configure)" 'PACKAGE_STRING="Gambit v${git-version}"' ; + ''; + }; + + export-gambopt = params : "export GAMBOPT=${params.buildRuntimeOptions} ;"; + + gambit-bootstrap = import ./bootstrap.nix ( pkgs ); + + meta = { + 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 ]; + }; +} diff --git a/pkgs/development/compilers/gambit/unstable.nix b/pkgs/development/compilers/gambit/unstable.nix index 4c33c83c67b..7c4434acdc3 100644 --- a/pkgs/development/compilers/gambit/unstable.nix +++ b/pkgs/development/compilers/gambit/unstable.nix @@ -1,13 +1,13 @@ -{ stdenv, callPackage, fetchFromGitHub }: +{ callPackage, fetchFromGitHub, gambit-support }: callPackage ./build.nix { version = "unstable-2020-02-24"; -# git-version = "4.9.3-979-gc69e9f70"; + git-version = "4.9.3-979-gc69e9f70"; src = fetchFromGitHub { owner = "feeley"; repo = "gambit"; rev = "c69e9f70dfdc6545353b135a5d5e2f9234f1e1cc"; sha256 = "1f69n7yzzdv3wpnjlrbck38xpa8115vbady43mc544l39ckklr0k"; }; - inherit stdenv; + gambit-params = gambit-support.unstable-params; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 729f97d65a1..8a26aea2beb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8203,7 +8203,8 @@ in fpc = callPackage ../development/compilers/fpc { }; gambit = callPackage ../development/compilers/gambit { stdenv = gccStdenv; }; - gambit-unstable = callPackage ../development/compilers/gambit/unstable.nix { stdenv = gccStdenv; }; + gambit-unstable = callPackage ../development/compilers/gambit/unstable.nix { }; + gambit-support = callPackage ../development/compilers/gambit/gambit-support.nix { }; gerbil = callPackage ../development/compilers/gerbil { stdenv = gccStdenv; }; gerbil-unstable = callPackage ../development/compilers/gerbil/unstable.nix { stdenv = gccStdenv; }; From 90835bc666881cfc9d4f632379f58684dea4a590 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Sat, 21 Mar 2020 00:53:33 -0400 Subject: [PATCH 2/6] Refactor Gerbil support - Use the new Gambit support. - Move files from $out to $out/gerbil. - Use new Gerbil configuration and installation scripts. - Move some fixups from preBuild to postPatch. - Give up on previous failed attempts at using static libraries. - Add support for compiling libraries written in Gerbil. - Build using NIX_BUILD_CORES. - Register all those things in all-packages. --- pkgs/development/compilers/gerbil/build.nix | 81 +++++++------------ pkgs/development/compilers/gerbil/default.nix | 42 +++++++++- .../compilers/gerbil/gerbil-support.nix | 63 +++++++++++++++ .../development/compilers/gerbil/unstable.nix | 27 ++++++- pkgs/top-level/all-packages.nix | 8 +- 5 files changed, 161 insertions(+), 60 deletions(-) create mode 100644 pkgs/development/compilers/gerbil/gerbil-support.nix diff --git a/pkgs/development/compilers/gerbil/build.nix b/pkgs/development/compilers/gerbil/build.nix index 21c2936fa0f..0177e706af1 100644 --- a/pkgs/development/compilers/gerbil/build.nix +++ b/pkgs/development/compilers/gerbil/build.nix @@ -1,34 +1,35 @@ -{ stdenv, makeStaticLibraries, - coreutils, rsync, bash, +{ pkgs, gccStdenv, lib, coreutils, # makeStaticLibraries, openssl, zlib, sqlite, libxml2, libyaml, libmysqlclient, lmdb, leveldb, postgresql, - version, git-version, gambit, src }: + version, git-version, + gambit-support, + gambit ? pkgs.gambit, gambit-params ? pkgs.gambit-support.stable-params, + src, configurePhase, installPhase }: + +# We use Gambit, that works 10x better with GCC than Clang. See ../gambit/build.nix +let stdenv = gccStdenv; in stdenv.mkDerivation rec { pname = "gerbil"; inherit version; inherit src; - # Use makeStaticLibraries to enable creation of statically linked binaries buildInputs_libraries = [ openssl zlib sqlite libxml2 libyaml libmysqlclient lmdb leveldb postgresql ]; - buildInputs_staticLibraries = map makeStaticLibraries buildInputs_libraries; - buildInputs = [ gambit rsync bash ] - ++ buildInputs_libraries ++ buildInputs_staticLibraries; + # TODO: either fix all of Gerbil's dependencies to provide static libraries, + # or give up and delete all tentative support for static libraries. + #buildInputs_staticLibraries = map makeStaticLibraries buildInputs_libraries; + + buildInputs = [ gambit ] + ++ buildInputs_libraries; # ++ buildInputs_staticLibraries; NIX_CFLAGS_COMPILE = "-I${libmysqlclient}/include/mysql -L${libmysqlclient}/lib/mysql"; postPatch = '' - echo '(define (gerbil-version-string) "v${git-version}")' > src/gerbil/runtime/gx-version.scm - - patchShebangs . - + echo '(define (gerbil-version-string) "v${git-version}")' > src/gerbil/runtime/gx-version.scm ; + patchShebangs . ; grep -Fl '#!/usr/bin/env' `find . -type f -executable` | while read f ; do - substituteInPlace "$f" --replace '#!/usr/bin/env' '#!${coreutils}/bin/env' - done - grep -Fl '"gsc"' `find . -type f -name '*.s*'` | while read f ; do - substituteInPlace "$f" --replace '"gsc"' '"${gambit}/bin/gsc"' - done - substituteInPlace "etc/gerbil.el" --replace '"gxc"' "\"$out/bin/gxc\"" + substituteInPlace "$f" --replace '#!/usr/bin/env' '#!${coreutils}/bin/env' ; + done ; ''; ## TODO: make static compilation work. @@ -47,22 +48,20 @@ stdenv.mkDerivation rec { # LEVELDB=${makeStaticLibraries leveldb}/lib/libleveldb.a # EOF + inherit configurePhase installPhase; + buildPhase = '' runHook preBuild - # 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 + export HOME=$PWD + export GERBIL_BUILD_CORES=$NIX_BUILD_CORES + export GERBIL_GXC=$PWD/bin/gxc + export GERBIL_BASE=$PWD + export GERBIL_HOME=$PWD + export GERBIL_PATH=$PWD/lib + export PATH=$PWD/bin:$PATH + ${gambit-support.export-gambopt gambit-params} # Build, replacing make by build.sh ( cd src && sh build.sh ) @@ -70,33 +69,15 @@ stdenv.mkDerivation rec { runHook postBuild ''; - installPhase = '' - runHook preInstall - mkdir -p $out/ - cp -fa bin lib etc doc $out/ - - cat > $out/bin/gxi < $out/gerbil/bin/gxi < "${version-path}" + fi + patchShebangs . ; + ''; + + postConfigure = '' + export GERBIL_BUILD_CORES=$NIX_BUILD_CORES + export GERBIL_PATH=$PWD/.build + export GERBIL_LOADPATH=${gerbilLoadPath gerbilInputs} + ${pkgs.gambit-support.export-gambopt gambit-params} + ''; + + buildPhase = '' + runHook preBuild + ./build.ss + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out/gerbil/lib + cp -fa .build/lib $out/gerbil/ + bins=(.build/bin/*) + if [ 0 -lt ''${#bins} ] ; then + cp -fa .build/bin $out/gerbil/ + mkdir $out/bin + cd $out/bin + ln -s ../gerbil/bin/* . + fi + runHook postInstall + ''; + + dontFixup = true; + }; +} diff --git a/pkgs/development/compilers/gerbil/unstable.nix b/pkgs/development/compilers/gerbil/unstable.nix index eb78eed35ee..d14b4f7d349 100644 --- a/pkgs/development/compilers/gerbil/unstable.nix +++ b/pkgs/development/compilers/gerbil/unstable.nix @@ -1,15 +1,34 @@ -{ stdenv, callPackage, fetchFromGitHub, gambit, gambit-unstable }: +{ callPackage, fetchFromGitHub, gambit-unstable, gambit-support, coreutils, bash }: callPackage ./build.nix { version = "unstable-2020-02-27"; git-version = "0.16-DEV-493-g1ffb74db"; - #gambit = gambit-unstable; - gambit = gambit; src = fetchFromGitHub { owner = "vyzo"; repo = "gerbil"; rev = "1ffb74db5ffd49b4bad751586cef5e619c891d41"; sha256 = "1szmdp8lvy5gpcwn5bpa7x383m6vywl35xa7hz9a5vs1rq4w2097"; }; - inherit stdenv; + inherit gambit-support; + gambit = gambit-unstable; + gambit-params = gambit-support.unstable-params; + configurePhase = '' + (cd src && ./configure \ + --prefix=$out/gerbil \ + --with-gambit=${gambit}/gambit \ + --enable-libxml \ + --enable-libyaml \ + --enable-zlib \ + --enable-sqlite \ + --enable-mysql \ + --enable-lmdb \ + --enable-leveldb) + ''; + installPhase = '' + runHook preInstall + mkdir -p $out/gerbil $out/bin + (cd src; ./install) + (cd $out/bin ; ln -s ../gerbil/bin/* .) + runHook postInstall + ''; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8a26aea2beb..05a2f3ec5a2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8202,11 +8202,13 @@ in fpc = callPackage ../development/compilers/fpc { }; - gambit = callPackage ../development/compilers/gambit { stdenv = gccStdenv; }; + gambit = callPackage ../development/compilers/gambit { }; gambit-unstable = callPackage ../development/compilers/gambit/unstable.nix { }; gambit-support = callPackage ../development/compilers/gambit/gambit-support.nix { }; - gerbil = callPackage ../development/compilers/gerbil { stdenv = gccStdenv; }; - gerbil-unstable = callPackage ../development/compilers/gerbil/unstable.nix { stdenv = gccStdenv; }; + gerbil = callPackage ../development/compilers/gerbil { }; + gerbil-unstable = callPackage ../development/compilers/gerbil/unstable.nix { }; + gerbil-support = callPackage ../development/compilers/gerbil/gerbil-support.nix { }; + gerbilPackages-unstable = gerbil-support.gerbilPackages-unstable; # NB: don't recurseIntoAttrs for (unstable!) libraries gccFun = callPackage (if stdenv.targetPlatform.isVc4 then ../development/compilers/gcc/6 else ../development/compilers/gcc/9); gcc = if stdenv.targetPlatform.isVc4 then gcc6 else gcc9; From da4aa17343f013c9b5e0873fbc1683e2d8496991 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Thu, 7 May 2020 17:21:17 -0400 Subject: [PATCH 3/6] gambit-unstable: 2020-02-24 -> 2020-05-13 --- pkgs/development/compilers/gambit/unstable.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/gambit/unstable.nix b/pkgs/development/compilers/gambit/unstable.nix index 7c4434acdc3..3ac4f536319 100644 --- a/pkgs/development/compilers/gambit/unstable.nix +++ b/pkgs/development/compilers/gambit/unstable.nix @@ -1,13 +1,13 @@ { callPackage, fetchFromGitHub, gambit-support }: callPackage ./build.nix { - version = "unstable-2020-02-24"; - git-version = "4.9.3-979-gc69e9f70"; + version = "unstable-2020-05-15"; + git-version = "4.9.3-1109-g3c4d40de"; src = fetchFromGitHub { owner = "feeley"; repo = "gambit"; - rev = "c69e9f70dfdc6545353b135a5d5e2f9234f1e1cc"; - sha256 = "1f69n7yzzdv3wpnjlrbck38xpa8115vbady43mc544l39ckklr0k"; + rev = "3c4d40de908ae03ca0e3d854edc2234ef401b36c"; + sha256 = "1c9a6rys2kiiqb79gvw29nv3dwwk6hmi1q4jk1whcx7mds7q5dvr"; }; gambit-params = gambit-support.unstable-params; } From 756c8a27d97efc87eaf65402f83495df949bf179 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Thu, 7 May 2020 17:22:24 -0400 Subject: [PATCH 4/6] gerbil-unstable: 2020-02-27 -> 2020-05-17 --- pkgs/development/compilers/gerbil/unstable.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/gerbil/unstable.nix b/pkgs/development/compilers/gerbil/unstable.nix index d14b4f7d349..e8bf18a6429 100644 --- a/pkgs/development/compilers/gerbil/unstable.nix +++ b/pkgs/development/compilers/gerbil/unstable.nix @@ -1,13 +1,13 @@ { callPackage, fetchFromGitHub, gambit-unstable, gambit-support, coreutils, bash }: -callPackage ./build.nix { - version = "unstable-2020-02-27"; - git-version = "0.16-DEV-493-g1ffb74db"; +callPackage ./build.nix rec { + version = "unstable-2020-05-17"; + git-version = "0.16-1-g36a31050"; src = fetchFromGitHub { owner = "vyzo"; repo = "gerbil"; - rev = "1ffb74db5ffd49b4bad751586cef5e619c891d41"; - sha256 = "1szmdp8lvy5gpcwn5bpa7x383m6vywl35xa7hz9a5vs1rq4w2097"; + rev = "36a31050f6c80e7e1a49dfae96a57b2ad0260698"; + sha256 = "0k3fypam9qx110sjxgzxa1mdf5b631w16s9p5v37cb8ll26vqfiv"; }; inherit gambit-support; gambit = gambit-unstable; From f9360e7974e6cb57d99995dbffabaef863c3917d Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Thu, 7 May 2020 17:24:11 -0400 Subject: [PATCH 5/6] gerbilPackages.gerbil-utils: init at 2020-05-16 --- .../compilers/gerbil/gerbil-support.nix | 1 + .../compilers/gerbil/gerbil-utils.nix | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 pkgs/development/compilers/gerbil/gerbil-utils.nix diff --git a/pkgs/development/compilers/gerbil/gerbil-support.nix b/pkgs/development/compilers/gerbil/gerbil-support.nix index af83cfa4a60..4e94b6e65de 100644 --- a/pkgs/development/compilers/gerbil/gerbil-support.nix +++ b/pkgs/development/compilers/gerbil/gerbil-support.nix @@ -4,6 +4,7 @@ rec { # Gerbil libraries gerbilPackages-unstable = { + gerbil-utils = callPackage ./gerbil-utils.nix { }; }; # Use this function in any package that uses Gerbil libraries, to define the GERBIL_LOADPATH. diff --git a/pkgs/development/compilers/gerbil/gerbil-utils.nix b/pkgs/development/compilers/gerbil/gerbil-utils.nix new file mode 100644 index 00000000000..075a63d7bf4 --- /dev/null +++ b/pkgs/development/compilers/gerbil/gerbil-utils.nix @@ -0,0 +1,24 @@ +{ lib, fetchFromGitHub, gerbil-unstable, gerbil-support, gambit-support }: + +gerbil-support.gerbilPackage { + pname = "gerbil-utils"; + version = "unstable-2020-05-17"; + git-version = "33ef720"; + package = "clan"; + gerbil = gerbil-unstable; + gambit-params = gambit-support.unstable-params; + version-path = ""; + src = fetchFromGitHub { + owner = "fare"; + repo = "gerbil-utils"; + rev = "33ef720799ba98dc9eec773c662f070af4bac016"; + sha256 = "0dsb97magbxzjqqfzwq4qwf7i80llv0s1dsy9nkzkvkq8drxlmqf"; + }; + meta = { + description = "Gerbil Clan: Community curated Collection of Common Utilities"; + homepage = "https://github.com/fare/gerbil-utils"; + license = lib.licenses.lgpl21; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ fare ]; + }; +} From 0d0f475f27b0978490a44327bdd558947d62c1e9 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Sun, 17 May 2020 16:10:03 -0400 Subject: [PATCH 6/6] gerbil: 0.15.1 -> 0.16 Now that v0.16 was released at last, make the configurePhase and instalPhase the same again for default and unstable. --- pkgs/development/compilers/gerbil/build.nix | 26 +++++++++-- pkgs/development/compilers/gerbil/default.nix | 46 ++----------------- .../development/compilers/gerbil/unstable.nix | 21 +-------- 3 files changed, 27 insertions(+), 66 deletions(-) diff --git a/pkgs/development/compilers/gerbil/build.nix b/pkgs/development/compilers/gerbil/build.nix index 0177e706af1..8297dafff8e 100644 --- a/pkgs/development/compilers/gerbil/build.nix +++ b/pkgs/development/compilers/gerbil/build.nix @@ -1,9 +1,8 @@ -{ pkgs, gccStdenv, lib, coreutils, # makeStaticLibraries, +{ pkgs, gccStdenv, lib, coreutils, bash, # makeStaticLibraries, openssl, zlib, sqlite, libxml2, libyaml, libmysqlclient, lmdb, leveldb, postgresql, version, git-version, gambit-support, - gambit ? pkgs.gambit, gambit-params ? pkgs.gambit-support.stable-params, - src, configurePhase, installPhase }: + gambit ? pkgs.gambit, gambit-params ? pkgs.gambit-support.stable-params, src }: # We use Gambit, that works 10x better with GCC than Clang. See ../gambit/build.nix let stdenv = gccStdenv; in @@ -48,7 +47,18 @@ stdenv.mkDerivation rec { # LEVELDB=${makeStaticLibraries leveldb}/lib/libleveldb.a # EOF - inherit configurePhase installPhase; + configurePhase = '' + (cd src && ./configure \ + --prefix=$out/gerbil \ + --with-gambit=${gambit}/gambit \ + --enable-libxml \ + --enable-libyaml \ + --enable-zlib \ + --enable-sqlite \ + --enable-mysql \ + --enable-lmdb \ + --enable-leveldb) + ''; buildPhase = '' runHook preBuild @@ -69,6 +79,14 @@ stdenv.mkDerivation rec { runHook postBuild ''; + installPhase = '' + runHook preInstall + mkdir -p $out/gerbil $out/bin + (cd src; ./install) + (cd $out/bin ; ln -s ../gerbil/bin/* .) + runHook postInstall + ''; + dontStrip = true; meta = { diff --git a/pkgs/development/compilers/gerbil/default.nix b/pkgs/development/compilers/gerbil/default.nix index d7b1fe3cf5e..3367ae581b2 100644 --- a/pkgs/development/compilers/gerbil/default.nix +++ b/pkgs/development/compilers/gerbil/default.nix @@ -1,50 +1,12 @@ -{ callPackage, fetchFromGitHub, gambit, bash }: +{ callPackage, fetchFromGitHub }: callPackage ./build.nix rec { - version = "0.15.1"; - git-version = "0.15.1"; + version = "0.16"; + git-version = version; src = fetchFromGitHub { owner = "vyzo"; repo = "gerbil"; rev = "v${version}"; - sha256 = "0qpqms66hz41wwhxb1z0fnzj96ivkm7qi9h9d7lhlr3fsxm1kp1n"; + sha256 = "0vng0kxpnwsg8jbjdpyn4sdww36jz7zfpfbzayg9sdpz6bjxjy0f"; }; - configurePhase = '' - grep -Fl '"gsc"' `find . -type f -name '*.s*'` | while read f ; do - substituteInPlace "$f" --replace '"gsc"' '"${gambit}/bin/gsc"' ; - done ; - for f in etc/gerbil.el src/std/make.ss ; do - substituteInPlace "$f" --replace '"gxc"' "\"$out/bin/gxc\"" ; - done ; - - # 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 '(define default-gerbil-home #f)' "(define default-gerbil-home \"$out/gerbil\")" ; - substituteInPlace "$i" --replace '(getenv "GERBIL_HOME" #f)' "(getenv \"GERBIL_HOME\" \"$out/gerbil\")" ; - 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/gerbil\")" ; - done - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/gerbil $out/bin - cp -fa bin lib etc doc $out/gerbil - cat > $out/gerbil/bin/gxi <