haskell.compiler.ghc*: correctly account for ncurses in cross
1. Explicitly set WITH_TERMINFO. We usually match GHC's behavior well, but it is better to tie the Nix option to make explicitly. Unfortunately, the same is very complicated to achieve with hadrian (iirc). 2. Disable enableTerminfo if we are cross-compiling. This matches the behavior of GHC's build system, so we'll have to match it now. It also reduces the ncurses-related headache a bit. 3. Stop passing --with-curses* flags. Unfortunately, GHC does not account for the fact that different platforms need different ncurses libraries. This is somewhat migitated by the fact that ncurses is only ever needed for the build platform if we are cross compiling, but I seem to remember it leaking into the final GHC somehow. A more reliable alternative is relying on the cc/ld wrapper scripts, as they'll always pull out the correct ncurses out of the environment when GHC's build system passes -lcurses. 4. Unconditionally add ncurses to depsBuildBuild. Stage0 unconditionally builds terminfo (maybe the stage1 compiler needs it?), so we need to make sure that ncurses for the build platform is available. Co-authored-by: sternenseemann <sternenseemann@systemli.org>
This commit is contained in:
committed by
sternenseemann
co-authored by
sternenseemann
parent
cd31b04413
commit
4b00fbf163
@@ -39,7 +39,10 @@
|
||||
enableShared ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.useiOSPrebuilt
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
enableTerminfo ? !(stdenv.targetPlatform.isWindows
|
||||
# terminfo can't be built for cross
|
||||
|| (stdenv.buildPlatform != stdenv.hostPlatform)
|
||||
|| (stdenv.hostPlatform != stdenv.targetPlatform))
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
@@ -86,6 +89,8 @@ let
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
|
||||
WITH_TERMINFO = ${if enableTerminfo then "YES" else "NO"}
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
@@ -341,7 +346,6 @@ stdenv.mkDerivation (rec {
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (args.${libffi_name} != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.${libffi_name}.dev}/include"
|
||||
@@ -380,6 +384,8 @@ stdenv.mkDerivation (rec {
|
||||
# Used by the STAGE0 compiler to build stage1
|
||||
depsBuildBuild = [
|
||||
buildCC
|
||||
# stage0 builds terminfo unconditionally, so we always need ncurses
|
||||
ncurses
|
||||
];
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
@@ -66,8 +66,14 @@
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic && !isGhcjs
|
||||
|
||||
, # Whether to build terminfo.
|
||||
# FIXME(@sternenseemann): This actually doesn't influence what hadrian does,
|
||||
# just what buildInputs etc. looks like. It would be best if we could actually
|
||||
# tell it what to do like it was possible with make.
|
||||
enableTerminfo ? !(stdenv.targetPlatform.isWindows
|
||||
|| stdenv.targetPlatform.isGhcjs)
|
||||
|| stdenv.targetPlatform.isGhcjs
|
||||
# terminfo can't be built for cross
|
||||
|| (stdenv.buildPlatform != stdenv.hostPlatform)
|
||||
|| (stdenv.hostPlatform != stdenv.targetPlatform))
|
||||
|
||||
, # Libdw.c only supports x86_64, i686 and s390x as of 2022-08-04
|
||||
enableDwarf ? (stdenv.targetPlatform.isx86 ||
|
||||
@@ -439,7 +445,6 @@ stdenv.mkDerivation ({
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null && !targetPlatform.isGhcjs) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
@@ -493,6 +498,8 @@ stdenv.mkDerivation ({
|
||||
# Used by the STAGE0 compiler to build stage1
|
||||
depsBuildBuild = [
|
||||
buildCC
|
||||
# stage0 builds terminfo unconditionally, so we always need ncurses
|
||||
ncurses
|
||||
];
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
@@ -42,7 +42,10 @@
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
enableTerminfo ? !(stdenv.targetPlatform.isWindows
|
||||
# terminfo can't be built for cross
|
||||
|| (stdenv.buildPlatform != stdenv.hostPlatform)
|
||||
|| (stdenv.hostPlatform != stdenv.targetPlatform))
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
@@ -88,6 +91,8 @@ let
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
|
||||
WITH_TERMINFO = ${if enableTerminfo then "YES" else "NO"}
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
@@ -359,7 +364,6 @@ stdenv.mkDerivation (rec {
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
@@ -402,6 +406,8 @@ stdenv.mkDerivation (rec {
|
||||
# Used by the STAGE0 compiler to build stage1
|
||||
depsBuildBuild = [
|
||||
buildCC
|
||||
# stage0 builds terminfo unconditionally, so we always need ncurses
|
||||
ncurses
|
||||
];
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
Reference in New Issue
Block a user