mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 17:33:09 +00:00
cabal: minor code re-factoring of shleavy's patch that allows building packages without a Setup.hs file
https://github.com/NixOS/nixpkgs/pull/3585
This commit is contained in:
parent
35779fd646
commit
a9fad50181
@ -18,6 +18,11 @@ let
|
||||
optionals = stdenv.lib.optionals;
|
||||
optionalString = stdenv.lib.optionalString;
|
||||
filter = stdenv.lib.filter;
|
||||
|
||||
defaultSetupHs = builtins.toFile "Setup.hs" ''
|
||||
import Distribution.Simple
|
||||
main = defaultMain
|
||||
'';
|
||||
in
|
||||
|
||||
# Cabal shipped with GHC 6.12.4 or earlier doesn't know the "--enable-tests configure" flag.
|
||||
@ -179,15 +184,10 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
|
||||
|
||||
${optionalString self.jailbreak "${jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal"}
|
||||
|
||||
for i in Setup.hs Setup.lhs; do
|
||||
test -f $i && ghc --make $i
|
||||
for i in Setup.hs Setup.lhs ${defaultSetupHs}; do
|
||||
test -f $i && break
|
||||
done
|
||||
if [ ! -f Setup ]; then
|
||||
ghc --make ${builtins.toFile "Setup.hs" ''
|
||||
import Distribution.Simple
|
||||
main = defaultMain
|
||||
''} -o Setup -odir $TMPDIR
|
||||
fi
|
||||
ghc --make -o Setup -odir $TMPDIR $i
|
||||
|
||||
for p in $extraBuildInputs $propagatedNativeBuildInputs; do
|
||||
if [ -d "$p/lib/ghc-${ghc.ghc.version}/package.conf.d" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user