From 4a73af53332e94ca56a6faed96f8391c14ecfa18 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Thu, 28 Aug 2008 12:48:14 +0000 Subject: [PATCH] Update the build system to handle building and using haddock2 One side-effect of this is that we need to build the install-utils with stage2 rather than stage1 as we need the ghc package. --- Makefile | 5 +++-- compiler/Makefile | 4 +++- libraries/Makefile | 6 +----- libraries/gen_contents_index | 7 ++++--- mk/cabal-flags.mk | 4 ---- mk/cabal.mk | 10 +++++----- utils/Makefile | 23 ++++++++++++----------- utils/ghc-pkg/Makefile | 4 ++-- utils/installPackage/Makefile | 2 +- utils/installPackage/installPackage.hs | 2 ++ 10 files changed, 33 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 02d43d9..6946c4c 100644 --- a/Makefile +++ b/Makefile @@ -125,7 +125,6 @@ stage1 : $(GCC_LIB_DEP) check-all $(MAKE) -C rts boot $(MAKE) -C rts $(MAKE) -C libraries all - $(MAKE) -C utils with-stage-1 # When making distributions (i.e., whether with binary-dist or using the # vanilla install target to create an installer package), we can have problems @@ -137,8 +136,10 @@ stage1 : $(GCC_LIB_DEP) check-all stage2 : check-all $(MAKE) -C compiler stage=2 boot $(MAKE) -C compiler stage=2 + $(MAKE) -C utils with-stage-2 ifeq "$(HADDOCK_DOCS)" "YES" - $(MAKE) -C compiler stage=2 doc + $(MAKE) -C libraries doc + $(MAKE) -C compiler doc stage=2 endif stage3 : check-all diff --git a/compiler/Makefile b/compiler/Makefile index 67d4e3f..7056ae7 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -199,7 +199,9 @@ build.stage.%: $(MAKE) -C ../ghc stage=$* doc.stage.%: - $(CABAL) haddock --distpref dist-stage$* + $(CABAL) haddock --distpref dist-stage$* \ + --haddock-option=--optghc=-DSTAGE=$* \ + --with-haddock=$(FPTOOLS_TOP_ABS)/utils/haddock/install-inplace/bin/haddock # XXX We ought to actually install the (stage 2) library install: diff --git a/libraries/Makefile b/libraries/Makefile index 914c351..d33435e 100644 --- a/libraries/Makefile +++ b/libraries/Makefile @@ -197,10 +197,6 @@ endif all: build -ifeq "$(HADDOCK_DOCS)" "YES" -all: doc -endif - .PHONY: rebuild.library.% .PHONY: remake.library.% @@ -297,7 +293,7 @@ doc: $(foreach SUBDIR,$(DOC_SUBDIRS),doc.library.$(SUBDIR)) ifneq "$(HSCOLOUR)" "" CABAL_HADDOCK_FLAGS += --hyperlink-source endif -CABAL_HADDOCK_FLAGS += --with-haddock=$(FPTOOLS_ABS_TOP)/utils/haddock/install-inplace/bin/haddock +CABAL_HADDOCK_FLAGS += --with-haddock=$(FPTOOLS_TOP_ABS)/utils/haddock/install-inplace/bin/haddock $(foreach SUBDIR,$(DOC_SUBDIRS),doc.library.$(SUBDIR)):\ doc.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \ diff --git a/libraries/gen_contents_index b/libraries/gen_contents_index index 4ddb58a..8129beb 100644 --- a/libraries/gen_contents_index +++ b/libraries/gen_contents_index @@ -2,6 +2,7 @@ set -e +HADDOCK=../utils/haddock/install-inplace/bin/haddock HADDOCK_ARGS= NAMES= @@ -22,9 +23,9 @@ do done # Now create the combined contents and index pages -haddock --gen-index --gen-contents -o . \ - -t "Haskell Hierarchical Libraries" \ - $HADDOCK_ARGS +$HADDOCK --gen-index --gen-contents -o . \ + -t "Haskell Hierarchical Libraries" \ + $HADDOCK_ARGS # Unhandled Windows help stuff?: diff --git a/mk/cabal-flags.mk b/mk/cabal-flags.mk index b50702d..4144f25 100644 --- a/mk/cabal-flags.mk +++ b/mk/cabal-flags.mk @@ -29,10 +29,6 @@ ifneq "$(ALEX)" "" COMMON_CONFIGURE_FLAGS += --with-alex=$(ALEX) endif -ifneq "$(HADDOCK)" "" -COMMON_CONFIGURE_FLAGS += --with-haddock=$(HADDOCK) -endif - ifneq "$(HAPPY)" "" COMMON_CONFIGURE_FLAGS += --with-happy=$(HAPPY) endif diff --git a/mk/cabal.mk b/mk/cabal.mk index 079f803..8c486a9 100644 --- a/mk/cabal.mk +++ b/mk/cabal.mk @@ -14,14 +14,14 @@ INSTALL_FLAGS = endif endif -# Tell stage1 to make a dynamically-linked binary, but no wrapper. We assume +# Tell stage2 to make a dynamically-linked binary, but no wrapper. We assume # that in an installation the shared libs will be installed somewhere that # the system can find them. ifeq "$(BuildSharedLibs)" "YES" DYN_FLAGS = --ghc-option=-dynamic --ghc-option=-dynload --ghc-option=deploy endif -.PHONY: default all with-bootstrapping-compiler with-stage-1 clean distclean +.PHONY: default all with-bootstrapping-compiler with-stage-2 clean distclean default all: with-bootstrapping-compiler @@ -34,12 +34,12 @@ with-bootstrapping-compiler: $(CABAL) build --distpref dist-inplace $(BUILD_FLAGS) $(CABAL) install --distpref dist-inplace $(INSTALL_FLAGS) -with-stage-1: +with-stage-2: $(CABAL) configure --distpref dist-install \ $(INSTALL_DIRS_CONFIGURE_FLAGS) \ - $(USE_STAGE1_CONFIGURE_FLAGS) \ + $(USE_STAGE2_CONFIGURE_FLAGS) \ $(COMMON_CONFIGURE_FLAGS) \ - $(EXTRA_STAGE1_CONFIGURE_FLAGS) + $(EXTRA_STAGE2_CONFIGURE_FLAGS) $(CABAL) build --distpref dist-install $(DYN_FLAGS) $(BUILD_FLAGS) install: diff --git a/utils/Makefile b/utils/Makefile index 06fa262..ab7f6ba 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -52,15 +52,15 @@ endif WITH_BOOTSTRAPPING_COMPILER = installPackage ghc-pkg hsc2hs hpc -WITH_STAGE1 = installPackage ghc-pkg hasktags runghc hpc pwd haddock +WITH_STAGE2 = installPackage ghc-pkg hasktags runghc hpc pwd haddock ifneq "$(NO_INSTALL_HSC2HS)" "YES" -WITH_STAGE1 += hsc2hs +WITH_STAGE2 += hsc2hs endif # sort removes duplicates - we don't actually care about the order -WITH_EITHER = $(sort $(WITH_BOOTSTRAPPING_COMPILER) $(WITH_STAGE1)) +WITH_EITHER = $(sort $(WITH_BOOTSTRAPPING_COMPILER) $(WITH_STAGE2)) -binary-dist: $(foreach P,$(WITH_STAGE1),binary-dist.$P) +binary-dist: $(foreach P,$(WITH_STAGE2),binary-dist.$P) ifeq "$(WHERE_AM_I)" "" echo "I don't know where I am" >&2 exit 1 @@ -75,9 +75,10 @@ distclean:: $(foreach P,$(WITH_EITHER),distclean.$P) with-bootstrapping-compiler: \ $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P) -with-stage-1: $(foreach P,$(WITH_STAGE1),with-stage-1.$P) +with-stage-2: $(foreach P,$(WITH_STAGE2),with-stage-2.$P) + $(MAKE) -C haddock install-inplace -install:: $(foreach P,$(WITH_STAGE1),install.$P) +install:: $(foreach P,$(WITH_STAGE2),install.$P) $(foreach P,$(WITH_EITHER),clean.$P): \ clean.%: @@ -91,15 +92,15 @@ $(foreach P,$(WITH_BOOTSTRAPPING_COMPILER),with-bootstrapping-compiler.$P): \ with-bootstrapping-compiler.%: $(MAKE) -C $* with-bootstrapping-compiler -$(foreach P,$(WITH_STAGE1),with-stage-1.$P): \ -with-stage-1.%: - $(MAKE) -C $* with-stage-1 +$(foreach P,$(WITH_STAGE2),with-stage-2.$P): \ +with-stage-2.%: + $(MAKE) -C $* with-stage-2 -$(foreach P,$(WITH_STAGE1),install.$P): \ +$(foreach P,$(WITH_STAGE2),install.$P): \ install.%: $(MAKE) -C $* install -$(foreach P,$(WITH_STAGE1),binary-dist.$P): \ +$(foreach P,$(WITH_STAGE2),binary-dist.$P): \ binary-dist.%: $(MAKE) -C $* binary-dist WHERE_AM_I=$(WHERE_AM_I)/$* diff --git a/utils/ghc-pkg/Makefile b/utils/ghc-pkg/Makefile index 0783d3f..632e02c 100644 --- a/utils/ghc-pkg/Makefile +++ b/utils/ghc-pkg/Makefile @@ -3,13 +3,13 @@ TOP=../.. ENABLE_SHELL_WRAPPERS = YES EXTRA_CLEAN = Version.hs EXTRA_INPLACE_CONFIGURE_FLAGS = $(INPLACE_GHC_DATADIR_CONFIGURE_FLAGS) -EXTRA_STAGE1_CONFIGURE_FLAGS = --datasubdir=. +EXTRA_STAGE2_CONFIGURE_FLAGS = --datasubdir=. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/cabal.mk with-bootstrapping-compiler: Version.hs -with-stage-1: Version.hs +with-stage-2: Version.hs Version.hs: Makefile $(TOP)/mk/config.mk $(RM) -f Version.hs diff --git a/utils/installPackage/Makefile b/utils/installPackage/Makefile index b5659f9..e963060 100644 --- a/utils/installPackage/Makefile +++ b/utils/installPackage/Makefile @@ -4,6 +4,6 @@ include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/cabal.mk # We should stop installPackage being installed itself, but we do need -# to build it with the stage1 compiler as we need to use it when +# to build it with the stage2 compiler as we need to use it when # installing. diff --git a/utils/installPackage/installPackage.hs b/utils/installPackage/installPackage.hs index 2c3d245..9ec7282 100644 --- a/utils/installPackage/installPackage.hs +++ b/utils/installPackage/installPackage.hs @@ -59,11 +59,13 @@ doInstall verbosity distPref enableShellWrappers strip do let userHooks = simpleUserHooks copyto = if null destdir then NoCopyDest else CopyTo destdir copyFlags = defaultCopyFlags { + copyDistPref = toFlag distPref, copyUseWrapper = toFlag enableShellWrappers, copyDest = toFlag copyto, copyVerbosity = toFlag verbosity } registerFlags = defaultRegisterFlags { + regDistPref = toFlag distPref, regPackageDB = toFlag GlobalPackageDB, regVerbosity = toFlag verbosity, regGenScript = toFlag $ False, -- 1.7.10.4