Patchwork Avoid issues with APR package detecting Libtool

login
register
mail settings
Submitter Martin Panter
Date Jan. 16, 2011, 12:32 p.m.
Message ID <AANLkTi=q0Qa2w=Tn1kPGcA2Y5c6t3kfAfoRj8x1uvn2y@mail.gmail.com>
Download mbox | patch
Permalink /patch/288/
State Superseded
Headers show

Comments

Martin Panter - Jan. 16, 2011, 12:32 p.m.
The configure script was failing for APR, I think because it was
trying to hack Libtool internals and wasn't compatible with newer
Libtool 2.4. Fixed for me with attached patch.
-Martin
From bcabb119df06cb55a7db782ee5c147726415e9f9 Mon Sep 17 00:00:00 2001
From: Martin Panter <vadmium à gmail.com>
Date: Fri, 24 Dec 2010 05:39:15 +0000
Subject: [PATCH 2/3] APR: Avoid issues with Libtool modification script

Fixes issue with detecting Libtool script location by taking change from
upstream 1.3 branch. Original complaint from buildconf script:

/libtool.m4 not found

Also avoids issue with libtool.m4 modification by explicitly setting the top_
builddir Make variable
---
 recipes/apr/apr/libtool-detect.patch |  152 ++++++++++++++++++++++++++++++++++
 recipes/apr/apr_1.3.5.bb             |   10 ++-
 2 files changed, 161 insertions(+), 1 deletions(-)
 create mode 100644 recipes/apr/apr/libtool-detect.patch
Martin Panter - Jan. 17, 2011, 1:55 p.m.
On 16 January 2011 12:32, Martin Panter <vadmium+floss@gmail.com> wrote:
> The configure script was failing for APR, I think because it was
> trying to hack Libtool internals and wasn't compatible with newer
> Libtool 2.4. Fixed for me with attached patch.
> -Martin

FYI I stumbled across another solution to apparently the same problem.
Gotta love independently reinventing the wheel!
"apr: Update to 1.4.2"
https://lists.yoctoproject.org/pipermail/poky/2011-January/002014.html
Martin Panter - Jan. 18, 2011, 6:30 a.m.
Hi all

On 16 January 2011 12:32, Martin Panter <vadmium+floss@gmail.com> wrote:
> The configure script was failing for APR, I think because it was
> trying to hack Libtool internals and wasn't compatible with newer
> Libtool 2.4. Fixed for me with attached patch.

That with the recent APR 1.3.12 commit b1ae47c by Martin Jansa it
compiles so my change is no longer necessary.

For reference the full error was like this:

| buildconf: checking installation...
| buildconf: python version 2.6.5 (ok)
| build/buildcheck.sh: line 26: test: 65-: integer expression expected
| buildconf: autoconf version 2.65- (ok)
| Copying libtool helper files ...
| /libtool.m4 not found
| ERROR: Function do_configure failed

Patch

diff --git a/recipes/apr/apr/libtool-detect.patch b/recipes/apr/apr/libtool-detect.patch
new file mode 100644
index 0000000..2da11b3
--- /dev/null
+++ b/recipes/apr/apr/libtool-detect.patch
@@ -0,0 +1,152 @@ 
+Taken from the following change, which has been merged into 1.3 and 1.4
+but not released yet
+------------------------------------------------------------------------
+r748902 | jerenkrantz | 2009-02-28 18:32:55 +0000 (Sat, 28 Feb 2009) | 12 lines
+Changed paths:
+   M /apr/apr/trunk/build/buildcheck.sh
+   M /apr/apr/trunk/buildconf
+   M /apr/apr/trunk/configure.in
+
+Go back around and clean up GNU libtool 2.x detection and usage.
+
+(Tested with GNU libtool 2.2.6, 1.5.26, and jlibtool; and GNU autoconf 2.63.)
+
+* configure.in
+  (AC_CONFIG_MACRO_DIR): Define so that glibtoolize2 knows where to plop things.
+  (AC_PROG_SED): Always find sed.
+  (Xsed): Define to work around libtool 2.x brokenness.
+* build/buildcheck.sh: Re-activate libtool 2.x
+* buildconf: Clean up and rationalize the entire process of importing libtool
+  autoconf macros.
+
+------------------------------------------------------------------------
+Index: configure.in
+===================================================================
+--- configure.in	(revision 748901)
++++ configure.in	(revision 748902)
+@@ -9,6 +9,7 @@ AC_PREREQ(2.50)
+ AC_INIT(build/apr_common.m4)
+ AC_CONFIG_HEADER(include/arch/unix/apr_private.h)
+ AC_CONFIG_AUX_DIR(build)
++AC_CONFIG_MACRO_DIR(build)
+ 
+ dnl 
+ dnl Include our own M4 macros along with those for libtool
+@@ -121,6 +122,8 @@ dnl can only be used once within a configure scrip
+ dnl preload section from invoking the macro to get compiler info.
+ AC_PROG_CC
+ 
++AC_PROG_SED
++
+ dnl Preload
+ APR_PRELOAD
+ 
+@@ -164,6 +167,11 @@ echo "performing libtool configuration..."
+ AC_ARG_ENABLE(experimental-libtool,[  --enable-experimental-libtool Use experimental custom libtool],
+   [experimental_libtool=$enableval],[experimental_libtool=no])
+ 
++dnl Workarounds for busted Libtool 2.x when we don't call AC_PROG_LIBTOOL
++if test "x$Xsed" = "x"; then
++  Xsed="$SED -e 1s/^X//"
++fi
++
+ case $host in
+ *-os2*)
+     # Use a custom-made libtool replacement
+Index: buildconf
+===================================================================
+--- buildconf	(revision 748901)
++++ buildconf	(revision 748902)
+@@ -35,25 +35,20 @@ fi
+ # Note: APR supplies its own config.guess and config.sub -- we do not
+ #       rely on libtool's versions
+ #
+-echo "Copying libtool helper files ..."
++echo "buildconf: copying libtool helper files using $libtoolize"
+ 
+ # Remove any libtool files so one can switch between libtool 1.3
+ # and libtool 1.4 by simply rerunning the buildconf script.
+-(cd build ; rm -f ltconfig ltmain.sh libtool.m4)
++(cd build ; rm -f ltconfig ltmain.sh libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4)
+ 
+-$libtoolize --copy --automake
+-
+-if [ -f libtool.m4 ]; then 
+-   ltfile=`pwd`/libtool.m4
+-elif grep all_pkgmacro_files $libtoolize > /dev/null; then
+-    # libtool 2.x
+-   aclocal_dir=`sed -n '/^aclocaldir=/{s/.*=//;p;q;}' < $libtoolize`
+-   ltfiles=`sed -n '/^all_pkgmacro_files=/{s/.*=//;;s/"//;p;q;}' < $libtoolize`
+-   for f in $ltfiles; do
+-       test -f "$aclocal_dir/$f" && cp "$aclocal_dir/$f" build
+-   done
+-   ltfile=$aclocal_dir/libtool.m4
+-else
++lt_pversion=`$libtoolize --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
++lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
++IFS=.; set $lt_version; IFS=' '
++if test "$1" = "1"; then
++  $libtoolize --copy --automake
++  if [ -f libtool.m4 ]; then 
++    ltfile=`pwd`/libtool.m4
++  else
+    ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
+                    < $libtoolize`"
+    ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}
+@@ -62,21 +57,17 @@ fi
+      ltpath=`dirname $libtoolize`
+      ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
+    fi
+-fi
+-  
+-if [ ! -f $ltfile ]; then
++  fi
++  if [ ! -f $ltfile ]; then
+     echo "$ltfile not found"
+     exit 1
++  fi
++  # Do we need this anymore?
++  echo "buildconf: Using libtool.m4 at ${ltfile}."
++  cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' > build/libtool.m4
+ fi
+-
+-echo "buildconf: Using libtool.m4 at ${ltfile}."
+-
+-cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' > build/libtool.m4
+-
+-# libtool.m4 from 1.6 requires ltsugar.m4
+-if [ -f ltsugar.m4 ]; then
+-   rm -f build/ltsugar.m4
+-   mv ltsugar.m4 build/ltsugar.m4
++if test "$1" = "2"; then
++  $libtoolize --copy
+ fi
+ 
+ # Clean up any leftovers
+@@ -85,22 +76,22 @@ rm -f aclocal.m4 libtool.m4
+ #
+ # Generate the autoconf header and ./configure
+ #
+-echo "Creating include/arch/unix/apr_private.h.in ..."
++echo "buildconf: creating include/arch/unix/apr_private.h.in ..."
+ ${AUTOHEADER:-autoheader}
+ 
+-echo "Creating configure ..."
++echo "buildconf: creating configure ..."
+ ### do some work to toss config.cache?
+ ${AUTOCONF:-autoconf}
+ 
+ # Remove autoconf 2.5x's cache directory
+ rm -rf autom4te*.cache
+ 
+-echo "Generating 'make' outputs ..."
++echo "buildconf: generating 'make' outputs ..."
+ build/gen-build.py make
+ 
+ # Create RPM Spec file
+ if [ -f `which cut` ]; then
+-  echo rebuilding rpm spec file
++  echo "buildconf: rebuilding rpm spec file"
+   ( REVISION=`build/get-version.sh all include/apr_version.h APR`
+     VERSION=`echo $REVISION | cut -d- -s -f1`
+     RELEASE=`echo $REVISION | cut -d- -s -f2`
diff --git a/recipes/apr/apr_1.3.5.bb b/recipes/apr/apr_1.3.5.bb
index 955334f..251d8fe 100644
--- a/recipes/apr/apr_1.3.5.bb
+++ b/recipes/apr/apr_1.3.5.bb
@@ -7,7 +7,9 @@  PR = "r5"
 SRC_URI = "${APACHE_MIRROR}/apr/${P}.tar.bz2;name=apr135tarbz2 \
            file://configure_fixes.patch \
 	   file://cleanup.patch \
-           file://configfix.patch"
+           file://configfix.patch \
+           file://libtool-detect.patch;striplevel=0 \
+"
 
 inherit autotools lib_package binconfig
 
@@ -18,6 +20,12 @@  do_configure_prepend() {
 	./buildconf
 }
 
+# The buildconf script tries to change build/libtool.m4 to use the apr_
+# builddir Make variable instead of top_builddir, but it's not working very
+# well. So explicitly set top_builddir to reference the apr_builddir variable
+# as a workaround.
+EXTRA_OEMAKE += "top_builddir='$(apr_builddir)'"
+
 do_stage() {
 	autotools_stage_all
 	install -d ${STAGING_DATADIR}/apr