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
# Calculate absolute path to 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
GHC_PWD=utils/ghc-pwd/dist-boot/ghc-pwd
])
AC_DEFUN([FP_BINDIST_GHC_PWD],[
GHC_PWD=utils/ghc-pwd/dist/build/tmp/ghc-pwd
])
AC_DEFUN([FP_FIND_ROOT],[
AC_MSG_CHECKING(for path to top of build tree)
hardtop=`$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.
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`
dnl Remove common automounter nonsense
hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|'`
if ! test -d "$hardtop"; then
if ! test -d "$hardtop"; then
AC_MSG_ERROR([cannot determine current directory])
fi
dnl Remove common automounter nonsense
dnl
hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|'`
fi
AC_SUBST(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
AC_MSG_RESULT(${hardtop})
AC_SUBST(hardtop)
# 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_MSG_RESULT($hardtop)
])
# GHC_CONVERT_CPU(cpu, target_var)
......
......@@ -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"
......
......@@ -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
......
......@@ -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))
......
......@@ -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
directory >= 1 && < 1.2
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
./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
......
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