From ea20904aefbb7a5bd865abd23b850ccb82e36342 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Fri, 6 Dec 2013 12:52:18 +0100 Subject: [PATCH] cabal: add support for the enableStaticLibrary flag to enable/disable building of static libraries Disabling static libraries is supported only in GHC 7.7 or later. --- pkgs/build-support/cabal/default.nix | 9 +++++++++ pkgs/top-level/haskell-packages.nix | 7 +++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix index 9b6d8c4e80ed..14bd01c7346e 100644 --- a/pkgs/build-support/cabal/default.nix +++ b/pkgs/build-support/cabal/default.nix @@ -4,6 +4,7 @@ , enableLibraryProfiling ? false , enableSharedLibraries ? false , enableSharedExecutables ? false +, enableStaticLibraries ? true , enableCheckPhase ? stdenv.lib.versionOlder "7.4" ghc.version }: @@ -25,6 +26,9 @@ assert enableSharedExecutables -> versionOlder "7.4" ghc.version; # Our GHC 6.10.x builds do not provide sharable versions of their core libraries. assert enableSharedLibraries -> versionOlder "6.12" ghc.version; +# Our GHC 6.10.x builds do not provide sharable versions of their core libraries. +assert !enableStaticLibraries -> versionOlder "7.7" ghc.version; + { mkDerivation = args : # arguments for the individual package, can modify the defaults @@ -128,6 +132,10 @@ assert enableSharedLibraries -> versionOlder "6.12" ghc.version; # and run any regression test suites the package might have doCheck = enableCheckPhase; + # pass the '--enable-library-vanilla' flag to cabal in the + # configure stage to enable building shared libraries + inherit enableStaticLibraries; + # pass the '--enable-shared' flag to cabal in the configure # stage to enable building shared libraries inherit enableSharedLibraries; @@ -140,6 +148,7 @@ assert enableSharedLibraries -> versionOlder "6.12" ghc.version; (enableFeature self.enableSplitObjs "split-objs") (enableFeature enableLibraryProfiling "library-profiling") (enableFeature self.enableSharedLibraries "shared") + (optional (versionOlder "7" ghc.version) (enableFeature self.enableStaticLibraries "library-vanilla")) (optional (versionOlder "7.4" ghc.version) (enableFeature self.enableSharedExecutables "executable-dynamic")) (optional (versionOlder "7" ghc.version) (enableFeature self.doCheck "tests")) ]; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 40446bcd3660..87b99ddf5d98 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -63,6 +63,7 @@ , enableSharedLibraries ? pkgs.stdenv.lib.versionOlder "7.7" ghc.version , enableSharedExecutables ? pkgs.stdenv.lib.versionOlder "7.7" ghc.version , enableCheckPhase ? pkgs.stdenv.lib.versionOlder "7.4" ghc.version +, enableStaticLibraries ? true }: # We redefine callPackage to take into account the new scope. The optional @@ -113,10 +114,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x # packages. It isn't the Cabal library, which is spelled "Cabal". cabal = callPackage ../build-support/cabal { - inherit enableLibraryProfiling; - inherit enableSharedLibraries; - inherit enableSharedExecutables; - inherit enableCheckPhase; + inherit enableLibraryProfiling enableCheckPhase + enableStaticLibraries enableSharedLibraries enableSharedExecutables; glibcLocales = if pkgs.stdenv.isLinux then pkgs.glibcLocales else null; };