From fd96f0f738a243a4e5964aa36753ec6c28f2444a Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sat, 10 Mar 2007 01:25:58 +0000 Subject: [PATCH] Make building binary dists work with cabalised libraries --- Makefile | 104 +++++++++++++++++++----------- distrib/{Makefile-bin.in => Makefile} | 114 +-------------------------------- distrib/Makefile-bin-vars.in | 62 ++++++++++++++++++ distrib/configure-bin.ac | 4 +- libraries/Makefile | 9 +++ 5 files changed, 141 insertions(+), 152 deletions(-) rename distrib/{Makefile-bin.in => Makefile} (66%) create mode 100644 distrib/Makefile-bin-vars.in diff --git a/Makefile b/Makefile index 98efc8b..07c8175 100644 --- a/Makefile +++ b/Makefile @@ -216,7 +216,7 @@ BinDistLibPrlScripts = ghc-asm ghc-split BinDistBins = hp2ps runghc BinDistLinks = ghc ghci ghc-pkg BinDistLibSplicedFiles = package.conf -BinDistDirs = includes compiler docs driver libraries rts utils +BinDistDirs = includes compiler docs driver rts utils BIN_DIST_NAME=ghc-$(ProjectVersion) BIN_DIST_TOPDIR=$(FPTOOLS_TOP_ABS) @@ -224,17 +224,17 @@ BIN_DIST_DIR=$(BIN_DIST_TOPDIR)/$(BIN_DIST_NAME) BIN_DIST_TARBALL=ghc-$(ProjectVersion)-$(TARGETPLATFORM).tar.bz2 -BIN_DIST_TOP= distrib/Makefile-bin.in \ - distrib/configure-bin.ac \ - distrib/INSTALL \ - distrib/README \ - ANNOUNCE \ - LICENSE \ - utils/mkdirhier/mkdirhier \ - install-sh \ - config.guess \ - config.sub \ - aclocal.m4 +BIN_DIST_TOP= distrib/Makefile \ + distrib/configure-bin.ac \ + distrib/INSTALL \ + distrib/README \ + ANNOUNCE \ + LICENSE \ + utils/mkdirhier/mkdirhier \ + install-sh \ + config.guess \ + config.sub \ + aclocal.m4 ifeq "$(darwin_TARGET_OS)" "1" BIN_DIST_TOP+=mk/fix_install_names.sh @@ -266,6 +266,8 @@ $(BINARY_DIST_PRE_RULES): binary-dist-pre-%: libexecdir=$(BIN_DIST_DIR)/lib/$(TARGETPLATFORM) \ datadir=$(BIN_DIST_DIR)/share +VARFILE=$(BIN_DIST_DIR)/Makefile-vars.in + binary-dist:: @for i in $(BIN_DIST_TOP); do \ if test -f "$$i"; then \ @@ -274,17 +276,17 @@ binary-dist:: fi; \ done; @echo "Configuring the Makefile for this project..." - touch $(BIN_DIST_DIR)/Makefile.in - echo "package = ghc" >> $(BIN_DIST_DIR)/Makefile.in - echo "version = $(ProjectVersion)" >> $(BIN_DIST_DIR)/Makefile.in - echo "PACKAGE_SH_SCRIPTS = $(BinDistShScripts)" >> $(BIN_DIST_DIR)/Makefile.in - echo "PACKAGE_PRL_SCRIPTS = $(BinDistPrlScripts)" >> $(BIN_DIST_DIR)/Makefile.in - echo "PACKAGE_LIB_PRL_SCRIPTS = $(BinDistLibPrlScripts)" >> $(BIN_DIST_DIR)/Makefile.in - echo "PACKAGE_LIB_SPLICED_FILES = $(BinDistLibSplicedFiles)" >> $(BIN_DIST_DIR)/Makefile.in - echo "PACKAGE_BINS = $(BinDistBins)" >> $(BIN_DIST_DIR)/Makefile.in - echo "PACKAGE_OPT_BINS = $(BinDistOptBins)" >> $(BIN_DIST_DIR)/Makefile.in - echo "PACKAGE_LINKS = $(BinDistLinks)" >> $(BIN_DIST_DIR)/Makefile.in - cat $(BIN_DIST_DIR)/Makefile-bin.in >> $(BIN_DIST_DIR)/Makefile.in + echo > $(VARFILE) + echo "package = ghc" >> $(VARFILE) + echo "version = $(ProjectVersion)" >> $(VARFILE) + echo "PACKAGE_SH_SCRIPTS = $(BinDistShScripts)" >> $(VARFILE) + echo "PACKAGE_PRL_SCRIPTS = $(BinDistPrlScripts)" >> $(VARFILE) + echo "PACKAGE_LIB_PRL_SCRIPTS = $(BinDistLibPrlScripts)" >> $(VARFILE) + echo "PACKAGE_LIB_SPLICED_FILES = $(BinDistLibSplicedFiles)" >> $(VARFILE) + echo "PACKAGE_BINS = $(BinDistBins)" >> $(VARFILE) + echo "PACKAGE_OPT_BINS = $(BinDistOptBins)" >> $(VARFILE) + echo "PACKAGE_LINKS = $(BinDistLinks)" >> $(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 ( cd $(BIN_DIST_DIR); autoconf ) @@ -295,21 +297,23 @@ binary-dist:: ifndef BINDIST_DOC_WAYS -ifneq "$(XSLTPROC)" "" -BINDIST_DOC_WAYS = html -ifneq "$(FOP)" "" -BINDIST_DOC_WAYS += ps pdf -else -ifneq "$(PDFXMLTEX)" "" -BINDIST_DOC_WAYS += pdf -endif -ifneq "$(XMLTEX)" "" -ifneq "$(DVIPS)" "" -BINDIST_DOC_WAYS += ps -endif # DVIPS -endif # XMLTEX -endif # FOP -endif # XSLTPROC +BINDIST_DOC_WAYS = $(XMLDocWays) + +# ifneq "$(XSLTPROC)" "" +# BINDIST_DOC_WAYS = html +# ifneq "$(FOP)" "" +# BINDIST_DOC_WAYS += ps pdf +# else +# ifneq "$(PDFXMLTEX)" "" +# BINDIST_DOC_WAYS += pdf +# endif +# ifneq "$(XMLTEX)" "" +# ifneq "$(DVIPS)" "" +# BINDIST_DOC_WAYS += ps +# endif # DVIPS +# endif # XMLTEX +# endif # FOP +# endif # XSLTPROC endif # BINDIST_DOC_WAYS @@ -361,6 +365,30 @@ binary-dist:: done endif +.PHONY: binary-dist-doc-% + +BIN_DIST_LIBDIR=$(BIN_DIST_DIR)/libraries + +LIBRARY_SUBDIRS=$(shell $(MAKE) -s -C libraries subdirs) + +BINARY_DIST_LIBRARY_RULES=$(foreach d,$(LIBRARY_SUBDIRS),binary-dist-lib-$d) + +binary-dist:: $(BINARY_DIST_LIBRARY_RULES) + cp libraries/Makefile $(BIN_DIST_LIBDIR) + cp libraries/gen_contents_index $(BIN_DIST_LIBDIR) + cp libraries/index.html $(BIN_DIST_LIBDIR) + cp libraries/doc-index.html $(BIN_DIST_LIBDIR) + cp -a libraries/stamp $(BIN_DIST_LIBDIR) + +$(BINARY_DIST_LIBRARY_RULES): binary-dist-lib-%: + $(MKDIRHIER) $(BIN_DIST_LIBDIR)/$*/setup + cp libraries/$*/setup/Setup $(BIN_DIST_LIBDIR)/$*/setup + cp libraries/$*/*.cabal $(BIN_DIST_LIBDIR)/$* + cp -a libraries/$*/dist $(BIN_DIST_LIBDIR)/$* + find $(BIN_DIST_LIBDIR)/$*/dist \ + \( \( -name "*.o" -o -name "*.p_o" \) -a \! -name "HS*" \) \ + -exec rm {} \; + # Tar up the distribution and build a manifest binary-dist :: ( cd $(BIN_DIST_TOPDIR); tar cf - $(BIN_DIST_NAME) | bzip2 >$(BIN_DIST_TARBALL) ) diff --git a/distrib/Makefile-bin.in b/distrib/Makefile similarity index 66% rename from distrib/Makefile-bin.in rename to distrib/Makefile index 6df1e05..77b63e5 100644 --- a/distrib/Makefile-bin.in +++ b/distrib/Makefile @@ -1,115 +1,5 @@ -# -# @configure_input@ -# -# Instructions for configuring an fptools package. -# -# There are two ways you can get started with an fptools package, either -# by using the unpacked distribution tree in-situ or by installing the -# package. -# -# Using the package directly is easy, just do `make in-place'. (The -# distribution will *not* work straight out of the box, you'll have to do -# this first) -# -# To install the package, you'll have to set one or more of the -# following variables: -# -# * bindir -# path to directory of where you want the executables -# to be installed. -# * libdir -# where you want the library archives to go. -# Note, if you specify /usr/foo/lib for libdir, -# the library files for your fptools package will be -# installed in /usr/foo/lib/-, e.g., -# /usr/foo/lib/ghc-3.00. If you don't want the package/version -# directory appended, you'll have to modify $(real_libdir) -# below. -# -# * datadir -# path to where the platform-independent files will go. -# As for libdir, the effective path for the platform-indep -# stuff is $(datadir)/-. If you want -# complete control, see $(real_datadir) -# -# * platform -# the platform you're installing for. The configure script -# makes an educated guess, so you'll only have to set this -# if it clashes with your reality, I guess. -# -# * htmldir -# where to install the HTML documentation files. -# * pdfdir -# where to install the PDF documentation files. -# * psdir -# where to install the Postscript documentation files. -# -# For more complete instructions, consult the INSTALL file -# that came with the bundle, and/or consult the installation -# documentation in one of the document directories. -# -# Please report any bugs, problems etc. with installing and using this bundle -# Makefile setup to glasgow-haskell-bugs@dcs.gla.ac.uk -# - -# Where the different pieces of the bundle should go: -bindir = @bindir@ -libdir = @libdir@/$(package)-$(version) -datadir = @datadir@/$(package)-$(version) - -platform = @TargetPlatform@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -# default -htmldir = $(datadir)/html -psdir = $(datadir) -pdfdir = $(datadir) - -PERL = @PerlCmd@ -SH = /bin/sh -RM = rm -f -MV = mv -CP = cp -LN_S = @LN_S@ -CHMOD = chmod -INSTALL = @INSTALL@ -exeext = @exeext@ -SED = @SedCmd@ -DEFAULT_TMPDIR = /tmp - -# sigh -INSTALL_DIR = ./mkdirhier - -# -# Set of package scripts for which you'd like a name- symlink -# to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to -# avoid version vertigo. -# -VERSION_SYMLINKS_FOR=$(PACKAGE_LINKS) - -# Binaries to install -PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS) - -#----------end of user-serviceable parts------------ -# -# -# How to install the different pieces -# -INSTALL_BIN = $(INSTALL) $(INSTALL_BIN_OPTS) -INSTALL_LIB = $(INSTALL) $(INSTALL_LIB_OPTS) -INSTALL_DATA = $(INSTALL) $(INSTALL_DATA_OPTS) - -# What's common to all installs -INSTALL_OPTS= $(EXTRA_INSTALL_OPTS) - -BIN_PERMS = 755 -LIB_PERMS = 644 - -INSTALL_BIN_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_BIN_OPTS) -INSTALL_LIB_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_LIB_OPTS) -INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS) +include Makefile-vars .PHONY: in-place config-pkgs mk-version-symlinks install-dirs install @@ -248,9 +138,9 @@ install-bin: fi; \ done - install-libs: (cd lib/$(platform); find . -type f -exec sh -c '$(CP) $$0 $(libdir)/$$0' {} \; ) + $(MAKE) -C libraries install IN_BIN_DIST=1 install-datas: for i in `(cd share; find . -type f )`; do \ diff --git a/distrib/Makefile-bin-vars.in b/distrib/Makefile-bin-vars.in new file mode 100644 index 0000000..53c4163 --- /dev/null +++ b/distrib/Makefile-bin-vars.in @@ -0,0 +1,62 @@ + +# Where the different pieces of the bundle should go: +bindir = @bindir@ +libdir = @libdir@/$(package)-$(version) +datadir = @datadir@/$(package)-$(version) + +platform = @TargetPlatform@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +# default +htmldir = $(datadir)/html +psdir = $(datadir) +pdfdir = $(datadir) + + +PERL = @PerlCmd@ +SH = /bin/sh +RM = rm -f +MV = mv +CP = cp +LN_S = @LN_S@ +CHMOD = chmod +INSTALL = @INSTALL@ +exeext = @exeext@ +SED = @SedCmd@ +DEFAULT_TMPDIR = /tmp + +# sigh +INSTALL_DIR = ./mkdirhier + +# +# Set of package scripts for which you'd like a name- symlink +# to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to +# avoid version vertigo. +# +VERSION_SYMLINKS_FOR=$(PACKAGE_LINKS) + +# Binaries to install +PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS) + +#----------end of user-serviceable parts------------ +# +# +# How to install the different pieces +# +INSTALL_BIN = $(INSTALL) $(INSTALL_BIN_OPTS) +INSTALL_LIB = $(INSTALL) $(INSTALL_LIB_OPTS) +INSTALL_DATA = $(INSTALL) $(INSTALL_DATA_OPTS) +INSTALL_SCRIPT = $(INSTALL) $(INSTALL_SCRIPT_OPTS) + +# What's common to all installs +INSTALL_OPTS= $(EXTRA_INSTALL_OPTS) + +BIN_PERMS = 755 +LIB_PERMS = 644 + +INSTALL_BIN_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_BIN_OPTS) +INSTALL_LIB_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_LIB_OPTS) +INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS) +INSTALL_SCRIPT_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_SCRIPT_OPTS) + diff --git a/distrib/configure-bin.ac b/distrib/configure-bin.ac index cda2cff..e50a50e 100644 --- a/distrib/configure-bin.ac +++ b/distrib/configure-bin.ac @@ -5,7 +5,7 @@ dnl # # Is it there? -AC_INIT(Makefile.in) +AC_INIT(Makefile-vars.in) exeext='' @@ -141,7 +141,7 @@ FP_HAVE_GCC AC_PROG_CPP # -AC_OUTPUT(Makefile) +AC_OUTPUT(Makefile-vars) echo "****************************************************" echo "Configuration done, ready to either 'make install'" diff --git a/libraries/Makefile b/libraries/Makefile index 594de16..2ce5176 100644 --- a/libraries/Makefile +++ b/libraries/Makefile @@ -3,8 +3,12 @@ default_target: build +ifeq "$(IN_BIN_DIST)" "1" +include ../Makefile-vars +else TOP=. include $(TOP)/mk/boilerplate.mk +endif SUBDIRS = base filepath haskell98 template-haskell readline \ regex-base regex-posix regex-compat parsec Cabal @@ -60,6 +64,11 @@ endif BOOTSTRAPPING_CABAL = bootstrapping.cabal +.PHONY: subdirs + +subdirs: + @echo $(SUBDIRS) + .PHONY: boot boot: $(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/setup/Setup) -- 1.7.10.4