]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: move coreutils-specific rules from maint.mk to new file
authorJim Meyering <meyering@redhat.com>
Fri, 24 Apr 2009 19:36:22 +0000 (21:36 +0200)
committerJim Meyering <meyering@redhat.com>
Fri, 24 Apr 2009 19:41:11 +0000 (21:41 +0200)
* dist-check.mk: New file: coreutils-specific rules extracted
from maint.mk, now that maint.mk has migrated to gnulib.
* Makefile.am (EXTRA_DIST): Add dist-check.mk.
* coreutils/cfg.mk: Include $(srcdir)/dist-check.mk.
* gnulib: Update submodule to latest.

Makefile.am
cfg.mk
dist-check.mk [new file with mode: 0644]
gnulib

index 13891ee9cef9299e4a6e3644fe399038df06f657..7670cd650e41abcb18076c21e98a3fba2b6de4e4 100644 (file)
@@ -66,6 +66,7 @@ EXTRA_DIST =                          \
   bootstrap.conf                       \
   build-aux/cvsu                       \
   cfg.mk                               \
+  dist-check.mk                                \
   gl/modules/getloadavg.diff           \
   maint.mk
 
diff --git a/cfg.mk b/cfg.mk
index d3a3436a9400dc1c9e23776d5f134806b4faa731..3012a27d96e720b1498e3d7d00ed9f01b1bd1450 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -191,3 +191,5 @@ sc_strftime_check:
          diff -u $@-src $@-info || exit 1;                             \
          rm -f $@-src $@-info;                                         \
        fi
+
+include $(srcdir)/dist-check.mk
diff --git a/dist-check.mk b/dist-check.mk
new file mode 100644 (file)
index 0000000..16f3859
--- /dev/null
@@ -0,0 +1,135 @@
+# Most of this is probably too coreutils-centric to be useful to other packages.
+
+warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith
+bin=bin-$$$$
+
+write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
+
+TMPDIR ?= /tmp
+t=$(TMPDIR)/$(PACKAGE)/test
+pfx=$(t)/i
+
+# More than once, tainted build and source directory names would
+# have caused at least one "make check" test to apply "chmod 700"
+# to all directories under $HOME.  Make sure it doesn't happen again.
+tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
+t_prefix = $(tp)/a
+t_taint = '$(t_prefix) b'
+fake_home = $(tp)/home
+
+# Ensure that tests run from tainted build and src dir names work,
+# and don't affect anything in $HOME.  Create witness files in $HOME,
+# record their attributes, and build/test.  Then ensure that the
+# witnesses were not affected.
+ALL_RECURSIVE_TARGETS += taint-distcheck
+taint-distcheck: $(DIST_ARCHIVES)
+       test -d $(t_taint) && chmod -R 700 $(t_taint) || :
+       -rm -rf $(t_taint) $(fake_home)
+       mkdir -p $(t_prefix) $(t_taint) $(fake_home)
+       GZIP=$(GZIP_ENV) $(AMTAR) -C $(t_taint) -zxf $(distdir).tar.gz
+       mkfifo $(fake_home)/fifo
+       touch $(fake_home)/f
+       mkdir -p $(fake_home)/d/e
+       ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
+       cd $(t_taint)/$(distdir)                        \
+         && ./configure                                \
+         && $(MAKE)                                    \
+         && HOME=$(fake_home) $(MAKE) check            \
+         && ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
+         && diff $(tp)/.ls-before $(tp)/.ls-after      \
+         && test -d $(t_prefix)
+       rm -rf $(tp)
+
+# Verify that a twisted use of --program-transform-name=PROGRAM works.
+define install-transform-check
+  echo running install-transform-check                 \
+    && rm -rf $(pfx)                                   \
+    && $(MAKE) program_transform_name='s/.*/zyx/'      \
+      prefix=$(pfx) install                            \
+    && test "$$(echo $(pfx)/bin/*)" = "$(pfx)/bin/zyx" \
+    && test "$$(find $(pfx)/share/man -type f|sed 's,.*/,,;s,\..*,,')" = "zyx"
+endef
+
+# Install, then verify that all binaries and man pages are in place.
+# Note that neither the binary, ginstall, nor the ].1 man page is installed.
+define my-instcheck
+  $(MAKE) prefix=$(pfx) install                                \
+    && test ! -f $(pfx)/bin/ginstall                   \
+    && { fail=0;                                       \
+      for i in $(built_programs); do                   \
+        test "$$i" = ginstall && i=install;            \
+        for j in "$(pfx)/bin/$$i"                      \
+                 "$(pfx)/share/man/man1/$$i.1"; do     \
+          case $$j in *'[.1') continue;; esac;         \
+          test -f "$$j" && :                           \
+            || { echo "$$j not installed"; fail=1; };  \
+        done;                                          \
+      done;                                            \
+      test $$fail = 1 && exit 1 || :;                  \
+    }
+endef
+
+define coreutils-path-check
+  {                                                    \
+    if test -f $(srcdir)/src/true.c; then              \
+      fail=1;                                          \
+      mkdir $(bin)                                     \
+       && ($(write_loser)) > $(bin)/loser              \
+       && chmod a+x $(bin)/loser                       \
+       && for i in $(built_programs); do               \
+              case $$i in                              \
+                rm|expr|basename|echo|sort|ls|tr);;    \
+                cat|dirname|mv|wc);;                   \
+                *) ln $(bin)/loser $(bin)/$$i;;        \
+              esac;                                    \
+            done                                       \
+         && ln -sf ../src/true $(bin)/false            \
+         && PATH=`pwd`/$(bin)$(PATH_SEPARATOR)$$PATH   \
+               $(MAKE) -C tests check                  \
+         && { test -d gnulib-tests                     \
+                && $(MAKE) -C gnulib-tests check       \
+                || :; }                                \
+         && rm -rf $(bin)                              \
+         && fail=0;                                    \
+    else                                               \
+      fail=0;                                          \
+    fi;                                                        \
+    test $$fail = 1 && exit 1 || :;                    \
+  }
+endef
+
+# Use -Wformat -Werror to detect format-string/arg-list mismatches.
+# Also, check for shadowing problems with -Wshadow, and for pointer
+# arithmetic problems with -Wpointer-arith.
+# These CFLAGS are pretty strict.  If you build this target, you probably
+# have to have a recent version of gcc and glibc headers.
+# The hard-linking for-loop below ensures that there is a bin/ directory
+# full of all of the programs under test (except the ones that are required
+# for basic Makefile rules), all symlinked to the just-built "false" program.
+# This is to ensure that if ever a test neglects to make PATH include
+# the build srcdir, these always-failing programs will run.
+# Otherwise, it is too easy to test the wrong programs.
+# Note that "false" itself is a symlink to true, so it too will malfunction.
+ALL_RECURSIVE_TARGETS += my-distcheck
+my-distcheck: $(DIST_ARCHIVES) $(local-check)
+       $(MAKE) syntax-check
+       $(MAKE) check
+       -rm -rf $(t)
+       mkdir -p $(t)
+       GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
+       cd $(t)/$(distdir)                              \
+         && ./configure --disable-nls                  \
+         && $(MAKE) CFLAGS='$(warn_cflags)'            \
+             AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'       \
+         && $(MAKE) dvi                                \
+         && $(install-transform-check)                 \
+         && $(my-instcheck)                            \
+         && $(coreutils-path-check)                    \
+         && $(MAKE) distclean
+       (cd $(t) && mv $(distdir) $(distdir).old        \
+         && $(AMTAR) -zxf - ) < $(distdir).tar.gz
+       diff -ur $(t)/$(distdir).old $(t)/$(distdir)
+       -rm -rf $(t)
+       @echo "========================"; \
+       echo "$(distdir).tar.gz is ready for distribution"; \
+       echo "========================"
diff --git a/gnulib b/gnulib
index 7f62c240e1767245b2a58aca8347377f99346e03..f937d166906633801966f9cf3e0efe6767ed586f 160000 (submodule)
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 7f62c240e1767245b2a58aca8347377f99346e03
+Subproject commit f937d166906633801966f9cf3e0efe6767ed586f