about summary refs log tree commit diff
path: root/pkgs/build-support/cabal/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/cabal/default.nix')
-rw-r--r--pkgs/build-support/cabal/default.nix22
1 files changed, 16 insertions, 6 deletions
diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix
index a5884786b001..6657a7fa3fc6 100644
--- a/pkgs/build-support/cabal/default.nix
+++ b/pkgs/build-support/cabal/default.nix
@@ -80,20 +80,30 @@
             isLibrary = ! self.isExecutable;
             isExecutable = false;
 
+            # ignore version restrictions on the build inputs that the cabal file might specify
+            jailbreak = false;
+
+            # pass the '--enable-split-objs' flag to cabal in the configure stage
+            enableSplitObjs = true;
+
+            # configure flag to pass to enable/disable library profiling
             libraryProfiling =
               if enableLibraryProfiling then ["--enable-library-profiling"]
                                         else ["--disable-library-profiling"];
 
+            # configure flag to pass to enable/disable object splitting
+            splitObjects = if self.enableSplitObjs then "--enable-split-objs" else "--disable-split-objs";
+
             # compiles Setup and configures
             configurePhase = ''
               eval "$preConfigure"
 
-              ${lib.optionalString (lib.attrByPath ["jailbreak"] false self) "${jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal && "
-              }for i in Setup.hs Setup.lhs; do
+              ${lib.optionalString self.jailbreak "${jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal"}
+              for i in Setup.hs Setup.lhs; do
                 test -f $i && ghc --make $i
               done
 
-              for p in $extraBuildInputs $propagatedBuildNativeInputs; do
+              for p in $extraBuildInputs $propagatedNativeBuildInputs; do
                 if [ -d "$p/include" ]; then
                   extraLibDirs="$extraLibDirs --extra-include-dir=$p/include"
                 fi
@@ -104,7 +114,7 @@
                 done
               done
 
-              ./Setup configure --verbose --prefix="$out" $libraryProfiling $extraLibDirs $configureFlags
+              ./Setup configure --verbose --prefix="$out" $libraryProfiling $splitObjects $extraLibDirs $configureFlags
 
               eval "$postConfigure"
             '';
@@ -145,8 +155,8 @@
             '';
 
             postFixup = ''
-              if test -f $out/nix-support/propagated-build-native-inputs; then
-                ln -s $out/nix-support/propagated-build-native-inputs $out/nix-support/propagated-user-env-packages
+              if test -f $out/nix-support/propagated-native-build-inputs; then
+                ln -s $out/nix-support/propagated-native-build-inputs $out/nix-support/propagated-user-env-packages
               fi
             '';