diff options
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | THANKS | 2 | ||||
-rw-r--r-- | bootstrap.conf | 1 | ||||
-rw-r--r-- | build-aux/.gitignore | 4 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | doc/.gitignore | 1 | ||||
-rw-r--r-- | doc/bison.texi | 6 | ||||
-rw-r--r-- | doc/local.mk | 3 | ||||
-rw-r--r-- | lib/.gitignore | 15 | ||||
-rw-r--r-- | m4/.gitignore | 4 | ||||
-rw-r--r-- | src/local.mk | 18 | ||||
-rw-r--r-- | src/main.c | 11 | ||||
-rw-r--r-- | src/output.c | 14 | ||||
-rw-r--r-- | src/yacc.in | 22 |
15 files changed, 105 insertions, 16 deletions
@@ -24,6 +24,15 @@ GNU Bison NEWS ** New features +*** Bison is now relocatable + + If you pass '--enable-relocatable' to 'configure', Bison is relocatable. + + A relocatable program can be moved or copied to a different location on + the file system. It can also be used through mount points for network + sharing. It is possible to make symlinks to the installed and moved + programs, and invoke them through the symlink. + *** %expect and %expect-rr modifiers on individual rules One can now document (and check) which rules participate in shift/reduce @@ -8,6 +8,16 @@ Bison requires GNU m4 1.4.6 or later. See: https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz +** Relocatability +If you pass '--enable-relocatable' to 'configure', Bison is relocatable. + +A relocatable program can be moved or copied to a different location on the +file system. It can also be used through mount points for network sharing. +It is possible to make symlinks to the installed and moved programs, and +invoke them through the symlink. + +See "Enabling Relocatability" in the documentation. + ** Internationalization Bison supports two catalogs: one for Bison itself (i.e., for the maintainer-side parser generation), and one for the generated parsers (i.e., @@ -40,6 +40,7 @@ Dagobert Michelsen dam@baltic-online.de Daniel Frużyński daniel@poradnik-webmastera.com Daniel Galloway dg1751@att.com Daniel Hagerty hag@gnu.org +David Barto david.barto@sparqlcity.com David J. MacKenzie djm@gnu.org David Kastrup dak@gnu.org David Michael fedora.dm0@gmail.com @@ -174,6 +175,7 @@ Troy A. Johnson troyj@ecn.purdue.edu Tys Lefering gccbison@gmail.com Valentin Tolmer nitnelave1@gmail.com Victor Khomenko victor.khomenko@newcastle.ac.uk +Victor Zverovich victor.zverovich@gmail.com Vin Shelton acs@alumni.princeton.edu W.C.A. Wijngaards wouter@NLnetLabs.nl Wayne Green wayne@infosavvy.com diff --git a/bootstrap.conf b/bootstrap.conf index 7e9aa1fc..c19f94f1 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -35,6 +35,7 @@ gnulib_modules=' quote quotearg readme-release realloc-posix + relocatable-prog relocatable-script spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp timevar unistd unistd-safer unlink unlocked-io diff --git a/build-aux/.gitignore b/build-aux/.gitignore index 0d8a2b30..e108a7fb 100644 --- a/build-aux/.gitignore +++ b/build-aux/.gitignore @@ -23,3 +23,7 @@ /useless-if-before-free /vc-list-files /ylwrap +/config.libpath +/install-reloc +/reloc-ldflags +/relocatable.sh.in diff --git a/configure.ac b/configure.ac index 61b07ca1..a1247eae 100644 --- a/configure.ac +++ b/configure.ac @@ -203,6 +203,7 @@ AC_ARG_ENABLE([yacc], [do not build a yacc command or an -ly library])], , [enable_yacc=yes]) AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes]) +AC_CONFIG_FILES([src/yacc], [chmod +x src/yacc]) # Checks for programs. AM_MISSING_PROG([DOT], [dot]) diff --git a/doc/.gitignore b/doc/.gitignore index 651eab93..31d36f60 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -30,3 +30,4 @@ /stamp-vti /version.texi /yacc.1 +/relocatable.texi diff --git a/doc/bison.texi b/doc/bison.texi index e1a5aaba..7bfc2879 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -382,6 +382,7 @@ Frequently Asked Questions * Strings are Destroyed:: @code{yylval} Loses Track of Strings * Implementing Gotos/Loops:: Control Flow in the Calculator * Multiple start-symbols:: Factoring closely related grammars +* Enabling Relocatability:: Moving Bison/using it through network shares * Secure? Conform?:: Is Bison POSIX safe? * I can't build Bison:: Troubleshooting * Where can I find help?:: Troubleshouting @@ -12875,6 +12876,7 @@ are addressed. * Implementing Gotos/Loops:: Control Flow in the Calculator * Multiple start-symbols:: Factoring closely related grammars * Secure? Conform?:: Is Bison POSIX safe? +* Enabling Relocatability:: Moving Bison/using it through network shares * I can't build Bison:: Troubleshooting * Where can I find help?:: Troubleshouting * Bug Reports:: Troublereporting @@ -13156,6 +13158,8 @@ However, Bison is intended to be a reliable program that conforms to the POSIX specification for Yacc. If you run into problems, please send us a bug report. +@include relocatable.texi + @node I can't build Bison @section I can't build Bison @@ -13209,7 +13213,7 @@ hearts. I found a bug. What should I include in the bug report? @end quotation -Before you send a bug report, make sure you are using the latest +Before sending a bug report, make sure you are using the latest version. Check @url{https://ftp.gnu.org/pub/gnu/bison/} or one of its mirrors. Be sure to include the version number in your bug report. If the bug is present in the latest version but not in a previous version, diff --git a/doc/local.mk b/doc/local.mk index 5af0ca01..8c02724e 100644 --- a/doc/local.mk +++ b/doc/local.mk @@ -19,7 +19,8 @@ info_TEXINFOS = doc/bison.texi doc_bison_TEXINFOS = \ $(CROSS_OPTIONS_TEXI) \ doc/fdl.texi \ - doc/gpl-3.0.texi + doc/gpl-3.0.texi \ + doc/relocatable.texi # Cannot express dependencies directly on file names because of Automake. # Obfuscate with a variable. diff --git a/lib/.gitignore b/lib/.gitignore index b7d7e6d2..8bfa82ab 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -294,3 +294,18 @@ /bitset/ /bitsetv.c /bitsetv.h +/allocator.c +/allocator.h +/areadlink.c +/areadlink.h +/canonicalize-lgpl.c +/careadlinkat.c +/careadlinkat.h +/progreloc.c +/readlink.c +/relocatable.c +/relocatable.h +/relocwrapper.c +/setenv.c +/xreadlink.c +/xreadlink.h diff --git a/m4/.gitignore b/m4/.gitignore index 187d9634..43cae90b 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -191,3 +191,7 @@ /sys_resource_h.m4 /timespec.m4 /intl-thread-locale.m4 +/canonicalize.m4 +/readlink.m4 +/relocatable-lib.m4 +/relocatable.m4 diff --git a/src/local.mk b/src/local.mk index 6d5adfd9..73d5efb5 100644 --- a/src/local.mk +++ b/src/local.mk @@ -13,10 +13,17 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see <http://www.gnu.org/licenses/>. +CLEANDIRS += %D%/*.dSYM + bin_PROGRAMS = src/bison # Prettify Automake-computed names of compiled objects. src_bison_SHORTNAME = bison +src_bison_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\" +if RELOCATABLE_VIA_LD + src_bison_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)` +endif + src_bison_CFLAGS = $(AM_CFLAGS) $(WERROR_CFLAGS) src_bison_SOURCES = \ src/AnnotationList.c \ @@ -127,16 +134,7 @@ src_bison_LDADD = \ ## ------ ## if ENABLE_YACC - bin_SCRIPTS = src/yacc + nodist_bin_SCRIPTS = src/yacc endif EXTRA_SCRIPTS = src/yacc MOSTLYCLEANFILES += src/yacc -CLEANDIRS += %D%/*.dSYM - -src/yacc: - $(AM_V_GEN)rm -f $@ $@.tmp - $(AM_V_at)$(MKDIR_P) src - $(AM_V_at)echo '#! /bin/sh' >$@.tmp - $(AM_V_at)echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@.tmp - $(AM_V_at)chmod a+x $@.tmp - $(AM_V_at)mv $@.tmp $@ @@ -26,6 +26,7 @@ #include <configmake.h> #include <progname.h> #include <quotearg.h> +#include <relocatable.h> /* relocate2 */ #include <timevar.h> #include "LR0.h" @@ -58,10 +59,16 @@ int main (int argc, char *argv[]) { +#define DEPENDS_ON_LIBINTL 1 set_program_name (argv[0]); setlocale (LC_ALL, ""); - (void) bindtextdomain (PACKAGE, LOCALEDIR); - (void) bindtextdomain ("bison-runtime", LOCALEDIR); + { + char *cp = NULL; + char const *localedir = relocate2 (LOCALEDIR, &cp); + (void) bindtextdomain (PACKAGE, localedir); + (void) bindtextdomain ("bison-runtime", localedir); + free (cp); + } (void) textdomain (PACKAGE); { diff --git a/src/output.c b/src/output.c index b6c60cf5..dd443608 100644 --- a/src/output.c +++ b/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); + } } diff --git a/src/yacc.in b/src/yacc.in new file mode 100644 index 00000000..1d45123d --- /dev/null +++ b/src/yacc.in @@ -0,0 +1,22 @@ +#! /bin/sh + +@relocatable_sh@ +if test "@RELOCATABLE@" = yes; then + exec_prefix="@exec_prefix@" + bindir="@bindir@" + orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables + func_find_curr_installdir # determine curr_installdir + func_find_prefixes + relocate () { + echo "$1/" \ + | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" \ + | sed -e 's,/$,,' + } +else + relocate () { + echo "$1" + } +fi + +bindir=`relocate "@bindir@"` +exec "$bindir/bison" -y "$@" |