From 01dd5fc03aec5e2e0590b469bb17709dcb841861 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Thu, 27 Dec 2007 02:11:03 +0000
Subject: [PATCH] upgrade libtool, add fixes for libdir searching, fix up paths
 to .la files

SVN-Revision: 9941
---
 package/libtool/Makefile                      |  9 ++++-
 package/libtool/patches/100-libdir_path.patch | 34 +++++++++++++++++++
 package/libtool/patches/110-no_rpath.patch    | 32 +++++++++++++++++
 .../libtool/patches/120-libdir_search.patch   | 19 +++++++++++
 4 files changed, 93 insertions(+), 1 deletion(-)
 create mode 100644 package/libtool/patches/100-libdir_path.patch
 create mode 100644 package/libtool/patches/110-no_rpath.patch
 create mode 100644 package/libtool/patches/120-libdir_search.patch

diff --git a/package/libtool/Makefile b/package/libtool/Makefile
index 1aad641986..c3feb9ec8b 100644
--- a/package/libtool/Makefile
+++ b/package/libtool/Makefile
@@ -9,7 +9,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libtool
-PKG_VERSION:=1.5.22
+PKG_VERSION:=1.5.24
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -21,6 +21,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 include $(INCLUDE_DIR)/package.mk
 
 CONFIGURE_PREFIX=$(STAGING_DIR)/host
+export GLOBAL_LIBDIR=$(STAGING_DIR)/usr/lib
 
 define Package/libltdl
   SECTION:=libs
@@ -31,11 +32,17 @@ endef
 
 define Build/InstallDev
 	$(MAKE) -C $(PKG_BUILD_DIR) \
+		bindir="$(2)/bin" \
+		datadir="$(2)/share" \
 		prefix="$(2)" \
 		exec_prefix="$(2)" \
 		install
 	$(INSTALL_DIR) $(1)/lib
 	mv $(2)/lib/* $(1)/lib/
+#	$(SED) 's,^dlopen_self=unknown,dlopen_self=yes,' \
+#	    -e 's,^dlopen_self_static=unknown,dlopen_self_static=no,' \
+#	    -e 's,^link_all_deplibs=unknown,link_all_deplibs=no,' \
+#		$(2)/bin/libtool
 endef
 
 define Package/libltdl/install
diff --git a/package/libtool/patches/100-libdir_path.patch b/package/libtool/patches/100-libdir_path.patch
new file mode 100644
index 0000000000..692d2f5536
--- /dev/null
+++ b/package/libtool/patches/100-libdir_path.patch
@@ -0,0 +1,34 @@
+Index: libtool-1.5.24/Makefile.in
+===================================================================
+--- libtool-1.5.24.orig/Makefile.in	2007-06-24 04:20:36.000000000 +0200
++++ libtool-1.5.24/Makefile.in	2007-12-26 04:39:04.171194995 +0100
+@@ -789,6 +789,7 @@
+ 	-rm -f ltmain.shT
+ 	date=`$(SHELL) $(srcdir)/mkstamp < $(srcdir)/ChangeLog` && \
+ 	sed -e 's/@''PACKAGE@/@PACKAGE@/' -e 's/@''VERSION@/@VERSION@/' \
++		-e 's#@''GLOBAL_LIBDIR@#$(GLOBAL_LIBDIR)#' \
+ 	    -e "s%@""TIMESTAMP@%$$date%" $(srcdir)/ltmain.in > ltmain.shT
+ 	mv -f ltmain.shT $@ || \
+ 	(rm -f $@ && cp ltmain.shT $@ && rm -f ltmain.shT)
+Index: libtool-1.5.24/ltmain.in
+===================================================================
+--- libtool-1.5.24.orig/ltmain.in	2007-12-26 04:39:09.151478801 +0100
++++ libtool-1.5.24/ltmain.in	2007-12-26 04:43:31.962455550 +0100
+@@ -5675,7 +5675,7 @@
+ 		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ 		  exit $EXIT_FAILURE
+ 		fi
+-		newdependency_libs="$newdependency_libs $libdir/$name"
++		newdependency_libs="$newdependency_libs @GLOBAL_LIBDIR@/$name"
+ 		;;
+ 	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+ 	      esac
+@@ -5700,7 +5700,7 @@
+ 		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ 		exit $EXIT_FAILURE
+ 	      fi
+-	      newdlprefiles="$newdlprefiles $libdir/$name"
++	      newdlprefiles="$newdlprefiles @GLOBAL_LIBDIR@/$name"
+ 	    done
+ 	    dlprefiles="$newdlprefiles"
+ 	  else
diff --git a/package/libtool/patches/110-no_rpath.patch b/package/libtool/patches/110-no_rpath.patch
new file mode 100644
index 0000000000..7c92524b3b
--- /dev/null
+++ b/package/libtool/patches/110-no_rpath.patch
@@ -0,0 +1,32 @@
+Well, brute force to disable rpath.
+
+Only 
+-hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
++#hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+should be necessary....
+
+Index: libtool-1.5.10/libtool.m4
+===================================================================
+--- libtool-1.5.10.orig/libtool.m4	2007-05-27 23:31:51.000000000 +0200
++++ libtool-1.5.10/libtool.m4	2007-05-27 23:50:26.000000000 +0200
+@@ -4244,16 +4244,16 @@
+ hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+ 
+ # Whether we should hardcode library paths into libraries.
+-hardcode_into_libs=$hardcode_into_libs
++hardcode_into_libs=no
+ 
+ # Flag to hardcode \$libdir into a binary during linking.
+ # This must work even if \$libdir does not exist.
+-hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
++hardcode_libdir_flag_spec=
+ 
+ # If ld is used when linking, flag to hardcode \$libdir into
+ # a binary during linking. This must work even if \$libdir does
+ # not exist.
+-hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
++hardcode_libdir_flag_spec_ld=
+ 
+ # Whether we need a single -rpath flag with a separated argument.
+ hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
diff --git a/package/libtool/patches/120-libdir_search.patch b/package/libtool/patches/120-libdir_search.patch
new file mode 100644
index 0000000000..ba2ab835ea
--- /dev/null
+++ b/package/libtool/patches/120-libdir_search.patch
@@ -0,0 +1,19 @@
+--- libtool-1.5.6/ltmain.in~libdir-la	2004-04-01 21:46:15.000000000 -0600
++++ libtool-1.5.6/ltmain.in	2004-05-14 22:53:51.000000000 -0500
+@@ -2147,8 +2147,14 @@
+ 	    absdir="$abs_ladir"
+ 	    libdir="$abs_ladir"
+ 	  else
+-	    dir="$libdir"
+-	    absdir="$libdir"
++            # Adding 'libdir' from the .la file to our library search paths
++            # breaks crosscompilation horribly.  We cheat here and don't add
++            # it, instead adding the path where we found the .la.  -CL
++	    dir="$abs_ladir"
++	    absdir="$abs_ladir"
++	    libdir="$abs_ladir"
++	    #dir="$libdir"
++	    #absdir="$libdir"
+ 	  fi
+ 	else
+ 	  dir="$ladir/$objdir"
-- 
2.30.2