Bug#537645: dpkg-cross: Please support -t gnu-triplet
Package: dpkg-cross
Version: 2.3.0.1
Severity: wishlist
Tags: patch
Hi,
the attached patch adds support for a -t option, to be passed on to
dpkg-architecture.
Simon
-- Package-specific info:
-- (/etc/dpkg-cross/cross-compile not submitted) --
-- System Information:
Debian Release: 5.0.2
APT prefers stable
APT policy: (990, 'stable'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.30-1-686 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages dpkg-cross depends on:
ii binutils-multiarch 2.18.1~cvs20080103-7 Binary utilities that support mult
ii debconf [debconf-2. 1.5.24 Debian configuration management sy
ii dpkg-dev 1.14.25 Debian package development tools
ii libdebian-dpkgcross 2.3.0.1 functions to aid cross-compiling D
ii perl 5.10.0-19 Larry Wall's Practical Extraction
Versions of packages dpkg-cross recommends:
ii fakeroot 1.11 Gives a fake root environment
dpkg-cross suggests no packages.
-- debconf information:
dpkg-cross/default-arch: None
--- /usr/share/perl5/Debian/DpkgCross.pm.orig 2009-07-20 03:10:12.000000000 +0200
+++ /usr/share/perl5/Debian/DpkgCross.pm 2009-07-20 03:10:53.000000000 +0200
@@ -18,7 +18,7 @@
$deb_host_gnu_type $crossbase $crossprefix $crossdir $crossbin
$crosslib $crossroot $crossinc $crosslib64 $crosslib32 $package $mode $tool_
%config @keepdeps %allcrossroots @removedeps $maintainer
-$compilerpath %debug_data);
+$compilerpath %debug_data $gnuarch);
@ISA = qw(Exporter);
@EXPORT = qw( read_config setup get_architecture create_tmpdir
convert_path get_config get_version rewrite_pkg_name dump_debug_data
@@ -376,7 +376,7 @@
return $ENV{'DPKGCROSSARCH'} || $ENV{'ARCH'} || $arch || $default_arch;
}
-=head1 check_arch($arch)
+=head1 check_arch($arch, $gnuarch)
Checks that the supplied $arch is (or can be converted to)
a DEB_HOST_GNU_TYPE that can be supported by dpkg-cross.
@@ -387,8 +387,13 @@
sub check_arch {
my $check = shift;
+ my $checkgnu = shift;
my $deb_host_gnu_type;
- chomp($deb_host_gnu_type = `CC="" dpkg-architecture -f -a$check -qDEB_HOST_GNU_TYPE 2> /dev/null`);
+ if (defined($checkgnu)) {
+ chomp($deb_host_gnu_type = `CC="" dpkg-architecture -f -a$check -t$checkgnu -qDEB_HOST_GNU_TYPE 2> /dev/null`);
+ } else {
+ chomp($deb_host_gnu_type = `CC="" dpkg-architecture -f -a$check -qDEB_HOST_GNU_TYPE 2> /dev/null`);
+ }
$deb_host_gnu_type ||= $archtable{$check};
$arch = $check if (defined($deb_host_gnu_type));
return $deb_host_gnu_type;
@@ -410,7 +415,11 @@
# Set '$arch' to defaults if not already specified.
$arch = &get_architecture();
die "$progname: Architecture is not specified.\n" unless ($arch);
- $deb_host_gnu_type = `CC="" dpkg-architecture -f -a$arch -qDEB_HOST_GNU_TYPE 2> /dev/null`;
+ if (defined($gnuarch)) {
+ $deb_host_gnu_type = `CC="" dpkg-architecture -f -a$arch -t$gnuarch -qDEB_HOST_GNU_TYPE 2> /dev/null`;
+ } else {
+ $deb_host_gnu_type = `CC="" dpkg-architecture -f -a$arch -qDEB_HOST_GNU_TYPE 2> /dev/null`;
+ }
chomp($deb_host_gnu_type);
$deb_host_gnu_type ||= $archtable{$arch};
--- /usr/bin/dpkg-cross.orig 2009-07-19 19:21:39.000000000 +0200
+++ /usr/bin/dpkg-cross 2009-07-19 19:47:21.000000000 +0200
@@ -36,7 +36,7 @@
@keepdeps $dpkg_statfile $progname $debname $anyway $cross2cross
$crossdir $crosslib $crosslib64 $crosslib32 $crossinc $data $len
$retval $dpkg_cmd $mode $pkg @exlist $conffile $removedeps $keepdeps
-$DPKGCROSSVERSION $keep_temp);
+$DPKGCROSSVERSION $keep_temp $gnuarch);
$dpkg_statfile = "/var/lib/dpkg/status";
&read_config;
@@ -67,6 +67,7 @@
Options:
-a|--arch ARCH: set architecture (default: defined in configuration file)
+ -t|--gnu TRIPLET set GNU triplet (default: derived from arch)
-v|--verbose: be verbose
-q|--quiet: be quiet
-A|--convert-anyway: convert package even if it does not provide any
@@ -146,6 +147,10 @@
$arch = shift(@ARGV);
die "$progname: --arch needs an argument.\n" if (!($arch));
}
+ elsif (/^(-t|--gnu$)/) {
+ $gnuarch = shift(@ARGV);
+ die "$progname: --gnu needs an argument.\n" if (!($gnuarch));
+ }
elsif (/^(-X|--exclude)$/) {
$pkg = shift (@ARGV);
die ("$progname: --exclude needs an argument.\n") if ($pkg =~ /^\-/);
@@ -163,7 +168,7 @@
die "$progname: Too few arguments.\n";
}
-if (!&check_arch($arch)) {
+if (!&check_arch($arch, $gnuarch)) {
die "$progname: Unrecognised architecture: $arch\n";
}
&setup;
Reply to: