Follow Cabal reorganisation, and improve build system a little
authorIan Lynagh <igloo@earth.li>
Thu, 23 Jun 2011 17:36:51 +0000 (18:36 +0100)
committerIan Lynagh <igloo@earth.li>
Thu, 23 Jun 2011 17:36:51 +0000 (18:36 +0100)
boot
ghc.mk
ghc/ghc.mk
rules/build-package.mk
utils/ghc-cabal/ghc.mk
utils/ghc-pkg/ghc.mk

diff --git a/boot b/boot
index 08d4846..591e067 100755 (executable)
--- a/boot
+++ b/boot
@@ -174,6 +174,7 @@ sub boot_pkgs {
                     or die "Opening $package/ghc.mk failed: $!";
                 print GHCMK "${package}_PACKAGE = ${pkg}\n";
                 print GHCMK "${package}_dist-install_GROUP = libraries\n";
+                print GHCMK "\$(if \$(filter ${dir},\$(STAGE0_PACKAGES)),\$(eval \$(call build-package,${package},dist-boot,0)))\n";
                 print GHCMK "\$(eval \$(call build-package,${package},dist-install,\$(if \$(filter ${dir},\$(STAGE2_PACKAGES)),2,1)))\n";
                 close GHCMK
                     or die "Closing $package/ghc.mk failed: $!";
diff --git a/ghc.mk b/ghc.mk
index 4508b68..3ae73a4 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -313,7 +313,7 @@ TH_PACKAGES := $(DPH_PACKAGES)
 #
 # We assume that the stage0 compiler has a suitable bytestring package,
 # so we don't have to include it below.
-STAGE0_PACKAGES = Cabal hpc extensible-exceptions binary bin-package-db hoopl
+STAGE0_PACKAGES = Cabal/cabal hpc extensible-exceptions binary bin-package-db hoopl
 
 # These packages are installed, but are installed hidden
 # Why install them at all?  Because the 'ghc' package depends on them
@@ -393,7 +393,7 @@ $(eval $(call addPackage,haskell2010))
 $(eval $(call addPackage,hpc))
 $(eval $(call addPackage,pretty))
 $(eval $(call addPackage,template-haskell))
-$(eval $(call addPackage,Cabal))
+$(eval $(call addPackage,Cabal/cabal))
 $(eval $(call addPackage,binary))
 $(eval $(call addPackage,bin-package-db))
 $(eval $(call addPackage,hoopl))
@@ -456,7 +456,10 @@ endif
 # --------------------------------
 # Misc package-related settings
 
-BOOT_PKG_CONSTRAINTS := $(foreach p,$(STAGE0_PACKAGES),--constraint "$p == $(shell grep -i "^Version:" libraries/$p/$p.cabal | sed "s/[^0-9.]//g")")
+BOOT_PKG_CONSTRAINTS := \
+    $(foreach d,$(STAGE0_PACKAGES),\
+        $(foreach p,$(basename $(notdir $(wildcard libraries/$d/*.cabal))),\
+            --constraint "$p == $(shell grep -i "^Version:" libraries/$d/$p.cabal | sed "s/[^0-9.]//g")"))
 
 # The actual .a and .so/.dll files: needed for dependencies.
 ALL_STAGE1_LIBS  = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_v_LIB))
@@ -672,16 +675,6 @@ endif
 
 $(eval $(call clean-target,$(BOOTSTRAPPING_CONF),,$(BOOTSTRAPPING_CONF)))
 
-# These three libraries do not depend on each other, so we can build
-# them straight off:
-
-$(eval $(call build-package,libraries/hpc,dist-boot,0))
-$(eval $(call build-package,libraries/extensible-exceptions,dist-boot,0))
-$(eval $(call build-package,libraries/Cabal,dist-boot,0))
-$(eval $(call build-package,libraries/binary,dist-boot,0))
-$(eval $(call build-package,libraries/bin-package-db,dist-boot,0))
-$(eval $(call build-package,libraries/hoopl,dist-boot,0))
-
 # register the boot packages in strict sequence, because running
 # multiple ghc-pkgs in parallel doesn't work (registrations may get
 # lost).
@@ -689,7 +682,9 @@ fixed_pkg_prev=
 $(foreach pkg,$(STAGE0_PACKAGES),$(eval $(call fixed_pkg_dep,$(pkg),dist-boot)))
 
 compiler/stage1/package-data.mk : $(fixed_pkg_prev)
+endif
 
+ifneq "$(BINDIST)" "YES"
 # Make sure we have all the GHCi libs by the time we've built
 # ghc-stage2.  DPH includes a bit of Template Haskell which needs the
 # GHCI libs, and we don't have a better way to express that dependency.
@@ -1145,6 +1140,8 @@ clean_libraries:
 # We have to define a clean target for each library manually, because the
 # libraries/*/ghc.mk files are not included when we're cleaning.
 ifeq "$(CLEANING)" "YES"
+$(foreach lib,$(STAGE0_PACKAGES),\
+  $(eval $(call clean-target,libraries/$(lib),dist-boot,libraries/$(lib)/dist-boot)))
 $(foreach lib,$(PACKAGES) $(PACKAGES_STAGE2),\
   $(eval $(call clean-target,libraries/$(lib),dist-install,libraries/$(lib)/dist-install)))
 endif
index da9fd8a..d270a7a 100644 (file)
@@ -94,6 +94,7 @@ $(eval $(call build-prog,ghc,stage3,2))
 
 ifneq "$(BINDIST)" "YES"
 
+ghc/stage1/build/tmp/$(ghc_stage1_PROG) : $(BOOT_LIBS)
 ifeq "$(GhcProfiled)" "YES"
 ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(compiler_stage2_p_LIB)
 ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_p_LIB))
index c735e51..c15a8c5 100644 (file)
@@ -132,7 +132,9 @@ check_$1: $$(GHC_CABAL_INPLACE)
        $$(GHC_CABAL_INPLACE) check $1
 endif
 
+ifneq "$3" "0"
 $(call haddock,$1,$2)
+endif
 
 # Don't put bootstrapping packages in the bindist
 ifneq "$3" "0"
index 9026eb1..bb28a3a 100644 (file)
 
 # Euch, hideous hack:
 # XXX This should be in a different Makefile
-CABAL_DOTTED_VERSION := $(shell grep "^Version:" libraries/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/Distribution/*/*/*.hs)
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*/*.hs)
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/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 \
+              -ilibraries/Cabal/cabal \
               -ilibraries/filepath \
               -ilibraries/hpc
        touch $@
index 6bc9be5..03c9523 100644 (file)
@@ -58,7 +58,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 \
+              -ilibraries/Cabal/cabal \
               -ilibraries/filepath \
               -ilibraries/extensible-exceptions \
               -ilibraries/hpc \