[beast: 7/10] BUILD: rename distgit to 'make dist' and support EXTRA_DIST



commit ed2a9c4c987e2df4d1506c4fb7fdbe04fcd0cd77
Author: Tim Janik <timj gnu org>
Date:   Sun Jun 18 02:16:07 2017 +0200

    BUILD: rename distgit to 'make dist' and support EXTRA_DIST
    
    Signed-off-by: Tim Janik <timj gnu org>

 Makefile.am            |   29 +++++++++++++++--------------
 Makefile.decl          |   15 +++++++++++++++
 misc/Dockerfile-apt.in |    2 +-
 3 files changed, 31 insertions(+), 15 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index c429448..696018b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -86,26 +86,27 @@ ChangeLog: $(GITSTAMPS)
 noinst_DATA          += ChangeLog
 MAINTAINERCLEANFILES += ChangeLog
 
-# == distgit ==
+# == dist ==
 distname      = $(PACKAGE)-$(VERSION)
 distnamexz    = $(distname).tar.xz
-distgit: $(extra_distgit)
+dist:
        $(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 .. && \
+       $(Q) rm -rf .tmpdist/ &&                                        \
+         mkdir .tmpdist/ &&                                            \
+         tar -C .tmpdist/ -xf $(distname).tar &&                       \
+         $(MAKE) $(AM_MAKEFLAGS) extra-gitdist                         \
+                 EXTRA_GITDIST_DIR=`pwd`"/.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
+.PHONY: dist
+EXTRA_DIST = ChangeLog README
 docs/revisions.lst:
        $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
 
@@ -119,7 +120,7 @@ docs/revisions.lst:
 # 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: distgit
+distcheck: dist
        $(Q) TMPDIR="$${TMPDIR-$${TEMP-$${TMP-/tmp}}}" \
        && DCDIR="$$TMPDIR/$(distcheck_uniqdir)" \
        && TARBALL=$$(readlink -f "$(distnamexz)") \
diff --git a/Makefile.decl b/Makefile.decl
index a6536a9..95f1614 100644
--- a/Makefile.decl
+++ b/Makefile.decl
@@ -32,6 +32,21 @@ download: download-local download-recursive
 download-recursive:
        $(Q) for subdir in $(SUBDIRS) ; do test "$$subdir" = '.' || $(MAKE) -C "$$subdir" $(AM_MAKEFLAGS) 
download || exit $$? ; done
 
+# == extra-gitdist ==
+extra-gitdist:
+       @test -z "$(EXTRA_DIST)" || echo "  TAR      $(patsubst %, $(subdir)/%, $(EXTRA_DIST))"
+       $(Q) test -w "$(EXTRA_GITDIST_DIR)" || { echo '$@: missing EXTRA_GITDIST_DIR' >&2; false; }
+       @for subdir in $(SUBDIRS) ; do                                          \
+         test "$$subdir" = '.' ||                                              \
+           $(MAKE) $(AM_MAKEFLAGS) -C "$$subdir" --no-print-directory $@ ||    \
+           exit 1 ;                                                            \
+       done
+       $(Q) for file in $(EXTRA_DIST) ; do                                     \
+         cp -a --parent "$$file" "$(EXTRA_GITDIST_DIR)/$(subdir)/" ||          \
+         exit 1;                                                               \
+       done
+.PHONY: extra-gitdist
+
 # === distfile-list ===
 # recursive rule supported by all Makefiles to generate a list of all files
 # listed as DISTFILES. this asserts a writable file named $DISTFILE_LIST.
diff --git a/misc/Dockerfile-apt.in b/misc/Dockerfile-apt.in
index e8543f2..8c5538f 100644
--- a/misc/Dockerfile-apt.in
+++ b/misc/Dockerfile-apt.in
@@ -79,7 +79,7 @@ RUN nice make -j`nproc`
 RUN nice make check
 RUN nice make install
 RUN nice make installcheck
-RUN nice make distgit
+RUN nice make dist
 RUN nice make uninstall
 
 # Carry out distcheck test if desired


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