From bf07f42487d37df20a4d839edabe7aae5820c205 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Sat, 20 Jan 2024 12:40:06 -0500 Subject: [PATCH] sbcl: allow overriding build flags from Nix E.g.: sbcl.overrideAttrs (old: { enableFeatures = old.enableFeatures ++ [ "foobar" ]; }) --- pkgs/development/compilers/sbcl/default.nix | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix index 3d13d2e0ed05..3b397a887894 100644 --- a/pkgs/development/compilers/sbcl/default.nix +++ b/pkgs/development/compilers/sbcl/default.nix @@ -77,7 +77,7 @@ let in -stdenv.mkDerivation rec { +stdenv.mkDerivation (self: rec { pname = "sbcl"; inherit version; @@ -130,7 +130,16 @@ stdenv.mkDerivation rec { optional (!threadSupport) "sb-thread" ++ optionals disableImmobileSpace [ "immobile-space" "immobile-code" "compact-instance-header" ]; - env.NIX_CFLAGS_COMPILE = toString (lib.optionals (lib.versionOlder version "2.1.10") [ + buildArgs = [ + "--prefix=$out" + "--xc-host=${lib.escapeShellArg bootstrapLisp'}" + ] ++ builtins.map (x: "--with-${x}") self.enableFeatures + ++ builtins.map (x: "--without-${x}") self.disableFeatures + ++ lib.optionals (stdenv.hostPlatform.system == "aarch64-darwin") [ + "--arch=arm64" + ]; + + env.NIX_CFLAGS_COMPILE = toString (lib.optionals (lib.versionOlder self.version "2.1.10") [ # Workaround build failure on -fno-common toolchains like upstream # clang-13. Without the change build fails as: # duplicate symbol '_static_code_space_free_pointer' in: alloc.o traceroot.o @@ -143,11 +152,7 @@ stdenv.mkDerivation rec { buildPhase = '' runHook preBuild - sh make.sh --prefix=$out --xc-host="${bootstrapLisp'}" ${ - lib.concatStringsSep " " - (builtins.map (x: "--with-${x}") enableFeatures ++ - builtins.map (x: "--without-${x}") disableFeatures) - } ${lib.optionalString (stdenv.hostPlatform.system == "aarch64-darwin") "--arch=arm64"} + sh make.sh ${lib.concatStringsSep " " self.buildArgs} (cd doc/manual ; make info) runHook postBuild @@ -197,4 +202,4 @@ stdenv.mkDerivation rec { "aarch64-linux" ]; }; -} +})