[Pkg-php-commits] [php/debian-sid] Detect the path to ltmain.sh at build time and set conflicts appropriately

Raphael Geissert atomo64 at gmail.com
Sun Feb 7 23:19:15 UTC 2010


NOTE: this is rebased to include the later changes in debian-sid that
improved the detection and aesthetics.

Since version 2.2 libtool ships ltmain.sh under /usr/share/libtool/config,
which lead to broken symlinks. debian/rules will now try to find the right
path at build time and add a conflict on pre 2.2 versions of libtool if
the path is usr/share/libtool/config, or a conflict on version 2.2 or higher
if the path is usr/share/libtool, to avoid issues when backporting.

note, this also contains changes to libtool related stuff in the patch
033-we_WANT_libtool.patch which was in seperate commits in unstable:

upstream ships an out of date version of libtool.  this ensures that
we build against an up-to-date version of libtool by running libtoolize
as part of our build process (this is called indirectly via ./buildconf.sh
from debian/rules)

note that we don't touch the libtool.m4 that they ship here, and this file
gets included in the build process as part of the phpize stuff.  however,
this is solved in ./debian/rules where it's overwritten with a symlink.
---
 debian/control                           |    1 +
 debian/patches/033-we_WANT_libtool.patch |   24 +++++++++++----------
 debian/rules                             |   33 ++++++++++++++++++++---------
 3 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/debian/control b/debian/control
index 1c1f6c5..f39d46d 100644
--- a/debian/control
+++ b/debian/control
@@ -116,6 +116,7 @@ Description: command-line interpreter for the php5 scripting language
 
 Package: php5-dev
 Depends: autoconf, automake1.4, libssl-dev, libtool, shtool, php5-common (>= ${binary:Version})
+Conflicts: ${libtool:Conflicts}
 Architecture: any
 Description: Files for PHP5 module development
  This package provides the files from the PHP5 source needed for compiling
diff --git a/debian/patches/033-we_WANT_libtool.patch b/debian/patches/033-we_WANT_libtool.patch
index 63dcbe3..c7f58f1 100644
--- a/debian/patches/033-we_WANT_libtool.patch
+++ b/debian/patches/033-we_WANT_libtool.patch
@@ -1,18 +1,20 @@
+upstream ships an out of date version of libtool.  this ensures that
+we build against an up-to-date version of libtool by running libtoolize
+as part of our build process (this is called indirectly via ./buildconf.sh
+from debian/rules)
+
+note that we don't touch the libtool.m4 that they ship here, and this file 
+gets included in the build process as part of the phpize stuff.  however,
+this is solved in ./debian/rules where it's overwritten with a symlink.
 --- php.orig/build/build2.mk
 +++ php/build/build2.mk
-@@ -52,6 +52,15 @@ $(TOUCH_FILES):
+@@ -52,7 +52,8 @@ $(TOUCH_FILES):
  
  aclocal.m4: configure.in acinclude.m4
  	@echo rebuilding $@
-+	@libtoolize=`./build/shtool path glibtoolize libtoolize`; \
-+	if $$libtoolize --help | grep -q -- --install; then \
-+	  $$libtoolize --copy --install --automake --force; \
-+	else \
-+	  $$libtoolize --copy --automake --force; \
-+	fi; \
-+	ltpath=`dirname $$libtoolize`; \
-+	ltfile=`cd $$ltpath/../share/aclocal; pwd`/libtool.m4; \
-+	cp $$ltfile ./build/libtool.m4
- 	cat acinclude.m4 ./build/libtool.m4 > $@
+-	cat acinclude.m4 ./build/libtool.m4 > $@
++	libtoolize --copy --install --automake --force
++	aclocal
  
  configure: aclocal.m4 configure.in $(config_m4_files)
+ 	@echo rebuilding $@
diff --git a/debian/rules b/debian/rules
index 20a5857..93a87bb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -59,6 +59,22 @@ ifeq ($(wildcard /usr/share/file/magic.mime), /usr/share/file/magic.mime)
 MAGIC_MIME = /usr/share/file/magic.mime
 endif
 
+# some other helpful (for readability at least) shorthand variables
+PHPIZE_BUILDDIR = debian/php5-dev/usr/lib/php5/build
+
+# support new (>= 2.2) and older versions of libtool for backporting ease
+LIBTOOL_DIRS = /usr/share/libtool/config /usr/share/libtool
+LTMAIN = $(firstword $(wildcard $(foreach d,$(LIBTOOL_DIRS),$d/ltmain.sh)))
+LTMAIN_DIR = $(dir $(LTMAIN))
+
+ifeq ($(LTMAIN_DIR), /usr/share/libtool/)
+LIBTOOL_CONFLICTS:=libtool (>= 2.2)
+else ifeq ($(LTMAIN_DIR), /usr/share/libtool/config/)
+LIBTOOL_CONFLICTS:=libtool (<< 2.2)
+else
+LIBTOOL_CONFLICTS:=$(error "could not resolve path to ltmain.sh")
+endif
+
 # only enable interbase support for i386/amd64/powerpc/sparc
 ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386 powerpc sparc))
 	IBFLAGS=--with-interbase=shared,/usr \
@@ -439,16 +455,11 @@ install: build
 		chmod 644 debian/php5-dev/usr/lib/php5/build/$$i; \
 	done
 	# shipping duplicate files from other packages is hell for security audits
-	rm debian/php5-dev/usr/lib/php5/build/config.guess && \
-	  ln -s ../../../share/misc/config.guess debian/php5-dev/usr/lib/php5/build/config.guess
-	rm debian/php5-dev/usr/lib/php5/build/config.sub && \
-	  ln -s ../../../share/misc/config.sub debian/php5-dev/usr/lib/php5/build/config.sub
-	rm debian/php5-dev/usr/lib/php5/build/libtool.m4 && \
-	  ln -s ../../../share/libtool/libtool.m4 debian/php5-dev/usr/lib/php5/build/libtool.m4
-	rm debian/php5-dev/usr/lib/php5/build/ltmain.sh && \
-	  ln -s ../../../share/libtool/ltmain.sh debian/php5-dev/usr/lib/php5/build/ltmain.sh
-	rm debian/php5-dev/usr/lib/php5/build/shtool && \
-	  ln -s ../../../bin/shtool debian/php5-dev/usr/lib/php5/build/shtool
+	ln -sf /usr/share/misc/config.guess $(PHPIZE_BUILDDIR)/config.guess
+	ln -sf /usr/share/misc/config.sub $(PHPIZE_BUILDDIR)/config.sub
+	ln -sf /usr/share/aclocal/libtool.m4 $(PHPIZE_BUILDDIR)/libtool.m4
+	ln -sf $(LTMAIN_DIR)ltmain.sh $(PHPIZE_BUILDDIR)/ltmain.sh
+	ln -sf /usr/bin/shtool $(PHPIZE_BUILDDIR)/shtool
 	# make php-dev stuff versioned
 	for i in php-config phpize; do \
 		mv debian/php5-dev/usr/bin/$$i debian/php5-dev/usr/bin/"$$i"5; \
@@ -582,6 +593,8 @@ binary-arch: build install
 
 	echo "apache2:Depends=apache2-mpm-prefork (>> 2.0.52) | apache2-mpm-itk, apache2.2-common" >>debian/libapache2-mod-php5.substvars
 	echo "apache2:Depends=apache2-mpm-prefork (>> 2.0.52) | apache2-mpm-itk, apache2.2-common" >>debian/libapache2-mod-php5filter.substvars
+
+	echo "libtool:Conflicts=$(LIBTOOL_CONFLICTS)" >>debian/php5-dev.substvars
 	dh_gencontrol -s
 	dh_md5sums -s
 	dh_builddeb -s
-- 
1.6.3.3





More information about the Pkg-php-commits mailing list