summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-08-24 13:09:38 +0000
committerIan Lynagh <igloo@earth.li>2010-08-24 13:09:38 +0000
commit4e7bbe99d475acc47fed45124bf748f3e258a702 (patch)
tree231356727ddd949678ec9cb7be0c6328909e085b
parentaf199e4953c6c75488a7c62b27cddf9fac09af84 (diff)
downloadhaskell-4e7bbe99d475acc47fed45124bf748f3e258a702.tar.gz
Change how the dblatex/lndir problem is worked around
Hack: dblatex normalises the name of the main input file using os.path.realpath, which means that if we're in a linked build tree, it find the real source files rather than the symlinks in our link tree. This is fine for the static sources, but it means it can't find the generated sources. We therefore also generate the main input file, so that it really is in the link tree, and thus dblatex can find everything.
-rw-r--r--docs/users_guide/ghc.mk35
-rw-r--r--utils/mkUserGuidePart/Main.hs23
2 files changed, 25 insertions, 33 deletions
diff --git a/docs/users_guide/ghc.mk b/docs/users_guide/ghc.mk
index fe2bddd0d9..5f817757ce 100644
--- a/docs/users_guide/ghc.mk
+++ b/docs/users_guide/ghc.mk
@@ -11,6 +11,7 @@
# -----------------------------------------------------------------------------
docs/users_guide_GENERATED_DOCBOOK_SOURCES := \
+ docs/users_guide/users_guide.xml \
docs/users_guide/what_glasgow_exts_does.gen.xml
# sort remove duplicates
@@ -19,29 +20,13 @@ docs/users_guide_DOCBOOK_SOURCES := \
$(wildcard docs/users_guide/*.xml) \
$(basename $(wildcard docs/users_guide/*.xml.in)))
-$(docs/users_guide_GENERATED_DOCBOOK_SOURCES): %.gen.xml: inplace/bin/mkUserGuidePart
+$(docs/users_guide_GENERATED_DOCBOOK_SOURCES): %.xml: inplace/bin/mkUserGuidePart
inplace/bin/mkUserGuidePart $@
$(eval $(call docbook,docs/users_guide,users_guide))
$(eval $(call clean-target,docs/users_guide,gen,$(docs/users_guide_GENERATED_DOCBOOK_SOURCES)))
-# Hack: dblatex normalises the name of the input file using
-# os.path.realpath, which means that if we're in a linked build tree,
-# it won't be able to find ug-book.xml which is in the build tree but
-# not in the source tree. Hence, we copy ug-book.xml to the source
-# tree. This is a horrible hack, but I can't find a better way to do
-# it --SDM (2009-05-11)
-
-build_ug_book = docs/users_guide/ug-book.xml
-src_ug_book = $(dir $(realpath $(dir $(build_ug_book))/ug-book.xml.in))ug-book.xml
-
-# ... and similarly for ug-ent.xml, which is now generated by configure from
-# ug-ent.xml.in --SDM (2010-02-25)
-
-build_ug_ent = docs/users_guide/ug-ent.xml
-src_ug_ent = $(dir $(realpath $(dir $(build_ug_ent))/ug-ent.xml.in))ug-ent.xml
-
html_docs/users_guide : docs/users_guide/users_guide/prof_scc.png
docs/users_guide/users_guide/prof_scc.png : \
@@ -50,19 +35,3 @@ docs/users_guide/users_guide/prof_scc.png : \
$(CP) $< $@
# dep. on d/u/u/index.html is to make sure that the d/u/u dir is created first
-ifneq "$(build_ug_book)" "$(src_ug_book)"
-$(src_ug_book) : $(build_ug_book)
- "$(CP)" $< $@
-ifneq "$(BINDIST)" "YES"
-docs/users_guide/users_guide.pdf docs/users_guide/users_guide.ps: $(src_ug_book)
-endif
-endif
-
-ifneq "$(build_ug_ent)" "$(src_ug_ent)"
-$(src_ug_ent) : $(build_ug_ent)
- "$(CP)" $< $@
-ifneq "$(BINDIST)" "YES"
-docs/users_guide/users_guide.pdf docs/users_guide/users_guide.ps: $(src_ug_ent)
-endif
-endif
-
diff --git a/utils/mkUserGuidePart/Main.hs b/utils/mkUserGuidePart/Main.hs
index 114114ca1c..c415eb4f49 100644
--- a/utils/mkUserGuidePart/Main.hs
+++ b/utils/mkUserGuidePart/Main.hs
@@ -12,12 +12,35 @@ main = do args <- getArgs
[] -> error "Need to give filename to generate as an argument"
[f] ->
case f of
+ "docs/users_guide/users_guide.xml" ->
+ writeFile f userGuideMain
"docs/users_guide/what_glasgow_exts_does.gen.xml" ->
writeFile f whatGlasgowExtsDoes
_ ->
error ("Don't know what to do for " ++ show f)
_ -> error "Bad args"
+-- Hack: dblatex normalises the name of the main input file using
+-- os.path.realpath, which means that if we're in a linked build tree,
+-- it find the real source files rather than the symlinks in our link
+-- tree. This is fine for the static sources, but it means it can't
+-- find the generated sources.
+-- We therefore also generate the main input file, so that it really
+-- is in the link tree, and thus dblatex can find everything.
+userGuideMain :: String
+userGuideMain = unlines [
+ "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>",
+ "<!DOCTYPE book PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"",
+ " \"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\" [",
+ "<!ENTITY % ug-ent SYSTEM \"ug-ent.xml\">",
+ "%ug-ent;",
+ "<!ENTITY ug-book SYSTEM \"ug-book.xml\">",
+ "]>",
+ "",
+ "<book id=\"users-guide\">",
+ "&ug-book;",
+ "</book>"]
+
whatGlasgowExtsDoes :: String
whatGlasgowExtsDoes = case maybeInitLast glasgowExtsFlags of
Just (xs, x) ->