diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index 9bcf8eb1fece..873925417c16 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -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; diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index aefaf5b70aaf..78e0e2dd167e 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -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); diff --git a/pkgs/development/compilers/ghc/common-make-native-bignum.nix b/pkgs/development/compilers/ghc/common-make-native-bignum.nix index 3788efeda8ba..3d5d9d6329a5 100644 --- a/pkgs/development/compilers/ghc/common-make-native-bignum.nix +++ b/pkgs/development/compilers/ghc/common-make-native-bignum.nix @@ -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;