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.
This commit is contained in:
Peter Simons 2013-12-06 12:52:18 +01:00
parent 36cb2af057
commit ea20904aef
2 changed files with 12 additions and 4 deletions

View File

@ -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"))
];

View File

@ -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;
};