{ pkgs, gccStdenv, lib, coreutils, 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 }: # 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 libxml2 libyaml libmysqlclient lmdb leveldb postgresql ]; # 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; # disable stackprotector on aarch64-darwin for now # build error: # ``` # /private/tmp/nix-build-gerbil-unstable-2020-11-05.drv-0/ccjyhWKi.s:326:15: error: index must be an integer in range [-256, 255]. # ldr x2, [x2, ___stack_chk_guard];momd # ^ # ``` hardeningDisable = lib.optionals (gccStdenv.isAarch64 && gccStdenv.isDarwin) [ "stackprotector" ]; 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 . ; grep -Fl '#!/usr/bin/env' `find . -type f -executable` | while read f ; do substituteInPlace "$f" --replace '#!/usr/bin/env' '#!${coreutils}/bin/env' ; 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 <