Bah!

Patches were the wrong way around. Try these.

The /usr/share/dpkg-cross/buildcross file is part of dpkg-cross 1.99
+2.0.0pre2 which is due to be uploaded to experimental just after pre1
leaves NEW.

dpkg-cross will need to depend on the version of dpkg-dev that includes
these patches before migrating into unstable.

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

--- dpkg.old/scripts/dpkg-buildpackage.sh	2007-08-27 23:23:28.000000000 +0100
+++ dpkg-1.14.5/scripts/dpkg-buildpackage.sh	2007-08-28 20:06:39.000000000 +0100
@@ -84,6 +84,18 @@
 passopts=''
 admindir=''
 
+DPKGCROSSENABLE=0
+if [ -f /usr/share/dpkg-cross/buildcross ]; then
+ . /usr/share/dpkg-cross/buildcross
+ DPKGCROSSENABLE=1
+fi
+
+function enhance_cross {
+	if [ $DPKGCROSSENABLE -gt 0 ]; then
+		setup_cross
+	fi
+}
+
 while [ $# != 0 ]
 do
 	value="`echo x\"$1\" | sed -e 's/x--.*=//;s/^x-.//'`"
@@ -104,7 +116,7 @@
 	-us)	signsource=: ;;
 	-uc)	signchanges=: ;;
 	-ap)	usepause="true";;
-	-a*)    targetarch="$value"; checkbuilddep=false ;;
+	-a*)    targetarch="$value"; checkbuilddep=false; enhance_cross ;;
 	-si)	sourcestyle=-si ;;
 	-sa)	sourcestyle=-sa ;;
 	-sd)	sourcestyle=-sd ;;
--- dpkg.old/scripts/dpkg-shlibdeps.pl	2007-08-27 23:23:48.000000000 +0100
+++ dpkg-1.14.5/scripts/dpkg-shlibdeps.pl	2007-08-28 00:02:16.000000000 +0100
@@ -75,6 +75,16 @@
 "), $progname, join("/",@depfields);
 }
 
+# detect cross-compilation
+my $result = `dpkg-architecture -qDEB_HOST_ARCH`;
+chomp($result);
+my $host_arch = $result;
+$result = `dpkg-architecture -qDEB_BUILD_ARCH`;
+chomp($result);
+my $target_arch = $result;
+my $use_cross = 0;
+$use_cross = 1 if ($host_arch ne $target_arch);
+
 my ($stdout, @exec, @execfield);
 foreach (@ARGV) {
     if (m/^-T/) {
@@ -134,8 +144,21 @@
     }
 }
 
-my @librarypaths = qw( /lib /usr/lib /lib32 /usr/lib32 /lib64 /usr/lib64
-		       /emul/ia32-linux/lib /emul/ia32-linux/usr/lib );
+my @librarypaths=();
+if ($use_cross)
+{
+    my $crossprefix = `dpkg-architecture -qDEB_HOST_GNU_TYPE`;
+    chomp($crossprefix);
+    @librarypaths = ( "${crossprefix}/lib", "/usr/${crossprefix}/lib",
+        "/${crossprefix}/lib32", "/usr/${crossprefix}/lib32",
+        "/${crossprefix}/lib64", "/usr/${crossprefix}/lib64",
+        "/emul/ia32-linux/lib", "/emul/ia32-linux/usr/lib" );
+}
+else
+{
+    @librarypaths = qw( /lib /usr/lib /lib32 /usr/lib32 /lib64 /usr/lib64
+                      /emul/ia32-linux/lib /emul/ia32-linux/usr/lib );
+}
 my %librarypaths = map { $_ => 'default' } @librarypaths;
 
 if ($ENV{LD_LIBRARY_PATH}) {

Attachment: pgp4DI5O3kBls.pgp
Description: PGP signature

Reply via email to