mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 07:13:02 +00:00
package: make bison a relocatable package
Suggested by David Barto https://lists.gnu.org/archive/html/help-bison/2015-02/msg00004.html and Victor Zverovich. https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00121.html This is very easy to do, thanks to work by Bruno Haible in gnulib. See "Supporting Relocation" in gnulib's documentation. * bootstrap.conf: We need relocatable-prog and relocatable-script (for yacc). * src/yacc.in: New. * configure.ac, src/local.mk: Instantiate it. * src/main.c, src/output.c (main, pkgdatadir): Use relocatable2. * doc/bison.texi (FAQ): Document it.
This commit is contained in:
14
src/output.c
14
src/output.c
@@ -26,6 +26,7 @@
|
||||
#include <get-errno.h>
|
||||
#include <path-join.h>
|
||||
#include <quotearg.h>
|
||||
#include <relocatable.h> /* relocate2 */
|
||||
#include <spawn-pipe.h>
|
||||
#include <timevar.h>
|
||||
#include <wait-process.h>
|
||||
@@ -44,6 +45,9 @@
|
||||
|
||||
static struct obstack format_obstack;
|
||||
|
||||
/* Memory allocated by relocate2, to free. */
|
||||
static char *relocate_buffer = NULL;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------.
|
||||
| Create a function NAME which associates to the muscle NAME the |
|
||||
@@ -718,11 +722,17 @@ output (void)
|
||||
unlink_generated_sources ();
|
||||
|
||||
obstack_free (&format_obstack, NULL);
|
||||
free (relocate_buffer);
|
||||
}
|
||||
|
||||
char const *
|
||||
pkgdatadir (void)
|
||||
{
|
||||
char const *cp = getenv ("BISON_PKGDATADIR");
|
||||
return cp ? cp : PKGDATADIR;
|
||||
if (relocate_buffer)
|
||||
return relocate_buffer;
|
||||
else
|
||||
{
|
||||
char const *cp = getenv ("BISON_PKGDATADIR");
|
||||
return cp ? cp : relocate2 (PKGDATADIR, &relocate_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user