diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2014-03-23 13:33:03 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2014-03-23 13:33:03 +0100 |
commit | 8f26728a44be395a41d9dd9cb933e8006f5a6dc4 (patch) | |
tree | 3336ebed1413a2d49e4545f25e83d0efa7fed386 /utils/ghc-cabal | |
parent | 34b072177b687c8fcc24f87293beae0752e82d32 (diff) | |
download | haskell-8f26728a44be395a41d9dd9cb933e8006f5a6dc4.tar.gz |
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 <hvr@gnu.org>
Diffstat (limited to 'utils/ghc-cabal')
-rw-r--r-- | utils/ghc-cabal/Main.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 8fa2c29113..a7d9e60051 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -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 |