[beast: 4/6] BUILD: use 'git archive' in rule 'distgit' to create distribution tarballs



commit bd0d4a384d7cb3058eb4a432880db47317bda925
Author: Tim Janik <timj gnu org>
Date:   Sat Jun 17 02:13:48 2017 +0200

    BUILD: use 'git archive' in rule 'distgit' to create distribution tarballs
    
    Signed-off-by: Tim Janik <timj gnu org>

 Makefile.am  |   31 +++++++++++++++++++++++++++----
 configure.ac |    2 +-
 2 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 39e38c8..6ad4a15 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -89,6 +89,29 @@ noinst_DATA          += ChangeLog
 MAINTAINERCLEANFILES += ChangeLog
 EXTRA_DIST           += ChangeLog taptool.sh
 
+# == distgit ==
+distname      = $(PACKAGE)-$(VERSION)
+distnamexz    = $(distname).tar.xz
+distgit: $(extra_distgit)
+       $(Q) test 0 = `git diff HEAD | wc -l` || echo -e "#\n# $@: WARNING: working tree unclean\n#" >&2
+       $(Q) git archive --format=tar --prefix=$(distname)/ HEAD >$(distname).tar
+       $(Q) rm -rf .tmpdist/ && \
+         mkdir .tmpdist/ && \
+         tar -C .tmpdist/ -xf $(distname).tar && \
+         { test -z "$(extra_distgit)" || cp --parents $(extra_distgit) .tmpdist/$(distname)/ ; } && \
+         cd .tmpdist/$(distname)/ && \
+         ./autogen.sh --help >/dev/null && \
+         cd ../ && \
+         tar -f ../$(distname).tar -hu $(distname)/ && \
+         cd .. && \
+         rm -fr .tmpdist/
+       $(Q) rm -f $(distname).tar.xz && xz $(distname).tar && test -e $(distnamexz)
+       $(Q) echo "Archive ready: $(distnamexz)" | sed '1h; 1s/./=/g; 1p; 1x; $$p; $$x'
+.PHONY: distgit
+extra_distgit = ChangeLog README docs/revisions.lst
+docs/revisions.lst:
+       $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
+
 # == distcheck ==
 # Distcheck aims:
 # - use srcdir==builddir;
@@ -99,17 +122,17 @@ EXTRA_DIST           += ChangeLog taptool.sh
 # distcheck_uniqdir - directory for build tests, outside of srcdir, unique per user and checkout
 # distcheck_uniqdir = distcheck-$(shell printf %d-%04x\\n $$UID 0x`X=$$(pwd) && echo -n "$$X" | md5sum | sed 
's/^\(....\).*/\1/'`)
 distcheck_uniqdir = distcheck-$(shell python -c "import os, md5; print ('%u-%s' % (os.getuid(), md5.new 
(os.getcwd()).hexdigest()[:4]))")
-distcheck: dist
+distcheck: distgit
        $(Q) TMPDIR="$${TMPDIR-$${TEMP-$${TMP-/tmp}}}" \
        && DCDIR="$$TMPDIR/$(distcheck_uniqdir)" \
-       && TARBALL=`readlink -f $(firstword $(DIST_ARCHIVES))` \
-       && test -n "$$TMPDIR" -a -n "$(distcheck_uniqdir)" -a -n "$$DCDIR" -a -n "$(distdir)" -a -n 
"$$TARBALL" \
+       && TARBALL=$$(readlink -f "$(distnamexz)") \
+       && test -n "$$TMPDIR" -a -n "$(distcheck_uniqdir)" -a -n "$$DCDIR" -a -n "$(distname)" -a -n 
"$$TARBALL" \
        && { test ! -e "$$DCDIR/" || { chmod u+w -R "$$DCDIR/" && rm -r "$$DCDIR/" ; } ; } \
        && mkdir -p "$$DCDIR" \
        && set -x \
        && cd "$$DCDIR" \
        && tar xf "$$TARBALL" \
-       && cd "$(distdir)" \
+       && cd "$(distname)" \
        && ./configure --prefix="$$DCDIR/inst" $(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS) \
        && touch dc-buildtree-cleaned \
        && find . -print >dc-buildtree-files \
diff --git a/configure.ac b/configure.ac
index b1f2f90..5d179fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@ AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_MACRO_DIR([config])
 AM_CONFIG_HEADER(config/config.h)
 AC_CANONICAL_TARGET                                     # architecture information
-AM_INIT_AUTOMAKE(1.9 dist-xz tar-pax no-dist-gzip no-define foreign subdir-objects)
+AM_INIT_AUTOMAKE(1.9 no-dist no-define foreign subdir-objects)
 # version handling
 BST_VERSION="$PACKAGE_VERSION"
 [MAJOR=`echo $PACKAGE_VERSION | sed 's/\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\(.*\)/\1/'`]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]