gambit: refactor (#113405)

This commit is contained in:
Ben Siraphob 2021-03-09 09:52:26 +00:00 committed by GitHub
parent 2deb6cf482
commit 7273ebabfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 18 deletions

View file

@ -25,10 +25,11 @@ gccStdenv.mkDerivation rec {
inherit src version git-version;
bootstrap = gambit-support.gambit-bootstrap;
nativeBuildInputs = [ git autoconf ];
# 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 ];
buildInputs = [ 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 ?
@ -62,11 +63,11 @@ gccStdenv.mkDerivation rec {
lib.optional (!gccStdenv.isDarwin) "--enable-poll";
configurePhase = ''
export CC=${gcc}/bin/gcc \
CXX=${gcc}/bin/g++ \
CPP=${gcc}/bin/cpp \
CXXCPP=${gcc}/bin/cpp \
LD=${gcc}/bin/ld \
export CC=${gccStdenv.cc.targetPrefix}gcc \
CXX=${gccStdenv.cc.targetPrefix}g++ \
CPP=${gccStdenv.cc.targetPrefix}cpp \
CXXCPP=${gccStdenv.cc.targetPrefix}cpp \
LD=${gccStdenv.cc.targetPrefix}ld \
XMKMF=${coreutils}/bin/false
unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS
@ -76,22 +77,23 @@ gccStdenv.mkDerivation rec {
# 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"
--replace "/usr/local/opt/openssl@1.1" "${openssl.out}" \
--replace "/usr/local/opt/openssl" "${openssl.out}"
./config.status
'';
buildPhase = ''
# Make bootstrap compiler, from release bootstrap
mkdir -p boot &&
cp -rp ${bootstrap}/gambit/. boot/. &&
chmod -R u+w boot &&
cd boot &&
cp ../gsc/makefile.in ../gsc/*.scm gsc/ && # */
./configure &&
for i in lib gsi gsc ; do (cd $i ; make -j$NIX_BUILD_CORES) ; done &&
cd .. &&
cp boot/gsc/gsc gsc-boot &&
mkdir -p boot
cp -rp ${bootstrap}/gambit/. boot/.
chmod -R u+w boot
cd boot
cp ../gsc/makefile.in ../gsc/*.scm gsc/
./configure
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 -j$NIX_BUILD_CORES from-scratch

View file

@ -1,4 +1,4 @@
{ pkgs, gccStdenv, lib, coreutils, bash, # makeStaticLibraries,
{ pkgs, gccStdenv, lib, coreutils,
openssl, zlib, sqlite, libxml2, libyaml, libmysqlclient, lmdb, leveldb, postgresql,
version, git-version,
gambit-support,