X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=distrib%2FMakefile-bin.in;h=6df1e056d8ad176af0d4ba4900b820ef4031b6d3;hp=f7775e204f46af5d411cef73b5effbfb476e0a69;hb=a3e027a34f5e956da3875ab629aa2427e520f879;hpb=50bf84a3a19fd3e88a4382a91979a45f315f5e63 diff --git a/distrib/Makefile-bin.in b/distrib/Makefile-bin.in index f7775e2..6df1e05 100644 --- a/distrib/Makefile-bin.in +++ b/distrib/Makefile-bin.in @@ -7,7 +7,7 @@ # by using the unpacked distribution tree in-situ or by installing the # package. # -# Using the package directly is easy, just do `make config'. (The +# 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) # @@ -22,7 +22,7 @@ # 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-2.07. If you don't want the package/version +# /usr/foo/lib/ghc-3.00. If you don't want the package/version # directory appended, you'll have to modify $(real_libdir) # below. # @@ -38,15 +38,11 @@ # if it clashes with your reality, I guess. # # * htmldir -# where to install the documentation HTML files. -# * dvidir -# where to install the DVI files. -# * infodir -# where to install the Emacs info files -# -# Installing the documentation is not done as part of the `install' rule, but -# via `install-docs' (or if you want to be selective: `install-html', `install-dvi' -# and `install-info'). +# 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 @@ -58,27 +54,19 @@ # Where the different pieces of the bundle should go: bindir = @bindir@ -libdir = @libdir@ -datadir = @datadir@ +libdir = @libdir@/$(package)-$(version) +datadir = @datadir@/$(package)-$(version) platform = @TargetPlatform@ prefix = @prefix@ exec_prefix = @exec_prefix@ # default -infodir = $(datadir) -htmldir = $(datadir) -dvidir = $(datadir) +htmldir = $(datadir)/html +psdir = $(datadir) +pdfdir = $(datadir) -# -# Putting the package stuff in package-specific -# directories: -# -real_libdir = $(libdir)/$(package)-$(version) -real_datadir = $(datadir)/$(package)-$(version) -package = ghc -version = 2.08 PERL = @PerlCmd@ SH = /bin/sh RM = rm -f @@ -87,8 +75,10 @@ CP = cp LN_S = @LN_S@ CHMOD = chmod INSTALL = @INSTALL@ -RAWCPP = @RAWCPP@ +exeext = @exeext@ SED = @SedCmd@ +DEFAULT_TMPDIR = /tmp + # sigh INSTALL_DIR = ./mkdirhier @@ -97,18 +87,10 @@ INSTALL_DIR = ./mkdirhier # to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to # avoid version vertigo. # -VERSION_SYMLINKS_FOR=ghc - -# -# List of files in bin directory that need to have -# local setup/install information prepended. -# -PACKAGE_SCRIPTS=ghc stat2resid hstags mkdependHS -PACKAGE_SH_SCRIPTS=happy -PACKAGE_LIB_SCRIPTS=hscpp +VERSION_SYMLINKS_FOR=$(PACKAGE_LINKS) # Binaries to install -PACKAGE_BINS=$(PACKAGE_SCRIPTS) $(PACKAGE_SH_SCRIPTS) hp2ps +PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS) #----------end of user-serviceable parts------------ # @@ -133,123 +115,168 @@ INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS) config-pkgs :: @echo "Configuring $(package), version $(version), on $(platform) ..." - $(RM) bin/$(platform)/$(package)-$(version)/$(package)-$(version) - @for i in $(PACKAGE_SCRIPTS); do \ + @for i in $(PACKAGE_PRL_SCRIPTS) ""; do \ + if test "$$i"; then \ echo "Creating a configured version of $$i .."; \ - $(RM) bin/$(platform)/$(package)-$(version)/$$i.bak; \ - test -f bin/$(platform)/$(package)-$(version)/$$i && $(MV) bin/$(platform)/$(package)-$(version)/$$i bin/$(platform)/$(package)-$(version)/$$i.bak; \ - echo "#! $(PERL)" > bin/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"bindir='$(bindir)';" >> bin/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"libdir='$(real_libdir)';" >> bin/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"libexecdir='$(real_libdir)';" >> bin/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"datadir='$(real_datadir)';" >> bin/$(platform)/$(package)-$(version)/$$i ; \ - cat bin/$(platform)/$(package)-$(version)/$$i.prl >> bin/$(platform)/$(package)-$(version)/$$i ; \ - $(CHMOD) $(BIN_PERMS) bin/$(platform)/$(package)-$(version)/$$i; \ + $(RM) bin/$(platform)/$$i.bak; \ + if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \ + echo "#! $(PERL)" > bin/$(platform)/$$i ; \ + echo '$$'"bindir='$(bindir)';" >> bin/$(platform)/$$i ; \ + echo '$$'"libdir='$(libdir)';" >> bin/$(platform)/$$i ; \ + echo '$$'"libexecdir='$(libdir)';" >> bin/$(platform)/$$i ; \ + echo '$$'"datadir='$(datadir)';" >> bin/$(platform)/$$i ; \ + echo '$$'"SED='$(SED)';" >> bin/$(platform)/$$i ; \ + echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> bin/$(platform)/$$i ; \ + cat bin/$(platform)/$$i.prl >> bin/$(platform)/$$i ; \ + $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \ echo "Done."; \ + fi; \ done - @for i in $(PACKAGE_LIB_SCRIPTS); do \ + @for i in $(PACKAGE_LIB_PRL_SCRIPTS) ""; do \ + if test "$$i"; then \ echo "Creating a configured version of $$i .."; \ - $(RM) lib/$(platform)/$(package)-$(version)/$$i.bak; \ - test -f lib/$(platform)/$(package)-$(version)/$$i && $(MV) lib/$(platform)/$(package)-$(version)/$$i lib/$(platform)/$(package)-$(version)/$$i.bak; \ - echo "#! $(PERL)" > lib/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"bindir='$(bindir)';" >> lib/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"libdir='$(real_libdir)';" >> lib/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"libexecdir='$(real_libdir)';" >> lib/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"datadir='$(real_datadir)';" >> lib/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"SED='$(SED)';" >> lib/$(platform)/$(package)-$(version)/$$i ; \ - echo $$"RAWCPP='$(RAWCPP)';" >> lib/$(platform)/$(package)-$(version)/$$i ; \ - cat lib/$(platform)/$(package)-$(version)/$$i.prl >> lib/$(platform)/$(package)-$(version)/$$i; \ - $(CHMOD) $(BIN_PERMS) lib/$(platform)/$(package)-$(version)/$$i; \ + $(RM) lib/$(platform)/$$i.bak; \ + if [ -f lib/$(platform)/$$i ]; then $(MV) lib/$(platform)/$$i lib/$(platform)/$$i.bak; fi; \ + echo "#! $(PERL)" > lib/$(platform)/$$i ; \ + echo '$$'"bindir='$(bindir)';" >> lib/$(platform)/$$i ; \ + echo '$$'"libdir='$(libdir)';" >> lib/$(platform)/$$i ; \ + echo '$$'"libexecdir='$(libdir)';" >> lib/$(platform)/$$i ; \ + echo '$$'"datadir='$(datadir)';" >> lib/$(platform)/$$i ; \ + echo '$$'"SED='$(SED)';" >> lib/$(platform)/$$i ; \ + echo '$$'"DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)';" >> lib/$(platform)/$$i ; \ + cat lib/$(platform)/$$i.prl >> lib/$(platform)/$$i; \ + $(CHMOD) $(BIN_PERMS) lib/$(platform)/$$i; \ echo "Done."; \ + fi; \ done - @for i in $(PACKAGE_SH_SCRIPTS); do \ + @for i in $(PACKAGE_SH_SCRIPTS) ""; do \ + if test "$$i"; then \ echo "Creating a configured version of $$i .."; \ - $(RM) bin/$(platform)/$(package)-$(version)/$$i.bak; \ - test -f bin/$(platform)/$(package)-$(version)/$$i && $(MV) bin/$(platform)/$(package)-$(version)/$$i bin/$(platform)/$(package)-$(version)/$$i.bak; \ - echo "#! $(SH)" > bin/$(platform)/$(package)-$(version)/$$i ; \ - echo "bindir='$(bindir)';" >> bin/$(platform)/$(package)-$(version)/$$i ; \ - echo "libdir='$(real_libdir)';" >> bin/$(platform)/$(package)-$(version)/$$i ; \ - echo "libexecdir='$(real_libdir)';" >> bin/$(platform)/$(package)-$(version)/$$i ; \ - echo "datadir='$(real_datadir)';" >> bin/$(platform)/$(package)-$(version)/$$i ; \ - cat bin/$(platform)/$(package)-$(version)/$$i.sh >> bin/$(platform)/$(package)-$(version)/$$i; \ - $(CHMOD) $(BIN_PERMS) bin/$(platform)/$(package)-$(version)/$$i; \ + $(RM) bin/$(platform)/$$i.bak; \ + if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \ + echo "#! $(SH)" > bin/$(platform)/$$i ; \ + echo "bindir='$(bindir)'" >> bin/$(platform)/$$i ; \ + echo "libdir='$(libdir)'" >> bin/$(platform)/$$i ; \ + echo "libexecdir='$(libdir)'" >> bin/$(platform)/$$i ; \ + echo "datadir='$(datadir)'" >> bin/$(platform)/$$i ; \ + echo "SED='$(SED)'" >> bin/$(platform)/$$i ; \ + echo "DEFAULT_TMPDIR='$(DEFAULT_TMPDIR)'" >> bin/$(platform)/$$i ; \ + cat bin/$(platform)/$$i.sh >> bin/$(platform)/$$i; \ + $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \ echo "Done."; \ + fi; \ done - - -mk-version-symlinks :: - @for i in $(VERSION_SYMLINKS_FOR) ""; do \ - if [ "x$$i" != "x" ]; then \ - echo "Symlinking $$i to $$i-$(version)"; \ - (cd bin/$(platform)/$(package)-$(version); \ - $(RM) $$i-$(version); \ - $(MV) $$i $$i-$(version); \ - $(LN_S) $$i-$(version) $$i \ - ); \ - fi; \ + @for i in $(PACKAGE_LIB_SPLICED_FILES) ""; do \ + if test "$$i"; then \ + echo "Creating a configured version of $$i .."; \ + $(PERL) -i.bak -lpe 's|\$$libdir|$(libdir)|g;s|\$$datadir|$(datadir)|g' lib/$(platform)/$$i; \ + fi; \ done + @if test "$(platform)" = "powerpc-apple-darwin"; then \ + echo "Configuring install names..."; \ + for i in lib/$(platform)/*; do \ + sh fix_install_names.sh "$(libdir)" "$$i"; \ + done; \ + echo "Done."; \ + fi in-place :: - $(MAKE) $(MFLAGS) config-pkgs bindir=`pwd`/bin/$(platform)/$(package)-$(version) libdir=`pwd`/lib/$(platform) datadir=`pwd`/share/$(package)-$(version) - $(MAKE) $(MFLAGS) mk-version-symlinks - @echo "Finished configuring..to use, add `pwd`/bin/$(platform)/$(package)-$(version) to your PATH." + $(MAKE) $(MFLAGS) config-pkgs bindir=`pwd`/bin/$(platform) libdir=`pwd`/lib/$(platform) datadir=`pwd`/share + @if test -x "./post-inplace-script" ; then \ + echo "Running project-specific post-inplace script ..." ; \ + ./post-inplace-script $(platform) `pwd` \ + $(package)-$(version); \ + echo "Done" ; \ + fi + @echo "Finished configuring..to use, add `pwd`/bin/$(platform) to your PATH." install-dirs :: $(INSTALL_DIR) $(bindir) - (cd lib/$(platform)/$(package)-$(version); find . -type d -exec sh -c '../../../$(INSTALL_DIR) $$0 $(real_libdir)/$$0' {} \; ) - (cd share/$(package)-$(version); find . -type d -exec sh -c '../../$(INSTALL_DIR) $(real_datadir)/$$0' {} \; ) - -install :: config-pkgs mk-version-symlinks install-dirs install-bin install-libs install-datas - -.PHONY: install-bin install-libs install-datas + (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 :: config-pkgs install-dirs install-bin install-libs install-datas install-docs postinstall denounce + +.PHONY: install-bin install-libs install-datas postinstall denounce + +denounce: + @echo + @echo ======================================================================= + @echo Installation of $(package)-$(version) was successful. + @echo + @echo To use, add $(bindir) to your PATH. + @echo + @if test -f share/html/index.html; then \ + echo For documentation, see $(htmldir)/index.html ; \ + elif test -d share/html ; then \ + echo Docs can be found in $(htmldir). ; \ + else \ + echo "Warning: this binary distribution does NOT contain documentation!" ; \ + fi + @echo ======================================================================= + +postinstall: + @if test -x "./post-install-script" ; then \ + echo "Running project-specific post-install script ..." ; \ + ./post-install-script $(platform) $(libdir) ; \ + echo "Done" ; \ + fi install-bin: - for i in $(PACKAGE_BINS); do \ - $(INSTALL_BIN) bin/$(platform)/$(package)-$(version)/$$i $(bindir); \ + for i in $(PACKAGE_BIN_INSTALL) ""; do \ + if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i $(bindir); fi; \ + done; + for i in $(PACKAGE_BINS) ""; do \ + if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \ + done; + for i in $(PACKAGE_OPT_BINS) ""; do \ + if test -n "$$i" -a ! -f "$(bindir)/$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \ done; - for i in $(VERSION_SYMLINKS_FOR) ""; do \ - if [ "x$$i" != "x" ]; then \ - ( cd $(bindir); $(LN_S) $$i $$i-$(version) ); \ - fi; \ + @for i in $(VERSION_SYMLINKS_FOR) ""; do \ + if [ "x$$i" != "x" ]; then \ + ( cd $(bindir); \ + if ( $(PERL) -e '$$fn="'$$i'"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \ + echo "Creating a symbolic link from $$i-$(version) to $$i"; \ + $(RM) $$i; \ + $(LN_S) $$i-$(version) $$i; \ + else \ + echo "Creating a symbolic link from $$i-$(version) to $$i failed: \`$$i' already exists"; \ + echo "Perhaps remove \`$$i' manually?"; \ + exit 1; \ + fi;\ + ); \ + fi; \ done install-libs: - (cd lib/$(platform)/$(package)-$(version); find . -type f -exec sh -c '$(CP) $$0 $(real_libdir)/$$0' {} \; ) + (cd lib/$(platform); find . -type f -exec sh -c '$(CP) $$0 $(libdir)/$$0' {} \; ) install-datas: - (cd share/$(package)-$(version); find . -type f -exec sh -c '$(INSTALL_DATA) $$0 $(real_datadir)/$$0' {} \; ) + 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)" - @echo "libdir = $(libdir) (real_libdir = $(real_libdir))" - @echo "datadir = $(datadir) (real_datadir = $(real_datadir))" + @echo "libdir = $(libdir) (libdir = $(libdir))" + @echo "datadir = $(datadir) (datadir = $(datadir))" # -# Documentation targets, install-docs for the whole lot, or -# install-{dvi,html,info} +# Documentation targets: install-docs. # -.PHONY: show-install-setup install-docs install-html install-info install-dirs-dvi install-dirs-html install-dirs-info - -install-docs : install-html install-dvi install-info +.PHONY: show-install-setup install-docs install-dirs-docs -install-dvi: install-dirs-dvi - $(INSTALL_DATA) dvi/$(package)-$(version)/* $(dvidir) - -install-info: install-dirs-info - $(INSTALL_DATA) info/$(package)-$(version)/* $(infodir) - -install-html: install-dirs-html - $(INSTALL_DATA) html/$(package)-$(version)/* $(htmldir) +install-docs : install-dirs-docs + if test -d share/html ; then $(CP) -r share/html/* $(htmldir) ; fi + for i in share/*.ps; do \ + if test -f "$$i"; then \ + $(CP) $$i $(psdir) ; \ + fi \ + done -install-dirs-html: +install-dirs-docs: $(INSTALL_DIR) $(htmldir) -install-dirs-info: - $(INSTALL_DIR) $(infodir) - -install-dirs-dvi: - $(INSTALL_DIR) $(dvidir) -