@@ -1,104 +0,0 @@
1−{ stdenv, fetchurl, writeText, sbclBootstrap
2−, sbclBootstrapHost ? "${sbclBootstrap}/bin/sbcl --disable-debugger --no-userinit --no-sysinit"
3−, threadSupport ? (stdenv.isi686 || stdenv.isx86_64)
4− # Meant for sbcl used for creating binaries portable to non-NixOS via save-lisp-and-die.
5− # Note that the created binaries still need `patchelf --set-interpreter ...`
6− # to get rid of ${glibc} dependency.
7−, purgeNixReferences ? false
8−}:
9−
10−stdenv.mkDerivation rec {
11− name = "sbcl-${version}";
12− version = "1.3.12";
13−
14− src = fetchurl {
15− url = "mirror://sourceforge/project/sbcl/sbcl/${version}/${name}-source.tar.bz2";
16− sha256 = "1hjr2xqazy4j0m58y4na6fz8ii3xflqairxy7vpd7ajbs00yqfc0";
17− };
18−
19− patchPhase = ''
20− echo '"${version}.nixos"' > version.lisp-expr
21− echo "
22− (lambda (features)
23− (flet ((enable (x)
24− (pushnew x features))
25− (disable (x)
26− (setf features (remove x features))))
27− ''
28− + (if threadSupport then "(enable :sb-thread)" else "(disable :sb-thread)")
29− + stdenv.lib.optionalString stdenv.isArm "(enable :arm)"
30− + ''
31− )) " > customize-target-features.lisp
32−
33− pwd
34−
35− # SBCL checks whether files are up-to-date in many places..
36− # Unfortunately, same timestamp is not good enough
37− sed -e 's@> x y@>= x y@' -i contrib/sb-aclrepl/repl.lisp
38− sed -e '/(date)/i((= date 2208988801) 2208988800)' -i contrib/asdf/asdf.lisp
39− sed -i src/cold/slam.lisp -e \
40− '/file-write-date input/a)'
41− sed -i src/cold/slam.lisp -e \
42− '/file-write-date output/i(or (and (= 2208988801 (file-write-date output)) (= 2208988801 (file-write-date input)))'
43− sed -i src/code/target-load.lisp -e \
44− '/date defaulted-fasl/a)'
45− sed -i src/code/target-load.lisp -e \
46− '/date defaulted-source/i(or (and (= 2208988801 (file-write-date defaulted-source-truename)) (= 2208988801 (file-write-date defaulted-fasl-truename)))'
47−
48− # Fix the tests
49− sed -e '/deftest pwent/inil' -i contrib/sb-posix/posix-tests.lisp
50− sed -e '/deftest grent/inil' -i contrib/sb-posix/posix-tests.lisp
51− sed -e '/deftest .*ent.non-existing/,+5d' -i contrib/sb-posix/posix-tests.lisp
52− sed -e '/deftest \(pw\|gr\)ent/,+3d' -i contrib/sb-posix/posix-tests.lisp
53−
54− sed -e '5,$d' -i contrib/sb-bsd-sockets/tests.lisp
55− sed -e '5,$d' -i contrib/sb-simple-streams/*test*.lisp
56−
57− # Use whatever `cc` the stdenv provides
58− substituteInPlace src/runtime/Config.x86-64-darwin --replace gcc cc
59−
60− substituteInPlace src/runtime/Config.x86-64-darwin \
61− --replace mmacosx-version-min=10.4 mmacosx-version-min=10.5
62− ''
63− + (if purgeNixReferences
64− then
65− # This is the default location to look for the core; by default in $out/lib/sbcl
66− ''
67− sed 's@^\(#define SBCL_HOME\) .*$@\1 "/no-such-path"@' \
68− -i src/runtime/runtime.c
69− ''
70− else
71− # Fix software version retrieval
72− ''
73− sed -e "s@/bin/uname@$(command -v uname)@g" -i src/code/*-os.lisp
74− ''
75− );
76−
77−
78− preBuild = ''
79− export INSTALL_ROOT=$out
80− mkdir -p test-home
81− export HOME=$PWD/test-home
82− '';
83−
84− buildPhase = ''
85− sh make.sh --prefix=$out --xc-host="${sbclBootstrapHost}"
86− '';
87−
88− installPhase = ''
89− INSTALL_ROOT=$out sh install.sh
90− '';
91−
92− # Specifying $SBCL_HOME is only truly needed with `purgeNixReferences = true`.
93− setupHook = writeText "setupHook.sh" ''
94− envHooks+=(_setSbclHome)
95− _setSbclHome() {
96− export SBCL_HOME='@out@/lib/sbcl/'
97− }
98− '';
99−
100− meta = sbclBootstrap.meta // {
101− inherit version;
102− updateWalker = true;
103− };
104−}