Package: debhelper
Version: 7.4.17
Severity: minor
Tags: patch

        Hi there

 When cross-building, dh_strip calls /usr/bin/strip and /usr/bin/objcopy
 instead of their $triplet-strip and $triplet-objcopy counterparts from
 the cross-toolchain.

 It was never reported so far because it's a common issue in upstream
 build systems as well, and there's an easy workaround in the form of
 binutils-multiarch.  dpkg-cross depends on binutils-multiarch.
 However, this means that one has to rebuild binutils-multiarch to
 cross-build for an architecture not supported by binutils-multiarch.

   Thanks for considering the attached patch,
-- 
Loïc Minier
diff -Nru debhelper-7.4.17/debian/changelog debhelper-7.4.18/debian/changelog
--- debhelper-7.4.17/debian/changelog	2010-04-09 00:23:44.000000000 +0200
+++ debhelper-7.4.18/debian/changelog	2010-04-19 12:25:53.000000000 +0200
@@ -1,3 +1,9 @@
+debhelper (7.4.18) UNRELEASED; urgency=low
+
+  * dh_strip: Use triplet-objcopy and triplet-strip when cross-building.
+
+ -- Loïc Minier <[email protected]>  Mon, 19 Apr 2010 12:25:01 +0200
+
 debhelper (7.4.17) unstable; urgency=low
 
   * Fix #572077 in one place I missed earlier. (See #576885)
diff -Nru debhelper-7.4.17/dh_strip debhelper-7.4.18/dh_strip
--- debhelper-7.4.17/dh_strip	2010-04-07 04:02:12.000000000 +0200
+++ debhelper-7.4.18/dh_strip	2010-04-19 12:31:48.000000000 +0200
@@ -86,6 +86,15 @@
 	exit;
 }
 
+my $objcopy = "objcopy";
+my $strip = "strip";
+# cross-compiling?
+if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE")
+    ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) {
+	$objcopy=dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-objcopy";
+	$strip=dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-strip";
+}
+
 # I could just use `file $_[0]`, but this is safer
 sub get_file_type {
 	my $file=shift;
@@ -163,7 +172,7 @@
 	if (! -d $debug_dir) {
 		doit("install", "-d", $debug_dir);
 	}
-	doit("objcopy", "--only-keep-debug", $file, $debug_path);
+	doit("$objcopy", "--only-keep-debug", $file, $debug_path);
 	# No reason for this to be executable.
 	doit("chmod", 644, $debug_path);
 	return $debug_path;
@@ -172,7 +181,7 @@
 sub attach_debug {
 	my $file=shift;
 	my $debug_path=shift;
-	doit("objcopy", "--add-gnu-debuglink", $debug_path, $file);
+	doit("$objcopy", "--add-gnu-debuglink", $debug_path, $file);
 }
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
@@ -207,20 +216,20 @@
 		my $debug_path = make_debug($_, $tmp, $debugtmp) if $keep_debug;
 		# Note that all calls to strip on shared libs
 		# *must* inclde the --strip-unneeded.
-		doit("strip","--remove-section=.comment",
+		doit("$strip","--remove-section=.comment",
 			"--remove-section=.note","--strip-unneeded",$_);
 		attach_debug($_, $debug_path) if defined $debug_path;
 	}
 	
 	foreach (@executables) {
 		my $debug_path = make_debug($_, $tmp, $debugtmp) if $keep_debug;
-		doit("strip","--remove-section=.comment",
+		doit("$strip","--remove-section=.comment",
 			"--remove-section=.note",$_);
  		attach_debug($_, $debug_path) if defined $debug_path;
 	}
 
 	foreach (@static_libs) {
-		doit("strip","--strip-debug",$_);
+		doit("$strip","--strip-debug",$_);
 	}
 }
 
Les fichiers binaires /tmp/BNTPgZTmZw/debhelper-7.4.17/.dh_strip.rej.swp et /tmp/pqJwv_P1Pu/debhelper-7.4.18/.dh_strip.rej.swp sont différents.

Reply via email to