haskell-generic-builder: use cpphs pre-processor by default on Darwin

Allegedly, the cpp implementation of Clang is weird and causes errors.
This commit is contained in:
Peter Simons 2015-01-13 22:15:29 +01:00
parent 67312f83ad
commit 007628fd49
2 changed files with 17 additions and 2 deletions

View file

@ -25,6 +25,17 @@ let
hyperlinkSource = false; # Avoid depending on hscolour for this build. hyperlinkSource = false; # Avoid depending on hscolour for this build.
postFixup = "rm -rf $out/lib $out/share $out/nix-support"; postFixup = "rm -rf $out/lib $out/share $out/nix-support";
}); });
cpphs = overrideCabal (self.cpphs.overrideScope (self: super: {
mkDerivation = drv: super.mkDerivation (drv // {
enableSharedExecutables = false;
enableSharedLibraries = false;
noHaddock = true;
useCpphs = false;
});
})) (drv: {
isLibrary = false;
postFixup = "rm -rf $out/lib $out/share $out/nix-support";
});
}; };
overrideCabal = drv: f: drv.override (args: args // { overrideCabal = drv: f: drv.override (args: args // {

View file

@ -1,5 +1,5 @@
{ stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused { stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused
, jailbreak-cabal, hscolour , jailbreak-cabal, hscolour, cpphs
}: }:
{ pname { pname
@ -39,7 +39,8 @@
, preInstall ? "", postInstall ? "" , preInstall ? "", postInstall ? ""
, checkPhase ? "", preCheck ? "", postCheck ? "" , checkPhase ? "", preCheck ? "", postCheck ? ""
, preFixup ? "", postFixup ? "" , preFixup ? "", postFixup ? ""
, coreSetup ? false # Use core packages to build Setup.hs , coreSetup ? false # Use only core packages to build Setup.hs.
, useCpphs ? stdenv.isDarwin
}: }:
assert pkgconfigDepends != [] -> pkgconfig != null; assert pkgconfigDepends != [] -> pkgconfig != null;
@ -119,6 +120,9 @@ stdenv.mkDerivation ({
setupCompileFlags="-j$NIX_BUILD_CORES" setupCompileFlags="-j$NIX_BUILD_CORES"
''}${optionalString stdenv.isDarwin '' ''}${optionalString stdenv.isDarwin ''
configureFlags+=" --with-gcc=$CC" # Cabal won't find clang without help. configureFlags+=" --with-gcc=$CC" # Cabal won't find clang without help.
''}${optionalString useCpphs ''
configureFlags+=" --with-cpphs=${cpphs}/bin/cpphs"
configureFlags+=" --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp"
''} ''}
packageConfDir="$TMP/package.conf.d" packageConfDir="$TMP/package.conf.d"