summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Pratt <mcpratt@pm.me>2024-04-01 15:51:16 -0400
committerRobert Marko <robimarko@gmail.com>2024-04-25 21:33:51 +0200
commit41bc16dcc4594cd85fb87942032dcbec0ade7068 (patch)
tree8d98ebcb01faf6840401141081c3c69cc3a6ed36
parent098bde1f3ebee9b5f302924474a99c00d6cc0242 (diff)
downloadopenwrt-41bc16dcc4594cd85fb87942032dcbec0ade7068.tar.gz
openwrt-41bc16dcc4594cd85fb87942032dcbec0ade7068.tar.bz2
openwrt-41bc16dcc4594cd85fb87942032dcbec0ade7068.zip
tools/bison: hardcode path to m4 with STAGING_DIR_HOST
Force bison to ignore the M4 environment variable and hardcode it to the locally built m4 during build operations using the relocatable path variable STAGING_DIR_HOST. This allows bison to continue to function while we are forcefully avoiding autoreconf and other autoconf and automake-like operations by giving a fake path to m4 with the M4 environment variable. The specific path can still be overridden independently from the environment within the line of invocation that runs bison by setting STAGING_DIR_HOST within the command, so document this in the help printout. Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS Signed-off-by: Michael Pratt <mcpratt@pm.me> Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
-rw-r--r--tools/bison/patches/000-relocatable.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/bison/patches/000-relocatable.patch b/tools/bison/patches/000-relocatable.patch
new file mode 100644
index 0000000000..b98d7a86dc
--- /dev/null
+++ b/tools/bison/patches/000-relocatable.patch
@@ -0,0 +1,43 @@
+--- a/src/files.c
++++ b/src/files.c
+@@ -560,9 +560,9 @@ pkgdatadir (void)
+ char const *
+ m4path (void)
+ {
+- char const *m4 = getenv ("M4");
++ char const *m4 = getenv ("STAGING_DIR_HOST");
+ if (m4)
+- return m4;
++ return strcat(getenv ("STAGING_DIR_HOST"), "/bin/m4");
+
+ /* We don't use relocate2() to store the temporary buffer and re-use
+ it, because m4path() is only called once. */
+--- a/src/getargs.c
++++ b/src/getargs.c
+@@ -373,11 +373,13 @@ usage (int status)
+ A --long option is required.
+ Otherwise, add exceptions to ../build-aux/cross-options.pl. */
+
+- printf (_("Usage: %s [OPTION]... FILE\n"), program_name);
++ printf (_("Usage: STAGING_DIR_HOST=... %s [OPTION]... FILE\n"), program_name);
+ fputs (_("\
+ Generate a deterministic LR or generalized LR (GLR) parser employing\n\
+ LALR(1), IELR(1), or canonical LR(1) parser tables.\n\
+ \n\
++Environment Variable STAGING_DIR_HOST controls path to m4\n\
++\n\
+ "), stdout);
+
+ fputs (_("\
+@@ -450,6 +452,11 @@ Output Files:\n\
+ -M, --file-prefix-map=OLD=NEW replace prefix OLD with NEW when writing file paths\n\
+ in output files\n\
+ "), stdout);
++
++ fputs (_("\
++Environment Variables:\n\
++ STAGING_DIR_HOST Path to m4 is [STAGING_DIR_HOST]/bin/m4\n\
++"), stdout);
+ putc ('\n', stdout);
+
+ argmatch_report_usage (stdout);