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; inherit src version git-version;
bootstrap = gambit-support.gambit-bootstrap; 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, # 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 # we could use something like (makeStaticLibraries openssl) to enable creation
# of statically linked binaries by gsc. # 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? # 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 ? # Or wrap relevant programs to add a suitable PATH ?
@ -62,11 +63,11 @@ gccStdenv.mkDerivation rec {
lib.optional (!gccStdenv.isDarwin) "--enable-poll"; lib.optional (!gccStdenv.isDarwin) "--enable-poll";
configurePhase = '' configurePhase = ''
export CC=${gcc}/bin/gcc \ export CC=${gccStdenv.cc.targetPrefix}gcc \
CXX=${gcc}/bin/g++ \ CXX=${gccStdenv.cc.targetPrefix}g++ \
CPP=${gcc}/bin/cpp \ CPP=${gccStdenv.cc.targetPrefix}cpp \
CXXCPP=${gcc}/bin/cpp \ CXXCPP=${gccStdenv.cc.targetPrefix}cpp \
LD=${gcc}/bin/ld \ LD=${gccStdenv.cc.targetPrefix}ld \
XMKMF=${coreutils}/bin/false XMKMF=${coreutils}/bin/false
unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS unset CFLAGS LDFLAGS LIBS CPPFLAGS CXXFLAGS
@ -76,22 +77,23 @@ gccStdenv.mkDerivation rec {
# OS-specific paths are hardcoded in ./configure # OS-specific paths are hardcoded in ./configure
substituteInPlace config.status \ substituteInPlace config.status \
--replace /usr/local/opt/openssl/lib "${openssl.out}/lib" \ --replace "/usr/local/opt/openssl@1.1" "${openssl.out}" \
--replace /usr/local/opt/openssl@1.1/lib "${openssl.out}/lib" --replace "/usr/local/opt/openssl" "${openssl.out}"
./config.status ./config.status
''; '';
buildPhase = '' buildPhase = ''
# Make bootstrap compiler, from release bootstrap # Make bootstrap compiler, from release bootstrap
mkdir -p boot && mkdir -p boot
cp -rp ${bootstrap}/gambit/. boot/. && cp -rp ${bootstrap}/gambit/. boot/.
chmod -R u+w boot && chmod -R u+w boot
cd boot && cd boot
cp ../gsc/makefile.in ../gsc/*.scm gsc/ && # */ cp ../gsc/makefile.in ../gsc/*.scm gsc/
./configure && ./configure
for i in lib gsi gsc ; do (cd $i ; make -j$NIX_BUILD_CORES) ; done && for i in lib gsi gsc ; do (cd $i ; make -j$NIX_BUILD_CORES) ; done
cd .. && cd ..
cp boot/gsc/gsc gsc-boot && cp boot/gsc/gsc gsc-boot
# Now use the bootstrap compiler to build the real thing! # Now use the bootstrap compiler to build the real thing!
make -j$NIX_BUILD_CORES from-scratch 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, openssl, zlib, sqlite, libxml2, libyaml, libmysqlclient, lmdb, leveldb, postgresql,
version, git-version, version, git-version,
gambit-support, gambit-support,