Package: pcre3
Version: 7.6
Severity: wishlist
Tags: patch
User: [EMAIL PROTECTED]
Usertags: crossbuilt

This is a very similar bug to #492555 for the same reasons - pcre3 fails
to cross-build in a clean chroot because libpcre3.la is not explicitly
set in the LDADD of the binaries that use internal libraries built
against libpcre3.

This doesn't relate to Lenny, it is part of my ongoing mass bug filing
for cross-build support. I am gradually migrating the patches that I use
for Emdebian Lenny. pcre3 fails to cross-build without patches due to
an upstream bug in Makefile.am. A separate issue with how
pkg-config and libtool are handled in pcre3 means that the Debian
support also needs a tweak.

In line with the autotools-dev guidance, --host should not be passed
unless cross-building so the first part of the patch moves the --build
and --host instructions to a conditional, only passing --build for
native builds. The new conditional also implements the libtool fix to
ensure that the build looks for /usr/arm-linux-gnu/lib/libm.so instead
of /usr/lib/libm.so which would fail when cross-building (for ARM).
These changes have no effect on the Debian build, only the cross-build.

The attached patches are intended to be forwarded upstream but have been
implemented via dpatch because this is the simplest way to handle
upstream changes within Emdebian. pcre3 already includes some changes
outside the debian/ directory in the .diff.gz so implementing the
upstream change with dpatch will result in these new lintian warnings:

W: pcre3 source: patch-system-but-direct-changes-in-diff Makefile.in
W: pcre3 source: patch-system-but-direct-changes-in-diff aclocal.m4
W: pcre3 source: patch-system-but-direct-changes-in-diff config.sub
W: pcre3 source: patch-system-but-direct-changes-in-diff configure
W: pcre3 source: patch-system-but-direct-changes-in-diff configure.ac
W: pcre3 source: patch-system-but-direct-changes-in-diff
doc/pcre_version.3
W: pcre3 source: patch-system-but-direct-changes-in-diff doc/pcreapi.3
W: pcre3 source: patch-system-but-direct-changes-in-diff doc/pcregrep.1
W: pcre3 source: patch-system-but-direct-changes-in-diff ltmain.sh
W: pcre3 source: patch-system-but-direct-changes-in-diff pcre_compile.c
W: pcre3 source: patch-system-but-direct-changes-in-diff pcrecpp.cc
W: pcre3 source: patch-system-but-direct-changes-in-diff pcrecpp.h
W: pcre3 source: patch-system-but-direct-changes-in-diff pcreposix.h
W: pcre3 source: patch-system-but-direct-changes-in-diff pcretest.c

If the effect of the 10-emdebian-libs.dpatch file is implemented
upstream (or via a direct change in the .diff.gz) and you would like an
updated patch for debian/rules that does not implement dpatch, let me
know. The dpatch changes are as advised at:

http://matrixhasu.altervista.org/index.php?view=use_dpatch

You can see the history of pcre3 cross-builds here:
http://www.emdebian.org/buildd/history.php?pkg=pcre3

A typical change from the patch would be:
-pcrecpp_unittest_LDADD = libpcrecpp.la
+pcrecpp_unittest_LDADD = libpcrecpp.la libpcre.la

libpcrecpp.so itself needs libpcre.so and cross-building without the
libpcre.la linkage results in missing symbols (see previous cross-builds
in the history above).

This has no effect on the dependencies or NEEDED linkages in the final 
binaries, it merely states explicitly what can be inferred from the 
existing rules.

This is an awkward bug for Emdebian because it does not tend to show up
in a "dirty" build environment, only in a clean chroot build. Once the
Lenny freeze is over, I would appreciate it if you would include these
changes.


*** ../crossbuild.diff
--- pcre3-7.6.debian/debian/rules 
+++ pcre3-7.6.emdebian/debian/rules 
@@ -5,10 +5,17 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+include /usr/share/dpatch/dpatch.make
 # These are used for cross-compiling and for saving the configure script
 # from having to guess our platform (since we know it already)
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) \
+ LDFLAGS="-L/usr/$(DEB_HOST_GNU_TYPE)/lib"
+else
+CROSS= --build $(DEB_BUILD_GNU_TYPE)
+endif
 
 CFLAGS = -Wall -g
 INSTALL = install
@@ -31,14 +38,14 @@
        dh_testdir
        # Add here commands to configure the package.
        CC_FOR_BUILD=cc CFLAGS="$(CFLAGS)" ./configure \
-               --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+               $(CROSS) \
                --prefix=/usr --mandir=\$${prefix}/share/man \
                --infodir=\$${prefix}/share/info \
                --enable-utf8 --enable-unicode-properties
 
 
 build: build-stamp
-build-stamp:  config.status
+build-stamp: patch-stamp config.status
        dh_testdir
 
        # Add here commands to compile the package.
@@ -49,7 +56,7 @@
 
        touch build-stamp
 
-clean: config.status
+clean: unpatch config.status
        dh_testdir
        dh_testroot
        rm -f build-stamp

*** ../control.diff
--- pcre3-7.6.debian/debian/control 
+++ pcre3-7.6.emdebian/debian/control 
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer:  Mark Baker <[EMAIL PROTECTED]>
 Standards-Version: 3.7.3
-Build-Depends: debhelper (>= 5.0.22)
+Build-Depends: debhelper (>= 5.0.22), dpatch
 
 Package: libpcre3
 Section: libs


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.25-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10-emdebian-libs.dpatch by Neil Williams <[EMAIL PROTECTED]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix internal linkages inferred by LDADD

@DPATCH@
diff -urNad pcre3-7.6~/Makefile.am pcre3-7.6/Makefile.am
--- pcre3-7.6~/Makefile.am	2008-01-23 17:58:28.000000000 +0000
+++ pcre3-7.6/Makefile.am	2008-07-27 10:30:44.000000000 +0100
@@ -221,17 +221,17 @@
 TESTS += pcrecpp_unittest
 noinst_PROGRAMS += pcrecpp_unittest
 pcrecpp_unittest_SOURCES = pcrecpp_unittest.cc
-pcrecpp_unittest_LDADD = libpcrecpp.la
+pcrecpp_unittest_LDADD = libpcrecpp.la libpcre.la
 
 TESTS += pcre_scanner_unittest
 noinst_PROGRAMS += pcre_scanner_unittest
 pcre_scanner_unittest_SOURCES = pcre_scanner_unittest.cc
-pcre_scanner_unittest_LDADD = libpcrecpp.la
+pcre_scanner_unittest_LDADD = libpcrecpp.la libpcre.la
 
 TESTS += pcre_stringpiece_unittest
 noinst_PROGRAMS += pcre_stringpiece_unittest
 pcre_stringpiece_unittest_SOURCES = pcre_stringpiece_unittest.cc
-pcre_stringpiece_unittest_LDADD = libpcrecpp.la
+pcre_stringpiece_unittest_LDADD = libpcrecpp.la libpcre.la
 
 endif # WITH_PCRE_CPP
 
@@ -245,13 +245,13 @@
 EXTRA_DIST += RunTest.bat
 bin_PROGRAMS += pcretest
 pcretest_SOURCES = pcretest.c
-pcretest_LDADD = libpcreposix.la
+pcretest_LDADD = libpcreposix.la libpcre.la
 
 TESTS += RunGrepTest
 dist_noinst_SCRIPTS += RunGrepTest
 bin_PROGRAMS += pcregrep
 pcregrep_SOURCES = pcregrep.c
-pcregrep_LDADD = libpcreposix.la
+pcregrep_LDADD = libpcreposix.la libpcre.la
 
 EXTRA_DIST += \
   testdata/grepinput \
diff -urNad pcre3-7.6~/Makefile.in pcre3-7.6/Makefile.in
--- pcre3-7.6~/Makefile.in	2008-07-27 09:56:17.000000000 +0100
+++ pcre3-7.6/Makefile.in	2008-07-27 10:31:18.000000000 +0100
@@ -500,15 +500,15 @@
 @[EMAIL PROTECTED] = $(EXTRA_LIBPCRECPP_LDFLAGS)
 @[EMAIL PROTECTED] = libpcre.la
 @[EMAIL PROTECTED] = pcrecpp_unittest.cc
[EMAIL PROTECTED]@pcrecpp_unittest_LDADD = libpcrecpp.la
[EMAIL PROTECTED]@pcrecpp_unittest_LDADD = libpcrecpp.la libpcre.la
 @[EMAIL PROTECTED] = pcre_scanner_unittest.cc
[EMAIL PROTECTED]@pcre_scanner_unittest_LDADD = libpcrecpp.la
[EMAIL PROTECTED]@pcre_scanner_unittest_LDADD = libpcrecpp.la libpcre.la
 @[EMAIL PROTECTED] = pcre_stringpiece_unittest.cc
[EMAIL PROTECTED]@pcre_stringpiece_unittest_LDADD = libpcrecpp.la
[EMAIL PROTECTED]@pcre_stringpiece_unittest_LDADD = libpcrecpp.la libpcre.la
 pcretest_SOURCES = pcretest.c
-pcretest_LDADD = libpcreposix.la
+pcretest_LDADD = libpcreposix.la libpcre.la
 pcregrep_SOURCES = pcregrep.c
-pcregrep_LDADD = libpcreposix.la
+pcregrep_LDADD = libpcreposix.la libpcre.la
 
 # A PCRE user submitted the following addition, saying that it "will allow
 # anyone using the 'mingw32' compiler to simply type 'make pcre.dll' and get a
10-emdebian-libs

Reply via email to