From fe33d5ba13370027165b9acf2bd895f5b4d9a4ea Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 22 Mar 2023 18:29:24 -0400 Subject: [PATCH] tools: add gnulib source By having a local copy of gnulib, we can: import the latest macro fixes into any package, get rid of some statically stored macros that were otherwise missing, bootstrap GNU tools with the latest relevant source without having to wait for a release or rely on git submodules, and possibly more... The patch assists in bootstrapping by ignoring the building of po files using gettext, and also to allow a user-defined path to a program to include parameters. Signed-off-by: Michael Pratt --- rules.mk | 1 + tools/Makefile | 1 + tools/gnulib/Makefile | 25 +++++++++++ tools/gnulib/patches/000-bootstrap.patch | 54 ++++++++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 tools/gnulib/Makefile create mode 100644 tools/gnulib/patches/000-bootstrap.patch diff --git a/rules.mk b/rules.mk index cc7904ac72..dcac49667b 100644 --- a/rules.mk +++ b/rules.mk @@ -358,6 +358,7 @@ ifeq ($(CONFIG_BUILD_LOG),y) endif export BISON_PKGDATADIR:=$(STAGING_DIR_HOST)/share/bison +export HOST_GNULIB_SRCDIR:=$(STAGING_DIR_HOST)/share/gnulib export M4:=$(STAGING_DIR_HOST)/bin/m4 define shvar diff --git a/tools/Makefile b/tools/Makefile index 7e8fbad107..3bf94827cf 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -45,6 +45,7 @@ tools-y += findutils tools-y += firmware-utils tools-y += flex tools-y += gengetopt +tools-y += gnulib tools-y += libressl tools-y += libtool tools-y += lzma diff --git a/tools/gnulib/Makefile b/tools/gnulib/Makefile new file mode 100644 index 0000000000..c5b7e78c54 --- /dev/null +++ b/tools/gnulib/Makefile @@ -0,0 +1,25 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gnulib +PKG_CPE_ID:=cpe:/a:gnu:$(PKG_NAME) +PKG_VERSION:=f9a4ee73c3e7b544f640d0d04b55983d3a7b894e# # master + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://git.savannah.gnu.org/cgit/$(PKG_NAME).git/snapshot +PKG_HASH:=514716d58987a9c0de0d69fb22d42bcd19edf80eed099882a004ff162060f1a8 + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Configure +endef + +define Host/Install + $(INSTALL_DIR) $(1)/share/gnulib + $(CP) $(HOST_BUILD_DIR)/* $(1)/share/gnulib/ +endef + +define Host/Clean + rm -rf $(STAGING_DIR_HOST)/share/gnulib +endef + +$(eval $(call HostBuild)) diff --git a/tools/gnulib/patches/000-bootstrap.patch b/tools/gnulib/patches/000-bootstrap.patch new file mode 100644 index 0000000000..40ed41125c --- /dev/null +++ b/tools/gnulib/patches/000-bootstrap.patch @@ -0,0 +1,54 @@ +--- a/build-aux/bootstrap ++++ b/build-aux/bootstrap +@@ -237,14 +237,14 @@ test -r "$conffile" && . "$conffile" + + check_exists() { + if test "$1" = "--verbose"; then +- ($2 --version /dev/null 2>&1 ++ ($2 $3 $4 --version /dev/null 2>&1 + if test $? -ge 126; then + # If not found, run with diagnostics as one may be + # presented with env variables to set to find the right version +- ($2 --version /dev/null 2>&1 ++ ($@ --version /dev/null 2>&1 + fi + + test $? -lt 126 +@@ -309,7 +309,7 @@ p + q' + + get_version() { +- app=$1 ++ app="$@" + + $app --version >/dev/null 2>&1 || { $app --version; return 1; } + +@@ -366,13 +366,13 @@ check_versions() { + if [ "$req_ver" = "-" ]; then + # Merely require app to exist; not all prereq apps are well-behaved + # so we have to rely on $? rather than get_version. +- if ! check_exists --verbose $app; then ++ if ! check_exists --verbose "$app"; then + warn_ "Error: '$app' not found" + ret=1 + fi + else + # Require app to produce a new enough version string. +- inst_ver=$(get_version $app) ++ inst_ver=$(get_version "$app") + if [ ! "$inst_ver" ]; then + warn_ "Error: '$app' not found" + ret=1 +@@ -1135,7 +1135,7 @@ autogen() + # two just-pre-run programs. + + # Import from gettext. +- with_gettext=yes ++ with_gettext=no + grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \ + with_gettext=no + -- 2.30.2