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;
|
optionals = stdenv.lib.optionals;
|
||||||
optionalString = stdenv.lib.optionalString;
|
optionalString = stdenv.lib.optionalString;
|
||||||
filter = stdenv.lib.filter;
|
filter = stdenv.lib.filter;
|
||||||
|
|
||||||
|
defaultSetupHs = builtins.toFile "Setup.hs" ''
|
||||||
|
import Distribution.Simple
|
||||||
|
main = defaultMain
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
|
|
||||||
# Cabal shipped with GHC 6.12.4 or earlier doesn't know the "--enable-tests configure" flag.
|
# 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"}
|
${optionalString self.jailbreak "${jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal"}
|
||||||
|
|
||||||
for i in Setup.hs Setup.lhs; do
|
for i in Setup.hs Setup.lhs ${defaultSetupHs}; do
|
||||||
test -f $i && ghc --make $i
|
test -f $i && break
|
||||||
done
|
done
|
||||||
if [ ! -f Setup ]; then
|
ghc --make -o Setup -odir $TMPDIR $i
|
||||||
ghc --make ${builtins.toFile "Setup.hs" ''
|
|
||||||
import Distribution.Simple
|
|
||||||
main = defaultMain
|
|
||||||
''} -o Setup -odir $TMPDIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
for p in $extraBuildInputs $propagatedNativeBuildInputs; do
|
for p in $extraBuildInputs $propagatedNativeBuildInputs; do
|
||||||
if [ -d "$p/lib/ghc-${ghc.ghc.version}/package.conf.d" ]; then
|
if [ -d "$p/lib/ghc-${ghc.ghc.version}/package.conf.d" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user