The following commit has been merged in the master branch:
commit 126fcaac1eff9b5ae52e9ab80c158fd3aaf214d6
Author: Guillem Jover <[email protected]>
Date: Sun Jun 28 09:13:10 2009 +0200
dpkg-architecture: Add support for bits and endianness variables
Add new DEB_(HOST|BUILD)_ARCH_(BITS|ENDIANNESS) variables to ease work
for porters.
diff --git a/cputable b/cputable
index b852059..18dc14b 100644
--- a/cputable
+++ b/cputable
@@ -13,25 +13,25 @@
# Column 3 is an extended regular expression used to match against the
# CPU part of the output of the GNU config.guess script.
#
-# <Debian name> <GNU name> <config.guess regex>
-i386 i486 (i[3456]86|pentium)
-ia64 ia64 ia64
-alpha alpha alpha.*
-amd64 x86_64 x86_64
-armeb armeb arm.*b
-arm arm arm.*
-avr32 avr32 avr32
-hppa hppa hppa.*
-m32r m32r m32r
-m68k m68k m68k
-mips mips mips(eb)?
-mipsel mipsel mipsel
-powerpc powerpc (powerpc|ppc)
-ppc64 powerpc64 (powerpc|ppc)64
-s390 s390 s390
-s390x s390x s390x
-sh3 sh3 sh3
-sh3eb sh3eb sh3eb
-sh4 sh4 sh4
-sh4eb sh4eb sh4eb
-sparc sparc sparc(64)?
+# <Debian name> <GNU name> <config.guess regex> <Bits>
<Endianness>
+i386 i486 (i[3456]86|pentium) 32 little
+ia64 ia64 ia64 64 little
+alpha alpha alpha.* 64 little
+amd64 x86_64 x86_64 64 little
+armeb armeb arm.*b 32 big
+arm arm arm.* 32 little
+avr32 avr32 avr32 32 big
+hppa hppa hppa.* 32 big
+m32r m32r m32r 32 big
+m68k m68k m68k 32 big
+mips mips mips(eb)? 32 big
+mipsel mipsel mipsel 32 little
+powerpc powerpc (powerpc|ppc) 32 big
+ppc64 powerpc64 (powerpc|ppc)64 64 big
+s390 s390 s390 32 big
+s390x s390x s390x 64 big
+sh3 sh3 sh3 32 little
+sh3eb sh3eb sh3eb 32 big
+sh4 sh4 sh4 32 little
+sh4eb sh4eb sh4eb 32 big
+sparc sparc sparc(64)? 32 big
diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index 5ce0902..08d2a2f 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -7,6 +7,7 @@ use base qw(Exporter);
our @EXPORT_OK = qw(get_raw_build_arch get_raw_host_arch
get_build_arch get_host_arch get_gcc_host_gnu_type
get_valid_arches debarch_eq debarch_is
+ debarch_to_cpuattrs
debarch_to_gnutriplet gnutriplet_to_debarch
debtriplet_to_gnutriplet gnutriplet_to_debtriplet
debtriplet_to_debarch debarch_to_debtriplet);
@@ -18,6 +19,7 @@ use Dpkg::ErrorHandling;
my (@cpu, @os);
my (%cputable, %ostable);
my (%cputable_re, %ostable_re);
+my (%cpubits, %cpuendian);
my %debtriplet_to_debarch;
my %debarch_to_debtriplet;
@@ -119,9 +121,11 @@ sub read_cputable
open CPUTABLE, "$pkgdatadir/cputable"
or syserr(_g("unable to open cputable"));
while (<CPUTABLE>) {
- if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)/) {
+ if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
$cputable{$1} = $2;
$cputable_re{$1} = $3;
+ $cpubits{$1} = $4;
+ $cpuendian{$1} = $5;
push @cpu, $1;
}
}
@@ -287,6 +291,18 @@ sub debwildcard_to_debtriplet($)
}
}
+sub debarch_to_cpuattrs($)
+{
+ my ($arch) = @_;
+ my ($abi, $os, $cpu) = debarch_to_debtriplet($arch);
+
+ if (defined($cpu)) {
+ return ($cpubits{$cpu}, $cpuendian{$cpu});
+ } else {
+ return undef;
+ }
+}
+
sub debarch_eq($$)
{
my ($a, $b) = @_;
diff --git a/scripts/dpkg-architecture.pl b/scripts/dpkg-architecture.pl
index dd26c28..1047fd2 100755
--- a/scripts/dpkg-architecture.pl
+++ b/scripts/dpkg-architecture.pl
@@ -26,6 +26,7 @@ use Dpkg;
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Arch qw(get_raw_build_arch get_raw_host_arch get_gcc_host_gnu_type
+ debarch_to_cpuattrs
get_valid_arches debarch_eq debarch_is debarch_to_debtriplet
debarch_to_gnutriplet gnutriplet_to_debarch);
@@ -125,8 +126,10 @@ while (@ARGV) {
my %v;
my @ordered = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_OS DEB_BUILD_ARCH_CPU
+ DEB_BUILD_ARCH_BITS DEB_BUILD_ARCH_ENDIANNESS
DEB_BUILD_GNU_CPU DEB_BUILD_GNU_SYSTEM DEB_BUILD_GNU_TYPE
DEB_HOST_ARCH DEB_HOST_ARCH_OS DEB_HOST_ARCH_CPU
+ DEB_HOST_ARCH_BITS DEB_HOST_ARCH_ENDIANNESS
DEB_HOST_GNU_CPU DEB_HOST_GNU_SYSTEM DEB_HOST_GNU_TYPE);
$v{DEB_BUILD_ARCH} = get_raw_build_arch();
@@ -180,6 +183,9 @@ my $abi;
($v{DEB_HOST_GNU_CPU}, $v{DEB_HOST_GNU_SYSTEM}) = split(/-/,
$v{DEB_HOST_GNU_TYPE}, 2);
($v{DEB_BUILD_GNU_CPU}, $v{DEB_BUILD_GNU_SYSTEM}) = split(/-/,
$v{DEB_BUILD_GNU_TYPE}, 2);
+($v{DEB_HOST_ARCH_BITS}, $v{DEB_HOST_ARCH_ENDIANNESS}) =
debarch_to_cpuattrs($v{DEB_HOST_ARCH});
+($v{DEB_BUILD_ARCH_BITS}, $v{DEB_BUILD_ARCH_ENDIANNESS}) =
debarch_to_cpuattrs($v{DEB_BUILD_ARCH});
+
for my $k (@ordered) {
$v{$k} = $ENV{$k} if (defined ($ENV{$k}) && !$force);
}
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]