2017-11-29 19:00:18 +00:00
|
|
|
{ stdenv, fetchgit, coreutils, cctools, ncurses, libiconv, libX11 }:
|
2016-05-01 03:05:16 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "chez-scheme-${version}";
|
2018-02-10 20:03:48 +00:00
|
|
|
version = "9.5.1";
|
2016-05-01 03:05:16 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
2016-05-01 20:12:49 +00:00
|
|
|
url = "https://github.com/cisco/chezscheme.git";
|
2017-11-15 16:19:17 +00:00
|
|
|
rev = "bc117fd4d567a6863689fec6814882a0f04e577a";
|
|
|
|
sha256 = "1adzw7bgdz0p4xmccc6awdkb7bp6xba9mnlsh3r3zvblqfci8i70";
|
2016-05-01 03:05:16 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2017-11-29 19:00:18 +00:00
|
|
|
nativeBuildInputs = [ coreutils ] ++ stdenv.lib.optional stdenv.isDarwin cctools;
|
|
|
|
buildInputs = [ ncurses libiconv libX11 ];
|
2016-05-01 03:05:16 +00:00
|
|
|
|
2018-02-10 20:03:48 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
/*
|
|
|
|
** We patch out a very annoying 'feature' in ./configure, which
|
2016-05-08 03:40:43 +00:00
|
|
|
** tries to use 'git' to update submodules.
|
2016-05-01 03:05:16 +00:00
|
|
|
**
|
2016-05-08 03:40:43 +00:00
|
|
|
** We have to also fix a few occurrences to tools with absolute
|
|
|
|
** paths in some helper scripts, otherwise the build will fail on
|
|
|
|
** NixOS or in any chroot build.
|
2016-05-01 03:05:16 +00:00
|
|
|
*/
|
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace ./configure \
|
2017-10-29 00:04:16 +00:00
|
|
|
--replace "git submodule init && git submodule update || exit 1" "true"
|
2016-05-01 22:10:18 +00:00
|
|
|
|
|
|
|
substituteInPlace ./workarea \
|
2017-11-29 19:00:18 +00:00
|
|
|
--replace "/bin/ln" ln \
|
|
|
|
--replace "/bin/cp" cp
|
2016-05-01 22:10:18 +00:00
|
|
|
|
|
|
|
substituteInPlace ./makefiles/installsh \
|
|
|
|
--replace "/usr/bin/true" "${coreutils}/bin/true"
|
2017-11-29 19:00:18 +00:00
|
|
|
|
|
|
|
substituteInPlace zlib/configure \
|
|
|
|
--replace "/usr/bin/libtool" libtool
|
2016-05-01 03:05:16 +00:00
|
|
|
'';
|
|
|
|
|
2018-02-10 20:03:48 +00:00
|
|
|
/*
|
|
|
|
** Don't use configureFlags, since that just implicitly appends
|
2016-05-01 03:05:16 +00:00
|
|
|
** everything onto a --prefix flag, which ./configure gets very angry
|
|
|
|
** about.
|
2018-02-10 20:03:48 +00:00
|
|
|
**
|
|
|
|
** Also, carefully set a manual workarea argument, so that we
|
|
|
|
** can later easily find the machine type that we built Chez
|
|
|
|
** for.
|
2016-05-01 03:05:16 +00:00
|
|
|
*/
|
|
|
|
configurePhase = ''
|
2018-02-10 20:03:48 +00:00
|
|
|
./configure --threads \
|
|
|
|
--installprefix=$out --installman=$out/share/man \
|
|
|
|
--workarea=work
|
2016-05-01 03:05:16 +00:00
|
|
|
'';
|
|
|
|
|
2018-02-10 20:03:48 +00:00
|
|
|
/*
|
|
|
|
** Install the kernel.o file, so we can compile C applications that
|
|
|
|
** link directly to the Chez runtime (for booting their own files, or
|
|
|
|
** embedding.)
|
|
|
|
**
|
|
|
|
** Ideally in the future this would be less of a hack and could be
|
|
|
|
** done by Chez itself. Alternatively, there could just be a big
|
2018-08-20 19:18:07 +00:00
|
|
|
** case statement matching to the different stdenv.hostPlatform.platform
|
|
|
|
** values...
|
2018-02-10 20:03:48 +00:00
|
|
|
*/
|
|
|
|
postInstall = ''
|
|
|
|
m="$(ls ./work/boot)"
|
|
|
|
if [ "x''${m[1]}" != "x" ]; then
|
|
|
|
>&2 echo "ERROR: more than one bootfile build found; this is a nixpkgs error"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
kernel=./work/boot/$m/kernel.o
|
|
|
|
kerneldest=$out/lib/csv${version}/$m/
|
|
|
|
|
|
|
|
echo installing $kernel to $kerneldest
|
|
|
|
cp $kernel $kerneldest/kernel.o
|
|
|
|
'';
|
2017-11-29 19:00:18 +00:00
|
|
|
|
2016-05-01 03:05:16 +00:00
|
|
|
meta = {
|
|
|
|
description = "A powerful and incredibly fast R6RS Scheme compiler";
|
2018-02-10 20:03:48 +00:00
|
|
|
homepage = https://cisco.github.io/ChezScheme/;
|
2016-05-01 03:05:16 +00:00
|
|
|
license = stdenv.lib.licenses.asl20;
|
2017-11-29 19:00:18 +00:00
|
|
|
platforms = stdenv.lib.platforms.unix;
|
2016-05-01 03:05:16 +00:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ thoughtpolice ];
|
|
|
|
};
|
|
|
|
}
|