From a7cabb5d0f067e78afd029d8ec41d14660d8f9e2 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sat, 26 Feb 2022 20:21:42 -0500 Subject: [PATCH] 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. --- scripts/fix-gnulib.pl | 10 ++++++++++ tests/scripts.at | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) 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 -- 2.43.2