diff options
author | Ian Lynagh <igloo@earth.li> | 2011-01-15 23:19:27 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2011-01-15 23:19:27 +0000 |
commit | a3be88fd60cc63b97ec8509f46a8d93025760792 (patch) | |
tree | eb73ab10e25592144b88a4dc80edd99adc18ea40 /rules | |
parent | 18fe16c9d3468c818d4fd650f47cfd6971e578b5 (diff) | |
download | haskell-a3be88fd60cc63b97ec8509f46a8d93025760792.tar.gz |
Build system improvements
We no longer use dummy-ghc; instead we don't configure most packages
until the stage1 compiler is available.
We also now use Cabal for building the ghc-bin package.
There are a couple more sanity checks too.
Diffstat (limited to 'rules')
-rw-r--r-- | rules/build-package-data.mk | 5 | ||||
-rw-r--r-- | rules/build-package.mk | 75 | ||||
-rw-r--r-- | rules/build-perl.mk | 2 | ||||
-rw-r--r-- | rules/build-prog.mk | 121 | ||||
-rw-r--r-- | rules/docbook.mk | 6 | ||||
-rw-r--r-- | rules/package-config.mk | 4 |
6 files changed, 138 insertions, 75 deletions
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk index ffaacd69ff..be33eabdb4 100644 --- a/rules/build-package-data.mk +++ b/rules/build-package-data.mk @@ -62,10 +62,13 @@ ifeq "$3" "0" $1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS) endif +$1/$2/inplace-pkg-config : $1/$2/package-data.mk +$1/$2/build/autogen/cabal_macros.h : $1/$2/package-data.mk + # This rule configures the package, generates the package-data.mk file # for our build system, and registers the package for use in-place in # the build tree. -$1/$2/package-data.mk $1/$2/inplace-pkg-config $1/$2/build/autogen/cabal_macros.h : $$(GHC_CABAL_INPLACE) $$($1_$2_GHC_PKG_DEP) $1/$$($1_PACKAGE).cabal $$(wildcard $1/configure) $$($1_$2_HC_CONFIG_DEP) +$1/$2/package-data.mk : $$(GHC_CABAL_INPLACE) $$($1_$2_GHC_PKG_DEP) $1/$$($1_PACKAGE).cabal $$(wildcard $1/configure) $$($1_$2_HC_CONFIG_DEP) "$$(GHC_CABAL_INPLACE)" configure --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" --with-gcc="$$(WhatGccIsCalled)" --configure-option=--with-cc="$$(WhatGccIsCalled)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) -- $2 $1 ifeq "$$($1_$2_PROG)" "" ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO" diff --git a/rules/build-package.mk b/rules/build-package.mk index 7ce11feeb5..9e2bae3628 100644 --- a/rules/build-package.mk +++ b/rules/build-package.mk @@ -60,58 +60,71 @@ define build-package-helper # $2 = distdir # $3 = GHC stage to use (0 == bootstrapping compiler) -# We don't install things compiled by stage 0, so no need to put them -# in the bindist. -ifneq "$$(BINDIST) $3" "YES 0" +# --- CONFIGURATION -$(call all-target,$1,all_$1_$2) -# This give us things like -# all_libraries: all_libraries/base_dist-install -ifneq "$$($1_$2_GROUP)" "" -all_$$($1_$2_GROUP): all_$1_$2 -endif +$(call package-config,$1,$2,$3) -ifneq "$$(CHECKED_$1)" "YES" -CHECKED_$1 = YES -check_packages: check_$1 -.PHONY: check_$1 -check_$1: $$(GHC_CABAL_INPLACE) - $$(GHC_CABAL_INPLACE) check $1 +######################################## +ifeq "$$($1_$2_CONFIGURE_PHASE)" "" +$$(error No configure phase for $1_$2) +else ifeq "$$($1_$2_CONFIGURE_PHASE)" "$$(phase)" + +ifeq "$$(DEBUG)" "YES" +$$(warning $1/$2 configure phase) endif -# --- CONFIGURATION +ifneq "$$(BINDIST)" "YES" +$(call build-package-data,$1,$2,$3) +endif ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" include $1/$2/package-data.mk endif -$(call package-config,$1,$2,$3) - -ifeq "$$($1_$2_DISABLE)" "YES" +else ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_or_later)" "YES" ifeq "$$(DEBUG)" "YES" -$$(warning $1/$2 disabled) +$$(warning $1/$2 build phase) +endif + +ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" +include $1/$2/package-data.mk +ifeq "$$($1_$2_VERSION)" "" +$$(error No version for $1_$2 found) +endif endif -# A package is disabled when we want to bring its package-data.mk file -# up-to-date first, or due to other build dependencies. +$(call all-target,$1,all_$1_$2) -$(call all-target,$1_$2,$1/$2/package-data.mk) +else -ifneq "$$(BINDIST)" "YES" -# We have a rule for package-data.mk only when the package is -# disabled, because we want the build to fail if we haven't run phase 0. -$(call build-package-data,$1,$2,$3) +ifeq "$$(DEBUG)" "YES" +$$(warning $1/$2 disabled phase) endif -else +endif +######################################## -ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" -ifeq "$$($1_$2_VERSION)" "" -$$(error phase ordering error: $1/$2 is enabled, but $1/$2/package-data.mk does not exist) +# We don't install things compiled by stage 0, so no need to put them +# in the bindist. +ifneq "$$(BINDIST) $3" "YES 0" + +# This give us things like +# all_libraries: all_libraries/base_dist-install +ifneq "$$($1_$2_GROUP)" "" +all_$$($1_$2_GROUP): all_$1_$2 endif + +ifneq "$$(CHECKED_$1)" "YES" +CHECKED_$1 = YES +check_packages: check_$1 +.PHONY: check_$1 +check_$1: $$(GHC_CABAL_INPLACE) + $$(GHC_CABAL_INPLACE) check $1 endif +ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_done)" "YES" + # Sometimes we need to modify the automatically-generated package-data.mk # bindings in a special way for the GHC build system, so allow that here: $($1_PACKAGE_MAGIC) diff --git a/rules/build-perl.mk b/rules/build-perl.mk index e13185d85d..c232193478 100644 --- a/rules/build-perl.mk +++ b/rules/build-perl.mk @@ -29,7 +29,9 @@ else $1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) endif +ifeq "$$(phase_1_or_later)" "YES" $(call all-target,$1_$2,$$($1_$2_INPLACE)) +endif $(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE)) .PHONY: clean_$1 diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 473bae8e8d..e303a44f1c 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -48,45 +48,106 @@ define build-prog-helper # $2 = distdir # $3 = GHC stage to use (0 == bootstrapping compiler) -$(call all-target,$1,all_$1_$2) - ifeq "$$($1_USES_CABAL)" "YES" $1_$2_USES_CABAL = YES endif +$(call package-config,$1,$2,$3) + +ifeq "$$($1_$2_INSTALL_INPLACE)" "NO" +ifeq "$(findstring clean,$(MAKECMDGOALS))" "" +$1_$2_INPLACE = $$(error $1_$2 should not be installed inplace, but INPLACE var evaluated) +else +$1_$2_INPLACE = +endif +else +# Where do we install the inplace version? +ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO" +$1_$2_INPLACE = $$(INPLACE_LIB)/$$($1_$2_PROG) +else +ifeq "$$($1_$2_TOPDIR)" "YES" +$1_$2_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG) +else +$1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) +endif +endif +endif + +######################################## +ifeq "$$($1_$2_CONFIGURE_PHASE)" "" +$$(error No configure phase for $1_$2) +else ifeq "$$($1_$2_CONFIGURE_PHASE)" "$$(phase)" + +ifeq "$$(DEBUG)" "YES" +$$(warning $1/$2 configure phase) +endif + +ifneq "$$(BINDIST)" "YES" +$(call build-package-data,$1,$2,$3) +endif + ifeq "$$($1_$2_USES_CABAL)" "YES" ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" include $1/$2/package-data.mk endif endif -$(call package-config,$1,$2,$3) - -ifeq "$$($1_$2_USES_CABAL)$$($1_$2_VERSION)" "YES" -$1_$2_DISABLE = YES +# INPLACE_BIN might be empty if we're distcleaning +ifeq "$(findstring clean,$(MAKECMDGOALS))" "" +ifneq "$$($1_$2_INSTALL_INPLACE)" "NO" +$$($1_$2_INPLACE) : + $$(error $1_$2 is configuring, but trying to build $$($1_$2_INPLACE)") +endif endif -ifeq "$$($1_$2_DISABLE)" "YES" +else ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_or_later)" "YES" ifeq "$$(DEBUG)" "YES" -$$(warning $1/$2 disabled) +$$(warning $1/$2 build phase) endif -# The following code to build the package all depends on settings -# obtained from package-data.mk. If we don't have package-data.mk -# yet, then don't try to do anything else with this package. Make will -# try to build package-data.mk, then restart itself and we'll be in business. +ifeq "$$($1_$2_USES_CABAL)" "YES" +ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" +include $1/$2/package-data.mk +ifeq "$$($1_$2_VERSION)" "" +$$(error No version for $1_$2 found) +endif +endif +endif -$(call all-target,$1_$2,$1/$2/package-data.mk) +$(call all-target,$1,all_$1_$2) +$(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG)) -# We have a rule for package-data.mk only when the package is -# disabled, because we want the build to fail if we haven't run phase 0. -ifneq "$$(BINDIST)" "YES" -$(call build-package-data,$1,$2,$3) +# INPLACE_BIN might be empty if we're distcleaning +ifeq "$(findstring clean,$(MAKECMDGOALS))" "" +ifneq "$$($1_$2_INSTALL_INPLACE)" "NO" +$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/. + "$$(CP)" -p $$< $$@ + touch $$@ +endif endif else +ifeq "$$(DEBUG)" "YES" +$$(warning $1/$2 disabled phase) +endif + +# INPLACE_BIN might be empty if we're distcleaning +ifeq "$(findstring clean,$(MAKECMDGOALS))" "" +ifneq "$$($1_$2_INSTALL_INPLACE)" "NO" +$$($1_$2_INPLACE) : + $$(error $1_$2 is disabled, but trying to build $$($1_$2_INPLACE)") +endif +endif + +endif +######################################## + +$(call shell-wrapper,$1,$2) + +ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_done)" "YES" + ifneq "$$(BINDIST)" "YES" $1_$2_WAYS = v @@ -153,37 +214,15 @@ endif $1/$2/build/tmp/$$($1_$2_PROG) : $$(ALL_STAGE1_LIBS) $$(ALL_RTS_LIBS) $$(OTHER_LIBS) endif endif -endif - -ifeq "$$($1_$2_INSTALL_INPLACE)" "NO" -$(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG)) -else -# Where do we install the inplace version? -ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO" -$1_$2_INPLACE = $$(INPLACE_LIB)/$$($1_$2_PROG) -else -ifeq "$$($1_$2_TOPDIR)" "YES" -$1_$2_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG) -else -$1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) -endif -endif +ifneq "$$($1_$2_INSTALL_INPLACE)" "NO" $(call all-target,$1_$2,$$($1_$2_INPLACE)) -$(call clean-target,$1,$2_inplace,$$($1_$2_INPLACE)) - -# INPLACE_BIN might be empty if we're distcleaning -ifeq "$(findstring clean,$(MAKECMDGOALS))" "" -$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/. - "$$(CP)" -p $$< $$@ - touch $$@ endif +$(call clean-target,$1,$2_inplace,$$($1_$2_INPLACE)) # touch is necessary; cp doesn't update the file time. endif -$(call shell-wrapper,$1,$2) - ifeq "$$($1_$2_INSTALL)" "YES" ifeq "$$($1_$2_TOPDIR)" "YES" INSTALL_TOPDIRS += $1/$2/build/tmp/$$($1_$2_PROG) diff --git a/rules/docbook.mk b/rules/docbook.mk index 8488de1484..ebc37517be 100644 --- a/rules/docbook.mk +++ b/rules/docbook.mk @@ -25,10 +25,12 @@ $(call all-target,$1,) .PHONY: html_$1 +ifeq "$$(phase)" "" ifeq "$$(BUILD_DOCBOOK_HTML)" "YES" $(call all-target,$1,html_$1) INSTALL_HTML_DOC_DIRS += $1/$2 endif +endif html_$1 : $1/$2/index.html @@ -47,10 +49,12 @@ endif .PHONY: ps_$1 +ifeq "$$(phase)" "" ifeq "$$(BUILD_DOCBOOK_PS)" "YES" $(call all-target,$1,ps_$1) INSTALL_DOCS += $1/$2.ps endif +endif ps_$1 : $1/$2.ps @@ -60,10 +64,12 @@ $1/$2.ps: $$($1_DOCBOOK_SOURCES) [ -f $$@ ] endif +ifeq "$$(phase)" "" ifeq "$$(BUILD_DOCBOOK_PDF)" "YES" $(call all-target,$1,pdf_$1) INSTALL_DOCS += $1/$2.pdf endif +endif .PHONY: pdf_$1 pdf_$1 : $1/$2.pdf diff --git a/rules/package-config.mk b/rules/package-config.mk index fbed905aba..871fde6775 100644 --- a/rules/package-config.mk +++ b/rules/package-config.mk @@ -38,8 +38,8 @@ endif else $1_$2_ghc_ge_613 = YES $1_$2_HC_PKGCONF = -$1_$2_HC_CONFIG = $$(TOP)/$$(DUMMY_GHC_INPLACE) -$1_$2_HC_CONFIG_DEP = $$(DUMMY_GHC_INPLACE) +$1_$2_HC_CONFIG = $$(TOP)/$$(GHC_STAGE1) +$1_$2_HC_CONFIG_DEP = $$(GHC_STAGE1) $1_$2_GHC_PKG = $$(TOP)/$$(GHC_PKG_INPLACE) $1_$2_GHC_PKG_DEP = $$(GHC_PKG_INPLACE) $1_$2_GHC_PKG_OPTS = |