]> git.draconx.ca Git - dxcommon.git/commitdiff
fix-gnulib: Drop silly libgnu warning options.
authorNick Bowler <nbowler@draconx.ca>
Sun, 27 Feb 2022 01:21:42 +0000 (20:21 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sun, 27 Feb 2022 01:21:42 +0000 (20:21 -0500)
We really don't care about upstream's choice of build warning flags.
All pushing this on downstream users does is massively inflate generated
makefiles for no actual benefit.

scripts/fix-gnulib.pl
tests/scripts.at

index 3af852d20d0ec54f4c42e759a1904c3e4db066da..69a7d864f29e939385a3f712d6fa1515318468e1 100755 (executable)
@@ -186,6 +186,16 @@ EOF
        # useful for non-recursive builds.  Strip them out.
        drop if (/^(AM_CPPFLAGS|AM_CFLAGS)/);
 
+       # We don't care about upstream warning flags that just result in adding
+       # massive amounts of additional build rules for no reason.
+       if (/_CFLAGS/) {
+               s/ *\$\(GL_CFLAG_GNULIB_WARNINGS\)// if /_CFLAGS\s*=/;
+       }
+
+       # Drop superfluous CFLAGS assignments (which may be created by above
+       # transformation).
+       drop if /_CFLAGS\s*=\s*\$\(AM_CFLAGS\)\s*$/;
+
        # Library dependencies are added automatically to libgnu.la by
        # gnulib-tool.  Unfortunately, this means that everything linking
        # against libgnu.la is forced to pull in the same deps, even if they're
index b49a94dad6b3cad48005af18100b200db0d4d4f4..9c5f56a950eb4391aa8d3b390117a53c4956bc10 100644 (file)
@@ -628,6 +628,25 @@ sed -n -e '/^## begin gnulib/,/^## end   gnulib/p' \
 
 AT_CLEANUP
 
+AT_SETUP([fix-gnulib.pl warning removal])
+
+AT_DATA([test.mk.in], [[
+## test begin
+noinst_LTLIBRARIES += libgnu.la
+libgnu_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS)
+noinst_LIBRARIES += libgnu.a
+libgnu_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS)
+## test end
+]])
+AT_CHECK([test_fix_gnulib -i test.mk.in -o test.mk || exit
+sed -n '/^## test begin/,/^## test end/p' test.mk], [0], [## test begin
+EXTRA_LTLIBRARIES += libgnu.la
+EXTRA_LIBRARIES += libgnu.a
+## test end
+])
+
+AT_CLEANUP
+
 dnl TEST_FIND_AUTOMAKE_VER([to-check], [test-action])
 dnl
 dnl For each whitespace-separated version token in to-check, check if we can