about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorKeshav Kini <keshav.kini@gmail.com>2020-05-30 02:01:56 -0700
committerKeshav Kini <keshav.kini@gmail.com>2020-05-30 17:23:21 -0700
commitd78985704c94107fb798d3401078eacf069e95f5 (patch)
tree681220ea4b33b2ae0740022acc7531d31b55d5bd /pkgs
parent2a16738d41ce73ab96633c7cb0ea97ed321aac3e (diff)
downloadnixlib-d78985704c94107fb798d3401078eacf069e95f5.tar
nixlib-d78985704c94107fb798d3401078eacf069e95f5.tar.gz
nixlib-d78985704c94107fb798d3401078eacf069e95f5.tar.bz2
nixlib-d78985704c94107fb798d3401078eacf069e95f5.tar.lz
nixlib-d78985704c94107fb798d3401078eacf069e95f5.tar.xz
nixlib-d78985704c94107fb798d3401078eacf069e95f5.tar.zst
nixlib-d78985704c94107fb798d3401078eacf069e95f5.zip
sbcl: add option to disable immobile space
Programs which generate and compile a lot of code at runtime (such as
programming language interpreters like ACL2) are not suited for running on SBCL
executables built with the "immobile space" feature, as explained by Douglas
Katzman in this mail thread:

  https://sourceforge.net/p/sbcl/mailman/message/36007057/

In this commit, I add an optional flag to the SBCL package allowing you to
disable the "immobile space" features.

I also migrated away from specifying enabled/disabled features in a
`customize-target-features.lisp` file and towards supplying them as command line
arguments to `make.sh`, as has been recommended by the installation instructions
since 2012 or so.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/sbcl/2.0.0.nix26
-rw-r--r--pkgs/development/compilers/sbcl/default.nix26
2 files changed, 28 insertions, 24 deletions
diff --git a/pkgs/development/compilers/sbcl/2.0.0.nix b/pkgs/development/compilers/sbcl/2.0.0.nix
index bb0056bb9ece..6df98a9a60ea 100644
--- a/pkgs/development/compilers/sbcl/2.0.0.nix
+++ b/pkgs/development/compilers/sbcl/2.0.0.nix
@@ -1,6 +1,7 @@
 { stdenv, fetchurl, writeText, sbclBootstrap
 , sbclBootstrapHost ? "${sbclBootstrap}/bin/sbcl --disable-debugger --no-userinit --no-sysinit"
 , threadSupport ? (stdenv.isi686 || stdenv.isx86_64 || "aarch64-linux" == stdenv.hostPlatform.system)
+, disableImmobileSpace ? false
   # Meant for sbcl used for creating binaries portable to non-NixOS via save-lisp-and-die.
   # Note that the created binaries still need `patchelf --set-interpreter ...`
   # to get rid of ${glibc} dependency.
@@ -21,17 +22,6 @@ stdenv.mkDerivation rec {
 
   patchPhase = ''
     echo '"${version}.nixos"' > version.lisp-expr
-    echo "
-    (lambda (features)
-      (flet ((enable (x)
-               (pushnew x features))
-             (disable (x)
-               (setf features (remove x features))))
-    ''
-    + (if threadSupport then "(enable :sb-thread)" else "(disable :sb-thread)")
-    + stdenv.lib.optionalString stdenv.isAarch32 "(enable :arm)"
-    + ''
-      )) " > customize-target-features.lisp
 
     pwd
 
@@ -80,8 +70,20 @@ stdenv.mkDerivation rec {
     export HOME=$PWD/test-home
   '';
 
+  enableFeatures = with stdenv.lib;
+    optional threadSupport "sb-thread" ++
+    optional stdenv.isAarch32 "arm";
+
+  disableFeatures = with stdenv.lib;
+    optional (!threadSupport) "sb-thread" ++
+    optionals disableImmobileSpace [ "immobile-space" "immobile-code" "compact-instance-header" ];
+
   buildPhase = ''
-    sh make.sh --prefix=$out --xc-host="${sbclBootstrapHost}"
+    sh make.sh --prefix=$out --xc-host="${sbclBootstrapHost}" ${
+                  stdenv.lib.concatStringsSep " "
+                    (builtins.map (x: "--with-${x}") enableFeatures ++
+                     builtins.map (x: "--without-${x}") disableFeatures)
+                }
     (cd doc/manual ; make info)
   '';
 
diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix
index 4517db4c3840..d4a00f57b6a4 100644
--- a/pkgs/development/compilers/sbcl/default.nix
+++ b/pkgs/development/compilers/sbcl/default.nix
@@ -1,6 +1,7 @@
 { stdenv, fetchurl, writeText, sbclBootstrap
 , sbclBootstrapHost ? "${sbclBootstrap}/bin/sbcl --disable-debugger --no-userinit --no-sysinit"
 , threadSupport ? (stdenv.isi686 || stdenv.isx86_64 || "aarch64-linux" == stdenv.hostPlatform.system)
+, disableImmobileSpace ? false
   # Meant for sbcl used for creating binaries portable to non-NixOS via save-lisp-and-die.
   # Note that the created binaries still need `patchelf --set-interpreter ...`
   # to get rid of ${glibc} dependency.
@@ -21,17 +22,6 @@ stdenv.mkDerivation rec {
 
   patchPhase = ''
     echo '"${version}.nixos"' > version.lisp-expr
-    echo "
-    (lambda (features)
-      (flet ((enable (x)
-               (pushnew x features))
-             (disable (x)
-               (setf features (remove x features))))
-    ''
-    + (if threadSupport then "(enable :sb-thread)" else "(disable :sb-thread)")
-    + stdenv.lib.optionalString stdenv.isAarch32 "(enable :arm)"
-    + ''
-      )) " > customize-target-features.lisp
 
     pwd
 
@@ -80,8 +70,20 @@ stdenv.mkDerivation rec {
     export HOME=$PWD/test-home
   '';
 
+  enableFeatures = with stdenv.lib;
+    optional threadSupport "sb-thread" ++
+    optional stdenv.isAarch32 "arm";
+
+  disableFeatures = with stdenv.lib;
+    optional (!threadSupport) "sb-thread" ++
+    optionals disableImmobileSpace [ "immobile-space" "immobile-code" "compact-instance-header" ];
+
   buildPhase = ''
-    sh make.sh --prefix=$out --xc-host="${sbclBootstrapHost}"
+    sh make.sh --prefix=$out --xc-host="${sbclBootstrapHost}" ${
+                  stdenv.lib.concatStringsSep " "
+                    (builtins.map (x: "--with-${x}") enableFeatures ++
+                     builtins.map (x: "--without-${x}") disableFeatures)
+                }
     (cd doc/manual ; make info)
   '';