From: Ian Lynagh Date: Tue, 5 Jun 2007 13:39:56 +0000 (+0000) Subject: Install the RTS from a bindist correctly X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=094f9feafaf83190891736ddd8d1d7213f4293c4 Install the RTS from a bindist correctly --- diff --git a/Makefile b/Makefile index af432d3..dbb4dfe 100644 --- a/Makefile +++ b/Makefile @@ -59,12 +59,12 @@ include $(TOP)/mk/boilerplate.mk # We can't 'make boot' in libraries until stage1 is built ifeq "$(BootingFromHc)" "YES" -SUBDIRS_NOLIB = includes rts compat compiler docs utils driver +SUBDIRS_BUILD = includes rts compat compiler docs utils driver else -SUBDIRS_NOLIB = includes compat utils driver docs compiler rts +SUBDIRS_BUILD = includes compat utils driver docs compiler rts endif -SUBDIRS = $(SUBDIRS_NOLIB) libraries +SUBDIRS_INSTALL = includes compat utils driver docs rts libraries compiler # Sanity check that all the core libraries are in the tree, to catch # failure to run darcs-all. @@ -85,7 +85,7 @@ check-packages : stage1 : check-packages $(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_NOLIB); do \ + for i in $(SUBDIRS_BUILD); do \ echo "------------------------------------------------------------------------"; \ echo "== $(MAKE) boot $(MFLAGS);"; \ echo " in $(shell pwd)/$$i"; \ @@ -93,7 +93,7 @@ stage1 : check-packages $(MAKE) --no-print-directory -C $$i $(MFLAGS) boot; \ if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \ done; \ - for i in $(SUBDIRS_NOLIB); do \ + for i in $(SUBDIRS_BUILD); do \ echo "------------------------------------------------------------------------"; \ echo "== $(MAKE) all $(MFLAGS);"; \ echo " in $(shell pwd)/$$i"; \ @@ -137,7 +137,7 @@ endif install :: check-packages $(INSTALL_DIR) $(bindir) @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \ - for i in $(SUBDIRS); do \ + for i in $(SUBDIRS_INSTALL); do \ echo "------------------------------------------------------------------------"; \ echo "== $(MAKE) $@ $(MFLAGS);"; \ echo " in $(shell pwd)/$$i"; \ @@ -179,7 +179,7 @@ endif install-docs :: @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \ - for i in $(SUBDIRS); do \ + for i in $(SUBDIRS_INSTALL); do \ echo "------------------------------------------------------------------------"; \ echo "== $(MAKE) $@ $(MFLAGS);"; \ echo " in $(shell pwd)/$$i"; \ @@ -232,9 +232,7 @@ endif .PHONY: binary-dist-pre% binary-dist binary-pack -BINARY_DIST_PRE_RULES=$(foreach d,$(BinDistDirs),binary-dist-pre-$d) - -binary-dist:: binary-dist-pre $(BINARY_DIST_PRE_RULES) +binary-dist:: binary-dist-pre binary-dist-pre:: -rm -rf $(BIN_DIST_DIR) @@ -244,23 +242,19 @@ binary-dist-pre:: echo 'include $$(TOP)/mk/install.mk' > $(BIN_DIST_DIR)/mk/target.mk echo 'include $$(TOP)/mk/recurse.mk' >> $(BIN_DIST_DIR)/mk/target.mk echo '' > $(BIN_DIST_DIR)/mk/compat.mk + cp mk/package.mk $(BIN_DIST_DIR)/mk/ cp mk/install.mk $(BIN_DIST_DIR)/mk/ cp mk/recurse.mk $(BIN_DIST_DIR)/mk/ $(MKDIRHIER) $(BIN_DIST_DIR)/lib/$(TARGETPLATFORM) $(MKDIRHIER) $(BIN_DIST_DIR)/share -$(BINARY_DIST_PRE_RULES): binary-dist-pre-%: - $(MAKE) -C $* $(MFLAGS) $(INSTALL_STAGE) install \ - prefix=$(BIN_DIST_DIR) \ - exec_prefix=$(BIN_DIST_DIR) \ - bindir=$(BIN_DIST_DIR)/bin/$(TARGETPLATFORM) \ - libdir=$(BIN_DIST_DIR)/lib/$(TARGETPLATFORM) \ - libexecdir=$(BIN_DIST_DIR)/lib/$(TARGETPLATFORM) \ - datadir=$(BIN_DIST_DIR)/share - binary-dist:: - $(MAKE) -C driver binary-dist DOING_BIN_DIST=YES - $(MAKE) -C utils binary-dist DOING_BIN_DIST=YES + $(MAKE) -C includes binary-dist DOING_BIN_DIST=YES + $(MAKE) -C compiler binary-dist DOING_BIN_DIST=YES $(INSTALL_STAGE) + # XXX $(MAKE) -C docs binary-dist DOING_BIN_DIST=YES + $(MAKE) -C rts binary-dist DOING_BIN_DIST=YES + $(MAKE) -C driver binary-dist DOING_BIN_DIST=YES + $(MAKE) -C utils binary-dist DOING_BIN_DIST=YES VARFILE=$(BIN_DIST_DIR)/Makefile-vars.in @@ -276,6 +270,8 @@ binary-dist:: echo "package = ghc" >> $(VARFILE) echo "version = $(ProjectVersion)" >> $(VARFILE) echo "ProjectVersion = $(ProjectVersion)" >> $(VARFILE) + echo "HaveLibGmp = $(HaveLibGmp)" >> $(VARFILE) + echo "GhcLibsWithUnix = $(GhcLibsWithUnix)" >> $(VARFILE) cat distrib/Makefile-bin-vars.in >> $(VARFILE) @echo "Generating a shippable configure script.." $(MV) $(BIN_DIST_DIR)/configure-bin.ac $(BIN_DIST_DIR)/configure.ac @@ -354,7 +350,7 @@ endif fiddle-binary-dist: cd $(BIN_DIST_DIR) && ../distrib/prep-bin-dist-mingw # Tar up the distribution and build a manifest -binary-dist :: tar-binary-dist +# XXX binary-dist :: tar-binary-dist .PHONY: tar-binary-dist tar-binary-dist: @@ -427,7 +423,7 @@ SRC_DIST_DIR=$(shell pwd)/$(SRC_DIST_NAME) # # Files to include in source distributions # -SRC_DIST_DIRS += mk docs distrib $(filter-out docs distrib,$(SUBDIRS)) +SRC_DIST_DIRS += mk docs distrib $(filter-out docs distrib,$(SUBDIRS_INSTALL)) SRC_DIST_FILES += \ configure.ac config.guess config.sub configure \ aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \ diff --git a/compiler/Makefile b/compiler/Makefile index 19fba4e..6c53f49 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -894,17 +894,45 @@ else GhcLibraryName=libHS$(PACKAGE)$(_way).a endif +ifneq "$(DOING_BIN_DIST)" "YES" $(GHC_PROG) : $(GhcLibraryName) main/Main.hs $(RM) package.conf.inplace $(RM) $(STAMP_PKG_CONF) $(MAKE) $(STAMP_PKG_CONF) $(MAKE) -f Makefile.ghcbin $(MFLAGS) HS_PROG=$(GHC_PROG) $@ +endif # Propagate standard targets to Makefile.ghcbin docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt:: $(MAKE) -f Makefile.ghcbin $(MFLAGS) $@ endif +include $(TOP)/mk/package.mk + +#----------------------------------------------------------------------------- +# binary-dist + +# $(error Q$(INSTALL_PROGS)W) +foo: + echo Q$(INSTALL_PROGS)W$(GHC_PROG)E + echo Q$(INSTALL_LIBEXECS)W$(GHC_PROG)E + +binary-dist: + $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler + $(INSTALL_DIR) $(BIN_DIST_DIR)/compiler/stage$(stage) + echo "stage=$(stage)" > $(BIN_DIST_DIR)/compiler/Makefile + cat Makefile >> $(BIN_DIST_DIR)/compiler/Makefile + $(INSTALL_DATA) package.conf.in $(BIN_DIST_DIR)/compiler/ +ifneq "$(INSTALL_LIBS)" "" + set -e; for f in $(INSTALL_LIBS); do $(INSTALL_DATA) $$f $(BIN_DIST_DIR)/compiler/$$f; done +endif +ifneq "$(INSTALL_PROGS)" "" + set -e; for f in $(INSTALL_PROGS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done +endif +ifneq "$(INSTALL_LIBEXECS)" "" + set -e; for f in $(INSTALL_LIBEXECS); do $(INSTALL_PROGRAM) $$f $(BIN_DIST_DIR)/compiler/$$f; done +endif + #----------------------------------------------------------------------------- # clean @@ -930,7 +958,6 @@ EXTRA_SRCS += parser/Parser.y TAGS_HS_SRCS = parser/Parser.y.pp $(filter-out $(DERIVED_SRCS) main/Config.hs parser/Parser.y, $(sort $(SRCS))) - include $(TOP)/mk/target.mk # ----------------------------------------------------------------------------- diff --git a/distrib/Makefile b/distrib/Makefile index 2b6cdca..d60e111 100644 --- a/distrib/Makefile +++ b/distrib/Makefile @@ -12,14 +12,22 @@ in-place :: fi @echo "Finished configuring..to use, add `pwd`/bin/$(platform) to your PATH." -install-dirs :: +install :: $(INSTALL_DIR) $(bindir) (cd lib/$(platform); find . -type d -exec sh -c '$(INSTALL_DIR) $$0 $(libdir)/$$0' {} \; ) (cd share; find . -type d -exec sh -c '$(INSTALL_DIR) $(datadir)/$$0' {} \; ) -install :: install-dirs install-driver install-utils install-libs install-datas install-docs postinstall denounce +install:: + $(MAKE) -C includes install DOING_BIN_DIST=YES + $(MAKE) -C driver install DOING_BIN_DIST=YES + $(MAKE) -C utils install DOING_BIN_DIST=YES + $(MAKE) -C rts install DOING_BIN_DIST=YES + $(MAKE) -C libraries install DOING_BIN_DIST=YES + $(MAKE) -C compiler install DOING_BIN_DIST=YES + +install :: install-docs postinstall denounce -.PHONY: install-libs install-utils install-datas postinstall denounce +.PHONY: postinstall denounce denounce: @echo @@ -44,21 +52,6 @@ postinstall: echo "Done" ; \ fi -install-libs: - (cd lib/$(platform); find . -type f -exec sh -c '$(CP) $$0 $(libdir)/$$0' {} \; ) - $(MAKE) -C libraries install DOING_BIN_DIST=YES - -install-driver: - $(MAKE) -C driver install DOING_BIN_DIST=YES - -install-utils: - $(MAKE) -C utils install DOING_BIN_DIST=YES - -install-datas: - set -e; for i in `(cd share; find . -type f )`; do \ - $(INSTALL_DATA) share/$$i $(datadir)/$$i; \ - done - show-install-setup: @echo "Install setup..." @echo "bindir = $(bindir)" diff --git a/distrib/Makefile-bin-vars.in b/distrib/Makefile-bin-vars.in index 0a4fdb9..5a54cbf 100644 --- a/distrib/Makefile-bin-vars.in +++ b/distrib/Makefile-bin-vars.in @@ -27,8 +27,11 @@ LN_S = @LN_S@ CHMOD = chmod INSTALL = @INSTALL@ exeext = @exeext@ -SED = @SedCmd@ +SED = @SedCmd@ DEFAULT_TMPDIR = /tmp +RANLIB = @RANLIB@ + +RAWCPP_FLAGS = -undef -traditional #----------end of user-serviceable parts------------ # diff --git a/distrib/configure-bin.ac b/distrib/configure-bin.ac index fd8c2f1..0d01388 100644 --- a/distrib/configure-bin.ac +++ b/distrib/configure-bin.ac @@ -132,6 +132,11 @@ dnl ** how to do symlinks ** AC_PROG_LN_S() # +dnl ** how to invoke `ar' and `ranlib' +# +FP_PROG_AR_NEEDS_RANLIB + +# dnl ** Find the path to sed ** # AC_PATH_PROG(SedCmd,sed) diff --git a/includes/Makefile b/includes/Makefile index cfb2a48..4b89d52 100644 --- a/includes/Makefile +++ b/includes/Makefile @@ -4,9 +4,17 @@ TOP = .. include $(TOP)/mk/boilerplate.mk # +# Header files built from the configure script's findings +# +H_CONFIG = ghcautoconf.h +H_PLATFORM = ghcplatform.h + +# # All header files # -H_FILES = $(filter-out gmp.h,$(wildcard *.h)) gmp.h +H_FILES = $(filter-out gmp.h $(H_CONFIG) $(H_PLATFORM),$(wildcard *.h)) gmp.h + +ifneq "$(DOING_BIN_DIST)" "YES" # # Options @@ -25,12 +33,6 @@ ifneq "$(GhcWithSMP)" "YES" SRC_CC_OPTS += -DNOSMP endif -# -# Header file built from the configure script's findings -# -H_CONFIG = ghcautoconf.h -H_PLATFORM = ghcplatform.h - boot :: gmp.h all :: $(H_CONFIG) $(H_PLATFORM) @@ -160,6 +162,8 @@ endif CLEAN_FILES += mkGHCConstants$(exeext) GHCConstants.h +endif + # --------------------------------------------------------------------------- # boot setup: # @@ -175,6 +179,11 @@ CLEAN_FILES += mkGHCConstants$(exeext) GHCConstants.h override datadir:=$(libdir)/include INSTALL_DATAS += $(H_FILES) $(H_CONFIG) $(H_PLATFORM) +binary-dist: + $(INSTALL_DIR) $(BIN_DIST_DIR)/includes + $(INSTALL_DATA) Makefile $(BIN_DIST_DIR)/includes/ + $(INSTALL_DATA) $(INSTALL_DATAS) $(BIN_DIST_DIR)/includes/ + # # `make clean' settings: # diff --git a/mk/package.mk b/mk/package.mk index 6c22535..00e3ea2 100644 --- a/mk/package.mk +++ b/mk/package.mk @@ -10,9 +10,7 @@ ifneq "$(PACKAGE)" "" # to the compiler, and spliced into package.conf in place of $topdir at # runtime. # -# On Unix, we only use absolute paths in package.conf, except that when -# building a binary distribution we use $libdir and $datadir in package.conf -# which are then replaced by the correct values at install time. +# On Unix, we only use absolute paths in package.conf. # ifeq "$(Windows)" "YES" @@ -22,8 +20,8 @@ PKG_DATADIR = $$topdir else -PKG_LIBDIR = $$libdir -PKG_DATADIR = $$datadir +PKG_LIBDIR = $(libdir) +PKG_DATADIR = $(datadir) endif # Unix @@ -74,17 +72,19 @@ package.conf.inplace : package.conf.in grep -v '^#pragma GCC' | \ sed -e 's/""//g' -e 's/:[ ]*,/: /g' >$@ -package.conf.installed : package.conf.in +install:: $(CPP) $(RAWCPP_FLAGS) -P -DINSTALLING \ - -DIMPORT_DIR='"$(IMPORT_DIR_INSTALLED)"' \ - -DLIB_DIR='"$(LIB_DIR_INSTALLED)"' \ - -DINCLUDE_DIR='"$(INCLUDE_DIR_INSTALLED)"' \ - -DDATA_DIR='"$(DATA_DIR_INSTALLED)"' \ - -DHTML_DIR='"$(HTML_DIR_INSTALLED)"' \ - -DHADDOCK_IFACE='"$(HADDOCK_IFACE_INSTALLED)"' \ - -x c $(PACKAGE_CPP_OPTS) $< | \ - grep -v '^#pragma GCC' | \ - sed -e 's/""//g' -e 's/:[ ]*,/: /g' >$@ + -DIMPORT_DIR='"$(IMPORT_DIR_INSTALLED)"' \ + -DLIB_DIR='"$(LIB_DIR_INSTALLED)"' \ + -DINCLUDE_DIR='"$(INCLUDE_DIR_INSTALLED)"' \ + -DDATA_DIR='"$(DATA_DIR_INSTALLED)"' \ + -DHTML_DIR='"$(HTML_DIR_INSTALLED)"' \ + -DHADDOCK_IFACE='"$(HADDOCK_IFACE_INSTALLED)"' \ + -I../includes \ + -x c $(PACKAGE_CPP_OPTS) package.conf.in \ + | grep -v '^#pragma GCC' \ + | sed -e 's/""//g' -e 's/:[ ]*,/: /g' \ + | $(bindir)/ghc-pkg update - --force # we could be more accurate here and add a dependency on # driver/package.conf, but that doesn't work too well because of @@ -105,12 +105,11 @@ ifneq "$(BootingFromHc)" "YES" boot all :: $(STAMP_PKG_CONF) endif -$(STAMP_PKG_CONF) : package.conf.inplace package.conf.installed +$(STAMP_PKG_CONF) : package.conf.inplace $(GHC_PKG_INPLACE) update - --force-files