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.
This commit is contained in:
Francois-Rene Rideau
2020-05-17 15:48:12 -04:00
parent 28c2c0156d
commit 9456522528
6 changed files with 89 additions and 44 deletions
+11 -11
View File
@@ -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 ];
};
}