[backfire] tools: backport quilt, bison, libtool, autoconf and automake relocatabilit...
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Fri, 27 Jan 2012 22:58:35 +0000 (22:58 +0000)
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Fri, 27 Jan 2012 22:58:35 +0000 (22:58 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@29924 3c298f89-4303-0410-b956-a3cf2f4a3e73

tools/autoconf/patches/000-relocatable.patch [new file with mode: 0644]
tools/automake/patches/000-relocatable.patch [new file with mode: 0644]
tools/automake/patches/100-aclocal-skip-not-existing-directories.patch
tools/bison/patches/000-relocatable.patch [new file with mode: 0644]
tools/libtool/patches/000-relocatable.patch [new file with mode: 0644]
tools/quilt/patches/000-relocatable.patch [new file with mode: 0644]

diff --git a/tools/autoconf/patches/000-relocatable.patch b/tools/autoconf/patches/000-relocatable.patch
new file mode 100644 (file)
index 0000000..98661e2
--- /dev/null
@@ -0,0 +1,154 @@
+--- a/bin/autoheader.in
++++ b/bin/autoheader.in
+@@ -29,7 +29,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
+ BEGIN
+ {
+-  my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
++  my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
++      ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
+   unshift @INC, "$pkgdatadir";
+   # Override SHELL.  On DJGPP SHELL may not be set to a shell
+@@ -51,7 +52,7 @@ use strict;
+ use vars qw ($config_h %verbatim %symbol);
+ # Lib files.
+-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
++my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@');
+ local $config_h;
+ my $config_h_in;
+ my @prepend_include;
+--- a/bin/autom4te.in
++++ b/bin/autom4te.in
+@@ -25,7 +25,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
+ BEGIN
+ {
+-  my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
++  my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
++      ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
+   unshift @INC, $pkgdatadir;
+   # Override SHELL.  On DJGPP SHELL may not be set to a shell
+@@ -45,7 +46,8 @@ use File::Basename;
+ use strict;
+ # Data directory.
+-my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@';
++my $pkgdatadir = $ENV{'AC_MACRODIR'} ||
++      ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
+ # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE.
+ my %language;
+@@ -88,7 +90,7 @@ my @include;
+ my $freeze = 0;
+ # $M4.
+-my $m4 = $ENV{"M4"} || '@M4@';
++my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/m4' : '@M4@');
+ # Some non-GNU m4's don't reject the --help option, so give them /dev/null.
+ fatal "need GNU m4 1.4 or later: $m4"
+   if system "$m4 --help </dev/null 2>&1 | grep reload-state >/dev/null";
+--- a/bin/autoreconf.in
++++ b/bin/autoreconf.in
+@@ -27,7 +27,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
+ BEGIN
+ {
+-  my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
++  my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
++      ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
+   unshift @INC, $pkgdatadir;
+   # Override SHELL.  On DJGPP SHELL may not be set to a shell
+@@ -107,9 +108,9 @@ Written by David J. MacKenzie and Akim D
+ ";
+ # Lib files.
+-my $autoconf   = $ENV{'AUTOCONF'}   || '@bindir@/@autoconf-name@';
+-my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@';
+-my $autom4te   = $ENV{'AUTOM4TE'}   || '@bindir@/@autom4te-name@';
++my $autoconf   = $ENV{'AUTOCONF'}   || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autoconf-name@' : '@bindir@/@autoconf-name@');
++my $autoheader = $ENV{'AUTOHEADER'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autoheader-name@' : '@bindir@/@autoheader-name@');
++my $autom4te   = $ENV{'AUTOM4TE'}   || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@');
+ my $automake   = $ENV{'AUTOMAKE'}   || 'automake';
+ my $aclocal    = $ENV{'ACLOCAL'}    || 'aclocal';
+ my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';
+--- a/bin/autoscan.in
++++ b/bin/autoscan.in
+@@ -26,7 +26,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
+ BEGIN
+ {
+-  my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
++  my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
++      ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
+   unshift @INC, $pkgdatadir;
+   # Override SHELL.  On DJGPP SHELL may not be set to a shell
+@@ -92,10 +93,10 @@ my $configure_scan = 'configure.scan';
+ my $log;
+ # Autoconf and lib files.
+-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
++my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@');
+ my $autoconf = "$autom4te --language=autoconf";
+ my @prepend_include;
+-my @include = ('@pkgdatadir@');
++my @include = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
+ # $help
+ # -----
+--- a/bin/autoupdate.in
++++ b/bin/autoupdate.in
+@@ -27,7 +27,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
+ BEGIN
+ {
+-  my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
++  my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
++      ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
+   unshift @INC, $pkgdatadir;
+   # Override SHELL.  On DJGPP SHELL may not be set to a shell
+@@ -51,10 +52,10 @@ my $autom4te = $ENV{'AUTOM4TE'} || '@bin
+ my $autoconf = "$autom4te --language=autoconf";
+ # We need to find m4sugar.
+ my @prepend_include;
+-my @include = ('@pkgdatadir@');
++my @include = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
+ my $force = 0;
+ # m4.
+-my $m4 = $ENV{"M4"} || '@M4@';
++my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/m4' : '@M4@');
+ # $HELP
+--- a/bin/ifnames.in
++++ b/bin/ifnames.in
+@@ -31,7 +31,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
+ BEGIN
+ {
+-  my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
++  my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
++      ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
+   unshift @INC, $pkgdatadir;
+   # Override SHELL.  On DJGPP SHELL may not be set to a shell
+--- a/bin/autoconf.as
++++ b/bin/autoconf.as
+@@ -85,7 +85,11 @@ exit_missing_arg='
+ # restore font-lock: '
+ # Variables.
+-: ${AUTOM4TE='@bindir@/@autom4te-name@'}
++if test -n "$STAGING_DIR"; then
++      : ${AUTOM4TE="$STAGING_DIR/../host/bin/@autom4te-name@"}
++else
++      : ${AUTOM4TE='@bindir@/@autom4te-name@'}
++fi
+ autom4te_options=
+ outfile=
+ verbose=false
diff --git a/tools/automake/patches/000-relocatable.patch b/tools/automake/patches/000-relocatable.patch
new file mode 100644 (file)
index 0000000..3255b97
--- /dev/null
@@ -0,0 +1,46 @@
+--- a/aclocal.in
++++ b/aclocal.in
+@@ -28,7 +28,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
+ BEGIN
+ {
+-  my $perllibdir = $ENV{'perllibdir'} || '@datadir@/@PACKAGE@-@APIVERSION@';
++  my $perllibdir = $ENV{'perllibdir'} ||
++      ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@');
+   unshift @INC, (split '@PATH_SEPARATOR@', $perllibdir);
+ }
+@@ -57,8 +58,8 @@ $perl_threads = 0;
+ # @system_includes can be augmented with the `dirlist' file.  Also
+ # --acdir will reset both @automake_includes and @system_includes.
+ my @user_includes = ();
+-my @automake_includes = ("@datadir@/aclocal-$APIVERSION");
+-my @system_includes = ('@datadir@/aclocal');
++my @automake_includes = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . "/../host/share/aclocal-$APIVERSION" : "@datadir@/aclocal-$APIVERSION");
++my @system_includes = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/aclocal' : '@datadir@/aclocal');
+ # Whether we should copy M4 file in $user_includes[0].
+ my $install = 0;
+--- a/automake.in
++++ b/automake.in
+@@ -31,7 +31,8 @@ package Language;
+ BEGIN
+ {
+-  my $perllibdir = $ENV{'perllibdir'} || '@datadir@/@PACKAGE@-@APIVERSION@';
++  my $perllibdir = $ENV{'perllibdir'} || 
++              ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@');
+   unshift @INC, (split '@PATH_SEPARATOR@', $perllibdir);
+   # Override SHELL.  This is required on DJGPP so that system() uses
+--- a/lib/Automake/Config.in
++++ b/lib/Automake/Config.in
+@@ -28,7 +28,7 @@ our @EXPORT = qw ($APIVERSION $PACKAGE $
+ our $APIVERSION = '@APIVERSION@';
+ our $PACKAGE = '@PACKAGE@';
+ our $VERSION = '@VERSION@';
+-our $libdir = '@datadir@/@PACKAGE@-@APIVERSION@';
++our $libdir = $ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@';
+ our $perl_threads = @PERL_THREADS@;
+ 1;;
index c049b83..cc1f49d 100644 (file)
@@ -1,6 +1,6 @@
 --- a/aclocal.in
 +++ b/aclocal.in
-@@ -309,6 +309,12 @@ sub scan_m4_dirs ($@)
+@@ -310,6 +310,12 @@ sub scan_m4_dirs ($@)
  
    foreach my $m4dir (@dirlist)
      {
diff --git a/tools/bison/patches/000-relocatable.patch b/tools/bison/patches/000-relocatable.patch
new file mode 100644 (file)
index 0000000..f83bb1e
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -77,6 +77,7 @@ MOSTLYCLEANFILES = yacc
+ yacc:
+       echo '#! /bin/sh' >$@
++      echo 'test -n "$$STAGING_DIR" && exec "$$STAGING_DIR/../host/bin/bison" -y "$$@"' >>$@
+       echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@
+       chmod a+x $@
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -1352,6 +1352,7 @@ uninstall-am: uninstall-binPROGRAMS unin
+ yacc:
+       echo '#! /bin/sh' >$@
++      echo 'test -n "$$STAGING_DIR" && exec "$$STAGING_DIR/../host/bin/bison" -y "$$@"' >>$@
+       echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@
+       chmod a+x $@
diff --git a/tools/libtool/patches/000-relocatable.patch b/tools/libtool/patches/000-relocatable.patch
new file mode 100644 (file)
index 0000000..c36b806
--- /dev/null
@@ -0,0 +1,96 @@
+--- a/libltdl/config/general.m4sh
++++ b/libltdl/config/general.m4sh
+@@ -53,7 +53,7 @@ test "${ECHO+set}" = set || ECHO=${as_ec
+ : ${MKDIR="mkdir"}
+ : ${MV="mv -f"}
+ : ${RM="rm -f"}
+-: ${SED="@SED@"}
++test "${STAGING_DIR+set}" = set && ${SED="$STAGING_DIR/../host/bin/sed"} || ${SED="@SED@"}
+ : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+ : ${Xsed="$SED -e 1s/^X//"}
+--- a/libtoolize.in
++++ b/libtoolize.in
+@@ -334,7 +334,11 @@ test "${ECHO+set}" = set || ECHO=${as_ec
+ : ${MKDIR="mkdir"}
+ : ${MV="mv -f"}
+ : ${RM="rm -f"}
+-: ${SED="@SED@"}
++if test -n "$STAGING_DIR"; then
++      : ${SED="$STAGING_DIR/../host/bin/sed"}
++else
++      : ${SED="@SED@"}
++fi
+ : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+ : ${Xsed="$SED -e 1s/^X//"}
+@@ -2476,10 +2480,17 @@ func_check_macros ()
+   # Locations for important files:
+   prefix=@prefix@
+-  datadir=@datadir@
+-  pkgdatadir=@pkgdatadir@
+-  pkgltdldir=@pkgdatadir@
+-  aclocaldir=@aclocaldir@
++  if test -n "$STAGING_DIR"; then
++    datadir="$STAGING_DIR/../host/share"
++    pkgdatadir="$STAGING_DIR/../host/share/libtool"
++    pkgltdldir="$STAGING_DIR/../host/share/libtool"
++    aclocaldir="$STAGING_DIR/../host/share/aclocal"
++  else
++    datadir=@datadir@
++    pkgdatadir=@pkgdatadir@
++    pkgltdldir=@pkgdatadir@
++    aclocaldir=@aclocaldir@
++  fi
+   auxdir=
+   macrodir=
+   configure_ac=configure.in
+--- a/libtoolize.m4sh
++++ b/libtoolize.m4sh
+@@ -1450,10 +1450,17 @@ func_check_macros ()
+   # Locations for important files:
+   prefix=@prefix@
+-  datadir=@datadir@
+-  pkgdatadir=@pkgdatadir@
+-  pkgltdldir=@pkgdatadir@
+-  aclocaldir=@aclocaldir@
++  if test -n "$STAGING_DIR"; then
++    datadir="$STAGING_DIR/../host/share"
++    pkgdatadir="$STAGING_DIR/../host/share/libtool"
++    pkgltdldir="$STAGING_DIR/../host/share/libtool"
++    aclocaldir="$STAGING_DIR/../host/share/aclocal"
++  else
++    datadir=@datadir@
++    pkgdatadir=@pkgdatadir@
++    pkgltdldir=@pkgdatadir@
++    aclocaldir=@aclocaldir@
++  fi
+   auxdir=
+   macrodir=
+   configure_ac=configure.in
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -875,9 +875,8 @@ dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+ # ----------------
+ m4_defun([_LT_TAG_COMPILER],
+ [AC_REQUIRE([AC_PROG_CC])dnl
+-
+ _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+-_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
++_LT_DECL([LTCFLAGS], [CFLAGS], ["-O2 -I\${STAGING_DIR:-$STAGING_DIR}/../host/include"], [LTCC compiler flags])dnl
+ _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+ _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+@@ -7544,9 +7543,8 @@ AC_SUBST([DLLTOOL])
+ # as few characters as possible.  Prefer GNU sed if found.
+ m4_defun([_LT_DECL_SED],
+ [AC_PROG_SED
+-test -z "$SED" && SED=sed
+ Xsed="$SED -e 1s/^X//"
+-_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
++_LT_DECL([], [SED], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/sed"], [A sed program that does not truncate output])
+ _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+     [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+ ])# _LT_DECL_SED
diff --git a/tools/quilt/patches/000-relocatable.patch b/tools/quilt/patches/000-relocatable.patch
new file mode 100644 (file)
index 0000000..f811023
--- /dev/null
@@ -0,0 +1,83 @@
+--- a/bin/quilt.in
++++ b/bin/quilt.in
+@@ -7,9 +7,15 @@
+ #  See the COPYING and AUTHORS files for more details.
+ export TEXTDOMAIN=quilt
+-export TEXTDOMAINDIR=@LOCALEDIR@
+-: ${QUILT_DIR=@QUILT_DIR@} ${QUILT_LIB=@QUILT_LIB@}
++if test -n "$STAGING_DIR"; then
++      export TEXTDOMAINDIR="$STAGING_DIR/../host/share/locale"
++      : ${QUILT_DIR=$STAGING_DIR/../host/share/quilt} ${QUILT_LIB=$STAGING_DIR/../host/lib/quilt}
++else
++      export TEXTDOMAINDIR=@LOCALEDIR@
++      : ${QUILT_DIR=@QUILT_DIR@} ${QUILT_LIB=@QUILT_LIB@}
++fi
++
+ export QUILT_DIR QUILT_LIB
+ if [ -z "$QUILTRC" ]
+--- a/quilt/scripts/edmail.in
++++ b/quilt/scripts/edmail.in
+@@ -29,7 +29,7 @@ BEGIN {
+ }
+ setlocale(LC_MESSAGES, "");
+-bindtextdomain("quilt", "@LOCALEDIR@");
++bindtextdomain("quilt", $ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/locale' : "@LOCALEDIR@");
+ textdomain("quilt");
+ sub _($) {
+--- a/quilt/scripts/inspect.in
++++ b/quilt/scripts/inspect.in
+@@ -6,7 +6,11 @@
+ #
+ #  See the COPYING and AUTHORS files for more details.
+-: ${QUILT_DIR=@QUILT_DIR@}
++if test -n "$STAGING_DIR"; then
++      : ${QUILT_DIR="$STAGING_DIR/../host/share/quilt"}
++else
++      : ${QUILT_DIR=@QUILT_DIR@}
++fi
+ if ! [ -r $QUILT_DIR/scripts/patchfns ]
+ then
+--- a/quilt/scripts/parse-patch.in
++++ b/quilt/scripts/parse-patch.in
+@@ -34,7 +34,7 @@ BEGIN {
+ }
+ setlocale(LC_MESSAGES, "");
+-bindtextdomain("quilt", "@LOCALEDIR@");
++bindtextdomain("quilt", $ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/locale' : "@LOCALEDIR@");
+ textdomain("quilt");
+ sub _($) {
+--- a/quilt/scripts/patchfns.in
++++ b/quilt/scripts/patchfns.in
+@@ -10,7 +10,11 @@
+ #  See the COPYING and AUTHORS files for more details.
+ export TEXTDOMAIN=quilt
+-export TEXTDOMAINDIR=@LOCALEDIR@
++if [ -n "$STAGING_DIR" ]; then
++      export TEXTDOMAINDIR="$STAGING_DIR/../host/share/locale"
++else
++      export TEXTDOMAINDIR=@LOCALEDIR@
++fi
+ : ${LC_CTYPE:=$LANG}
+ : ${LC_MESSAGES:=$LANG}
+--- a/quilt/scripts/remove-trailing-ws.in
++++ b/quilt/scripts/remove-trailing-ws.in
+@@ -31,7 +31,7 @@ BEGIN {
+ }
+ setlocale(LC_MESSAGES, "");
+-bindtextdomain("quilt", "@LOCALEDIR@");
++bindtextdomain("quilt", $ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/locale' : "@LOCALEDIR@");
+ textdomain("quilt");
+ sub _($) {