Merge pull request #33358 from obsidiansystems/cross-haskell-samehash
haskell infra, ghc: Start to fix cross compilation without changing hashes
This commit is contained in:
commit
eb6db32d01
@ -4,6 +4,9 @@
|
|||||||
, enableIntegerSimple ? false
|
, enableIntegerSimple ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# Prebuilt only does native
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "6.10.2";
|
version = "6.10.2";
|
||||||
|
|
||||||
@ -93,6 +96,8 @@ stdenv.mkDerivation rec {
|
|||||||
[ $(./main) == "yes" ]
|
[ $(./main) == "yes" ]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
description = "The Glasgow Haskell Compiler";
|
description = "The Glasgow Haskell Compiler";
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{stdenv, fetchurl, libedit, ghc, perl, gmp, ncurses}:
|
{stdenv, fetchurl, libedit, ghc, perl, gmp, ncurses}:
|
||||||
|
|
||||||
|
# TODO(@Ericson2314): Cross compilation support
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "6.10.4";
|
version = "6.10.4";
|
||||||
|
|
||||||
@ -22,6 +25,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
|
NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
description = "The Glasgow Haskell Compiler";
|
description = "The Glasgow Haskell Compiler";
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{stdenv, fetchurl, ghc, perl, gmp, ncurses}:
|
{stdenv, fetchurl, ghc, perl, gmp, ncurses}:
|
||||||
|
|
||||||
|
# TODO(@Ericson2314): Cross compilation support
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "6.12.3";
|
version = "6.12.3";
|
||||||
|
|
||||||
@ -33,6 +36,8 @@ stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags=["-S" "--keep-file-symbols"];
|
stripDebugFlags=["-S" "--keep-file-symbols"];
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
description = "The Glasgow Haskell Compiler";
|
description = "The Glasgow Haskell Compiler";
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
, ncurses5, gmp, libiconv
|
, ncurses5, gmp, libiconv
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# Prebuilt only does native
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
|
||||||
let
|
let
|
||||||
libPath = stdenv.lib.makeLibraryPath ([
|
libPath = stdenv.lib.makeLibraryPath ([
|
||||||
ncurses5 gmp
|
ncurses5 gmp
|
||||||
@ -131,6 +134,8 @@ stdenv.mkDerivation rec {
|
|||||||
[ $(./main) == "yes" ]
|
[ $(./main) == "yes" ]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta.license = stdenv.lib.licenses.bsd3;
|
meta.license = stdenv.lib.licenses.bsd3;
|
||||||
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{ stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }:
|
{ stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }:
|
||||||
|
|
||||||
|
# TODO(@Ericson2314): Cross compilation support
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "7.0.4";
|
version = "7.0.4";
|
||||||
name = "ghc-${version}";
|
name = "ghc-${version}";
|
||||||
@ -42,6 +45,8 @@ stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags=["-S" "--keep-file-symbols"];
|
stripDebugFlags=["-S" "--keep-file-symbols"];
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
description = "The Glasgow Haskell Compiler";
|
description = "The Glasgow Haskell Compiler";
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
, gcc
|
, gcc
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# Prebuilt only does native
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
|
||||||
let
|
let
|
||||||
libPath = stdenv.lib.makeLibraryPath ([
|
libPath = stdenv.lib.makeLibraryPath ([
|
||||||
ncurses5 gmp
|
ncurses5 gmp
|
||||||
@ -148,6 +151,8 @@ stdenv.mkDerivation rec {
|
|||||||
[ $(./main) == "yes" ]
|
[ $(./main) == "yes" ]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta.license = stdenv.lib.licenses.bsd3;
|
meta.license = stdenv.lib.licenses.bsd3;
|
||||||
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin" "armv7l-linux"];
|
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin" "armv7l-linux"];
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,28 @@
|
|||||||
{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, ncurses, libiconv, targetPackages, coreutils
|
{ stdenv, targetPackages
|
||||||
, libxml2, libxslt, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, hscolour
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
|
||||||
# If enabled GHC will be build with the GPL-free but slower integer-simple
|
# build-tools
|
||||||
|
, bootPkgs, hscolour
|
||||||
|
, coreutils, fetchurl, fetchpatch, perl
|
||||||
|
, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, libxml2, libxslt
|
||||||
|
|
||||||
|
, libiconv ? null, ncurses
|
||||||
|
|
||||||
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
, enableIntegerSimple ? false, gmp
|
enableIntegerSimple ? false, gmp ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (bootPkgs) ghc;
|
inherit (bootPkgs) ghc;
|
||||||
|
|
||||||
|
# TODO(@Ericson2314) Make unconditional
|
||||||
|
targetPrefix = stdenv.lib.optionalString
|
||||||
|
(targetPlatform != hostPlatform)
|
||||||
|
"${targetPlatform.config}-";
|
||||||
|
|
||||||
docFixes = fetchurl {
|
docFixes = fetchurl {
|
||||||
url = "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3a.patch";
|
url = "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3a.patch";
|
||||||
sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0";
|
sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0";
|
||||||
@ -18,10 +32,10 @@ in
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "7.10.3";
|
version = "7.10.3";
|
||||||
name = "ghc-${version}";
|
name = "${targetPrefix}ghc-${version}";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://downloads.haskell.org/~ghc/${version}/${name}-src.tar.xz";
|
url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
|
||||||
sha256 = "1vsgmic8csczl62ciz51iv8nhrkm72lyhbz7p7id13y2w7fcx46g";
|
sha256 = "1vsgmic8csczl62ciz51iv8nhrkm72lyhbz7p7id13y2w7fcx46g";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,7 +76,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
# Install the bash completion file.
|
# Install the bash completion file.
|
||||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
|
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||||
|
|
||||||
# Patch scripts to include "readelf" and "cat" in $PATH.
|
# Patch scripts to include "readelf" and "cat" in $PATH.
|
||||||
for i in "$out/bin/"*; do
|
for i in "$out/bin/"*; do
|
||||||
@ -73,7 +87,7 @@ stdenv.mkDerivation rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs;
|
inherit bootPkgs targetPrefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
|
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
|
||||||
|
|
||||||
# If enabled GHC will be build with the GPL-free but slower integer-simple
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
, enableIntegerSimple ? false, gmp
|
enableIntegerSimple ? false, gmp ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# TODO(@Ericson2314): Cross compilation support
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "7.2.2";
|
version = "7.2.2";
|
||||||
name = "ghc-${version}";
|
name = "ghc-${version}";
|
||||||
@ -51,6 +55,8 @@ stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags=["-S" "--keep-file-symbols"];
|
stripDebugFlags=["-S" "--keep-file-symbols"];
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
description = "The Glasgow Haskell Compiler";
|
description = "The Glasgow Haskell Compiler";
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
, ncurses5, gmp, libiconv
|
, ncurses5, gmp, libiconv
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# Prebuilt only does native
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
|
||||||
let
|
let
|
||||||
libPath = stdenv.lib.makeLibraryPath ([
|
libPath = stdenv.lib.makeLibraryPath ([
|
||||||
ncurses5 gmp
|
ncurses5 gmp
|
||||||
@ -133,6 +136,8 @@ stdenv.mkDerivation rec {
|
|||||||
[ $(./main) == "yes" ]
|
[ $(./main) == "yes" ]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta.license = stdenv.lib.licenses.bsd3;
|
meta.license = stdenv.lib.licenses.bsd3;
|
||||||
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
|
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
|
||||||
|
|
||||||
# If enabled GHC will be build with the GPL-free but slower integer-simple
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
, enableIntegerSimple ? false, gmp
|
enableIntegerSimple ? false, gmp ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# TODO(@Ericson2314): Cross compilation support
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "7.4.2";
|
version = "7.4.2";
|
||||||
|
|
||||||
@ -52,6 +56,8 @@ stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
description = "The Glasgow Haskell Compiler";
|
description = "The Glasgow Haskell Compiler";
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
|
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
|
||||||
|
|
||||||
# If enabled GHC will be build with the GPL-free but slower integer-simple
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
, enableIntegerSimple ? false, gmp
|
enableIntegerSimple ? false, gmp ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# TODO(@Ericson2314): Cross compilation support
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
# The "-Wa,--noexecstack" options might be needed only with GNU ld (as opposed
|
# The "-Wa,--noexecstack" options might be needed only with GNU ld (as opposed
|
||||||
# to the gold linker). It prevents binaries' stacks from being marked as
|
# to the gold linker). It prevents binaries' stacks from being marked as
|
||||||
@ -78,6 +82,8 @@ in stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
description = "The Glasgow Haskell Compiler";
|
description = "The Glasgow Haskell Compiler";
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
, ncurses5, gmp, libiconv
|
, ncurses5, gmp, libiconv
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# Prebuilt only does native
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
|
||||||
let
|
let
|
||||||
libPath = stdenv.lib.makeLibraryPath ([
|
libPath = stdenv.lib.makeLibraryPath ([
|
||||||
ncurses5 gmp
|
ncurses5 gmp
|
||||||
@ -146,6 +149,8 @@ stdenv.mkDerivation rec {
|
|||||||
[ $(./main) == "yes" ]
|
[ $(./main) == "yes" ]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta.license = stdenv.lib.licenses.bsd3;
|
meta.license = stdenv.lib.licenses.bsd3;
|
||||||
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
|
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
|
||||||
|
|
||||||
# If enabled GHC will be build with the GPL-free but slower integer-simple
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
, enableIntegerSimple ? false, gmp
|
enableIntegerSimple ? false, gmp ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# TODO(@Ericson2314): Cross compilation support
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
|
|
||||||
stdenv.mkDerivation (rec {
|
stdenv.mkDerivation (rec {
|
||||||
version = "7.8.4";
|
version = "7.8.4";
|
||||||
name = "ghc-${version}";
|
name = "ghc-${version}";
|
||||||
@ -49,6 +53,8 @@ stdenv.mkDerivation (rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
description = "The Glasgow Haskell Compiler";
|
description = "The Glasgow Haskell Compiler";
|
||||||
|
@ -1,21 +1,33 @@
|
|||||||
{ stdenv, lib, fetchurl, fetchpatch, bootPkgs, perl, ncurses, libiconv, targetPackages, coreutils
|
{ stdenv, targetPackages
|
||||||
, hscolour, patchutils, sphinx
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
|
||||||
# If enabled GHC will be build with the GPL-free but slower integer-simple
|
# build-tools
|
||||||
|
, bootPkgs, hscolour
|
||||||
|
, coreutils, fetchurl, fetchpatch, patchutils, perl, sphinx
|
||||||
|
|
||||||
|
, libiconv ? null, ncurses
|
||||||
|
|
||||||
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
, enableIntegerSimple ? false, gmp
|
enableIntegerSimple ? false, gmp ? null
|
||||||
, cross ? null
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (bootPkgs) ghc;
|
inherit (bootPkgs) ghc;
|
||||||
|
|
||||||
|
# TODO(@Ericson2314) Make unconditional
|
||||||
|
targetPrefix = stdenv.lib.optionalString
|
||||||
|
(targetPlatform != hostPlatform)
|
||||||
|
"${targetPlatform.config}-";
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "8.0.2";
|
version = "8.0.2";
|
||||||
name = "ghc-${version}";
|
name = "${targetPrefix}ghc-${version}";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://downloads.haskell.org/~ghc/8.0.2/${name}-src.tar.xz";
|
url = "https://downloads.haskell.org/~ghc/8.0.2/ghc-${version}-src.tar.xz";
|
||||||
sha256 = "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi";
|
sha256 = "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -47,19 +59,20 @@ stdenv.mkDerivation rec {
|
|||||||
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
||||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
] ++ stdenv.lib.optional stdenv.isDarwin [
|
||||||
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
||||||
] ++
|
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
|
||||||
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||||
lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
|
"--disable-large-address-space"
|
||||||
|
];
|
||||||
|
|
||||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
paxmark m $out/lib/${name}/bin/{ghc,haddock}
|
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||||
|
|
||||||
# Install the bash completion file.
|
# Install the bash completion file.
|
||||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
|
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||||
|
|
||||||
# Patch scripts to include "readelf" and "cat" in $PATH.
|
# Patch scripts to include "readelf" and "cat" in $PATH.
|
||||||
for i in "$out/bin/"*; do
|
for i in "$out/bin/"*; do
|
||||||
@ -70,7 +83,7 @@ stdenv.mkDerivation rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs;
|
inherit bootPkgs targetPrefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
, ncurses5, gmp, libiconv
|
, ncurses5, gmp, libiconv
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
# Prebuilt only does native
|
||||||
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
|
|
||||||
let
|
let
|
||||||
libPath = stdenv.lib.makeLibraryPath ([
|
libPath = stdenv.lib.makeLibraryPath ([
|
||||||
ncurses5 gmp
|
ncurses5 gmp
|
||||||
@ -151,6 +154,8 @@ stdenv.mkDerivation rec {
|
|||||||
[ $(./main) == "yes" ]
|
[ $(./main) == "yes" ]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru = { targetPrefix = ""; };
|
||||||
|
|
||||||
meta.license = stdenv.lib.licenses.bsd3;
|
meta.license = stdenv.lib.licenses.bsd3;
|
||||||
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin" "armv7l-linux" "aarch64-linux"];
|
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin" "armv7l-linux" "aarch64-linux"];
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,30 @@
|
|||||||
{ stdenv, lib, fetchurl, bootPkgs, perl, ncurses, libiconv, binutils, coreutils
|
{ stdenv, targetPackages
|
||||||
, autoconf, automake, happy, alex, python3, sphinx, hscolour
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
, buildPlatform, targetPlatform , selfPkgs, cross ? null
|
, selfPkgs, cross ? null
|
||||||
|
|
||||||
# If enabled GHC will be build with the GPL-free but slower integer-simple
|
# build-tools
|
||||||
|
, bootPkgs, alex, happy, hscolour
|
||||||
|
, autoconf, automake, coreutils, fetchurl, perl, python3, sphinx
|
||||||
|
|
||||||
|
, libiconv ? null, ncurses
|
||||||
|
|
||||||
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
, enableIntegerSimple ? false, gmp
|
enableIntegerSimple ? false, gmp ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (bootPkgs) ghc;
|
inherit (bootPkgs) ghc;
|
||||||
version = "8.2.2";
|
version = "8.2.2";
|
||||||
|
|
||||||
commonBuildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ];
|
# TODO(@Ericson2314) Make unconditional
|
||||||
commonPreConfigure = ''
|
targetPrefix = stdenv.lib.optionalString
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
(targetPlatform != hostPlatform)
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
"${targetPlatform.config}-";
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
in
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
stdenv.mkDerivation (rec {
|
||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
|
||||||
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
|
||||||
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
|
|
||||||
'';
|
|
||||||
in stdenv.mkDerivation (rec {
|
|
||||||
inherit version;
|
inherit version;
|
||||||
name = "ghc-${version}";
|
name = "ghc-${version}";
|
||||||
|
|
||||||
@ -32,9 +35,19 @@ in stdenv.mkDerivation (rec {
|
|||||||
|
|
||||||
postPatch = "patchShebangs .";
|
postPatch = "patchShebangs .";
|
||||||
|
|
||||||
preConfigure = commonPreConfigure;
|
preConfigure = ''
|
||||||
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
|
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
||||||
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||||
|
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
||||||
|
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
|
||||||
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
|
sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk
|
||||||
|
'';
|
||||||
|
|
||||||
buildInputs = commonBuildInputs;
|
buildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ];
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
@ -50,28 +63,28 @@ in stdenv.mkDerivation (rec {
|
|||||||
|
|
||||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
checkTarget = "test";
|
checkTarget = "test";
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
paxmark m $out/lib/${name}/bin/{ghc,haddock}
|
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||||
|
|
||||||
# Install the bash completion file.
|
# Install the bash completion file.
|
||||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
|
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||||
|
|
||||||
# Patch scripts to include "readelf" and "cat" in $PATH.
|
# Patch scripts to include "readelf" and "cat" in $PATH.
|
||||||
for i in "$out/bin/"*; do
|
for i in "$out/bin/"*; do
|
||||||
test ! -h $i || continue
|
test ! -h $i || continue
|
||||||
egrep --quiet '^#!' <(head -n 1 $i) || continue
|
egrep --quiet '^#!' <(head -n 1 $i) || continue
|
||||||
sed -i -e '2i export PATH="$PATH:${stdenv.lib.makeBinPath [ binutils coreutils ]}"' $i
|
sed -i -e '2i export PATH="$PATH:${stdenv.lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "doc" ];
|
outputs = [ "out" "doc" ];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs;
|
inherit bootPkgs targetPrefix;
|
||||||
} // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
|
} // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
|
||||||
crossCompiler = selfPkgs.ghc.override {
|
crossCompiler = selfPkgs.ghc.override {
|
||||||
cross = targetPlatform;
|
cross = targetPlatform;
|
||||||
@ -89,29 +102,23 @@ in stdenv.mkDerivation (rec {
|
|||||||
} // stdenv.lib.optionalAttrs (cross != null) {
|
} // stdenv.lib.optionalAttrs (cross != null) {
|
||||||
name = "${cross.config}-ghc-${version}";
|
name = "${cross.config}-ghc-${version}";
|
||||||
|
|
||||||
preConfigure = commonPreConfigure + ''
|
|
||||||
sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk
|
|
||||||
'';
|
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"CC=${stdenv.ccCross}/bin/${cross.config}-cc"
|
"CC=${stdenv.cc}/bin/${cross.config}-cc"
|
||||||
"LD=${stdenv.binutils}/bin/${cross.config}-ld"
|
"LD=${stdenv.cc.bintools}/bin/${cross.config}-ld"
|
||||||
"AR=${stdenv.binutils}/bin/${cross.config}-ar"
|
"AR=${stdenv.cc.bintools}/bin/${cross.config}-ar"
|
||||||
"NM=${stdenv.binutils}/bin/${cross.config}-nm"
|
"NM=${stdenv.cc.bintools}/bin/${cross.config}-nm"
|
||||||
"RANLIB=${stdenv.binutils}/bin/${cross.config}-ranlib"
|
"RANLIB=${stdenv.cc.bintools}/bin/${cross.config}-ranlib"
|
||||||
"--target=${cross.config}"
|
"--target=${cross.config}"
|
||||||
"--enable-bootstrap-with-devel-snapshot"
|
"--enable-bootstrap-with-devel-snapshot"
|
||||||
] ++
|
] ++
|
||||||
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||||
lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
|
stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
|
||||||
|
|
||||||
buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutils ];
|
configurePlatforms = [];
|
||||||
|
|
||||||
dontSetConfigureCross = true;
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs cross;
|
inherit bootPkgs cross;
|
||||||
cc = "${stdenv.ccCross}/bin/${cross.config}-cc";
|
cc = "${stdenv.cc}/bin/${cross.config}-cc";
|
||||||
ld = "${stdenv.binutils}/bin/${cross.config}-ld";
|
ld = "${stdenv.cc}/bin/${cross.config}-ld";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
{ stdenv, lib, fetchgit, bootPkgs, perl, ncurses, libiconv, targetPackages, coreutils
|
{ stdenv, targetPackages
|
||||||
, autoconf, automake, happy, alex, python3, buildPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
, selfPkgs, cross ? null
|
, selfPkgs, cross ? null
|
||||||
|
|
||||||
# If enabled GHC will be build with the GPL-free but slower integer-simple
|
# build-tools
|
||||||
|
, bootPkgs, alex, happy
|
||||||
|
, autoconf, automake, coreutils, fetchgit, perl, python3
|
||||||
|
|
||||||
|
, libiconv ? null, ncurses
|
||||||
|
|
||||||
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
, enableIntegerSimple ? false, gmp
|
enableIntegerSimple ? false, gmp ? null
|
||||||
|
|
||||||
, version ? "8.5.20171209"
|
, version ? "8.5.20171209"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (bootPkgs) ghc;
|
inherit (bootPkgs) ghc;
|
||||||
|
|
||||||
commonBuildInputs = [ ghc perl autoconf automake happy alex python3 ];
|
|
||||||
|
|
||||||
rev = "4335c07ca7e64624819b22644d7591853826bd75";
|
rev = "4335c07ca7e64624819b22644d7591853826bd75";
|
||||||
|
|
||||||
commonPreConfigure = ''
|
# TODO(@Ericson2314) Make unconditional
|
||||||
echo ${version} >VERSION
|
targetPrefix = stdenv.lib.optionalString
|
||||||
echo ${rev} >GIT_COMMIT_ID
|
(targetPlatform != hostPlatform)
|
||||||
./boot
|
"${targetPlatform.config}-";
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
in
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
stdenv.mkDerivation (rec {
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
|
||||||
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
|
||||||
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
|
|
||||||
'';
|
|
||||||
in stdenv.mkDerivation (rec {
|
|
||||||
inherit version rev;
|
inherit version rev;
|
||||||
name = "ghc-${version}";
|
name = "ghc-${version}";
|
||||||
|
|
||||||
@ -39,9 +39,22 @@ in stdenv.mkDerivation (rec {
|
|||||||
|
|
||||||
postPatch = "patchShebangs .";
|
postPatch = "patchShebangs .";
|
||||||
|
|
||||||
preConfigure = commonPreConfigure;
|
preConfigure = ''
|
||||||
|
echo ${version} >VERSION
|
||||||
|
echo ${rev} >GIT_COMMIT_ID
|
||||||
|
./boot
|
||||||
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
|
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
||||||
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||||
|
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
||||||
|
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
|
||||||
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
|
sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk
|
||||||
|
'';
|
||||||
|
|
||||||
buildInputs = commonBuildInputs;
|
buildInputs = [ ghc perl autoconf automake happy alex python3 ];
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
@ -57,15 +70,15 @@ in stdenv.mkDerivation (rec {
|
|||||||
|
|
||||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
checkTarget = "test";
|
checkTarget = "test";
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
paxmark m $out/lib/${name}/bin/{ghc,haddock}
|
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||||
|
|
||||||
# Install the bash completion file.
|
# Install the bash completion file.
|
||||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
|
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||||
|
|
||||||
# Patch scripts to include "readelf" and "cat" in $PATH.
|
# Patch scripts to include "readelf" and "cat" in $PATH.
|
||||||
for i in "$out/bin/"*; do
|
for i in "$out/bin/"*; do
|
||||||
@ -78,7 +91,7 @@ in stdenv.mkDerivation (rec {
|
|||||||
outputs = [ "out" "doc" ];
|
outputs = [ "out" "doc" ];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs;
|
inherit bootPkgs targetPrefix;
|
||||||
} // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
|
} // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
|
||||||
crossCompiler = selfPkgs.ghc.override {
|
crossCompiler = selfPkgs.ghc.override {
|
||||||
cross = targetPlatform;
|
cross = targetPlatform;
|
||||||
@ -96,31 +109,23 @@ in stdenv.mkDerivation (rec {
|
|||||||
} // stdenv.lib.optionalAttrs (cross != null) {
|
} // stdenv.lib.optionalAttrs (cross != null) {
|
||||||
name = "${cross.config}-ghc-${version}";
|
name = "${cross.config}-ghc-${version}";
|
||||||
|
|
||||||
preConfigure = commonPreConfigure + ''
|
|
||||||
sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk
|
|
||||||
'';
|
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"CC=${stdenv.cc}/bin/${cross.config}-cc"
|
"CC=${stdenv.cc}/bin/${cross.config}-cc"
|
||||||
"LD=${stdenv.cc}/bin/${cross.config}-ld"
|
"LD=${stdenv.cc.bintools}/bin/${cross.config}-ld"
|
||||||
"AR=${stdenv.cc}/bin/${cross.config}-ar"
|
"AR=${stdenv.cc.bintools}/bin/${cross.config}-ar"
|
||||||
"NM=${stdenv.cc}/bin/${cross.config}-nm"
|
"NM=${stdenv.cc.bintools}/bin/${cross.config}-nm"
|
||||||
"RANLIB=${stdenv.cc}/bin/${cross.config}-ranlib"
|
"RANLIB=${stdenv.cc.bintools}/bin/${cross.config}-ranlib"
|
||||||
"--target=${cross.config}"
|
"--target=${cross.config}"
|
||||||
"--enable-bootstrap-with-devel-snapshot"
|
"--enable-bootstrap-with-devel-snapshot"
|
||||||
] ++
|
] ++
|
||||||
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||||
lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
|
stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
|
||||||
|
|
||||||
buildInputs = commonBuildInputs;
|
|
||||||
|
|
||||||
configurePlatforms = [];
|
configurePlatforms = [];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs cross;
|
inherit bootPkgs cross;
|
||||||
|
|
||||||
cc = "${stdenv.cc}/bin/${cross.config}-cc";
|
cc = "${stdenv.cc}/bin/${cross.config}-cc";
|
||||||
|
|
||||||
ld = "${stdenv.cc}/bin/${cross.config}-ld";
|
ld = "${stdenv.cc}/bin/${cross.config}-ld";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
{ stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused
|
{ stdenv, buildPackages, ghc
|
||||||
, jailbreak-cabal, hscolour, cpphs, nodejs, lib, removeReferencesTo
|
, jailbreak-cabal, hscolour, cpphs, nodejs
|
||||||
|
, buildPlatform, hostPlatform
|
||||||
}:
|
}:
|
||||||
let isCross = (ghc.cross or null) != null; in
|
|
||||||
|
let
|
||||||
|
isCross = buildPlatform != hostPlatform;
|
||||||
|
inherit (buildPackages)
|
||||||
|
fetchurl removeReferencesTo
|
||||||
|
pkgconfig coreutils gnugrep gnused glibcLocales;
|
||||||
|
in
|
||||||
|
|
||||||
{ pname
|
{ pname
|
||||||
, dontStrip ? (ghc.isGhcjs or false)
|
, dontStrip ? (ghc.isGhcjs or false)
|
||||||
@ -20,8 +27,8 @@ let isCross = (ghc.cross or null) != null; in
|
|||||||
, enableLibraryProfiling ? false
|
, enableLibraryProfiling ? false
|
||||||
, enableExecutableProfiling ? false
|
, enableExecutableProfiling ? false
|
||||||
# TODO enable shared libs for cross-compiling
|
# TODO enable shared libs for cross-compiling
|
||||||
, enableSharedExecutables ? !isCross && (((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version))
|
, enableSharedExecutables ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
|
||||||
, enableSharedLibraries ? !isCross && (((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version))
|
, enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
|
||||||
, enableSplitObjs ? null # OBSOLETE, use enableDeadCodeElimination
|
, enableSplitObjs ? null # OBSOLETE, use enableDeadCodeElimination
|
||||||
, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin
|
, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin
|
||||||
, enableStaticLibraries ? true
|
, enableStaticLibraries ? true
|
||||||
@ -53,7 +60,7 @@ let isCross = (ghc.cross or null) != null; in
|
|||||||
, shellHook ? ""
|
, shellHook ? ""
|
||||||
, coreSetup ? false # Use only core packages to build Setup.hs.
|
, coreSetup ? false # Use only core packages to build Setup.hs.
|
||||||
, useCpphs ? false
|
, useCpphs ? false
|
||||||
, hardeningDisable ? lib.optional (ghc.isHaLVM or false) "all"
|
, hardeningDisable ? stdenv.lib.optional (ghc.isHaLVM or false) "all"
|
||||||
, enableSeparateDataOutput ? false
|
, enableSeparateDataOutput ? false
|
||||||
, enableSeparateDocOutput ? doHaddock
|
, enableSeparateDocOutput ? doHaddock
|
||||||
} @ args:
|
} @ args:
|
||||||
@ -102,11 +109,12 @@ let
|
|||||||
enableParallelBuilding = (versionOlder "7.8" ghc.version && !hasActiveLibrary) || versionOlder "8.0.1" ghc.version;
|
enableParallelBuilding = (versionOlder "7.8" ghc.version && !hasActiveLibrary) || versionOlder "8.0.1" ghc.version;
|
||||||
|
|
||||||
crossCabalFlags = [
|
crossCabalFlags = [
|
||||||
"--with-ghc=${ghc.cross.config}-ghc"
|
"--with-ghc=${ghc.targetPrefix}ghc"
|
||||||
"--with-ghc-pkg=${ghc.cross.config}-ghc-pkg"
|
"--with-ghc-pkg=${ghc.targetPrefix}ghc-pkg"
|
||||||
"--with-gcc=${ghc.cc}"
|
"--with-gcc=${stdenv.cc.targetPrefix}cc"
|
||||||
"--with-ld=${ghc.ld}"
|
"--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
|
||||||
"--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
|
"--with-hsc2hs=${nativeGhc}/bin/hsc2hs" # not cross one
|
||||||
|
"--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
|
||||||
] ++ (if isHaLVM then [] else ["--hsc2hs-options=--cross-compile"]);
|
] ++ (if isHaLVM then [] else ["--hsc2hs-options=--cross-compile"]);
|
||||||
|
|
||||||
crossCabalFlagsString =
|
crossCabalFlagsString =
|
||||||
@ -135,7 +143,7 @@ let
|
|||||||
] ++ optionals isGhcjs [
|
] ++ optionals isGhcjs [
|
||||||
"--ghcjs"
|
"--ghcjs"
|
||||||
] ++ optionals isCross ([
|
] ++ optionals isCross ([
|
||||||
"--configure-option=--host=${ghc.cross.config}"
|
"--configure-option=--host=${hostPlatform.config}"
|
||||||
] ++ crossCabalFlags);
|
] ++ crossCabalFlags);
|
||||||
|
|
||||||
setupCompileFlags = [
|
setupCompileFlags = [
|
||||||
@ -171,8 +179,7 @@ let
|
|||||||
setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand;
|
setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand;
|
||||||
setupCommand = "./Setup";
|
setupCommand = "./Setup";
|
||||||
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
||||||
crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
|
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
||||||
ghcCommand = "${crossPrefix}${ghcCommand'}";
|
|
||||||
ghcCommandCaps= toUpper ghcCommand';
|
ghcCommandCaps= toUpper ghcCommand';
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -269,6 +276,8 @@ stdenv.mkDerivation ({
|
|||||||
runHook postCompileBuildDriver
|
runHook postCompileBuildDriver
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
inherit configureFlags;
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
@ -402,7 +411,6 @@ stdenv.mkDerivation ({
|
|||||||
// optionalAttrs (postCompileBuildDriver != "") { inherit postCompileBuildDriver; }
|
// optionalAttrs (postCompileBuildDriver != "") { inherit postCompileBuildDriver; }
|
||||||
// optionalAttrs (preUnpack != "") { inherit preUnpack; }
|
// optionalAttrs (preUnpack != "") { inherit preUnpack; }
|
||||||
// optionalAttrs (postUnpack != "") { inherit postUnpack; }
|
// optionalAttrs (postUnpack != "") { inherit postUnpack; }
|
||||||
// optionalAttrs (configureFlags != []) { inherit configureFlags; }
|
|
||||||
// optionalAttrs (patches != []) { inherit patches; }
|
// optionalAttrs (patches != []) { inherit patches; }
|
||||||
// optionalAttrs (patchPhase != "") { inherit patchPhase; }
|
// optionalAttrs (patchPhase != "") { inherit patchPhase; }
|
||||||
// optionalAttrs (preConfigure != "") { inherit preConfigure; }
|
// optionalAttrs (preConfigure != "") { inherit preConfigure; }
|
||||||
@ -421,5 +429,5 @@ stdenv.mkDerivation ({
|
|||||||
// optionalAttrs (postFixup != "") { inherit postFixup; }
|
// optionalAttrs (postFixup != "") { inherit postFixup; }
|
||||||
// optionalAttrs (dontStrip) { inherit dontStrip; }
|
// optionalAttrs (dontStrip) { inherit dontStrip; }
|
||||||
// optionalAttrs (hardeningDisable != []) { inherit hardeningDisable; }
|
// optionalAttrs (hardeningDisable != []) { inherit hardeningDisable; }
|
||||||
// optionalAttrs (stdenv.isLinux) { LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }
|
// optionalAttrs (buildPlatform.isLinux){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
# This expression takes a file like `hackage-packages.nix` and constructs
|
# This expression takes a file like `hackage-packages.nix` and constructs
|
||||||
# a full package set out of that.
|
# a full package set out of that.
|
||||||
|
|
||||||
{ # package-set used for non-haskell dependencies (all of nixpkgs)
|
{ # package-set used for build tools (all of nixpkgs)
|
||||||
|
buildPackages
|
||||||
|
|
||||||
|
, # package-set used for non-haskell dependencies (all of nixpkgs)
|
||||||
pkgs
|
pkgs
|
||||||
|
|
||||||
, # stdenv to use for building haskell packages
|
, # stdenv to use for building haskell packages
|
||||||
@ -28,19 +31,21 @@
|
|||||||
self:
|
self:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (stdenv) buildPlatform hostPlatform;
|
||||||
|
|
||||||
inherit (stdenv.lib) fix' extends makeOverridable;
|
inherit (stdenv.lib) fix' extends makeOverridable;
|
||||||
inherit (haskellLib) overrideCabal;
|
inherit (haskellLib) overrideCabal;
|
||||||
|
|
||||||
|
buildHaskellPackages = if hostPlatform != buildPlatform
|
||||||
|
then self.ghc.bootPkgs
|
||||||
|
else self;
|
||||||
|
|
||||||
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
|
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
|
||||||
inherit stdenv;
|
inherit stdenv;
|
||||||
inherit (pkgs) fetchurl pkgconfig glibcLocales coreutils gnugrep gnused;
|
nodejs = buildPackages.nodejs-slim;
|
||||||
nodejs = pkgs.nodejs-slim;
|
inherit (buildHaskellPackages) jailbreak-cabal;
|
||||||
jailbreak-cabal = if (self.ghc.cross or null) != null
|
|
||||||
then self.ghc.bootPkgs.jailbreak-cabal
|
|
||||||
else self.jailbreak-cabal;
|
|
||||||
inherit (self) ghc;
|
inherit (self) ghc;
|
||||||
hscolour = overrideCabal self.hscolour (drv: {
|
hscolour = overrideCabal buildHaskellPackages.hscolour (drv: {
|
||||||
isLibrary = false;
|
isLibrary = false;
|
||||||
doHaddock = false;
|
doHaddock = false;
|
||||||
hyperlinkSource = false; # Avoid depending on hscolour for this build.
|
hyperlinkSource = false; # Avoid depending on hscolour for this build.
|
||||||
@ -95,7 +100,7 @@ let
|
|||||||
defaultScope = mkScope self;
|
defaultScope = mkScope self;
|
||||||
callPackage = drv: args: callPackageWithScope defaultScope drv args;
|
callPackage = drv: args: callPackageWithScope defaultScope drv args;
|
||||||
|
|
||||||
withPackages = packages: callPackage ./with-packages-wrapper.nix {
|
withPackages = packages: buildPackages.callPackage ./with-packages-wrapper.nix {
|
||||||
inherit (self) llvmPackages;
|
inherit (self) llvmPackages;
|
||||||
haskellPackages = self;
|
haskellPackages = self;
|
||||||
inherit packages;
|
inherit packages;
|
||||||
@ -104,13 +109,13 @@ let
|
|||||||
haskellSrc2nix = { name, src, sha256 ? null }:
|
haskellSrc2nix = { name, src, sha256 ? null }:
|
||||||
let
|
let
|
||||||
sha256Arg = if isNull sha256 then "--sha256=" else ''--sha256="${sha256}"'';
|
sha256Arg = if isNull sha256 then "--sha256=" else ''--sha256="${sha256}"'';
|
||||||
in pkgs.stdenv.mkDerivation {
|
in pkgs.buildPackages.stdenv.mkDerivation {
|
||||||
name = "cabal2nix-${name}";
|
name = "cabal2nix-${name}";
|
||||||
buildInputs = [ pkgs.haskellPackages.cabal2nix ];
|
nativeBuildInputs = [ pkgs.buildPackages.haskellPackages.cabal2nix ];
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
phases = ["installPhase"];
|
phases = ["installPhase"];
|
||||||
LANG = "en_US.UTF-8";
|
LANG = "en_US.UTF-8";
|
||||||
LOCALE_ARCHIVE = pkgs.lib.optionalString pkgs.stdenv.isLinux "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
LOCALE_ARCHIVE = pkgs.lib.optionalString buildPlatform.isLinux "${buildPackages.glibcLocales}/lib/locale/locale-archive";
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
export HOME="$TMP"
|
export HOME="$TMP"
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, lib, ghc, llvmPackages, packages, symlinkJoin, makeWrapper
|
{ lib, targetPlatform, ghc, llvmPackages, packages, symlinkJoin, makeWrapper
|
||||||
, ignoreCollisions ? false, withLLVM ? false
|
, ignoreCollisions ? false, withLLVM ? false
|
||||||
, postBuild ? ""
|
, postBuild ? ""
|
||||||
, haskellPackages
|
, haskellPackages
|
||||||
@ -37,8 +37,7 @@ let
|
|||||||
ghc761OrLater = isGhcjs || isHaLVM || lib.versionOlder "7.6.1" ghc.version;
|
ghc761OrLater = isGhcjs || isHaLVM || lib.versionOlder "7.6.1" ghc.version;
|
||||||
packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
|
packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
|
||||||
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
||||||
crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
|
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
||||||
ghcCommand = "${crossPrefix}${ghcCommand'}";
|
|
||||||
ghcCommandCaps= lib.toUpper ghcCommand';
|
ghcCommandCaps= lib.toUpper ghcCommand';
|
||||||
libDir = if isHaLVM then "$out/lib/HaLVM-${ghc.version}" else "$out/lib/${ghcCommand}-${ghc.version}";
|
libDir = if isHaLVM then "$out/lib/HaLVM-${ghc.version}" else "$out/lib/${ghcCommand}-${ghc.version}";
|
||||||
docDir = "$out/share/doc/ghc/html";
|
docDir = "$out/share/doc/ghc/html";
|
||||||
@ -49,7 +48,7 @@ let
|
|||||||
# https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/code-generators.html
|
# https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/code-generators.html
|
||||||
llvm = lib.makeBinPath
|
llvm = lib.makeBinPath
|
||||||
([ llvmPackages.llvm ]
|
([ llvmPackages.llvm ]
|
||||||
++ lib.optional stdenv.isDarwin llvmPackages.clang);
|
++ lib.optional targetPlatform.isDarwin llvmPackages.clang);
|
||||||
in
|
in
|
||||||
if paths == [] && !withLLVM then ghc else
|
if paths == [] && !withLLVM then ghc else
|
||||||
symlinkJoin {
|
symlinkJoin {
|
||||||
@ -99,7 +98,7 @@ symlinkJoin {
|
|||||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
|
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'' + (lib.optionalString stdenv.isDarwin ''
|
'' + (lib.optionalString targetPlatform.isDarwin ''
|
||||||
# Work around a linker limit in macOS Sierra (see generic-builder.nix):
|
# Work around a linker limit in macOS Sierra (see generic-builder.nix):
|
||||||
local packageConfDir="$out/lib/${ghc.name}/package.conf.d";
|
local packageConfDir="$out/lib/${ghc.name}/package.conf.d";
|
||||||
local dynamicLinksDir="$out/lib/links"
|
local dynamicLinksDir="$out/lib/links"
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
{ haskellPackages, src, deps ? p : [], name }: let
|
{ haskellPackages, src, deps ? p : [], name }: let
|
||||||
inherit (haskellPackages) ghc ghcWithPackages;
|
inherit (haskellPackages) ghc ghcWithPackages;
|
||||||
with-env = ghcWithPackages deps;
|
with-env = ghcWithPackages deps;
|
||||||
crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
|
ghcName = "${ghc.targetPrefix}ghc";
|
||||||
ghcName = "${crossPrefix}ghc";
|
|
||||||
in runCommand name { buildInputs = [ with-env cctools ]; } ''
|
in runCommand name { buildInputs = [ with-env cctools ]; } ''
|
||||||
mkdir -p $out/lib
|
mkdir -p $out/lib
|
||||||
mkdir -p $out/include
|
mkdir -p $out/include
|
||||||
|
Loading…
Reference in New Issue
Block a user