pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc
Module Name: pkgsrc
Committed By: rillig
Date: Sat May 4 15:16:51 UTC 2019
Modified Files:
pkgsrc/mk/configure: gnu-configure.mk
Added Files:
pkgsrc/mk/configure: gnu-configure-unknown.awk
pkgsrc/regress/gnu-configure-strict: spec t-gettext-tools.test
t-simple-unrecognized.test t-subdirs-ok.test
t-subdirs-only-in-main.test t-subdirs-unrecognized.test
t-verbose.test
Log Message:
mk/configure: assist in finding unrecognized configure options
Instead of giving instructions, just to the work automatically as far as
it can be automated.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/mk/configure/gnu-configure-unknown.awk
cvs rdiff -u -r1.20 -r1.21 pkgsrc/mk/configure/gnu-configure.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/regress/gnu-configure-strict/spec \
pkgsrc/regress/gnu-configure-strict/t-gettext-tools.test \
pkgsrc/regress/gnu-configure-strict/t-simple-unrecognized.test \
pkgsrc/regress/gnu-configure-strict/t-subdirs-ok.test \
pkgsrc/regress/gnu-configure-strict/t-subdirs-only-in-main.test \
pkgsrc/regress/gnu-configure-strict/t-subdirs-unrecognized.test \
pkgsrc/regress/gnu-configure-strict/t-verbose.test
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/mk/configure/gnu-configure.mk
diff -u pkgsrc/mk/configure/gnu-configure.mk:1.20 pkgsrc/mk/configure/gnu-configure.mk:1.21
--- pkgsrc/mk/configure/gnu-configure.mk:1.20 Sat May 4 08:43:06 2019
+++ pkgsrc/mk/configure/gnu-configure.mk Sat May 4 15:16:50 2019
@@ -1,4 +1,4 @@
-# $NetBSD: gnu-configure.mk,v 1.20 2019/05/04 08:43:06 rillig Exp $
+# $NetBSD: gnu-configure.mk,v 1.21 2019/05/04 15:16:50 rillig Exp $
#
# Package-settable variables:
#
@@ -13,15 +13,19 @@
# Whether unknown --enable/--disable/--with/--without options make
# the package fail immediately.
#
-# When this check fails, inspect the configure script using "bmake
-# configure-help" and adjust the CONFIGURE_ARGS accordingly.
-# Inspect whether the configure script runs embedded configure
-# scripts from subdirectories. In that case, some of the
-# sub-configure scripts may need the options and some may not know
-# them at all.
+# Command line options that are unknown for all configure scripts
+# of a package are effectively ignored and should be replaced with
+# their current equivalent (in case they have been renamed), or
+# otherwise be removed.
+#
+# This check may incorrectly report unknown options for packages
+# that have multiple configure scripts, when one of these scripts
+# recognizes the option and some other doesn't. To check this, run
+# "bmake show-unknown-configure-options" after the package failed.
#
-# Possible: yes no
+# Possible: yes no warn
# Default: no
+# See also: configure-help show-unknown-configure-options
#
# Keywords: configure configure_args gnu
@@ -200,5 +204,27 @@ configure-scripts-osdep:
done
.endif
-GNU_CONFIGURE_STRICT?= no
-CONFIGURE_ARGS+= ${"${GNU_CONFIGURE_STRICT:M[yY][eE][sS]}":?--enable-option-checking=fatal:}
+GNU_CONFIGURE_STRICT?= warn
+.if ${GNU_CONFIGURE_STRICT:M[yY][eE][sS]}
+CONFIGURE_ARGS+= --enable-option-checking=fatal
+.elif ${GNU_CONFIGURE_STRICT} == warn
+CONFIGURE_ARGS+= --enable-option-checking=yes
+.endif
+
+# Inspects the configure scripts of a package to see whether there are
+# multiple configure scripts, and one of them reports an option as
+# unrecognized while some other still needs it.
+#
+# This target is expected to be called manually, after a package failed
+# to configure because of the GNU_CONFIGURE_STRICT check.
+#
+# See also: GNU_CONFIGURE_STRICT configure-help
+#
+# Keywords: GNU_CONFIGURE_STRICT configure-help
+show-unknown-configure-options: .PHONY
+ ${RUN} ${MAKE} patch
+ ${RUN} ${RM} -f ${_COOKIE.configure}
+ @${STEP_MSG} "Running configure scripts silently"
+ ${RUN} ${MAKE} configure GNU_CONFIGURE_STRICT=warn 2>&1 \
+ | ${AWK} -f ${PKGSRCDIR}/mk/configure/gnu-configure-unknown.awk
+ ${RUN} ${RM} -f ${_COOKIE.configure}
Added files:
Index: pkgsrc/mk/configure/gnu-configure-unknown.awk
diff -u /dev/null pkgsrc/mk/configure/gnu-configure-unknown.awk:1.1
--- /dev/null Sat May 4 15:16:51 2019
+++ pkgsrc/mk/configure/gnu-configure-unknown.awk Sat May 4 15:16:50 2019
@@ -0,0 +1,83 @@
+#! awk
+# $NetBSD: gnu-configure-unknown.awk,v 1.1 2019/05/04 15:16:50 rillig Exp $
+#
+# Inspects all GNU configure scripts from a package, including nested
+# ones, to see whether command line options that are reported as
+# unrecognized by one of them are also unrecognized by the others.
+#
+# See GNU_CONFIGURE_STRICT.
+
+BEGIN {
+ # The set of all options from all configure scripts,
+ # kept in insertion order to guarantee reproducible output.
+ delete opts; opts_len = 0; delete opts_seen;
+
+ # The list of subdirectories from which a configure script
+ # has been executed.
+ delete subdirs; subdirs_len = 0;
+
+ # There's always at least one configure script.
+ # This script may execute others.
+ subdir = ".";
+ subdirs[subdirs_len++] = subdir;
+}
+
+/^=== configuring in / {
+ subdir = $4;
+ subdirs[subdirs_len++] = subdir;
+}
+
+/^configure: WARNING: unrecognized options: / {
+ for (i = 5; i <= NF; i++) {
+ opt = $i;
+ sub(",", "", opt);
+ if (!opts_seen[opt]++) {
+ opts[opts_len++] = opt;
+ }
+ unknown[subdir, opt] = 1;
+ }
+}
+
+function count_unknown(opt, n, i) {
+ n = 0;
+ for (i in subdirs) {
+ if (unknown[subdirs[i], opt]) {
+ n++;
+ }
+ }
+ return n;
+}
+
+function summary(opt, n) {
+ n = count_unknown(opt);
+ if (n == subdirs_len) {
+ print("option " opt " is unknown",
+ "in all " subdirs_len " configure scripts");
+ return 1;
+ }
+
+ if ("PKG_VERBOSE" in ENVIRON) {
+ print("good: option " opt " is known",
+ "in " (subdirs_len - n),
+ "of " subdirs_len " configure scripts");
+ return 1;
+ }
+
+ return 0;
+}
+
+function finish(_, i, msgs) {
+ msgs = 0;
+ for (i = 0; i < opts_len; i++) {
+ msgs += summary(opts[i]);
+ }
+
+ if (msgs == 0) {
+ print("good: all " opts_len " options are used somewhere");
+ print("please set GNU_CONFIGURE_STRICT=no in the package");
+ }
+}
+
+END {
+ finish()
+}
Index: pkgsrc/regress/gnu-configure-strict/spec
diff -u /dev/null pkgsrc/regress/gnu-configure-strict/spec:1.1
--- /dev/null Sat May 4 15:16:51 2019
+++ pkgsrc/regress/gnu-configure-strict/spec Sat May 4 15:16:51 2019
@@ -0,0 +1,47 @@
+# $NetBSD: spec,v 1.1 2019/05/04 15:16:51 rillig Exp $
+#
+# Checks that analyzing unknown CONFIGURE_ARGS produces the expected results,
+# for both packages containing only a single configure scripts and those
+# containing multiple configure scripts.
+
+set -eu
+
+tmpdir=${TMPDIR:-/tmp}/pkgsrc-gnu-configure
+rm -rf "$tmpdir"
+mkdir -p "$tmpdir"
+
+require_file() {
+ if diff -u "$3" "$1" > /dev/null; then
+ :
+ else
+ regress_fail "Expected files to be equal."
+ diff -u "$3" "$1" || true
+ fi
+}
+
+do_test_case() {
+ testname=${1%.test}
+
+ awk '/^# end/ { relevant = 0 } relevant { print } /^# begin/ { relevant = 1 }' \
+ < "$1" > "$tmpdir/$testname.expected"
+
+ awk -f $PKGSRCDIR/mk/configure/gnu-configure-unknown.awk \
+ "$1" > "$tmpdir/$testname.actual"
+
+ require_file "$tmpdir/$testname.actual" --equals "$tmpdir/$testname.expected"
+}
+
+do_test() {
+ do_test_case "t-simple-unrecognized.test"
+ do_test_case "t-gettext-tools.test"
+ do_test_case "t-subdirs-ok.test"
+ do_test_case "t-subdirs-unrecognized.test"
+ do_test_case "t-subdirs-only-in-main.test"
+ export PKG_VERBOSE=yes
+ do_test_case "t-verbose.test"
+ unset PKG_VERBOSE
+}
+
+check_result() {
+ exit_status 0
+}
Index: pkgsrc/regress/gnu-configure-strict/t-gettext-tools.test
diff -u /dev/null pkgsrc/regress/gnu-configure-strict/t-gettext-tools.test:1.1
--- /dev/null Sat May 4 15:16:51 2019
+++ pkgsrc/regress/gnu-configure-strict/t-gettext-tools.test Sat May 4 15:16:51 2019
@@ -0,0 +1,35 @@
+# $NetBSD: t-gettext-tools.test,v 1.1 2019/05/04 15:16:51 rillig Exp $
+
+This is the output of running "bmake configure GNU_CONFIGURE_STRICT=warn"
+in devel/gettext-tools. That package has several subdirectories, and some
+of them even run multiple configure scripts.
+
+===> Configuring for gettext-tools-0.19.8.1nb1
+...
+=== configuring in gettext-runtime
+...
+configure: WARNING: unrecognized options: --with-included-libcroco, --without-git, --with-xz, --without-emacs, --disable-openmp
+...
+=== configuring in libasprintf
+...
+configure: WARNING: unrecognized options: --disable-csharp, --disable-java, --with-included-libcroco, --without-git, --with-xz, --without-included-gettext, --without-emacs, --disable-openmp
+...
+configure: WARNING: unrecognized options: --disable-csharp, --disable-java, --with-included-libcroco, --without-git, --with-xz, --without-included-gettext, --without-emacs, --disable-openmp
+configure: WARNING: unrecognized options: --with-included-libcroco, --without-git, --with-xz, --without-emacs, --disable-openmp
+...
+=== configuring in gettext-tools
+...
+=== configuring in examples
+...
+configure: WARNING: unrecognized options: --disable-csharp, --disable-java, --with-included-libcroco, --without-git, --with-xz, --without-included-gettext, --without-emacs, --disable-openmp
+...
+configure: WARNING: unrecognized options: --disable-csharp, --disable-java, --with-included-libcroco, --without-git, --with-xz, --without-included-gettext, --without-emacs, --disable-openmp
+
+Each of the subdirectories flags several options as unrecognized, but in
+summary, each of the given options is used in at least one subdirectory,
+which in this case is gettext-tools.
+
+# begin expected output
+good: all 8 options are used somewhere
+please set GNU_CONFIGURE_STRICT=no in the package
+# end expected output
Index: pkgsrc/regress/gnu-configure-strict/t-simple-unrecognized.test
diff -u /dev/null pkgsrc/regress/gnu-configure-strict/t-simple-unrecognized.test:1.1
--- /dev/null Sat May 4 15:16:51 2019
+++ pkgsrc/regress/gnu-configure-strict/t-simple-unrecognized.test Sat May 4 15:16:51 2019
@@ -0,0 +1,12 @@
+# $NetBSD: t-simple-unrecognized.test,v 1.1 2019/05/04 15:16:51 rillig Exp $
+
+In most configure scripts there are no calls to other configure scripts.
+In that case the only "subdir" is the main configure script itself.
+
+===> Configuring for screen-4.6.2nb1
+...
+configure: WARNING: unrecognized options: --enable-feature
+
+# begin
+option --enable-feature is unknown in all 1 configure scripts
+# end
Index: pkgsrc/regress/gnu-configure-strict/t-subdirs-ok.test
diff -u /dev/null pkgsrc/regress/gnu-configure-strict/t-subdirs-ok.test:1.1
--- /dev/null Sat May 4 15:16:51 2019
+++ pkgsrc/regress/gnu-configure-strict/t-subdirs-ok.test Sat May 4 15:16:51 2019
@@ -0,0 +1,20 @@
+# $NetBSD: t-subdirs-ok.test,v 1.1 2019/05/04 15:16:51 rillig Exp $
+
+===> Configuring for package-1.0
+...
+=== configuring in subdir1
+...
+configure: WARNING: unrecognized options: --only-subdir2
+...
+=== configuring in subdir2
+...
+configure: WARNING: unrecognized options: --only-subdir1
+...
+
+No output expected since each of the unrecognized options is used in the
+other subdirectory.
+
+# begin expected output
+good: all 2 options are used somewhere
+please set GNU_CONFIGURE_STRICT=no in the package
+# end expected output
Index: pkgsrc/regress/gnu-configure-strict/t-subdirs-only-in-main.test
diff -u /dev/null pkgsrc/regress/gnu-configure-strict/t-subdirs-only-in-main.test:1.1
--- /dev/null Sat May 4 15:16:51 2019
+++ pkgsrc/regress/gnu-configure-strict/t-subdirs-only-in-main.test Sat May 4 15:16:51 2019
@@ -0,0 +1,20 @@
+# $NetBSD: t-subdirs-only-in-main.test,v 1.1 2019/05/04 15:16:51 rillig Exp $
+
+===> Configuring for package-1.0
+...
+=== configuring in subdir1
+...
+configure: WARNING: unrecognized options: --enable-feature
+...
+=== configuring in subdir2
+...
+configure: WARNING: unrecognized options: --enable-feature
+...
+
+The option is unrecognized in all subdirectories. Yet the main configure
+script didn't complain. Therefore it cannot be removed.
+
+# begin expected output
+good: all 1 options are used somewhere
+please set GNU_CONFIGURE_STRICT=no in the package
+# end expected output
Index: pkgsrc/regress/gnu-configure-strict/t-subdirs-unrecognized.test
diff -u /dev/null pkgsrc/regress/gnu-configure-strict/t-subdirs-unrecognized.test:1.1
--- /dev/null Sat May 4 15:16:51 2019
+++ pkgsrc/regress/gnu-configure-strict/t-subdirs-unrecognized.test Sat May 4 15:16:51 2019
@@ -0,0 +1,21 @@
+# $NetBSD: t-subdirs-unrecognized.test,v 1.1 2019/05/04 15:16:51 rillig Exp $
+
+===> Configuring for package-1.0
+...
+configure: WARNING: unrecognized options: --enable-feature
+...
+=== configuring in subdir1
+...
+configure: WARNING: unrecognized options: --enable-feature
+...
+=== configuring in subdir2
+...
+configure: WARNING: unrecognized options: --enable-feature
+...
+
+Since the option is unrecognized in both the main directory and in all
+subdirectories, it can be removed without side effect.
+
+# begin expected output
+option --enable-feature is unknown in all 3 configure scripts
+# end expected output
Index: pkgsrc/regress/gnu-configure-strict/t-verbose.test
diff -u /dev/null pkgsrc/regress/gnu-configure-strict/t-verbose.test:1.1
--- /dev/null Sat May 4 15:16:51 2019
+++ pkgsrc/regress/gnu-configure-strict/t-verbose.test Sat May 4 15:16:51 2019
@@ -0,0 +1,41 @@
+# $NetBSD: t-verbose.test,v 1.1 2019/05/04 15:16:51 rillig Exp $
+
+This is the output of running "bmake configure GNU_CONFIGURE_STRICT=warn"
+in devel/gettext-tools. That package has several subdirectories, and some
+of them even run multiple configure scripts.
+
+===> Configuring for gettext-tools-0.19.8.1nb1
+...
+=== configuring in gettext-runtime
+...
+configure: WARNING: unrecognized options: --with-included-libcroco, --without-git, --with-xz, --without-emacs, --disable-openmp
+...
+=== configuring in libasprintf
+...
+configure: WARNING: unrecognized options: --disable-csharp, --disable-java, --with-included-libcroco, --without-git, --with-xz, --without-included-gettext, --without-emacs, --disable-openmp
+...
+configure: WARNING: unrecognized options: --disable-csharp, --disable-java, --with-included-libcroco, --without-git, --with-xz, --without-included-gettext, --without-emacs, --disable-openmp
+configure: WARNING: unrecognized options: --with-included-libcroco, --without-git, --with-xz, --without-emacs, --disable-openmp
+...
+=== configuring in gettext-tools
+...
+=== configuring in examples
+...
+configure: WARNING: unrecognized options: --disable-csharp, --disable-java, --with-included-libcroco, --without-git, --with-xz, --without-included-gettext, --without-emacs, --disable-openmp
+...
+configure: WARNING: unrecognized options: --disable-csharp, --disable-java, --with-included-libcroco, --without-git, --with-xz, --without-included-gettext, --without-emacs, --disable-openmp
+
+Each of the subdirectories flags several options as unrecognized, but in
+summary, each of the given options is used in at least one subdirectory,
+which in this case is gettext-tools.
+
+# begin expected output
+good: option --with-included-libcroco is known in 2 of 5 configure scripts
+good: option --without-git is known in 2 of 5 configure scripts
+good: option --with-xz is known in 2 of 5 configure scripts
+good: option --without-emacs is known in 2 of 5 configure scripts
+good: option --disable-openmp is known in 2 of 5 configure scripts
+good: option --disable-csharp is known in 3 of 5 configure scripts
+good: option --disable-java is known in 3 of 5 configure scripts
+good: option --without-included-gettext is known in 3 of 5 configure scripts
+# end expected output
Home |
Main Index |
Thread Index |
Old Index