[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Preliminary dpkg armel architecture support



Hi,

As part of the EABI move we are doing at Nokia for the 770 I've
implemented a proof of concept patch for dpkg which implements
support for a debian triplet (used internally by dpkg-architecture)
which would get mapped from and to the gnu triplet and then converted
to the appropriate final architecture. This patch adds a new
_ARCH_ABI variable as well, we were dopping this information before
and was making it really cumbersome use stuff like uclibc or eabi.

This patch is mostly missing an aliastable (I'm attaching a tentative
one, but it's not bidirectional) which would map the debian triplet
to the gnu triplet (and would remove the need to have all those
hardcoded conversions in the patch). I've even been thinking on
something like a debian.{guess,sub} as counterparts to the
config.{guess,sub}, which other programs could use as a standard
interface, but I'm not sure about this yet.

Some example output that you'll get with this patch:

DEB_HOST_ARCH=armel
DEB_HOST_ARCH_ABI=gnueabi
DEB_HOST_ARCH_OS=linux
DEB_HOST_ARCH_CPU=arm
DEB_HOST_GNU_CPU=arm
DEB_HOST_GNU_SYSTEM=linux-gnueabi
DEB_HOST_GNU_TYPE=arm-linux-gnueabi

DEB_HOST_ARCH=i386
DEB_HOST_ARCH_ABI=gnu
DEB_HOST_ARCH_OS=linux
DEB_HOST_ARCH_CPU=i386
DEB_HOST_GNU_CPU=i486
DEB_HOST_GNU_SYSTEM=linux-gnu
DEB_HOST_GNU_TYPE=i486-linux-gnu

DEB_HOST_ARCH=i386
DEB_HOST_ARCH_ABI=uclibc
DEB_HOST_ARCH_OS=linux
DEB_HOST_ARCH_CPU=i386
DEB_HOST_GNU_CPU=i486
DEB_HOST_GNU_SYSTEM=linux-uclibc
DEB_HOST_GNU_TYPE=i486-linux-uclibc

regards,
guillem
diff -Naur dpkg-1.13.18.orig/m4/arch.m4 dpkg-1.13.18/m4/arch.m4
--- dpkg-1.13.18.orig/m4/arch.m4	2006-01-19 02:24:20.000000000 +0200
+++ dpkg-1.13.18/m4/arch.m4	2006-05-09 17:39:00.000000000 +0300
@@ -42,11 +42,25 @@
 [DPKG_CPU_TYPE
 DPKG_OS_TYPE
 AC_MSG_CHECKING([dpkg architecture name])
-if test "x$os_type" = "xlinux"; then
+case "$os_type-$cpu_type" in
+(gnueabi-linux-arm)
+	dpkg_arch=armel
+	;;
+(gnu-linux-*)
 	dpkg_arch=$cpu_type
-else
+	;;
+(gnu-*)
+	t=`echo $os_type | sed -e 's:gnu::'`
+	dpkg_arch="$t-$cpu_type"
+	;;
+(none-*)
+	t=`echo $os_type | sed -e 's:none::'`
+	dpkg_arch="$t-$cpu_type"
+	;;
+(*)
 	dpkg_arch="$os_type-$cpu_type"
-fi
+	;;
+esac
 AC_MSG_RESULT([$dpkg_arch])
 AC_DEFINE_UNQUOTED(ARCHITECTURE, "${dpkg_arch}",
 	[Set this to the canonical dpkg architecture name.])
diff -Naur dpkg-1.13.18.orig/ostable dpkg-1.13.18/ostable
--- dpkg-1.13.18.orig/ostable	2006-01-19 02:24:46.000000000 +0200
+++ dpkg-1.13.18/ostable	2006-05-09 12:20:00.000000000 +0300
@@ -13,11 +13,12 @@
 # system part of the output of the GNU config.guess script.
 #
 # <Debian name>	<GNU name>	<config.guess regex>
-linux		linux-gnu	linux[^-]*(-gnu.*)?
-darwin		darwin		darwin[^-]*
-freebsd		freebsd		freebsd[^-]*
-kfreebsd	kfreebsd-gnu	kfreebsd[^-]*(-gnu.*)?
-knetbsd		knetbsd-gnu	knetbsd[^-]*(-gnu.*)?
-netbsd		netbsd		netbsd[^-]*
-openbsd		openbsd		openbsd[^-]*
-hurd		gnu		gnu[^-]*
+gnueabi-linux	linux-gnueabi	linux[^-]*-gnueabi
+gnu-linux	linux-gnu	linux[^-]*(-gnu)?
+gnu-hurd	gnu		gnu[^-]*
+gnu-kfreebsd	kfreebsd-gnu	kfreebsd[^-]*(-gnu)?
+gnu-knetbsd	knetbsd-gnu	knetbsd[^-]*(-gnu)?
+bsd-darwin	darwin		darwin[^-]*
+bsd-freebsd	freebsd		freebsd[^-]*
+bsd-netbsd	netbsd		netbsd[^-]*
+bsd-openbsd	openbsd		openbsd[^-]*
diff -Naur dpkg-1.13.18.orig/scripts/controllib.pl dpkg-1.13.18/scripts/controllib.pl
--- dpkg-1.13.18.orig/scripts/controllib.pl	2006-03-09 02:01:11.000000000 +0200
+++ dpkg-1.13.18/scripts/controllib.pl	2006-05-09 15:24:57.000000000 +0300
@@ -81,8 +81,12 @@
 {
     local ($os, $cpu) = @_;
 
-    if ($os eq "linux") {
+    if ($os eq "gnu-linux") {
 	return $cpu;
+    } elsif ($os =~ /^(none|gnu)-(.*)/) {
+	return "$2-$cpu";
+    } elsif ("$os-$cpu" eq "gnueabi-linux-arm") {
+	return "armel";
     } else {
 	return "$os-$cpu";
     }
@@ -95,8 +99,10 @@
 	return ($1, $2);
     } elsif (/any/ || /all/) {
 	return ($_, $_);
+    } elsif (/^armel$/) {
+	return ("gnueabi-linux", "arm");
     } else {
-	return ("linux", $_);
+	return ("gnu-linux", $_);
     }
 }
 
diff -Naur dpkg-1.13.18.orig/scripts/dpkg-architecture.pl dpkg-1.13.18/scripts/dpkg-architecture.pl
--- dpkg-1.13.18.orig/scripts/dpkg-architecture.pl	2006-03-09 02:01:48.000000000 +0200
+++ dpkg-1.13.18/scripts/dpkg-architecture.pl	2006-05-09 17:24:51.000000000 +0300
@@ -83,19 +83,23 @@
 sub split_debian {
     local ($_) = @_;
     
-    if (/^([^-]*)-(.*)/) {
-	return ($1, $2);
+    if (/^([^-]*)-([^-]*)-(.*)/) {
+	return ($1, $2, $3);
+    } elsif (/^([^-]*)-(.*)/) {
+	return ("gnu", $1, $2);
+    } elsif (/^armel/) {
+	return ("gnueabi", "linux", "arm");
     } else {
-	return ("linux", $_);
+	return ("gnu", "linux", $_);
     }
 }
 
 sub debian_to_gnu {
     local ($arch) = @_;
-    local ($os, $cpu) = &split_debian($arch);
+    local ($abi, $os, $cpu) = &split_debian($arch);
 
-    return undef unless exists($cputable{$cpu}) && exists($ostable{$os});
-    return join("-", $cputable{$cpu}, $ostable{$os});
+    return undef unless exists($cputable{$cpu}) && exists($ostable{"$abi-$os"});
+    return join("-", $cputable{$cpu}, $ostable{"$abi-$os"});
 }
 
 sub split_gnu {
@@ -234,20 +238,22 @@
 &warn("Specified GNU system type $deb_host_gnu_type does not match gcc system type $gcc.") if !($req_is_arch or $req_eq_arch) && ($gcc ne '') && ($gcc ne $deb_host_gnu_type);
 
 # Split the Debian and GNU names
-($deb_host_arch_os, $deb_host_arch_cpu) = &split_debian($deb_host_arch);
-($deb_build_arch_os, $deb_build_arch_cpu) = &split_debian($deb_build_arch);
+($deb_host_arch_abi, $deb_host_arch_os, $deb_host_arch_cpu) = &split_debian($deb_host_arch);
+($deb_build_arch_abi, $deb_build_arch_os, $deb_build_arch_cpu) = &split_debian($deb_build_arch);
 ($deb_host_gnu_cpu, $deb_host_gnu_system) = &split_gnu($deb_host_gnu_type);
 ($deb_build_gnu_cpu, $deb_build_gnu_system) = &split_gnu($deb_build_gnu_type);
 
 %env = ();
 if (!$force) {
     $deb_build_arch = $ENV{DEB_BUILD_ARCH} if (exists $ENV{DEB_BUILD_ARCH});
+    $deb_build_arch_abi = $ENV{DEB_BUILD_ARCH_ABI} if (exists $ENV{DEB_BUILD_ARCH_ABI});
     $deb_build_arch_os = $ENV{DEB_BUILD_ARCH_OS} if (exists $ENV{DEB_BUILD_ARCH_OS});
     $deb_build_arch_cpu = $ENV{DEB_BUILD_ARCH_CPU} if (exists $ENV{DEB_BUILD_ARCH_CPU});
     $deb_build_gnu_cpu = $ENV{DEB_BUILD_GNU_CPU} if (exists $ENV{DEB_BUILD_GNU_CPU});
     $deb_build_gnu_system = $ENV{DEB_BUILD_GNU_SYSTEM} if (exists $ENV{DEB_BUILD_GNU_SYSTEM});
     $deb_build_gnu_type = $ENV{DEB_BUILD_GNU_TYPE} if (exists $ENV{DEB_BUILD_GNU_TYPE});
     $deb_host_arch = $ENV{DEB_HOST_ARCH} if (exists $ENV{DEB_HOST_ARCH});
+    $deb_host_arch_abi = $ENV{DEB_HOST_ARCH_ABI} if (exists $ENV{DEB_HOST_ARCH_ABI});
     $deb_host_arch_os = $ENV{DEB_HOST_ARCH_OS} if (exists $ENV{DEB_HOST_ARCH_OS});
     $deb_host_arch_cpu = $ENV{DEB_HOST_ARCH_CPU} if (exists $ENV{DEB_HOST_ARCH_CPU});
     $deb_host_gnu_cpu = $ENV{DEB_HOST_GNU_CPU} if (exists $ENV{DEB_HOST_GNU_CPU});
@@ -255,18 +261,20 @@
     $deb_host_gnu_type = $ENV{DEB_HOST_GNU_TYPE} if (exists $ENV{DEB_HOST_GNU_TYPE});
 }
 
-@ordered = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_OS DEB_BUILD_ARCH_CPU
+@ordered = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_ABI DEB_BUILD_ARCH_OS DEB_BUILD_ARCH_CPU
 	      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 DEB_HOST_ARCH_ABI DEB_HOST_ARCH_OS DEB_HOST_ARCH_CPU
 	      DEB_HOST_GNU_CPU DEB_HOST_GNU_SYSTEM DEB_HOST_GNU_TYPE);
 
 $env{'DEB_BUILD_ARCH'}=$deb_build_arch;
+$env{'DEB_BUILD_ARCH_ABI'}=$deb_build_arch_abi;
 $env{'DEB_BUILD_ARCH_OS'}=$deb_build_arch_os;
 $env{'DEB_BUILD_ARCH_CPU'}=$deb_build_arch_cpu;
 $env{'DEB_BUILD_GNU_CPU'}=$deb_build_gnu_cpu;
 $env{'DEB_BUILD_GNU_SYSTEM'}=$deb_build_gnu_system;
 $env{'DEB_BUILD_GNU_TYPE'}=$deb_build_gnu_type;
 $env{'DEB_HOST_ARCH'}=$deb_host_arch;
+$env{'DEB_HOST_ARCH_ABI'}=$deb_host_arch_abi;
 $env{'DEB_HOST_ARCH_OS'}=$deb_host_arch_os;
 $env{'DEB_HOST_ARCH_CPU'}=$deb_host_arch_cpu;
 $env{'DEB_HOST_GNU_CPU'}=$deb_host_gnu_cpu;
# Debian triplet to Debian architecture conversion table
#
# List from more specific to less specific
#
# <Debian triplet>			<Debian arch>
gnueabi-linux-arm			armel
gnu-linux-(.*)				$1
gnu-hurd-(.*)				hurd-$1
gnu-kfreebsd-(.*)			kfreebsd-$1
gnu-knetbsd-(.*)			knetbsd-$1
bsd-darwin-(.*)				darwin-$1
bsd-freebsd-(.*)			freebsd-$1
bsd-netbsd-(.*)				netbsd-$1
bsd-openbsd-(.*)			openbsd-$1
none-([^-]*)-(.*)			$1-$2
([^-]*)-([^-]*)-(.*)			$1-$2-$3


Reply to: