From: Nick Bowler Date: Sun, 27 Feb 2022 01:21:42 +0000 (-0500) Subject: fix-gnulib: Drop silly libgnu warning options. X-Git-Url: https://git.draconx.ca/gitweb/dxcommon.git/commitdiff_plain/a7cabb5d0f067e78afd029d8ec41d14660d8f9e2?hp=8d922a2f63801c78bfebc41612cb57839f5367b8 fix-gnulib: Drop silly libgnu warning options. 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. --- diff --git a/scripts/fix-gnulib.pl b/scripts/fix-gnulib.pl index 3af852d..69a7d86 100755 --- a/scripts/fix-gnulib.pl +++ b/scripts/fix-gnulib.pl @@ -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 diff --git a/tests/scripts.at b/tests/scripts.at index b49a94d..9c5f56a 100644 --- a/tests/scripts.at +++ b/tests/scripts.at @@ -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