summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-02-08 15:32:22 -0400
committerJoey Hess <joey@kitenet.net>2011-02-08 15:32:22 -0400
commitc51b87a19648c4527a0c6612dd8f1bfbceda812d (patch)
tree463998575cc40f3a57c172e9b3edca431a1bc443
parent7bc99d44cfc0275e1b44b390bed1362c457da9ab (diff)
refactor cross command generation
-rw-r--r--Debian/Debhelper/Dh_Lib.pm15
-rwxr-xr-xdh_makeshlibs13
-rwxr-xr-xdh_strip10
3 files changed, 20 insertions, 18 deletions
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index fb83480b..9b6118e9 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -17,7 +17,8 @@ use vars qw(@ISA @EXPORT %dh);
&is_udeb &udeb_filename &debhelper_script_subst &escape_shell
&inhibit_log &load_log &write_log &dpkg_architecture_value
&sourcepackage
- &is_make_jobserver_unavailable &clean_jobserver_makeflags);
+ &is_make_jobserver_unavailable &clean_jobserver_makeflags
+ &cross_command);
my $max_compat=8;
@@ -858,4 +859,16 @@ sub clean_jobserver_makeflags {
}
}
+# If cross-compiling, returns appropriate cross version of command.
+sub cross_command {
+ my $command=shift;
+ if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE")
+ ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) {
+ return dpkg_architecture_value("DEB_HOST_GNU_TYPE")."-$command";
+ }
+ else {
+ return $command;
+ }
+}
+
1
diff --git a/dh_makeshlibs b/dh_makeshlibs
index 29d3f4d3..b6779f90 100755
--- a/dh_makeshlibs
+++ b/dh_makeshlibs
@@ -121,12 +121,7 @@ init(options => {
"add-udeb=s" => \$dh{SHLIBS_UDEB},
});
-my $od = "objdump";
-# cross-compiling?
-if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE")
- ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) {
- $od=dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-objdump";
-}
+my $objdump=cross_command("objdump");
foreach my $package (@{$dh{DOPACKAGES}}) {
next if is_udeb($package);
@@ -153,13 +148,13 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
while (<FIND>) {
my ($library, $major);
push @lib_files, $_;
- my $objdump=`$od -p $_`;
- if ($objdump=~m/\s+SONAME\s+(.+)\.so\.(.+)/) {
+ my $ret=`$objdump -p $_`;
+ if ($ret=~m/\s+SONAME\s+(.+)\.so\.(.+)/) {
# proper soname format
$library=$1;
$major=$2;
}
- elsif ($objdump=~m/\s+SONAME\s+(.+)-(.+)\.so/) {
+ elsif ($ret=~m/\s+SONAME\s+(.+)-(.+)\.so/) {
# idiotic crap soname format
$library=$1;
$major=$2;
diff --git a/dh_strip b/dh_strip
index b4098be6..5cc68834 100755
--- a/dh_strip
+++ b/dh_strip
@@ -86,14 +86,8 @@ if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~ /nostrip/) {
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";
-}
+my $objcopy = cross_command("objcopy");
+my $strip = cross_command("strip");
# I could just use `file $_[0]`, but this is safer
sub get_file_type {