From f716fa5303f16769af69b424ca0600cbc5877f1f Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 15 Sep 2024 11:10:09 +0200 Subject: [PATCH] haskell.compiler.*: pass --with-curses-* flags again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We reuse the targetLibs logic for this since it is more or less the same story. However, the terminfo library is only built when GHC is neither a cross-compiler nor being cross-compiled. Therefore ncurses (if used) will only ever come from pkgsHostTarget. In the other cases ncurses is still passed via depsBuildBuild for the stage1 compiler. This commit tries to resolve the problem that the package-db doesn't include library and include dirs of ncurses for the terminfo package, causing library loading and linking problems in downstream packages, e.g. dhall-docs and dhall-toml. This problem was introduced in 4b00fbf16307a1501bd57370cf334a905554ee90. With this in mind, not passing --with-curses-* – as long as the terminfo package isn't built – seems fine. --- pkgs/development/compilers/ghc/8.10.7.nix | 5 ++++- pkgs/development/compilers/ghc/common-hadrian.nix | 6 +++++- .../development/compilers/ghc/common-make-native-bignum.nix | 6 +++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index 81ec3eb84d11..da6ec060ce03 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -228,7 +228,7 @@ let else pkgsHostTarget; in { - inherit (basePackageSet) gmp; + inherit (basePackageSet) gmp ncurses; # dynamic inherits are not possible in Nix libffi = basePackageSet.${libffi_name}; }; @@ -394,6 +394,9 @@ stdenv.mkDerivation (rec { # `--with` flags for libraries needed for RTS linker configureFlags = [ "--datadir=$doc/share/doc/ghc" + ] ++ lib.optionals enableTerminfo [ + "--with-curses-includes=${lib.getDev targetLibs.ncurses}/include" + "--with-curses-libraries=${lib.getLib targetLibs.ncurses}/lib" ] ++ lib.optionals (args.${libffi_name} != null) [ "--with-system-libffi" "--with-ffi-includes=${targetLibs.libffi.dev}/include" diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 6a95bf009ac8..f9c81dd4b203 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -362,7 +362,8 @@ let (if hostPlatform != targetPlatform then targetPackages else pkgsHostTarget) elfutils gmp - libffi; + libffi + ncurses; }; # Our Cabal compiler name @@ -492,6 +493,9 @@ stdenv.mkDerivation ({ # `--with` flags for libraries needed for RTS linker configureFlags = [ "--datadir=$doc/share/doc/ghc" + ] ++ lib.optionals enableTerminfo [ + "--with-curses-includes=${lib.getDev targetLibs.ncurses}/include" + "--with-curses-libraries=${lib.getLib targetLibs.ncurses}/lib" ] ++ lib.optionals (libffi != null && !targetPlatform.isGhcjs) [ "--with-system-libffi" "--with-ffi-includes=${targetLibs.libffi.dev}/include" diff --git a/pkgs/development/compilers/ghc/common-make-native-bignum.nix b/pkgs/development/compilers/ghc/common-make-native-bignum.nix index b1b139a290d8..66e38154e979 100644 --- a/pkgs/development/compilers/ghc/common-make-native-bignum.nix +++ b/pkgs/development/compilers/ghc/common-make-native-bignum.nix @@ -225,7 +225,8 @@ let inherit (if hostPlatform != targetPlatform then targetPackages else pkgsHostTarget) gmp - libffi; + libffi + ncurses; }; in @@ -407,6 +408,9 @@ stdenv.mkDerivation (rec { # `--with` flags for libraries needed for RTS linker configureFlags = [ "--datadir=$doc/share/doc/ghc" + ] ++ lib.optionals enableTerminfo [ + "--with-curses-includes=${lib.getDev targetLibs.ncurses}/include" + "--with-curses-libraries=${lib.getLib targetLibs.ncurses}/lib" ] ++ lib.optionals (libffi != null) [ "--with-system-libffi" "--with-ffi-includes=${targetLibs.libffi.dev}/include"