[commit: ghc] master: Fix documentation build on windows (6bef55c)

git at git.haskell.org git at git.haskell.org
Sat Oct 31 17:13:04 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6bef55c6b561080c5ddff73f2c501e40acee86ef/ghc

>---------------------------------------------------------------

commit 6bef55c6b561080c5ddff73f2c501e40acee86ef
Author: Tamar Christina <tamar at zhox.com>
Date:   Sat Oct 31 18:12:42 2015 +0100

    Fix documentation build on windows
    
    Summary:
    Fix building new Sphinx documenation on Windows in msys2 using Awson's patch on #11021.
    
    Install Sphinx using `pacman -S mingw-w64-$(uname -m)-python2-sphinx`
    
    Test Plan: Apply patch and ./validate
    
    Reviewers: thomie, bgamari, austin
    
    Reviewed By: thomie, bgamari
    
    Subscribers: erikd
    
    Differential Revision: https://phabricator.haskell.org/D1408
    
    GHC Trac Issues: #11021


>---------------------------------------------------------------

6bef55c6b561080c5ddff73f2c501e40acee86ef
 configure.ac                  | 14 +++++++++++---
 utils/mkUserGuidePart/Main.hs |  7 ++++++-
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 82524b8..65e5d77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -725,11 +725,19 @@ then
 fi
 
 dnl ** check for Sphinx toolchain
-AC_PATH_PROG(SPHINXBUILD,sphinx-build)
-AC_CACHE_CHECK([for version of sphinx-build], fp_cv_sphinx_version,
+if test "$HostOS" = "mingw32"
+then
+SphinxBin=sphinx-build2
+else
+SphinxBin=sphinx-build
+fi;
+
+AC_SUBST([SphinxBin])
+AC_PATH_PROG(SPHINXBUILD,${SphinxBin})
+AC_CACHE_CHECK([for version of ${SphinxBin}], fp_cv_sphinx_version,
 changequote(, )dnl
 [if test -n "$SPHINXBUILD"; then
-  fp_cv_sphinx_version=`"$SPHINXBUILD" --version 2>&1 | sed 's/Sphinx\( (sphinx-build)\)\? v\?\([0-9]\.[0-9]\.[0-9]\)/\2/' | head -n1`;
+  fp_cv_sphinx_version=`"$SPHINXBUILD" --version 2>&1 | sed 's/Sphinx\( (sphinx-build[2]\?)\)\? v\?\([0-9]\.[0-9]\.[0-9]\)/\2/' | head -n1`;
 fi;
 changequote([, ])dnl
 ])
diff --git a/utils/mkUserGuidePart/Main.hs b/utils/mkUserGuidePart/Main.hs
index 9bc8caa..dd72c27 100644
--- a/utils/mkUserGuidePart/Main.hs
+++ b/utils/mkUserGuidePart/Main.hs
@@ -7,6 +7,11 @@ import Types hiding (flag)
 import Table
 import Options
 
+import System.IO
+
+writeFileUtf8 :: FilePath -> String -> IO ()
+writeFileUtf8 f txt = withFile f WriteMode (\ hdl -> hSetEncoding hdl utf8 >> hPutStr hdl txt)
+
 -- | A ReStructuredText fragment
 type ReST = String
 
@@ -27,7 +32,7 @@ usersGuideFile fname = "docs/users_guide/"++fname
 
 writeRestFile :: FilePath -> ReST -> IO ()
 writeRestFile fname content =
-  writeFile fname $ unlines
+  writeFileUtf8 fname $ unlines
     [ ".. This file is generated by utils/mkUserGuidePart"
     , ""
     , content



More information about the ghc-commits mailing list