Add function to build a ghc standalone archive (OSX/iOS only)
This commit is contained in:
parent
e026568e6c
commit
4f9f00fcc9
|
@ -85,8 +85,17 @@ in stdenv.mkDerivation (rec {
|
||||||
} // stdenv.lib.optionalAttrs (cross != null) {
|
} // stdenv.lib.optionalAttrs (cross != null) {
|
||||||
name = "${cross.config}-ghc-${version}";
|
name = "${cross.config}-ghc-${version}";
|
||||||
|
|
||||||
|
patches = [ ./ios-linker.patch ];
|
||||||
|
|
||||||
preConfigure = commonPreConfigure + ''
|
preConfigure = commonPreConfigure + ''
|
||||||
sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk
|
sed 's|#BuildFlavour = quick-cross|BuildFlavour = quick-cross|' mk/build.mk.sample > mk/build.mk
|
||||||
|
echo "GhcRtsCcOpts = -glldb -Og" >> mk/build.mk
|
||||||
|
'';
|
||||||
|
|
||||||
|
postUnpack = ''
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
mv $sourceRoot $out/nix-support/source
|
||||||
|
sourceRoot=$out/nix-support/source
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
|
@ -103,6 +112,8 @@ in stdenv.mkDerivation (rec {
|
||||||
|
|
||||||
dontSetConfigureCross = true;
|
dontSetConfigureCross = true;
|
||||||
|
|
||||||
|
dontStrip = true;
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs cross;
|
inherit bootPkgs cross;
|
||||||
|
|
||||||
|
|
14
pkgs/os-specific/darwin/ghc-standalone-archive/default.nix
Normal file
14
pkgs/os-specific/darwin/ghc-standalone-archive/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{ runCommand, cctools }:
|
||||||
|
{ haskellPackages, src, deps ? p : [], name }: let
|
||||||
|
inherit (haskellPackages) ghc ghcWithPackages;
|
||||||
|
with-env = ghcWithPackages deps;
|
||||||
|
crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
|
||||||
|
ghcName = "${crossPrefix}ghc";
|
||||||
|
in runCommand name { buildInputs = [ with-env cctools ]; } ''
|
||||||
|
mkdir -p $out/lib
|
||||||
|
mkdir -p $out/include
|
||||||
|
${ghcName} ${src} -staticlib -outputdir . -o $out/lib/${name}.a -stubdir $out/include
|
||||||
|
for file in ${ghc}/lib/${ghcName}-${ghc.version}/include/*; do
|
||||||
|
ln -sv $file $out/include
|
||||||
|
done
|
||||||
|
''
|
|
@ -18042,4 +18042,6 @@ in
|
||||||
simplenote = callPackage ../applications/misc/simplenote { };
|
simplenote = callPackage ../applications/misc/simplenote { };
|
||||||
|
|
||||||
hy = callPackage ../development/interpreters/hy {};
|
hy = callPackage ../development/interpreters/hy {};
|
||||||
|
|
||||||
|
ghc-standalone-archive = callPackage ../os-specific/darwin/ghc-standalone-archive { inherit (darwin) cctools; };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue