summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg/ghc.mk
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-02-16 15:39:32 +0000
committerIan Lynagh <ian@well-typed.com>2013-02-16 16:23:51 +0000
commitac5a314504554ddef0e855ef9e2fcf51e961f4a6 (patch)
treef1cbca12d13992189769fd0d41ab21e336ff80b4 /utils/ghc-pkg/ghc.mk
parent4c821f0cf512ca5f6aa65113e9302e5982b53b1a (diff)
downloadhaskell-ac5a314504554ddef0e855ef9e2fcf51e961f4a6.tar.gz
Build the stage0 ghc-pkg with Cabal
This solves the problem of how to define MIN_VERSION_base for the binary package. Also fixed a couple of build system bugs along the way.
Diffstat (limited to 'utils/ghc-pkg/ghc.mk')
-rw-r--r--utils/ghc-pkg/ghc.mk69
1 files changed, 13 insertions, 56 deletions
diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
index d904c48d11..fac39e8d5e 100644
--- a/utils/ghc-pkg/ghc.mk
+++ b/utils/ghc-pkg/ghc.mk
@@ -15,60 +15,6 @@
utils/ghc-pkg_dist_PROG = ghc-pkg$(exeext)
-ifeq "$(BootingFromHc)" "YES"
-
-inplace/bin/ghc-pkg : utils/ghc-pkg/dist-install/build/tmp/$(utils/ghc-pkg_dist_PROG)$(exeext)
-ifeq "$(Windows)" "YES"
- cp $< $@
-else
- $(call removeFiles,$@)
- echo "#!/bin/sh" >>$@
- echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
- echo '$(TOP)/$< --global-package-db $$PKGCONF $${1+"$$@"}' >> $@
- chmod +x $@
-endif
-
-else
-
-$(GHC_PKG_INPLACE) : utils/ghc-pkg/dist/build/tmp/$(utils/ghc-pkg_dist_PROG)$(exeext) | $$(dir $$@)/. $(INPLACE_PACKAGE_CONF)/.
- $(call removeFiles,$(wildcard $(INPLACE_PACKAGE_CONF)/*))
-ifeq "$(Windows)" "YES"
- cp $< $@
-else
- $(call removeFiles,$@)
- echo "#!/bin/sh" >>$@
- echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
- echo '$(TOP)/$< --global-package-db $$PKGCONF $${1+"$$@"}' >> $@
- chmod +x $@
-endif
-
-endif
-
-# depend on ghc-cabal, otherwise we build Cabal twice when building in parallel.
-# (ghc-cabal is an order-only dependency, we don't need to rebuild ghc-pkg
-# if ghc-cabal is newer).
-# The binary package is not warning-clean, so we need a few -fno-warns here.
-#
-# ToDo: we might want to do this using ghc-cabal instead.
-#
-utils/ghc-pkg/dist/build/tmp/$(utils/ghc-pkg_dist_PROG)$(exeext): utils/ghc-pkg/Main.hs utils/ghc-pkg/dist/build/Version.hs | bootstrapping/. $$(dir $$@)/. $(GHC_CABAL_INPLACE)
- "$(GHC)" $(SRC_HC_OPTS) --make utils/ghc-pkg/Main.hs -o $@ \
- -no-user-$(GHC_PACKAGE_DB_FLAG) \
- -Wall -fno-warn-unused-imports -fno-warn-warnings-deprecations \
- $(SRC_HC_WARNING_OPTS) \
- -DCABAL_VERSION=$(CABAL_VERSION) \
- -DBOOTSTRAPPING \
- -odir bootstrapping \
- -hidir bootstrapping \
- -iutils/ghc-pkg \
- -iutils/ghc-pkg/dist/build \
- -ilibraries/Cabal/Cabal \
- -ilibraries/filepath \
- -ilibraries/hpc \
- -ilibraries/binary/src \
- -ilibraries/bin-package-db
-
-
utils/ghc-pkg/dist/build/Version.hs \
utils/ghc-pkg/dist-install/build/Version.hs: mk/project.mk | $$(dir $$@)/.
$(call removeFiles,$@)
@@ -78,7 +24,7 @@ utils/ghc-pkg/dist-install/build/Version.hs: mk/project.mk | $$(dir $$@)/.
echo "targetOS = \"$(TargetOS_CPP)\"" >> $@
echo "targetARCH = \"$(TargetArch_CPP)\"" >> $@
-$(eval $(call clean-target,utils/ghc-pkg,dist,utils/ghc-pkg/dist))
+utils/ghc-pkg_PACKAGE = ghc-pkg
# -----------------------------------------------------------------------------
# Cross-compile case: install our dist version
@@ -96,13 +42,24 @@ $(eval $(call shell-wrapper,utils/ghc-pkg,dist))
endif
+utils/ghc-pkg_dist_USES_CABAL = YES
+utils/ghc-pkg_dist_PROG = ghc-pkg
+utils/ghc-pkg_dist_SHELL_WRAPPER = YES
+utils/ghc-pkg_dist_INSTALL_INPLACE = YES
+
+$(eval $(call build-prog,utils/ghc-pkg,dist,0))
+
+$(GHC_PKG_INPLACE) : | $(INPLACE_PACKAGE_CONF)/.
+
+utils/ghc-pkg/dist/package-data.mk: \
+ utils/ghc-pkg/dist/build/Version.hs
+
# -----------------------------------------------------------------------------
# Normal case: Build ghc-pkg with stage 1 and install it
ifneq "$(Stage1Only)" "YES"
utils/ghc-pkg_dist-install_USES_CABAL = YES
-utils/ghc-pkg_PACKAGE = ghc-pkg
utils/ghc-pkg_dist-install_PROG = ghc-pkg
utils/ghc-pkg_dist-install_SHELL_WRAPPER = YES