Commit 8f26728a authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺
Browse files

ghc-cabal: force use of UTF8 when writing out `haddock-prologue.txt`



This unbreaks the GHC build if a non-UTF8 locale such as LANG=C is active

See also haskell/cabal#1721 and haskell/haddock#286
Signed-off-by: Herbert Valerio Riedel's avatarHerbert Valerio Riedel <hvr@gnu.org>
parent 34b07217
......@@ -452,7 +452,8 @@ generate directory distdir dll0Modules config_args
"$(eval $(" ++ directory ++ "_PACKAGE_MAGIC))"
]
writeFile (distdir ++ "/package-data.mk") $ unlines xs
writeFile (distdir ++ "/haddock-prologue.txt") $
writeFileUtf8 (distdir ++ "/haddock-prologue.txt") $
if null (description pd) then synopsis pd
else description pd
unless (null dll0Modules) $
......@@ -475,3 +476,8 @@ generate directory distdir dll0Modules config_args
mkSearchPath = intercalate [searchPathSeparator]
boolToYesNo True = "YES"
boolToYesNo False = "NO"
-- | Version of 'writeFile' that always uses UTF8 encoding
writeFileUtf8 f txt = withFile f WriteMode $ \hdl -> do
hSetEncoding hdl utf8
hPutStr hdl txt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment