Commit 32f41c79 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

Make distribution tarball compression format configurable

By default, bzip2 compression is selected (which is what has been used
till now). Additionally, by setting the TAR_COMP make variable to one of
the values "bzip2", "gzip", or "xz", an explicit compression format can
be requested for the distribution tarballs. For instance, invoking

  make TAR_COMP=xz sdist-ghc

will result in a tarball `./sdistprep/ghc-7.9.20140226-src.tar.xz`
Signed-off-by: Herbert Valerio Riedel's avatarHerbert Valerio Riedel <hvr@gnu.org>
parent 98b6756b
......@@ -11,9 +11,9 @@
# -----------------------------------------------------------------------------
ifeq "$(TEST_PREP)" "YES"
BIN_DIST_TEST_TAR_BZ2 = $(BIN_DIST_PREP_TAR_BZ2)
BIN_DIST_TEST_TAR_COMP = $(BIN_DIST_PREP_TAR_COMP)
else
BIN_DIST_TEST_TAR_BZ2 = $(BIN_DIST_TAR_BZ2)
BIN_DIST_TEST_TAR_COMP = $(BIN_DIST_TAR_COMP)
endif
.PHONY: test_bindist
......@@ -33,7 +33,7 @@ test_bindist:
mkdir bindisttest/a
mkdir bindisttest/a/b
mkdir bindisttest/a/b/c
cd bindisttest/a/b/c/ && $(BZIP2_CMD) -cd ../../../../$(BIN_DIST_TEST_TAR_BZ2) | $(TAR_CMD) -xf -
cd bindisttest/a/b/c/ && $(TAR_COMP_CMD) -cd ../../../../$(BIN_DIST_TEST_TAR_COMP) | $(TAR_CMD) -xf -
$(SHELL) bindisttest/checkBinaries.sh $(ProjectVersion)
ifeq "$(Windows_Host)" "YES"
mv bindisttest/a/b/c/$(BIN_DIST_NAME) $(BIN_DIST_INST_DIR)
......
......@@ -1009,12 +1009,12 @@ unix-binary-dist-prep:
$(call removeFiles,$(BIN_DIST_PREP_TAR))
# h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source
# tree then we want to include the real file, not a symlink to it
cd bindistprep && "$(TAR_CMD)" hcf - -T ../bindist-list | bzip2 -c > ../$(BIN_DIST_PREP_TAR_BZ2)
cd bindistprep && "$(TAR_CMD)" hcf - -T ../bindist-list | $(TAR_COMP_CMD) -c > ../$(BIN_DIST_PREP_TAR_COMP)
windows-binary-dist-prep:
$(call removeTrees,bindistprep/)
$(MAKE) prefix=$(TOP)/$(BIN_DIST_PREP_DIR) install
cd bindistprep && "$(TAR_CMD)" cf - $(BIN_DIST_NAME) | bzip2 -c > ../$(BIN_DIST_PREP_TAR_BZ2)
cd bindistprep && "$(TAR_CMD)" cf - $(BIN_DIST_NAME) | $(TAR_COMP_CMD) -c > ../$(BIN_DIST_PREP_TAR_COMP)
# tryTimes tries to run its third argument multiple times, until it
# succeeds. Don't call it directly; call try10Times instead.
......@@ -1032,7 +1032,7 @@ try10Times = $(call tryTimes,,x x x x x x x x x x,$1) { echo Failed; false; }
.PHONY: publish-binary-dist
publish-binary-dist:
$(call try10Times,$(PublishCp) $(BIN_DIST_TAR_BZ2) $(PublishLocation)/dist)
$(call try10Times,$(PublishCp) $(BIN_DIST_TAR_COMP) $(PublishLocation)/dist)
ifeq "$(mingw32_TARGET_OS)" "1"
DOCDIR_TO_PUBLISH = $(BIN_DIST_INST_DIR)/doc
......@@ -1072,17 +1072,17 @@ SRC_DIST_BASE_NAME = ghc-$(ProjectVersion)
SRC_DIST_GHC_NAME = ghc-$(ProjectVersion)-src
SRC_DIST_GHC_ROOT = $(SRC_DIST_ROOT)/ghc
SRC_DIST_GHC_DIR = $(SRC_DIST_GHC_ROOT)/$(SRC_DIST_BASE_NAME)
SRC_DIST_GHC_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_GHC_NAME).tar.bz2
SRC_DIST_GHC_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_GHC_NAME).tar.$(TAR_COMP_EXT)
SRC_DIST_WINDOWS_TARBALLS_NAME = ghc-$(ProjectVersion)-windows-extra-src
SRC_DIST_WINDOWS_TARBALLS_ROOT = $(SRC_DIST_ROOT)/windows-tarballs
SRC_DIST_WINDOWS_TARBALLS_DIR = $(SRC_DIST_WINDOWS_TARBALLS_ROOT)/$(SRC_DIST_BASE_NAME)
SRC_DIST_WINDOWS_TARBALLS_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_WINDOWS_TARBALLS_NAME).tar.bz2
SRC_DIST_WINDOWS_TARBALLS_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_WINDOWS_TARBALLS_NAME).tar.$(TAR_COMP_EXT)
SRC_DIST_TESTSUITE_NAME = ghc-$(ProjectVersion)-testsuite
SRC_DIST_TESTSUITE_ROOT = $(SRC_DIST_ROOT)/testsuite-ghc
SRC_DIST_TESTSUITE_DIR = $(SRC_DIST_TESTSUITE_ROOT)/$(SRC_DIST_BASE_NAME)
SRC_DIST_TESTSUITE_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_TESTSUITE_NAME).tar.bz2
SRC_DIST_TESTSUITE_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_TESTSUITE_NAME).tar.$(TAR_COMP_EXT)
#
# Files to include in source distributions
......@@ -1160,15 +1160,15 @@ sdist-testsuite-prep :
.PHONY: sdist-ghc
sdist-ghc: sdist-ghc-prep
cd $(SRC_DIST_GHC_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> src_ghc_log | bzip2 > $(TOP)/$(SRC_DIST_GHC_TARBALL)
cd $(SRC_DIST_GHC_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> src_ghc_log | $(TAR_COMP_CMD) -c > $(TOP)/$(SRC_DIST_GHC_TARBALL)
.PHONY: sdist-windows-tarballs
sdist-windows-tarballs: sdist-windows-tarballs-prep
cd $(SRC_DIST_WINDOWS_TARBALLS_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> windows_extra_src_ghc_log | bzip2 > $(TOP)/$(SRC_DIST_WINDOWS_TARBALLS_TARBALL)
cd $(SRC_DIST_WINDOWS_TARBALLS_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> windows_extra_src_ghc_log | $(TAR_COMP_CMD) -c > $(TOP)/$(SRC_DIST_WINDOWS_TARBALLS_TARBALL)
.PHONY: sdist-testsuite
sdist-testsuite: sdist-testsuite-prep
cd $(SRC_DIST_TESTSUITE_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> testsuite_log | bzip2 > $(TOP)/$(SRC_DIST_TESTSUITE_TARBALL)
cd $(SRC_DIST_TESTSUITE_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> testsuite_log | $(TAR_COMP_CMD) -c > $(TOP)/$(SRC_DIST_TESTSUITE_TARBALL)
.PHONY: sdist
......
......@@ -697,6 +697,24 @@ PATCH_CMD = @PatchCmd@
TAR_CMD = @TarCmd@
BZIP2_CMD = bzip2
GZIP_CMD = gzip
XZ_CMD = xz
# bzip2 is default compression
TAR_COMP = bzip2
# select compression command and .tar extension based on TAR_COMP value
ifeq "$(TAR_COMP)" "bzip2"
TAR_COMP_CMD = $(BZIP2_CMD)
TAR_COMP_EXT = bz2
else ifeq "$(TAR_COMP)" "gzip"
TAR_COMP_CMD = $(GZIP_CMD)
TAR_COMP_EXT = gz
else ifeq "$(TAR_COMP)" "xz"
TAR_COMP_CMD = $(XZ_CMD)
TAR_COMP_EXT = xz
else
$(error $$(TAR_COMP) set to unknown value "$(TAR_COMP)" (supported: "bzip2", "gzip", "xz"))
endif
ifeq "$(Windows_Host)" "YES"
TOUCH_CMD = $(utils/touchy_dist_INPLACE)
......
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