Follow cabal->Cabal rename, and fix haddock index generation
authorIan Lynagh <igloo@earth.li>
Sun, 23 Oct 2011 15:13:56 +0000 (16:13 +0100)
committerIan Lynagh <igloo@earth.li>
Sun, 23 Oct 2011 15:30:22 +0000 (16:30 +0100)
We now make use of the ghc-packages file when making the haddock index.

configure.ac
ghc.mk
libraries/gen_contents_index
mk/validate-settings.mk
utils/ghc-cabal/ghc.mk
utils/ghc-pkg/ghc.mk

index aec9c88..c80c32c 100644 (file)
@@ -777,7 +777,7 @@ AC_SUBST(BUILD_DOCBOOK_PS)
 AC_SUBST(BUILD_DOCBOOK_PDF)
 
 LIBRARY_VERSION(base)
-LIBRARY_VERSION(Cabal, Cabal/cabal)
+LIBRARY_VERSION(Cabal, Cabal/Cabal)
 LIBRARY_VERSION(ghc-prim)
 LIBRARY_ghc_VERSION="$ProjectVersion"
 AC_SUBST(LIBRARY_ghc_VERSION)
diff --git a/ghc.mk b/ghc.mk
index be23b2c..8ae3e04 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -332,7 +332,7 @@ PKGS_THAT_USE_TH := $(PKGS_THAT_ARE_DPH)
 #
 # We assume that the stage0 compiler has a suitable bytestring package,
 # so we don't have to include it below.
-PKGS_THAT_BUILD_WITH_STAGE0 = Cabal/cabal hpc extensible-exceptions binary bin-package-db hoopl
+PKGS_THAT_BUILD_WITH_STAGE0 = Cabal/Cabal hpc extensible-exceptions binary bin-package-db hoopl
 
 # $(EXTRA_PACKAGES)  is another classification, of packages built but
 #                    not installed
@@ -413,7 +413,7 @@ $(eval $(call addPackage,haskell2010))
 $(eval $(call addPackage,hpc))
 $(eval $(call addPackage,pretty))
 $(eval $(call addPackage,template-haskell))
-$(eval $(call addPackage,Cabal/cabal))
+$(eval $(call addPackage,Cabal/Cabal))
 $(eval $(call addPackage,binary))
 $(eval $(call addPackage,bin-package-db))
 $(eval $(call addPackage,hoopl))
index bfdf962..c8d82c8 100644 (file)
@@ -7,19 +7,30 @@ HADDOCK_ARGS=
 case $* in
 --inplace)
     HADDOCK=../inplace/bin/haddock
-    for LIB in `grep '^libraries/[^ ]*  *- ' ../packages | sed -e 's#libraries/##' -e 's/ .*//'`
+    for REPO in `grep '^libraries/[^ ]*  *- ' ../packages | sed -e 's#libraries/##' -e 's/ .*//'`
     do
-        HADDOCK_FILE="$LIB/dist-install/doc/html/$LIB/$LIB.haddock"
-        if [ -f "$HADDOCK_FILE" ]
+        if [ -f "$REPO/ghc-packages" ]
         then
-            LIBPATH=`echo "$HADDOCK_FILE" | sed 's#/dist-install.*##'`
-            NAME=`echo "$HADDOCK_FILE" | sed 's#.*/##' | sed 's#\.haddock$##'`
-            # It's easier to portably remove tabs with tr than to try to get
-            # sed to do what we want
-            VERSION=`grep -i '^version:' $LIBPATH/$NAME.cabal | sed 's/.*://' | tr -d ' \t'`
-            HADDOCK_ARG="--read-interface=${NAME}-${VERSION},$HADDOCK_FILE"
-            HADDOCK_ARGS="$HADDOCK_ARGS $HADDOCK_ARG"
+            LIBS="`cat $REPO/ghc-packages`"
+            LIBROOT="$REPO"
+        else
+            LIBS="$REPO"
+            LIBROOT="."
         fi
+        for LIB in $LIBS
+        do
+            HADDOCK_FILE="$LIBROOT/$LIB/dist-install/doc/html/$LIB/$LIB.haddock"
+            if [ -f "$HADDOCK_FILE" ]
+            then
+                LIBPATH=`echo "$HADDOCK_FILE" | sed 's#/dist-install.*##'`
+                NAME=`echo "$HADDOCK_FILE" | sed 's#.*/##' | sed 's#\.haddock$##'`
+                # It's easier to portably remove tabs with tr than to try to get
+                # sed to do what we want
+                VERSION=`grep -i '^version:' $LIBPATH/$NAME.cabal | sed 's/.*://' | tr -d ' \t'`
+                HADDOCK_ARG="--read-interface=${NAME}-${VERSION},$HADDOCK_FILE"
+                HADDOCK_ARGS="$HADDOCK_ARGS $HADDOCK_ARG"
+            fi
+        done
     done
     ;;
 *)
index 00d4657..f0d8de1 100644 (file)
@@ -56,8 +56,8 @@ endif
 
 # Cabal doesn't promise to be warning-free
 utils/ghc-cabal_dist_EXTRA_HC_OPTS += -w
-libraries/Cabal/cabal_dist-boot_EXTRA_HC_OPTS += -w
-libraries/Cabal/cabal_dist-install_EXTRA_HC_OPTS += -w
+libraries/Cabal/Cabal_dist-boot_EXTRA_HC_OPTS += -w
+libraries/Cabal/Cabal_dist-install_EXTRA_HC_OPTS += -w
 
 # Temporarily turn off incomplete-pattern warnings for containers
 libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-incomplete-patterns
index 39a26f0..9af611c 100644 (file)
 
 # Euch, hideous hack:
 # XXX This should be in a different Makefile
-CABAL_DOTTED_VERSION := $(shell grep "^Version:" libraries/Cabal/cabal/Cabal.cabal | sed "s/^Version: //")
+CABAL_DOTTED_VERSION := $(shell grep "^Version:" libraries/Cabal/Cabal/Cabal.cabal | sed "s/^Version: //")
 CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION))
 CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
 
 $(GHC_CABAL_INPLACE) : $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext) | $$(dir $$@)/.
        "$(CP)" $< $@
 
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/cabal/Distribution/*/*/*.hs)
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/cabal/Distribution/*/*.hs)
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/cabal/Distribution/*.hs)
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*/*.hs)
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*.hs)
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*.hs)
 
 $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs | $$(dir $$@)/. bootstrapping/.
        "$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/Main.hs -o $@ \
@@ -32,7 +32,7 @@ $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs | $
               -DCABAL_VERSION=$(CABAL_VERSION) \
               -odir  bootstrapping \
               -hidir bootstrapping \
-              -ilibraries/Cabal/cabal \
+              -ilibraries/Cabal/Cabal \
               -ilibraries/filepath \
               -ilibraries/hpc \
               $(utils/ghc-cabal_dist_EXTRA_HC_OPTS)
index 45b91d6..f420547 100644 (file)
@@ -61,7 +61,7 @@ utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext): utils/ghc-pkg/Main
               -hidir bootstrapping \
                -iutils/ghc-pkg \
               -XCPP -XExistentialQuantification -XDeriveDataTypeable \
-              -ilibraries/Cabal/cabal \
+              -ilibraries/Cabal/Cabal \
               -ilibraries/filepath \
               -ilibraries/extensible-exceptions \
               -ilibraries/hpc \