From 6e9db31207f1bdc5fe2310d2e91664640a21c679 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Fri, 17 Sep 2010 22:44:09 +0000 Subject: [PATCH] extra packages info is now read from packages file rather than being repeated in the build system --- ghc.mk | 59 ++++++++++++++++++----------------------------- rules/extra-packages.mk | 29 +++++++++++++++++++++++ 2 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 rules/extra-packages.mk diff --git a/ghc.mk b/ghc.mk index f79732c..199e07a 100644 --- a/ghc.mk +++ b/ghc.mk @@ -279,6 +279,7 @@ include rules/build-package.mk include rules/build-package-way.mk include rules/haddock.mk include rules/tags-package.mk +include rules/extra-packages.mk # ----------------------------------------------------------------------------- # Registering hand-written package descriptions (used in libffi and rts) @@ -298,20 +299,29 @@ include rules/bindist.mk # ----------------------------------------------------------------------------- # Building libraries -define addPackage # args: $1 = package, $2 = condition - ifneq "$2" "" +define addPackageGeneral +# args: $1 = PACKAGES variable, $2 = package, $3 = condition + ifeq "$3" "" + $1 += $2 + else ifeq "$$(CLEANING)" "YES" - PACKAGES += $1 + $1 += $2 else - ifeq $2 - PACKAGES += $1 + ifeq $3 + $1 += $2 endif endif - else - PACKAGES += $1 endif endef +define addPackage # args: $1 = package, $2 = condition +$(call addPackageGeneral,PACKAGES,$1,$2) +endef + +define addPackage2 # args: $1 = package, $2 = condition +$(call addPackageGeneral,PACKAGES_STAGE2,$1,$2) +endef + INTREE_ONLY_PACKAGES := haskeline mtl terminfo utf8-string xhtml $(foreach p,$(INTREE_ONLY_PACKAGES),$(eval libraries/$p_dist-install_HADDOCK_ME = NO)) @@ -355,28 +365,8 @@ $(eval $(call addPackage,terminfo,($$(Windows),NO))) $(eval $(call addPackage,haskeline)) -$(foreach pkg,$(EXTRA_PACKAGES),$(eval $(call addPackage,$(pkg)))) - +$(eval $(call extra-packages)) -# ------------------- Adding DPH packaes --------------- - -# The DPH packages are added when: -# * not BootingFromHc (they aren't necessary for bootstrapping), and -# * not GhcProfiled (they need TH, so can't be compiled by a -prof GHC), or -# * CLEANING: when cleaning we always enable everything - -# if !BootingFromHc && (!GhcProfiled || CLEANING) - -ifneq "$(BootingFromHc)" "YES" -ifneq "$(GhcProfiled) $(CLEANING)" "NO YES" -PACKAGES_STAGE2 += dph/dph-base \ - dph/dph-prim-interface \ - dph/dph-prim-seq \ - dph/dph-prim-par \ - dph/dph-seq \ - dph/dph-par -endif -endif # BootingFromHc # ------------------------------------------------------- @@ -516,8 +506,6 @@ libraries/ghc-prim_dist-install_EXTRA_HADDOCK_SRCS = libraries/ghc-prim/dist-ins # # The rest : libraries/*/dist-install, compiler/stage2, ghc/stage2 -BUILD_DIRS = - ifneq "$(BINDIST)" "YES" BUILD_DIRS += \ $(GHC_MKDIRHIER_DIR) @@ -567,11 +555,6 @@ BUILD_DIRS += \ $(patsubst %, libraries/%, $(PACKAGES)) endif -ifneq "$(BootingFromHc)" "YES" -BUILD_DIRS += \ - libraries/dph -endif - ifeq "$(INTEGER_LIBRARY)" "integer-gmp" BUILD_DIRS += libraries/integer-gmp/gmp endif @@ -961,6 +944,7 @@ $(eval $(call bindist,.,\ INSTALL \ configure config.sub config.guess install-sh \ extra-gcc-opts.in \ + packages \ Makefile \ mk/config.mk.in \ $(INPLACE_BIN)/mkdirhier \ @@ -997,6 +981,9 @@ $(eval $(call bindist,.,\ libraries/gen_contents_index \ libraries/prologue.txt \ libraries/dph/LICENSE \ + libraries/dph/ghc-packages \ + libraries/dph/ghc-packages2 \ + libraries/dph/ghc-stage2-package \ )) endif # mk/project.mk gets an absolute path, so we manually include it in @@ -1007,7 +994,7 @@ BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk unix-binary-dist-prep: "$(RM)" $(RM_OPTS_REC) bindistprep/ "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR) - set -e; for i in LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh extra-gcc-opts.in ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done + set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh extra-gcc-opts.in ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done echo "HADDOCK_DOCS = $(HADDOCK_DOCS)" >> $(BIN_DIST_MK) echo "LATEX_DOCS = $(LATEX_DOCS)" >> $(BIN_DIST_MK) echo "BUILD_DOCBOOK_HTML = $(BUILD_DOCBOOK_HTML)" >> $(BIN_DIST_MK) diff --git a/rules/extra-packages.mk b/rules/extra-packages.mk new file mode 100644 index 0000000..134fa42 --- /dev/null +++ b/rules/extra-packages.mk @@ -0,0 +1,29 @@ +# ----------------------------------------------------------------------------- +# +# (c) 2010 The University of Glasgow +# +# This file is part of the GHC build system. +# +# To understand how the build system works and how to modify it, see +# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture +# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying +# +# ----------------------------------------------------------------------------- + +define extra-packages +$$(foreach p,$$(patsubst libraries/%,%,$$(wildcard $$(shell grep '^[^ ]\+ \+\(dph\|extra\) \+[^ ]\+ \+[^ ]\+ \+[^ ]\+' packages | sed 's/ .*//'))),\ + $$(eval BUILD_DIRS += libraries/$$p)\ + $$(if $$(wildcard libraries/$$p/ghc-packages),\ + $$(foreach q,$$(shell cat libraries/$$p/ghc-packages2),$$(eval $$(call extra-package,$$p,$$p/$$q))),\ + $$(eval $$(call extra-package,$$p,$$p)))\ +) +endef + +define extra-package # $1 = package root, $2 = package +ifeq "$(wildcard libraries/$1/ghc-stage2-package)" "" +$$(eval $$(call addPackage,$2)) +else +$$(eval $$(call addPackage2,$2)) +endif +endef + -- 1.7.10.4