Commit 104ff6e9 authored by ian@well-typed.com's avatar ian@well-typed.com

Change how the build system handles packages

This makes the build system a little simpler, and in particular
will make it easier to handle the changes needed for cross-compilation.
parent 458c653a
......@@ -131,8 +131,9 @@ 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},\$(PKGS_THAT_BUILD_WITH_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n";
print GHCMK "\$(eval \$(call build-package,${package},dist-install,\$(if \$(filter ${dir},\$(PKGS_THAT_BUILD_WITH_STAGE2)),2,1)))\n";
print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n";
print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE1)),\$(eval \$(call build-package,${package},dist-install,1)))\n";
print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE2)),\$(eval \$(call build-package,${package},dist-install,2)))\n";
close GHCMK
or die "Closing $package/ghc.mk failed: $!";
......
......@@ -409,10 +409,6 @@ compiler_stage1_REGISTER_PACKAGE = NO
endif
# haddocking only happens for stage2
compiler_stage1_DO_HADDOCK = NO
compiler_stage3_DO_HADDOCK = NO
# Don't do splitting for the GHC package, it takes too long and
# there's not much benefit.
compiler_stage1_SplitObjs = NO
......
This diff is collapsed.
......@@ -315,10 +315,7 @@ SplitObjs=$(SupportsSplitObjs)
# ----------------------------------------------------------------------------
# Package-related things
# Extra packages to add to the build, in dependency order
EXTRA_PACKAGES =
# Whether to install $(EXTRA_PACKAGES)
# Whether to install the extra packages
InstallExtraPackages = NO
# Run "ghc-pkg check" on each package
......
# -----------------------------------------------------------------------------
#
# (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
#
# -----------------------------------------------------------------------------
# For each package P marked as "dph" or "extra" in $(TOP)/packages:
# if $(TOP)/libraries/P exists, then
# if $(TOP)/libraries/P/ghc-packages exists, then
# * add each package from $(TOP)/libraries/P/ghc-packages2 to the list of
# packages.
# Note: ghc-packages2 might have a different list from
# ghc-packages, this is to support dph which has some
# packages that are automatically derived from a single
# source by the build system).
# * add $(TOP)/libraries/P to $(BUILD_DIRS)
# This step is necessary in the case of dph, which has some
# build system code in libraries/dph/ghc.mk, but
# libraries/dph is not itself a package.
# else
# add P to the list of packages
define extra-packages
# Collects some dirs containing ghc.mk files that we need to include:
BUILD_DIRS_EXTRA=
$$(foreach p,$$(patsubst libraries/%,%,$$(wildcard $$(shell grep '^[^ #][^ ]* \+\(dph\|extra\) \+[^ ]\+ \+[^ ]\+$$$$' packages | sed 's/ .*//'))),\
$$(if $$(wildcard libraries/$$p/ghc-packages),\
$$(eval BUILD_DIRS_EXTRA += libraries/$$p) \
$$(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
$(call trace, extra-package($1,$2))
EXTRA_PACKAGES += $2
$$(eval $$(call addPackage,$2))
endef
# -----------------------------------------------------------------------------
#
# (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
#
# -----------------------------------------------------------------------------
# For each line in $(TOP)/packages:
# libraries/foo tag ...
# this calls
# $(call $1,foo,tag)
#
# Except! If there's a libraries/foo/ghc-packages then it calls
# $(call $1,foo/bar,tag)
# for each word 'bar' in libraries/foo/ghc-packages.
#
# We use an FEL_ prefix for the variable names, to avoid trampling on
# other variables, as make has no concept of local variables.
# We need to handle bin-package-db specially, as it doesn't have an
# entry in the packages file, as it isn't in its own repository.
define foreachLibrary
# $1 = function to call for each library
# We will give it the package path and the tag as arguments
$$(foreach hashline,libraries/bin-package-db#-#no-remote-repo#no-vcs \
$$(shell grep '^libraries/' packages | sed 's/ */#/g'),\
$$(eval FEL_line := $$(subst #,$$(space),$$(hashline))) \
$$(eval FEL_libdir := $$(word 1,$$(FEL_line))) \
$$(eval FEL_tag := $$(word 2,$$(FEL_line))) \
$$(eval FEL_libroot := $$(patsubst libraries/%,%,$$(FEL_libdir))) \
$$(if $$(wildcard $$(FEL_libdir)/ghc-packages), \
$$(foreach lib,$$(shell cat $$(FEL_libdir)/ghc-packages), \
$$(eval $$(call $1,$$(FEL_libroot)/$$(lib),$$(FEL_tag)))), \
$$(if $$(wildcard $$(FEL_libdir)/), \
$$(eval $$(call $1,$$(FEL_libroot),$$(FEL_tag))))))
endef
......@@ -15,7 +15,7 @@ define haddock # args: $1 = dir, $2 = distdir
$(call trace, haddock($1,$2))
$(call profStart, haddock($1,$2))
ifneq "$$($1_$2_DO_HADDOCK)" "NO"
ifeq "$$($1_$2_DO_HADDOCK)" "YES"
ifeq "$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE)" ""
$$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE = $1/$2/doc/html/$$($1_PACKAGE)/$$($1_PACKAGE).haddock
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment