From 1dc749f957e34a3fb8156ebcabef2545a0d4998e Mon Sep 17 00:00:00 2001 From: Maxime Joubert Date: Fri, 20 Jul 2018 23:11:39 +0200 Subject: [PATCH] build: bison: build nolimips with bison In order to avoid conflicts between the LRDE bison version needed to build nolimips and the last bison version installed on the host machine, this commit gets bison from the LRDE tarball, builds it and uses it. This commit fixes also some ugly tabulations and trailing whitespaces. * .gitignore, * bootstrap, * build-aux/bin/bison++.in, * build-aux/gitlog-to-changelog, * configure.ac: here. --- .gitignore | 4 ++ bootstrap | 78 +++++++++++++++++++++++------------ build-aux/bin/bison++.in | 64 ++++++++++++++-------------- build-aux/gitlog-to-changelog | 10 ++--- configure.ac | 4 +- 5 files changed, 95 insertions(+), 65 deletions(-) diff --git a/.gitignore b/.gitignore index d161dd0..82a078f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,7 @@ Makefile /configure /gnulib /m4 +/build-aux/bin/bison +/build-aux/bin/yacc +/build-aux/lib +/build-aux/share diff --git a/bootstrap b/bootstrap index ee0e3d2..8265618 100755 --- a/bootstrap +++ b/bootstrap @@ -30,7 +30,7 @@ export LC_ALL usage() { cat <&2 "$0: $option: unknown option" - exit 1;; + echo >&2 "$0: $option: unknown option" + exit 1;; esac done @@ -116,12 +116,12 @@ cvs_checkout() { pserver) build_cvs_prefix pserver ${CVS_USER:-anonymous} ;; gserver|server) - build_cvs_prefix $CVS_AUTH ${CVS_USER--} - ;; + build_cvs_prefix $CVS_AUTH ${CVS_USER--} + ;; ext) build_cvs_prefix $CVS_AUTH ${CVS_USER--} ;; *) echo "$0: Unknown CVS access method" >&2 - exit 1;; + exit 1;; esac cvs -q -d ${CVS_PREFIX}cvs.sv.gnu.org:/cvsroot/$1 co $1 || exit @@ -147,7 +147,7 @@ newline=' ' get_modules() { - new_gnulib_modules=`sed '/^[ ]*#/d; /^[ ]*$/d' $*` + new_gnulib_modules=`sed '/^[ ]*#/d; /^[ ]*$/d' $*` case $gnulib_modules,$new_gnulib_modules in ?*,?*) new_gnulib_modules=$newline$new_gnulib_modules;; esac @@ -194,18 +194,18 @@ for gnulib_file in $gnulib_files; do dest=$gnulib_file case $gnulib_file in - m4/codeset.m4) continue;; - m4/intdiv0.m4) continue;; - m4/inttypes-pri.m4) continue;; - m4/isc-posix.m4) continue;; - m4/lcmessage.m4) continue;; - m4/onceonly_2_57.m4) dest=m4/onceonly.m4;; + m4/codeset.m4) continue;; + m4/intdiv0.m4) continue;; + m4/inttypes-pri.m4) continue;; + m4/isc-posix.m4) continue;; + m4/lcmessage.m4) continue;; + m4/onceonly_2_57.m4) dest=m4/onceonly.m4;; # These will be overwritten by autopoint, which still uses # old jm_.* macro names, so we have to keep both copies. - m4/gettext.m4 | m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \ - m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \ - m4/ulonglong.m4) - dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;; + m4/gettext.m4 | m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \ + m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \ + m4/ulonglong.m4) + dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;; esac rm -f $dest && @@ -218,9 +218,9 @@ echo "$0: Creating m4/gnulib.m4" echo "#" echo "AC_DEFUN([nolimips_GNULIB],[" for gnulib_module in $gnulib_modules; do - echo "# $gnulib_module" - $GNULIB_SRCDIR/gnulib-tool \ - --aux-dir=build-aux --extract-autoconf-snippet $gnulib_module + echo "# $gnulib_module" + $GNULIB_SRCDIR/gnulib-tool \ + --aux-dir=build-aux --extract-autoconf-snippet $gnulib_module done | sed '/AM_GNU_GETTEXT/d' echo "])") > ./m4/gnulib.m4 @@ -259,6 +259,32 @@ do done export LIBTOOLIZE=$libtoolize +TIGER_WEBSITE="https://www.lrde.epita.fr/~tiger/download" +BISON="bison-3.0.4.19-fbaf" +BISON_TARBALL="$BISON.tar.xz" +BISON_PREFIX_DIR="$(pwd)/build-aux" +BISON_BIN="$BISON_PREFIX_DIR/bin/bison" + +# Getting LRDE bison +if [ ! -f "$BISON_BIN" ]; then + echo "$0: wget $TIGER_WEBSITE/$BISON_TARBALL" + wget -q $TIGER_WEBSITE/$BISON_TARBALL + echo "$0: tar -xvf $BISON_TARBALL" + tar -xvf $BISON_TARBALL + echo "$0: rm $BISON_TARBALL" + rm $BISON_TARBALL + + # Building bison + echo "$0: mkdir $BISON/build" + mkdir $BISON/build + echo "$0: cd $BISON/build && ../configure && make" + cd $BISON/build + ../configure --prefix=$BISON_PREFIX_DIR + make install + cd ../.. + rm -r $BISON +fi + # Reconfigure, getting other files. diff --git a/build-aux/bin/bison++.in b/build-aux/bin/bison++.in index 733750b..d4116aa 100755 --- a/build-aux/bin/bison++.in +++ b/build-aux/bin/bison++.in @@ -52,11 +52,11 @@ get_options () # Handle --option=value by splitting apart and putting back on argv. case $1 in (--*=*) - opt=$(echo "$1" | sed -e 's/=.*//') - val=$(echo "$1" | sed -e 's/[^=]*=//') - shift - set dummy "$opt" "$val" ${1+"$@"}; shift - ;; + opt=$(echo "$1" | sed -e 's/=.*//') + val=$(echo "$1" | sed -e 's/[^=]*=//') + shift + set dummy "$opt" "$val" ${1+"$@"}; shift + ;; esac case $1 in @@ -205,7 +205,7 @@ install () # Exit status. status=0 -: ${BISON='@BISON@'} +: ${BISON='@abs_top_srcdir@/@BISON@'} me=$(basename $0) fuse_switch='@abs_srcdir@/fuse-switch' @@ -251,43 +251,43 @@ do base=$(basename $file) case $status:$base in (*:$input_base) - # Leave it here. - ;; + # Leave it here. + ;; # Success or not, install it. (*:*.xml) - # Computing the HTML is slow. Do it when the XML changed. - fix_bison_output "$file" - compile_xml_file "$file" "xml2xhtml" "html" - # Compiling the dot output is quite long, it would be better - # to do that from the Makefile, so that -j applies. - # compile_xml_file "$file" "xml2dot" "dot" - install "$file" - ;; + # Computing the HTML is slow. Do it when the XML changed. + fix_bison_output "$file" + compile_xml_file "$file" "xml2xhtml" "html" + # Compiling the dot output is quite long, it would be better + # to do that from the Makefile, so that -j applies. + # compile_xml_file "$file" "xml2dot" "dot" + install "$file" + ;; (0:*.hh) - fix_bison_output "$file" - # To save cycles, if the file differs only on sync lines, - # update it (to be right), but keep the original timestamps. - if test -r "$(out "$file")" && - diff -I '^#line' -I '/\* Line .* of .* \*/' -q \ + fix_bison_output "$file" + # To save cycles, if the file differs only on sync lines, + # update it (to be right), but keep the original timestamps. + if test -r "$(out "$file")" && + diff -I '^#line' -I '/\* Line .* of .* \*/' -q \ "$file" "$(out "$file")" then - touch -r "$(out "$file")" "$file" - cp "$(out "$file")" "$(out "$file").bak" - verbose "kept the stamps of $file" - fi - install "$file" - ;; + touch -r "$(out "$file")" "$file" + cp "$(out "$file")" "$(out "$file").bak" + verbose "kept the stamps of $file" + fi + install "$file" + ;; (*:*.output) - install "$file" - ;; + install "$file" + ;; (0:*) - fix_bison_output "$file" - install "$file" - ;; + fix_bison_output "$file" + install "$file" + ;; esac done diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 83bafdf..1e73f42 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -3,13 +3,13 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" "$@"' if 0; # Convert git log output to ChangeLog format. -my $VERSION = '2016-03-22 21:49'; # UTC +my $VERSION = '2018-03-07 03:47'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. -# Copyright (C) 2008-2016 Free Software Foundation, Inc. +# Copyright (C) 2008-2018 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ my $VERSION = '2016-03-22 21:49'; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # Written by Jim Meyering @@ -33,7 +33,7 @@ use POSIX qw(strftime); (my $ME = $0) =~ s|.*/||; -# use File::Coda; # http://meyering.net/code/Coda/ +# use File::Coda; # https://meyering.net/code/Coda/ END { defined fileno STDOUT or return; close STDOUT and return; @@ -491,7 +491,7 @@ sub git_dir_option($) # Local Variables: # mode: perl # indent-tabs-mode: nil -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "my $VERSION = '" # time-stamp-format: "%:y-%02m-%02d %02H:%02M" # time-stamp-time-zone: "UTC0" diff --git a/configure.ac b/configure.ac index ca81e07..8b42e3e 100644 --- a/configure.ac +++ b/configure.ac @@ -19,8 +19,8 @@ AM_SILENT_RULES([yes]) ## Development tools ------------------- # Look for a lex-like program. AC_PROG_LEX -# Look for bison. -AC_CHECK_PROGS([BISON], [bison]) +# Set the path to the lrde version of bison. +AC_SUBST([BISON], [build-aux/bin/bison]) # Look for a C++ compiler. AC_LANG([C++]) -- GitLab