diff options
author | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2008-02-18 06:18:09 +0000 |
---|---|---|
committer | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2008-02-18 06:18:09 +0000 |
commit | 3e2748164e3e2e2dc21ca511959671f0f5f2e37f (patch) | |
tree | 83bad04ee4581aa0ba12b7ef3d3a074f5334550b | |
parent | 82dc0d197b39b6462d1a19e4c556f7acdf376ee9 (diff) | |
download | haskell-3e2748164e3e2e2dc21ca511959671f0f5f2e37f.tar.gz |
All installed Haskell prgms have an inplace and an installed version
- GHC installs a range of compiled Haskell programs in addition to the actual
compiler. To ensure that they all run on the platform targeted by the build
(which may have different libraries installed than the build host), we need
to make sure that all compiled Haskell code going into an install is build
with the stage 1 compiler, not the bootstrap compiler. Getting this right
is especially important on the Mac to enable builds that work on Mac OS X
versions that are older than the one performing the build.
- For all installed utils implemented in Haskell (i.e., ghc-pkg, hasktags,
hsc2hs, runghc, hpc, and pwd) we compile two versions, an inplace version
and a version for installation. The former is build by the bootstrap
compiler during the stage 1 build and the latter is build by the stage 1
compiler during the stage 2 build.
- This is really very much as the setup for ghc itself, only that we don't use
separate stage1/ and stage2/ build directories. Instead, we clean before
each build. CAVEAT: This only works properly if invoked from the
toplevel Makefile.
- Instead of UseStage1=YES (as used by the previous binary-dist-specific
recompilation), we now use the same $(stage) variables as used for the
compiler proper - to increase uniformity and to avoid extra conditionals for
the install target.
-rw-r--r-- | Makefile | 30 | ||||
-rw-r--r-- | libraries/Makefile | 4 | ||||
-rw-r--r-- | mk/config.mk.in | 3 | ||||
-rw-r--r-- | utils/ghc-pkg/Makefile | 8 | ||||
-rw-r--r-- | utils/hasktags/Makefile | 8 | ||||
-rw-r--r-- | utils/hpc/Makefile | 6 | ||||
-rw-r--r-- | utils/hsc2hs/Makefile | 9 | ||||
-rw-r--r-- | utils/pwd/Makefile | 8 | ||||
-rw-r--r-- | utils/runghc/Makefile | 8 |
9 files changed, 63 insertions, 21 deletions
@@ -98,6 +98,7 @@ endif endif stage1 : $(GCC_LIB_DEP) check-packages + $(MAKE) -C utils mostlyclean $(MAKE) -C utils/mkdependC boot @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \ for i in $(SUBDIRS_BUILD); do \ @@ -119,9 +120,23 @@ stage1 : $(GCC_LIB_DEP) check-packages $(MAKE) -C libraries boot $(MAKE) -C libraries all +# When making distributions (i.e., whether with binary-dist or using the +# vanilla install target to create an installer package), we can have problems +# if some things (e.g. ghc-pkg) are compiled with the bootstrapping compiler +# and some (e.g. the stage 2 compiler) with the stage1 compiler. See #1860 for +# an example. Thus, we explicitly build a second version with the stage 1 +# compiler of all utils that get installed and of all extra support binaries +# includes in binary dists. stage2 : check-packages + $(MAKE) -C utils mostlyclean + $(MAKE) -C utils stage=2 $(MAKE) -C compiler boot stage=2 $(MAKE) -C compiler stage=2 + $(RM) -f libraries/ifBuildable/ifBuildable + $(MAKE) -C libraries stage=2 ifBuildable/ifBuildable + $(RM) -f libraries/installPackage/installPackage + $(MAKE) -C libraries stage=2 installPackage/installPackage + stage3 : check-packages $(MAKE) -C compiler boot stage=3 @@ -259,21 +274,6 @@ binary-dist:: -rm -rf $(BIN_DIST_DIR) -$(RM) $(BIN_DIST_TARBALL) -# When making bindists, we can have problems if some things (e.g. ghc-pkg) -# are compiled with the bootstrapping compiler and some (e.g. the stage 2 -# compiler) with the stage1 compiler. See #1860 for an example. -# Thus we rebuild the utils with stage 1 here. This is a bit unpleasant, -# as binary-dist really shouldn't actually build anything, but it works. -# We need to do the same for utilities used during library package installation. -binary-dist:: - $(MAKE) -C utils clean - $(MAKE) -C utils UseStage1=YES boot - $(MAKE) -C utils UseStage1=YES - $(RM) -f libraries/ifBuildable/ifBuildable - $(MAKE) -C libraries UseStage1=YES ifBuildable/ifBuildable - $(RM) -f libraries/installPackage/installPackage - $(MAKE) -C libraries UseStage1=YES installPackage/installPackage - ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" binary-dist:: diff --git a/libraries/Makefile b/libraries/Makefile index 60418f1473..9a8cd40749 100644 --- a/libraries/Makefile +++ b/libraries/Makefile @@ -173,7 +173,7 @@ installPackage/installPackage: installPackage.hs $(BOOTSTRAP_STAMPS) -$(RM) -rf installPackage mkdir installPackage $(CP) installPackage.hs installPackage/ -ifeq "$(UseStage1)" "YES" +ifeq "$(stage)" "2" cd installPackage && ../$(HC) -Wall -cpp \ --make installPackage -o installPackage \ $(BOOTSTRAP_INC_1_UP) @@ -190,7 +190,7 @@ ifBuildable/ifBuildable: ifBuildable.hs -$(RM) -rf ifBuildable mkdir ifBuildable $(CP) ifBuildable.hs ifBuildable/ -ifeq "$(UseStage1)" "YES" +ifeq "$(stage)" "2" cd ifBuildable && ../$(HC) -Wall --make ifBuildable -o ifBuildable else cd ifBuildable && $(GHC) -Wall --make ifBuildable -o ifBuildable diff --git a/mk/config.mk.in b/mk/config.mk.in index fc26319e81..65d3aaa91c 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -864,6 +864,9 @@ GHC_STAGE3 = $(GHC_COMPILER_DIR)/stage3/ghc-inplace -no-user-package-conf # installed for this GHC version. They are bound to be incompatible # with the packages we built in the tree. +ifeq "$(stage)" "2" + UseStage1 = YES +endif ifneq "$(findstring YES, $(UseStage1) $(BootingFromHc))" "" # We are using the stage1 compiler to compile Haskell code, set up diff --git a/utils/ghc-pkg/Makefile b/utils/ghc-pkg/Makefile index 9cb2a598e6..383524a6fd 100644 --- a/utils/ghc-pkg/Makefile +++ b/utils/ghc-pkg/Makefile @@ -35,9 +35,17 @@ INSTALL_PROGS += $(HS_PROG) EXCLUDE_SRCS += CRT_noglob.c NOGLOB_O = CRT_noglob.o else + +# We have two version: the inplace version compiled by the bootstrap compiler +# and the install version compiled by the stage 1 compiler +ifeq "$(stage)" "2" HS_PROG = ghc-pkg.bin +else +HS_PROG = ghc-pkg-inplace.bin +endif INSTALL_LIBEXECS += $(HS_PROG) NOGLOB_O = + endif # ----------------------------------------------------------------------------- diff --git a/utils/hasktags/Makefile b/utils/hasktags/Makefile index 471b339daa..aa81c13093 100644 --- a/utils/hasktags/Makefile +++ b/utils/hasktags/Makefile @@ -1,7 +1,13 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk -HS_PROG = hasktags +# We have two version: the inplace version compiled by the bootstrap compiler +# and the install version compiled by the stage 1 compiler +ifeq "$(stage)" "2" +HS_PROG = hasktags +else +HS_PROG = hasktags-inplace +endif CLEAN_FILES += Main.hi diff --git a/utils/hpc/Makefile b/utils/hpc/Makefile index 17065fa081..a59aa091fb 100644 --- a/utils/hpc/Makefile +++ b/utils/hpc/Makefile @@ -1,7 +1,13 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk +# We have two version: the inplace version compiled by the bootstrap compiler +# and the install version compiled by the stage 1 compiler +ifeq "$(stage)" "2" HS_PROG = hpc$(exeext) +else +HS_PROG = hpc-inplace$(exeext) +endif INSTALL_PROGS += $(HS_PROG) HPC_LIB = $(TOP)/libraries/hpc diff --git a/utils/hsc2hs/Makefile b/utils/hsc2hs/Makefile index de8d64f06b..ca3fcd0220 100644 --- a/utils/hsc2hs/Makefile +++ b/utils/hsc2hs/Makefile @@ -13,7 +13,14 @@ include $(GHC_COMPAT_DIR)/compat.mk # we must also build with $(GhcHcOpts) here: SRC_HC_OPTS += $(GhcHcOpts) $(GhcStage1HcOpts) -HS_PROG = hsc2hs-bin +# We have two version: the inplace version compiled by the bootstrap compiler +# and the install version compiled by the stage 1 compiler +ifeq "$(stage)" "2" +HS_PROG = hsc2hs.bin +else +HS_PROG = hsc2hs-inplace.bin +endif + ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" HS_PROG = hsc2hs$(exeext) endif diff --git a/utils/pwd/Makefile b/utils/pwd/Makefile index f8fea4542a..c753ae889f 100644 --- a/utils/pwd/Makefile +++ b/utils/pwd/Makefile @@ -1,7 +1,13 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk -HS_PROG=pwd +# We have two version: the inplace version compiled by the bootstrap compiler +# and the install version compiled by the stage 1 compiler +ifeq "$(stage)" "2" +HS_PROG = pwd +else +HS_PROG = pwd-inplace +endif binary-dist: $(INSTALL_DIR) $(BIN_DIST_DIR)/utils/pwd diff --git a/utils/runghc/Makefile b/utils/runghc/Makefile index a7303f97d7..654ffad6dc 100644 --- a/utils/runghc/Makefile +++ b/utils/runghc/Makefile @@ -1,7 +1,13 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk -HS_PROG = runghc$(exeext) +# We have two version: the inplace version compiled by the bootstrap compiler +# and the install version compiled by the stage 1 compiler +ifeq "$(stage)" "2" +HS_PROG = runghc$(exeext) +else +HS_PROG = runghc-inplace$(exeext) +endif INSTALL_PROGS += $(HS_PROG) UseGhcForCc = YES |