summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2020-12-20 15:02:45 +0100
committerSimon Horman <horms@verge.net.au>2021-04-02 12:11:45 +0200
commite0a17a2014de662803965fd1a8211ceaf7230498 (patch)
tree2f5f6d2cefe402cd74166a30a190b51b7dc86795
parent0eb015422d2e3f83b3ceb250e8840c83989036d0 (diff)
downloadkexec-tools-e0a17a2014de662803965fd1a8211ceaf7230498.tar.gz
build: add distcheck target
Add distcheck target which aims to exercise build, install and uninstall using distribution tarball. Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--Makefile.in39
-rw-r--r--configure.ac1
2 files changed, 39 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in
index 1569b423..09bbd5cd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -55,6 +55,8 @@ LIBS = @LIBS@
# Utilities called by the makefiles
INSTALL = @INSTALL@
+CHMOD = @CHMOD@
+CD = cd
MKDIR = @MKDIR@
RM = @RM@
CP = @CP@
@@ -215,6 +217,8 @@ dist: tarball
tarball: $(TARBALL.gz)
$(TARBALL): $(SRCS) $(GENERATED_SRCS)
+ [ ! -d $(PACKAGE_NAME)-$(PACKAGE_VERSION) ] || \
+ $(CHMOD) u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(MKDIR) $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(TAR) -c $(SRCS) $(GENERATED_SRCS) | \
@@ -255,6 +259,38 @@ dist-clean: clean
$(RM) -f include/config.h.in configure $(SPEC)
$(RM) -rf autom4te.cache
+distuninstallcheck:
+ FOUND=$$(find $(distuninstallcheck_dir) ! -type d) && \
+ [ -z "$$FOUND" ] || { \
+ echo "Unexpeced files found after uninstall:" && \
+ echo "$$FOUND" && \
+ exit 1; }
+
+distcheck: $(TARBALL)
+ [ ! -d $(PACKAGE_NAME)-$(PACKAGE_VERSION) ] || \
+ $(CHMOD) u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ $(TAR) -xf $(TARBALL)
+ $(MKDIR) $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_build \
+ $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_build/sub \
+ $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_inst \
+ $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_dest
+ $(CHMOD) a-w $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ test -d $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_build
+ INSTALL_BASE=$$($(CD) $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,') &&\
+ DESTDIR="$(PACKAGE_NAME)-$(PACKAGE_VERSION)/_dest" && \
+ $(CD) $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_build/sub && \
+ ../../configure \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ --srcdir=../.. --prefix="$$INSTALL_BASE" && \
+ $(MAKE) $(AM_MAKEFLAGS) && \
+ $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" install && \
+ $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" uninstall && \
+ $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$DESTDIR" \
+ distuninstallcheck
+ $(CHMOD) u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+
install: $(TARGETS)
for file in $(TARGETS) ; do \
if test `$(DIRNAME) $$file` = "$(SBINDIR)" ; then \
@@ -355,5 +391,6 @@ uninstall:
done; \
done
-.PHONY: echo install uninstall all targets uninstall-targets clean dist-clean distclean \
+.PHONY: echo install uninstall distuninstallcheck all targets \
+ uninstall-targets clean dist-clean distclean distcheck \
maintainer-clean maintainerclean dist tarball rpm
diff --git a/configure.ac b/configure.ac
index 6c8e0538..6469fd17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,6 +151,7 @@ AC_SUBST(PURGATORY_EXTRA_CFLAGS, [$PURGATORY_EXTRA_CFLAGS])
dnl Find the helper functions
AC_PROG_INSTALL
+AC_CHECK_PROG([CHMOD], chmod, chmod, "no", [$PATH])
AC_CHECK_PROG([MKDIR], mkdir, mkdir, "no", [$PATH])
AC_CHECK_PROG([RM], rm, rm, "no", [$PATH])
AC_CHECK_PROG([CP], cp, cp, "no", [$PATH])