Commit 6bb8d64a authored by Ian Lynagh's avatar Ian Lynagh

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.
parent 0d348bce
...@@ -1280,43 +1280,49 @@ fi ...@@ -1280,43 +1280,49 @@ fi
# Calculate absolute path to build tree # Calculate absolute path to build tree
# -------------------------------------------------------------- # --------------------------------------------------------------
AC_DEFUN([FP_FIND_ROOT],[ AC_DEFUN([FP_INTREE_GHC_PWD],[
AC_MSG_CHECKING(for path to top of build tree) 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 GHC_PWD=utils/ghc-pwd/dist-boot/ghc-pwd
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
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_DEFUN([FP_FIND_ROOT],[
AC_MSG_ERROR([cannot determine current directory]) AC_MSG_CHECKING(for path to top of build tree)
fi hardtop=`$GHC_PWD`
dnl Remove common automounter nonsense dnl Remove common automounter nonsense
dnl hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|'`
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. AC_SUBST(hardtop)
case "$hardtop" in
*' '*) AC_MSG_ERROR([ AC_MSG_RESULT($hardtop)
The build system does not support building in a directory containing
space characters. Suggestion: move the build tree somewhere else.])
;;
esac
]) ])
# GHC_CONVERT_CPU(cpu, target_var) # GHC_CONVERT_CPU(cpu, target_var)
......
...@@ -385,6 +385,7 @@ AC_PATH_PROGS(NHC,nhc nhc98) ...@@ -385,6 +385,7 @@ AC_PATH_PROGS(NHC,nhc nhc98)
AC_PATH_PROG(HBC,hbc) AC_PATH_PROG(HBC,hbc)
# This uses GHC, so put it after the "GHC is required" check above: # This uses GHC, so put it after the "GHC is required" check above:
FP_INTREE_GHC_PWD
FP_FIND_ROOT FP_FIND_ROOT
if test "$HostOS" = "mingw32" if test "$HostOS" = "mingw32"
......
...@@ -6,6 +6,7 @@ dnl ...@@ -6,6 +6,7 @@ dnl
AC_INIT([The Glorious Glasgow Haskell Compilation System], [@ProjectVersion@], [glasgow-haskell-bugs@haskell.org], [ghc]) AC_INIT([The Glorious Glasgow Haskell Compilation System], [@ProjectVersion@], [glasgow-haskell-bugs@haskell.org], [ghc])
FP_BINDIST_GHC_PWD
FP_FIND_ROOT FP_FIND_ROOT
BootingFromHc=NO BootingFromHc=NO
......
...@@ -435,6 +435,7 @@ ghc/stage2/package-data.mk: compiler/stage2/package-data.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 # package-data.mk is sufficient, as that in turn depends on all the
# libraries # libraries
utils/haddock/dist/package-data.mk: compiler/stage2/package-data.mk 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/ghc-pkg/dist-install/package-data.mk: compiler/stage2/package-data.mk
utils/hsc2hs/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 += \ ...@@ -598,10 +599,6 @@ BUILD_DIRS += \
$(GHC_GENAPPLY_DIR) $(GHC_GENAPPLY_DIR)
endif endif
BUILD_DIRS += \
utils/haddock \
utils/haddock/doc
ifneq "$(CLEANING)" "YES" ifneq "$(CLEANING)" "YES"
BUILD_DIRS += \ BUILD_DIRS += \
$(patsubst %, libraries/%, $(PACKAGES)) $(patsubst %, libraries/%, $(PACKAGES))
...@@ -612,11 +609,14 @@ BUILD_DIRS += libraries/integer-gmp/gmp ...@@ -612,11 +609,14 @@ BUILD_DIRS += libraries/integer-gmp/gmp
endif endif
BUILD_DIRS += \ BUILD_DIRS += \
utils/haddock \
utils/haddock/doc \
compiler \ compiler \
$(GHC_HSC2HS_DIR) \ $(GHC_HSC2HS_DIR) \
$(GHC_PKG_DIR) \ $(GHC_PKG_DIR) \
utils/testremove \ utils/testremove \
utils/ghctags \ utils/ghctags \
utils/ghc-pwd \
utils/hpc \ utils/hpc \
utils/runghc \ utils/runghc \
ghc ghc
...@@ -664,6 +664,7 @@ utils/ghctags_dist_DISABLE = YES ...@@ -664,6 +664,7 @@ utils/ghctags_dist_DISABLE = YES
utils/hpc_dist_DISABLE = YES utils/hpc_dist_DISABLE = YES
utils/hsc2hs_dist-install_DISABLE = YES utils/hsc2hs_dist-install_DISABLE = YES
utils/ghc-pkg_dist-install_DISABLE = YES utils/ghc-pkg_dist-install_DISABLE = YES
utils/ghc-pwd_dist_DISABLE = YES
utils/mkUserGuidePart_dist_DISABLE = YES utils/mkUserGuidePart_dist_DISABLE = YES
utils/compare_sizes_dist_DISABLE = YES utils/compare_sizes_dist_DISABLE = YES
compiler_stage2_DISABLE = YES compiler_stage2_DISABLE = YES
...@@ -985,7 +986,7 @@ $(eval $(call bindist,.,\ ...@@ -985,7 +986,7 @@ $(eval $(call bindist,.,\
mk/config.mk.in \ mk/config.mk.in \
$(INPLACE_BIN)/mkdirhier \ $(INPLACE_BIN)/mkdirhier \
$(INPLACE_BIN)/ghc-cabal \ $(INPLACE_BIN)/ghc-cabal \
utils/ghc-pwd/ghc-pwd \ utils/ghc-pwd/dist/build/tmp/ghc-pwd \
$(BINDIST_WRAPPERS) \ $(BINDIST_WRAPPERS) \
$(BINDIST_PERL_SOURCES) \ $(BINDIST_PERL_SOURCES) \
$(BINDIST_LIBS) \ $(BINDIST_LIBS) \
...@@ -1199,10 +1200,6 @@ sdist_%: ...@@ -1199,10 +1200,6 @@ sdist_%:
.PHONY: clean .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/bootstrapping.conf
CLEAN_FILES += libraries/integer-gmp/cbits/GmpDerivedConstants.h CLEAN_FILES += libraries/integer-gmp/cbits/GmpDerivedConstants.h
CLEAN_FILES += libraries/integer-gmp/cbits/mkGmpDerivedConstants CLEAN_FILES += libraries/integer-gmp/cbits/mkGmpDerivedConstants
...@@ -1256,6 +1253,7 @@ distclean : clean ...@@ -1256,6 +1253,7 @@ distclean : clean
"$(RM)" $(RM_OPTS) libraries/process/include/HsProcessConfig.h "$(RM)" $(RM_OPTS) libraries/process/include/HsProcessConfig.h
"$(RM)" $(RM_OPTS) libraries/unix/include/HsUnixConfig.h "$(RM)" $(RM_OPTS) libraries/unix/include/HsUnixConfig.h
"$(RM)" $(RM_OPTS) libraries/old-time/include/HsTimeConfig.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.log, $(PACKAGES) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.status, $(PACKAGES) $(PACKAGES_STAGE2)) "$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.status, $(PACKAGES) $(PACKAGES_STAGE2))
......
...@@ -11,14 +11,8 @@ Description: ...@@ -11,14 +11,8 @@ Description:
build-type: Simple build-type: Simple
cabal-version: >=1.2 cabal-version: >=1.2
Flag base3
Description: Choose the new smaller, split-up base package.
Executable ghc-pwd Executable ghc-pwd
Main-Is: ghc-pwd.hs Main-Is: ghc-pwd.hs
if flag(base3) Build-Depends: base >= 3 && < 5,
Build-Depends: base >= 3 && < 5, directory >= 1 && < 1.2
directory >= 1 && < 1.1
else
Build-Depends: base < 3
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))
...@@ -77,7 +77,7 @@ if [ $no_clean -eq 0 ]; then ...@@ -77,7 +77,7 @@ if [ $no_clean -eq 0 ]; then
./configure --prefix="$INSTDIR" $config_args ./configure --prefix="$INSTDIR" $config_args
fi fi
thisdir=`utils/ghc-pwd/ghc-pwd` thisdir=`utils/ghc-pwd/dist-boot/ghc-pwd`
echo "Validating=YES" > mk/are-validating.mk echo "Validating=YES" > mk/are-validating.mk
......
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