From: Ian Lynagh Date: Sun, 21 Nov 2010 18:35:20 +0000 (+0000) Subject: For bindists, build ghc-pwd with stage 1 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=6bb8d64a971afce310df3349e8767b790c2845ee For bindists, build ghc-pwd with stage 1 rather then the bootstrapping compiler. This fixes problems where the bootstrapping compiler dynamically links against libraries not on the target machine. --- diff --git a/aclocal.m4 b/aclocal.m4 index 9ebfe7d..c50d348 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1280,43 +1280,49 @@ fi # Calculate absolute path to build tree # -------------------------------------------------------------- -AC_DEFUN([FP_FIND_ROOT],[ -AC_MSG_CHECKING(for path to top of build tree) +AC_DEFUN([FP_INTREE_GHC_PWD],[ +AC_MSG_NOTICE(Building in-tree ghc-pwd) + dnl This would be + dnl make -C utils/ghc-pwd clean && make -C utils/ghc-pwd + dnl except we don't want to have to know what make is called. Sigh. + rm -rf utils/ghc-pwd/dist-boot + mkdir utils/ghc-pwd/dist-boot + if ! "$WithGhc" -v0 -no-user-package-conf -hidir utils/ghc-pwd/dist-boot -odir utils/ghc-pwd/dist-boot -stubdir utils/ghc-pwd/dist-boot --make utils/ghc-pwd/Main.hs -o utils/ghc-pwd/dist-boot/ghc-pwd + then + AC_MSG_ERROR([Building ghc-pwd failed]) + fi -dnl This would be -dnl make -C utils/ghc-pwd clean && make -C utils/ghc-pwd -dnl except we don't want to have to know what make is called. Sigh. -if test ! -f utils/ghc-pwd/ghc-pwd && test ! -f utils/ghc-pwd/ghc-pwd.exe; then - cd utils/ghc-pwd - rm -f *.o - rm -f *.hi - rm -f ghc-pwd - rm -f ghc-pwd.exe - "$WithGhc" -v0 -no-user-package-conf --make ghc-pwd -o ghc-pwd - cd ../.. -fi + GHC_PWD=utils/ghc-pwd/dist-boot/ghc-pwd +]) -hardtop=`utils/ghc-pwd/ghc-pwd` +AC_DEFUN([FP_BINDIST_GHC_PWD],[ + GHC_PWD=utils/ghc-pwd/dist/build/tmp/ghc-pwd +]) -if ! test -d "$hardtop"; then - AC_MSG_ERROR([cannot determine current directory]) -fi +AC_DEFUN([FP_FIND_ROOT],[ +AC_MSG_CHECKING(for path to top of build tree) + hardtop=`$GHC_PWD` -dnl Remove common automounter nonsense -dnl -hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|'` + dnl Remove common automounter nonsense + hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|'` -AC_SUBST(hardtop) + if ! test -d "$hardtop"; then + AC_MSG_ERROR([cannot determine current directory]) + fi -AC_MSG_RESULT(${hardtop}) + dnl We don't support building in directories with spaces. + case "$hardtop" in + *' '*) + AC_MSG_ERROR([ + The build system does not support building in a directory + containing space characters. + Suggestion: move the build tree somewhere else.]) + ;; + esac -# We don't support building in directories with spaces. -case "$hardtop" in - *' '*) AC_MSG_ERROR([ - The build system does not support building in a directory containing - space characters. Suggestion: move the build tree somewhere else.]) - ;; -esac + AC_SUBST(hardtop) + + AC_MSG_RESULT($hardtop) ]) # GHC_CONVERT_CPU(cpu, target_var) diff --git a/configure.ac b/configure.ac index e878dbd..b09c5a7 100644 --- a/configure.ac +++ b/configure.ac @@ -385,6 +385,7 @@ AC_PATH_PROGS(NHC,nhc nhc98) AC_PATH_PROG(HBC,hbc) # This uses GHC, so put it after the "GHC is required" check above: +FP_INTREE_GHC_PWD FP_FIND_ROOT if test "$HostOS" = "mingw32" diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 1879fd1..677a249 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -6,6 +6,7 @@ dnl AC_INIT([The Glorious Glasgow Haskell Compilation System], [@ProjectVersion@], [glasgow-haskell-bugs@haskell.org], [ghc]) +FP_BINDIST_GHC_PWD FP_FIND_ROOT BootingFromHc=NO diff --git a/ghc.mk b/ghc.mk index 5ae123a..1fd8509 100644 --- a/ghc.mk +++ b/ghc.mk @@ -435,6 +435,7 @@ ghc/stage2/package-data.mk: compiler/stage2/package-data.mk # package-data.mk is sufficient, as that in turn depends on all the # libraries utils/haddock/dist/package-data.mk: compiler/stage2/package-data.mk +utils/ghc-pwd/dist/package-data.mk: compiler/stage2/package-data.mk utils/ghc-pkg/dist-install/package-data.mk: compiler/stage2/package-data.mk utils/hsc2hs/dist-install/package-data.mk: compiler/stage2/package-data.mk @@ -598,10 +599,6 @@ BUILD_DIRS += \ $(GHC_GENAPPLY_DIR) endif -BUILD_DIRS += \ - utils/haddock \ - utils/haddock/doc - ifneq "$(CLEANING)" "YES" BUILD_DIRS += \ $(patsubst %, libraries/%, $(PACKAGES)) @@ -612,11 +609,14 @@ BUILD_DIRS += libraries/integer-gmp/gmp endif BUILD_DIRS += \ + utils/haddock \ + utils/haddock/doc \ compiler \ $(GHC_HSC2HS_DIR) \ $(GHC_PKG_DIR) \ utils/testremove \ utils/ghctags \ + utils/ghc-pwd \ utils/hpc \ utils/runghc \ ghc @@ -664,6 +664,7 @@ utils/ghctags_dist_DISABLE = YES utils/hpc_dist_DISABLE = YES utils/hsc2hs_dist-install_DISABLE = YES utils/ghc-pkg_dist-install_DISABLE = YES +utils/ghc-pwd_dist_DISABLE = YES utils/mkUserGuidePart_dist_DISABLE = YES utils/compare_sizes_dist_DISABLE = YES compiler_stage2_DISABLE = YES @@ -985,7 +986,7 @@ $(eval $(call bindist,.,\ mk/config.mk.in \ $(INPLACE_BIN)/mkdirhier \ $(INPLACE_BIN)/ghc-cabal \ - utils/ghc-pwd/ghc-pwd \ + utils/ghc-pwd/dist/build/tmp/ghc-pwd \ $(BINDIST_WRAPPERS) \ $(BINDIST_PERL_SOURCES) \ $(BINDIST_LIBS) \ @@ -1199,10 +1200,6 @@ sdist_%: .PHONY: clean -CLEAN_FILES += utils/ghc-pwd/ghc-pwd -CLEAN_FILES += utils/ghc-pwd/ghc-pwd.exe -CLEAN_FILES += utils/ghc-pwd/ghc-pwd.hi -CLEAN_FILES += utils/ghc-pwd/ghc-pwd.o CLEAN_FILES += libraries/bootstrapping.conf CLEAN_FILES += libraries/integer-gmp/cbits/GmpDerivedConstants.h CLEAN_FILES += libraries/integer-gmp/cbits/mkGmpDerivedConstants @@ -1256,6 +1253,7 @@ distclean : clean "$(RM)" $(RM_OPTS) libraries/process/include/HsProcessConfig.h "$(RM)" $(RM_OPTS) libraries/unix/include/HsUnixConfig.h "$(RM)" $(RM_OPTS) libraries/old-time/include/HsTimeConfig.h + "$(RM)" $(RM_OPTS_REC) utils/ghc-pwd/dist "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.log, $(PACKAGES) $(PACKAGES_STAGE2)) "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.status, $(PACKAGES) $(PACKAGES_STAGE2)) diff --git a/utils/ghc-pwd/ghc-pwd.hs b/utils/ghc-pwd/Main.hs similarity index 100% rename from utils/ghc-pwd/ghc-pwd.hs rename to utils/ghc-pwd/Main.hs diff --git a/utils/ghc-pwd/ghc-pwd.cabal b/utils/ghc-pwd/ghc-pwd.cabal index a7908fb..8fae857 100644 --- a/utils/ghc-pwd/ghc-pwd.cabal +++ b/utils/ghc-pwd/ghc-pwd.cabal @@ -11,14 +11,8 @@ Description: build-type: Simple cabal-version: >=1.2 -Flag base3 - Description: Choose the new smaller, split-up base package. - Executable ghc-pwd Main-Is: ghc-pwd.hs - if flag(base3) - Build-Depends: base >= 3 && < 5, - directory >= 1 && < 1.1 - else - Build-Depends: base < 3 + Build-Depends: base >= 3 && < 5, + directory >= 1 && < 1.2 diff --git a/utils/ghc-pwd/ghc.mk b/utils/ghc-pwd/ghc.mk new file mode 100644 index 0000000..29f74e8 --- /dev/null +++ b/utils/ghc-pwd/ghc.mk @@ -0,0 +1,7 @@ + +utils/ghc-pwd_USES_CABAL = YES +utils/ghc-pwd_PACKAGE = ghc-pwd +utils/ghc-pwd_dist_PROG = ghc-pwd$(exeext) + +$(eval $(call build-prog,utils/ghc-pwd,dist,1)) + diff --git a/validate b/validate index c2954f2..8d6e2c3 100644 --- a/validate +++ b/validate @@ -77,7 +77,7 @@ if [ $no_clean -eq 0 ]; then ./configure --prefix="$INSTDIR" $config_args fi -thisdir=`utils/ghc-pwd/ghc-pwd` +thisdir=`utils/ghc-pwd/dist-boot/ghc-pwd` echo "Validating=YES" > mk/are-validating.mk