[commit: ghc] ghc-7.8: Make distribution tarball compression format configurable (e5c57c6)
git at git.haskell.org
git at git.haskell.org
Thu Feb 27 00:04:15 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-7.8
Link : http://ghc.haskell.org/trac/ghc/changeset/e5c57c6b0d71915ae18a767202502153dbc4199c/ghc
>---------------------------------------------------------------
commit e5c57c6b0d71915ae18a767202502153dbc4199c
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Wed Feb 26 22:20:52 2014 +0100
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 <hvr at gnu.org>
(cherry picked from commit 32f41c79960ffc1d04c4573acb37756109d279a5)
>---------------------------------------------------------------
e5c57c6b0d71915ae18a767202502153dbc4199c
bindisttest/ghc.mk | 6 +++---
ghc.mk | 18 +++++++++---------
mk/config.mk.in | 18 ++++++++++++++++++
3 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/bindisttest/ghc.mk b/bindisttest/ghc.mk
index 0126e39..4b21106 100644
--- a/bindisttest/ghc.mk
+++ b/bindisttest/ghc.mk
@@ -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)
diff --git a/ghc.mk b/ghc.mk
index 0b33547..f864443 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -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
@@ -1161,15 +1161,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
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 6207cce..ce58302 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -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)
More information about the ghc-commits
mailing list