[commit: ghc] ghc-7.6: Tweak the gen_contents_index script (4e29038)

Ian Lynagh igloo at earth.li
Tue Jan 29 19:45:37 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : ghc-7.6

http://hackage.haskell.org/trac/ghc/changeset/4e29038c07963106676fbd2a2395ea5d3d06470a

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

commit 4e29038c07963106676fbd2a2395ea5d3d06470a
Author: Ian Lynagh <ian at well-typed.com>
Date:   Tue Jan 29 15:59:39 2013 +0000

    Tweak the gen_contents_index script

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

 ghc.mk                       |    2 +-
 libraries/gen_contents_index |   24 +++++++++++++-----------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/ghc.mk b/ghc.mk
index 48d247a..06b1403 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -702,7 +702,7 @@ $(foreach p,$(PACKAGES_STAGE0),$(eval libraries/$p_dist-boot_DO_HADDOCK = NO))
 # Build the Haddock contents and index
 ifeq "$(HADDOCK_DOCS)" "YES"
 libraries/dist-haddock/index.html: inplace/bin/haddock$(exeext) $(ALL_HADDOCK_FILES)
-	cd libraries && sh gen_contents_index --inplace
+	cd libraries && sh gen_contents_index --intree
 ifeq "$(phase)" "final"
 $(eval $(call all-target,library_doc_index,libraries/dist-haddock/index.html))
 endif
diff --git a/libraries/gen_contents_index b/libraries/gen_contents_index
index 5303aa6..34e51f3 100644
--- a/libraries/gen_contents_index
+++ b/libraries/gen_contents_index
@@ -2,20 +2,18 @@
 
 set -e
 
-USAGE="Usage: $0 [--inplace] [--verbose] [--help]"
-INPLACE=
+USAGE="Usage: $0 [--intree] [--verbose] [--help]"
+INTREE=
 VERBOSE=
 
 HADDOCK_ARGS=
 
-[ -d dist-haddock ] || mkdir dist-haddock
-cd dist-haddock
-
 while [ "$#" -ne "0" ]
 do
     case "$1" in
-    --inplace)
-        INPLACE=yes
+    --intree)
+        # We're in a GHC build tree
+        INTREE=yes
         ;;
     --verbose)
         VERBOSE=yes
@@ -29,9 +27,13 @@ do
     shift
 done
 
-if [ -n "$INPLACE" ]
+if [ -n "$INTREE" ]
 then
+    [ -d dist-haddock ] || mkdir dist-haddock
+    cd dist-haddock
+
     HADDOCK=../../inplace/bin/haddock
+    HADDOCK_ARGS="-p ../prologue.txt"
     for REPO in `grep '^libraries/[^ ]*  *- ' ../../packages | sed -e 's#libraries/##' -e 's/ .*//'`
     do
         if [ -f "../$REPO/ghc-packages" ]
@@ -58,9 +60,10 @@ then
         done
     done
 else
-    HADDOCK=../../../../../../bin/haddock
+    HADDOCK=../../../../../bin/haddock
     # We don't want the GHC API to swamp the index
-    HADDOCK_FILES=`ls -1 ../*/*.haddock | grep -v '/ghc\.haddock' | sort`
+    HADDOCK_FILES=`ls -1 */*.haddock | grep -v '/ghc\.haddock' | sort`
+    HADDOCK_ARGS="-p prologue.txt"
     for HADDOCK_FILE in $HADDOCK_FILES
     do
         NAME_VERSION=`echo "$HADDOCK_FILE" | sed 's#/.*##'`
@@ -76,7 +79,6 @@ then
 fi
 $HADDOCK --gen-index --gen-contents -o . \
          -t "Haskell Hierarchical Libraries" \
-         -p "../prologue.txt" \
          $HADDOCK_ARGS
 
 # Unhandled Windows help stuff?:





More information about the ghc-commits mailing list