[Git][ghc/ghc][wip/fix-xelatex] hadrian/make: Detect makeindex

Ben Gamari gitlab at gitlab.haskell.org
Mon Jun 1 14:39:36 UTC 2020



Ben Gamari pushed to branch wip/fix-xelatex at Glasgow Haskell Compiler / GHC


Commits:
1b06d1db by Ben Gamari at 2020-06-01T10:39:24-04:00
hadrian/make: Detect makeindex

Previously we would simply assume that makeindex was available.
Now we correctly detect it in `configure` and respect this conclusion in
hadrian and make.

- - - - -


7 changed files:

- configure.ac
- ghc.mk
- hadrian/cfg/system.config.in
- hadrian/src/Builder.hs
- hadrian/src/Rules/Documentation.hs
- mk/config.mk.in
- rules/sphinx.mk


Changes:

=====================================
configure.ac
=====================================
@@ -878,6 +878,7 @@ fi
 
 dnl ** check for xelatex
 AC_PATH_PROG(XELATEX,xelatex)
+AC_PATH_PROG(MAKEINDEX,makeindex)
 
 dnl ** check for makeinfo
 AC_PATH_PROG(MAKEINFO,makeinfo)
@@ -1377,7 +1378,7 @@ dnl --------------------------------------------------------------
 if test -n "$SPHINXBUILD"; then
     BUILD_MAN=YES
     BUILD_SPHINX_HTML=YES
-    if test -n "$XELATEX"; then
+    if test -n "$XELATEX" -a -n "$MAKEINDEX"; then
         BUILD_SPHINX_PDF=YES
     else
         BUILD_SPHINX_PDF=NO


=====================================
ghc.mk
=====================================
@@ -185,6 +185,11 @@ $(error BUILD_SPHINX_PDF=YES, but `xelatex` was not found. \
   Install `xelatex`, then rerun `./configure`. \
   See https://gitlab.haskell.org/ghc/ghc/wikis/building/preparation)
 endif
+ifeq "$(MAKEINDEX)" ""
+$(error BUILD_SPHINX_PDF=YES, but `makeindex` was not found. \
+  Install `xelatex`, then rerun `./configure`. \
+  See https://gitlab.haskell.org/ghc/ghc/wikis/building/preparation)
+endif
 endif
 
 ifeq "$(HSCOLOUR_SRCS)" "YES"


=====================================
hadrian/cfg/system.config.in
=====================================
@@ -24,6 +24,7 @@ system-ghc-pkg = @GhcPkgCmd@
 tar            = @TarCmd@
 patch          = @PatchCmd@
 xelatex        = @XELATEX@
+makeindex      = @MAKEINDEX@
 makeinfo       = @MAKEINFO@
 
 # Python 3 is required to run test driver.


=====================================
hadrian/src/Builder.hs
=====================================
@@ -140,6 +140,7 @@ data Builder = Alex
              | Tar TarMode
              | Unlit
              | Xelatex
+             | Makeindex  -- ^ from xelatex
              deriving (Eq, Generic, Show)
 
 instance Binary   Builder
@@ -279,13 +280,8 @@ instance H.Builder Builder where
                 Makeinfo -> do
                   cmd' echo [path] "--no-split" [ "-o", output] [input]
 
-                Xelatex -> do
-                    unit $ cmd' [Cwd output] [path]        buildArgs
-                    unit $ cmd' [Cwd output] [path]        buildArgs
-                    unit $ cmd' [Cwd output] [path]        buildArgs
-                    unit $ cmd' [Cwd output] ["makeindex"] (input -<.> "idx")
-                    unit $ cmd' [Cwd output] [path]        buildArgs
-                    unit $ cmd' [Cwd output] [path]        buildArgs
+                Xelatex   -> unit $ cmd' [Cwd output] [path] buildArgs
+                Makeindex -> unit $ cmd' [Cwd output] [path] buildArgs
 
                 Tar _ -> cmd' buildOptions echo [path] buildArgs
                 _  -> cmd' echo [path] buildArgs
@@ -326,6 +322,7 @@ systemBuilderPath builder = case builder of
     Sphinx _        -> fromKey "sphinx-build"
     Tar _           -> fromKey "tar"
     Xelatex         -> fromKey "xelatex"
+    Makeindex       -> fromKey "makeindex"
     _               -> error $ "No entry for " ++ show builder ++ inCfg
   where
     inCfg = " in " ++ quote configFile ++ " file."


=====================================
hadrian/src/Rules/Documentation.hs
=====================================
@@ -290,6 +290,13 @@ buildSphinxPdf path = do
             need (map (rstFilesDir -/-) rstFiles)
             build $ target docContext (Sphinx LatexMode) [pathPath path] [dir]
             checkSphinxWarnings dir
+
+            -- LaTeX "fixed point"
+            build $ target docContext Xelatex [path <.> "tex"] [dir]
+            build $ target docContext Xelatex [path <.> "tex"] [dir]
+            build $ target docContext Xelatex [path <.> "tex"] [dir]
+            build $ target docContext Makeindex [path <.> "idx"] [dir]
+            build $ target docContext Xelatex [path <.> "tex"] [dir]
             build $ target docContext Xelatex [path <.> "tex"] [dir]
             copyFileUntracked (dir -/- path <.> "pdf") file
 


=====================================
mk/config.mk.in
=====================================
@@ -839,6 +839,7 @@ BUILD_SPHINX_HTML        = @BUILD_SPHINX_HTML@
 BUILD_SPHINX_PDF         = @BUILD_SPHINX_PDF@
 SPHINXOPTS               = -D latex_paper_size=letter
 XELATEX                  = @XELATEX@
+MAKEINDEX                = @MAKEINDEX@
 
 #-----------------------------------------------------------------------------
 # 		FPtools support software


=====================================
rules/sphinx.mk
=====================================
@@ -66,7 +66,7 @@ $1/$2.pdf: $1/conf.py $$($1_RST_SOURCES)
 	cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex 2>/dev/null >/dev/null || true
 	cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex 2>/dev/null >/dev/null || true
 	cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex 2>/dev/null >/dev/null || true
-	cd $1/build-pdf/$2 ; makeindex $2.idx
+	cd $1/build-pdf/$2 ; $(MAKEINDEX) $2.idx
 	cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex 2>/dev/null >/dev/null || true
 	cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex
 	cp $1/build-pdf/$2/$2.pdf $1/$2.pdf



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1b06d1dbae519d8dc40f71fe5ec09ebaad6706c9

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1b06d1dbae519d8dc40f71fe5ec09ebaad6706c9
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200601/d6fdc6f4/attachment-0001.html>


More information about the ghc-commits mailing list