{ pkgs, gccStdenv, lib, coreutils, openssl, zlib, sqlite, version, git-version, src, gambit-support, gambit-git-version, gambit-stampYmd, gambit-stampHms, gambit-params }: # 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; buildInputs_libraries = [ openssl zlib sqlite ]; # 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 = buildInputs_libraries; postPatch = '' 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 ; substituteInPlace ./configure --replace 'set -e' 'set -e ; git () { echo "v${git-version}" ;}' ; substituteInPlace ./src/build/build-version.scm --replace "with-exception-catcher" '(lambda _ "v${git-version}")' ; #rmdir src/gambit #cp -a ${pkgs.gambit-unstable.src} ./src/gambit chmod -R u+w ./src/gambit ( cd src/gambit ; ${gambit-params.fixStamp gambit-git-version gambit-stampYmd gambit-stampHms} ) for f in src/bootstrap/gerbil/compiler/driver__0.scm \ src/build/build-libgerbil.ss \ src/gerbil/compiler/driver.ss ; do substituteInPlace "$f" --replace '"gcc"' '"${gccStdenv.cc}/bin/${gccStdenv.cc.targetPrefix}gcc"' ; done ''; ## 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 <