Fix up bindist creation and publishing
authorIan Lynagh <igloo@earth.li>
Wed, 5 Sep 2007 16:06:41 +0000 (16:06 +0000)
committerIan Lynagh <igloo@earth.li>
Wed, 5 Sep 2007 16:06:41 +0000 (16:06 +0000)
Makefile
bindisttest/Makefile
distrib/Makefile-bin-vars.in
libraries/Makefile
mk/config.mk.in
mk/package.mk

index 445b008..61b49e6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -394,8 +394,8 @@ binary-dist :: tar-binary-dist
 
 .PHONY: tar-binary-dist
 tar-binary-dist:
-       ( cd $(BIN_DIST_TOPDIR); tar cf - $(BIN_DIST_NAME) | bzip2 >$(BIN_DIST_TARBALL) )
-       ( cd $(BIN_DIST_TOPDIR); bunzip2 -c $(BIN_DIST_TARBALL) | tar tf - | sed "s/^ghc-$(ProjectVersion)/fptools/" | sort >bin-manifest-$(ProjectVersion) )
+       ( cd $(BIN_DIST_TOPDIR_ABS); tar cf - $(BIN_DIST_NAME) | bzip2 >$(BIN_DIST_TARBALL) )
+       ( cd $(BIN_DIST_TOPDIR_ABS); bunzip2 -c $(BIN_DIST_TARBALL) | tar tf - | sed "s/^ghc-$(ProjectVersion)/fptools/" | sort >bin-manifest-$(ProjectVersion) )
 
 PUBLISH_FILES = $(BIN_DIST_TARBALL)
 
@@ -415,7 +415,7 @@ endif
 
 # Upload the distribution and documentation
 ifneq "$(PublishLocation)" ""
-binary-dist :: publish-binary-dist
+publish :: publish-binary-dist
 endif
 
 .PHONY: publish-binary-dist
@@ -427,16 +427,11 @@ publish-binary-dist ::
            done \
        done
 
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-# On Windows, we cannot use absoluate pathnames to rsync, because they look
-# like remote pathnames ("c:/foo/bar").  Also, the docs reside in doc/
-# rather than share/, due to prep-bin-dist-mingw.
-publish-binary-dist ::
-       $(PublishCp) -r $(FPTOOLS_TOP)/$(BIN_DIST_NAME)/doc/html/* $(PublishLocation)/docs
-else
+# You need to first make binddisttest, and then run
+#     make publish 'prefix=$(BIN_DIST_INST_DIR)'
+# for this to find the right place.
 publish-binary-dist ::
-       $(PublishCp) -r $(BIN_DIST_DIR)/share/html/* $(PublishLocation)/docs
-endif
+       $(PublishCp) -r $(docdir)/* $(PublishLocation)/docs
 
 binary-dist::
        @echo "Mechanical and super-natty! Inspect the result and *if* happy; freeze, sell and get some sleep!"
index cfcf13b..c26ca79 100644 (file)
@@ -8,20 +8,18 @@ default_target: all
 TOP=..
 include $(TOP)/mk/boilerplate.mk
 
-INST_DIR = $(FPTOOLS_TOP_ABS)/bindisttest/installed
-
 all:
        $(RM) -rf installed
        $(RM) -rf ghc*
        $(RM) HelloWorld HelloWorld.o HelloWorld.hi output
-       $(TAR) -jxf ../$(BIN_DIST_TARBALL)
+       $(TAR) -jxf $(BIN_DIST_TARBALL)
 ifeq "$(Windows)" "YES"
-       mv $(BIN_DIST_NAME) $(INST_DIR)
+       mv $(BIN_DIST_NAME) $(BIN_DIST_INST_DIR)
 else
-       cd $(BIN_DIST_NAME) && ./configure --prefix=$(INST_DIR)
+       cd $(BIN_DIST_NAME) && ./configure --prefix=$(BIN_DIST_INST_DIR)
        cd $(BIN_DIST_NAME) && make install
 endif
-       $(INST_DIR)/bin/ghc --make HelloWorld
+       $(BIN_DIST_INST_DIR)/bin/ghc --make HelloWorld
        ./HelloWorld > output
        $(CONTEXT_DIFF) output expected_output
 
index 5a54cbf..5603e72 100644 (file)
@@ -1,21 +1,30 @@
 
 # Where we are
 bindist_abs_root = @hardtop@
+FPTOOLS_TOP_ABS  = @hardtop@
+
+# This Makefile isn't used on Windows, so wel always have ghc-pkg.bin
+# rather than ghc-pkg.exe.
+GHC_PKG_PROG = $(FPTOOLS_TOP_ABS)/utils/ghc-pkg/ghc-pkg.bin
 
 # Where the different pieces of the bundle should go:
 bindir      = @bindir@
 libdir      = @libdir@/$(package)-$(version)
 libexecdir  = $(libdir)
+datarootdir = @datarootdir@
 datadir     = @datadir@/$(package)-$(version)
 
 platform    = @TargetPlatform@
 prefix      = @prefix@
 exec_prefix = @exec_prefix@
 
+headerdir   = $(libdir)/include
+
 # default
-htmldir     = $(datadir)/html
-psdir       = $(datadir)
-pdfdir      = $(datadir)
+docdir      = @datadir@/doc/ghc
+htmldir     = $(docdir)
+psdir       = $(docdir)
+pdfdir      = $(docdir)
 
 
 PERL        = @PerlCmd@
@@ -44,6 +53,9 @@ INSTALL_LIB     = $(INSTALL) $(INSTALL_LIB_OPTS)
 INSTALL_DATA    = $(INSTALL) $(INSTALL_DATA_OPTS)
 INSTALL_SCRIPT  = $(INSTALL) $(INSTALL_SCRIPT_OPTS)
 INSTALL_PROGRAM = $(INSTALL) $(INSTALL_PROGRAM_OPTS)
+INSTALL_HEADER  = $(INSTALL) $(INSTALL_HEADER_OPTS)
+INSTALL_SHLIB   = $(INSTALL) $(INSTALL_SHLIB_OPTS)
+INSTALL_MAN     = $(INSTALL) $(INSTALL_MAN_OPTS)
 
 # What's common to all installs
 INSTALL_OPTS= $(EXTRA_INSTALL_OPTS)
@@ -56,6 +68,9 @@ 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)
 INSTALL_PROGRAM_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_PROGRAM_OPTS)
+INSTALL_HEADER_OPTS  = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_HEADER_OPTS)
+INSTALL_SHLIB_OPTS   = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_SHLIB_OPTS)
+INSTALL_MAN_OPTS     = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_MAN_OPTS)
 
 EXECUTABLE_FILE = chmod $(BIN_PERMS)
 
index b78eb8c..a90d52c 100644 (file)
@@ -322,7 +322,7 @@ $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR)): \
 install.library.%: installPackage/installPackage ifBuildable/ifBuildable
        if ifBuildable/ifBuildable $*; then \
          cd $* && \
-         ../installPackage/installPackage "$(DESTDIR)" $(prefix) $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/ghc-pkg-inplace $(DESTDIR)$(libdir)/package.conf; \
+         ../installPackage/installPackage "$(DESTDIR)" $(prefix) $(GHC_PKG_PROG) $(DESTDIR)$(libdir)/package.conf; \
        fi
 
 .PHONY: binary-dist binary-dist.library.%
@@ -350,7 +350,7 @@ binary-dist.library.%:
          cp    $*.cabal      $(BIN_DIST_LIBDIR)/$* && \
          cp    LICENSE       $(BIN_DIST_LIBDIR)/$* && \
          cp -R dist          $(BIN_DIST_LIBDIR)/$* && \
-         (cp -RL include      $(BIN_DIST_LIBDIR)/$* || :) && \
+         (cp -RL include      $(BIN_DIST_LIBDIR)/$* || true) && \
          $(FIND) $(BIN_DIST_LIBDIR)/$*/dist \
             \( -name "*_split" -o -name "autogen" \) | xargs rm -rf && \
          $(FIND) $(BIN_DIST_LIBDIR)/$*/dist \
index c716ab0..417d6e4 100644 (file)
@@ -506,9 +506,13 @@ FPTOOLS_TOP_ABS_PLATFORM = @hardtop_plat@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
 
 BIN_DIST_NAME=ghc-$(ProjectVersion)
-BIN_DIST_TOPDIR=$(FPTOOLS_TOP_ABS)
-BIN_DIST_DIR=$(BIN_DIST_TOPDIR)/$(BIN_DIST_NAME)
-BIN_DIST_TARBALL=$(BIN_DIST_TOPDIR)/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar.bz2
+BIN_DIST_TOPDIR_REL=$(FPTOOLS_TOP)
+BIN_DIST_TOPDIR_ABS=$(FPTOOLS_TOP_ABS)
+BIN_DIST_DIR=$(BIN_DIST_TOPDIR_ABS)/$(BIN_DIST_NAME)
+BIN_DIST_TARBALL=$(BIN_DIST_TOPDIR_REL)/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar.bz2
+
+BIN_DIST_INST_DIR = $(FPTOOLS_TOP_ABS)/bindisttest/installed
+
 
 #
 # Installation directories, we don't use half of these,
@@ -614,6 +618,11 @@ ifeq "$(strip $(mandir))" ""
 mandir         = $(prefix)/man
 endif
 
+# This is a bit of a lie, as this is a wrapper rather than the program
+# itself. However, it means that we don't have to worry about Windows
+# and non-Windows having different extensions.
+GHC_PKG_PROG = $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/ghc-pkg-inplace
+
 #-----------------------------------------------------------------------------
 # install configuration
 
index 60507db..78c01f2 100644 (file)
@@ -84,7 +84,7 @@ install::
               -x c $(PACKAGE_CPP_OPTS) package.conf.in \
            | grep -v '^#pragma GCC' \
            | sed -e 's/""//g' -e 's/:[   ]*,/: /g' \
-           | $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/ghc-pkg-inplace --global-conf $(DESTDIR)$(libdir)/package.conf update - --force
+           | $(GHC_PKG_PROG) --global-conf $(DESTDIR)$(libdir)/package.conf 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