at 18.03-beta 87 lines 2.7 kB view raw
1{ stdenv, fetchgit, coreutils, cctools, ncurses, libiconv, libX11 }: 2 3stdenv.mkDerivation rec { 4 name = "chez-scheme-${version}"; 5 version = "9.5.1"; 6 7 src = fetchgit { 8 url = "https://github.com/cisco/chezscheme.git"; 9 rev = "bc117fd4d567a6863689fec6814882a0f04e577a"; 10 sha256 = "1adzw7bgdz0p4xmccc6awdkb7bp6xba9mnlsh3r3zvblqfci8i70"; 11 fetchSubmodules = true; 12 }; 13 14 nativeBuildInputs = [ coreutils ] ++ stdenv.lib.optional stdenv.isDarwin cctools; 15 buildInputs = [ ncurses libiconv libX11 ]; 16 17 enableParallelBuilding = true; 18 19 /* 20 ** We patch out a very annoying 'feature' in ./configure, which 21 ** tries to use 'git' to update submodules. 22 ** 23 ** We have to also fix a few occurrences to tools with absolute 24 ** paths in some helper scripts, otherwise the build will fail on 25 ** NixOS or in any chroot build. 26 */ 27 patchPhase = '' 28 substituteInPlace ./configure \ 29 --replace "git submodule init && git submodule update || exit 1" "true" 30 31 substituteInPlace ./workarea \ 32 --replace "/bin/ln" ln \ 33 --replace "/bin/cp" cp 34 35 substituteInPlace ./makefiles/installsh \ 36 --replace "/usr/bin/true" "${coreutils}/bin/true" 37 38 substituteInPlace zlib/configure \ 39 --replace "/usr/bin/libtool" libtool 40 ''; 41 42 /* 43 ** Don't use configureFlags, since that just implicitly appends 44 ** everything onto a --prefix flag, which ./configure gets very angry 45 ** about. 46 ** 47 ** Also, carefully set a manual workarea argument, so that we 48 ** can later easily find the machine type that we built Chez 49 ** for. 50 */ 51 configurePhase = '' 52 ./configure --threads \ 53 --installprefix=$out --installman=$out/share/man \ 54 --workarea=work 55 ''; 56 57 /* 58 ** Install the kernel.o file, so we can compile C applications that 59 ** link directly to the Chez runtime (for booting their own files, or 60 ** embedding.) 61 ** 62 ** Ideally in the future this would be less of a hack and could be 63 ** done by Chez itself. Alternatively, there could just be a big 64 ** case statement matching to the different stdenv.platform values... 65 */ 66 postInstall = '' 67 m="$(ls ./work/boot)" 68 if [ "x''${m[1]}" != "x" ]; then 69 >&2 echo "ERROR: more than one bootfile build found; this is a nixpkgs error" 70 exit 1 71 fi 72 73 kernel=./work/boot/$m/kernel.o 74 kerneldest=$out/lib/csv${version}/$m/ 75 76 echo installing $kernel to $kerneldest 77 cp $kernel $kerneldest/kernel.o 78 ''; 79 80 meta = { 81 description = "A powerful and incredibly fast R6RS Scheme compiler"; 82 homepage = https://cisco.github.io/ChezScheme/; 83 license = stdenv.lib.licenses.asl20; 84 platforms = stdenv.lib.platforms.unix; 85 maintainers = with stdenv.lib.maintainers; [ thoughtpolice ]; 86 }; 87}