From 8a21e02e3177c4fc5a4df8bfc6c6aab5c6269d91 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Fri, 1 Jan 2021 21:28:10 +0100 Subject: [PATCH] ghc-9.0.1: set utf-8 locale during the build so that Haddock succeeds --- pkgs/development/compilers/ghc/9.0.1.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/compilers/ghc/9.0.1.nix b/pkgs/development/compilers/ghc/9.0.1.nix index 859d288649de..d86cce9849ca 100644 --- a/pkgs/development/compilers/ghc/9.0.1.nix +++ b/pkgs/development/compilers/ghc/9.0.1.nix @@ -6,6 +6,7 @@ , bash , libiconv ? null, ncurses +, glibcLocales ? null , # GHC can be built with system libffi or a bundled one. libffi ? null @@ -109,6 +110,9 @@ stdenv.mkDerivation (rec { postPatch = "patchShebangs ."; + # GHC needs the locale configured during the Haddock phase. + LANG = "en_US.UTF-8"; + # GHC is a bit confused on its cross terminology. preConfigure = '' for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do @@ -129,6 +133,8 @@ stdenv.mkDerivation (rec { echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure + '' + stdenv.lib.optionalString (stdenv.isLinux) '' + export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive" '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" '' + stdenv.lib.optionalString stdenv.isDarwin ''