Your message dated Mon, 4 Mar 2019 00:07:22 +0100
with message-id <[email protected]>
and subject line Re: Bug#180128: state of integration of dpkg-cross into dpkg
has caused the Debian Bug report #180128,
regarding dpkg - cross compile patch
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
180128: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=180128
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: dpkg
Version: 1.10.9
Severity: wishlist

this patch makes cross compilation with dpkg easier. automake build
environments should work with them without modifications.

bastian

-- 
I've already got a female to worry about.  Her name is the Enterprise.
                -- Kirk, "The Corbomite Maneuver", stardate 1514.0
Index: Makefile.in
===================================================================
RCS file: /home/bastian/debian/cvs/dpkg/Makefile.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Makefile.in 14 Jul 2002 20:15:06 -0000      1.1.1.1
+++ Makefile.in 23 Dec 2002 17:55:49 -0000      1.2
@@ -19,6 +19,8 @@
        $(mkinstalldirs) $(DESTDIR)$(dpkgsharedir)/origins
        $(INSTALL_DATA) $(srcdir)/origin $(DESTDIR)$(dpkgconfdir)/origins/debian
        $(INSTALL_DATA) $(srcdir)/archtable $(DESTDIR)$(dpkgsharedir)/archtable
+       $(mkinstalldirs) $(DESTDIR)$(dpkgconfdir)/cross
+       $(INSTALL_DATA) $(srcdir)/cross/* $(DESTDIR)$(dpkgconfdir)/cross/
 
 clean: clean-recursive
        rm -f $(GENFILES)
Index: cross/config
===================================================================
RCS file: cross/config
diff -N cross/config
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cross/config        23 Dec 2002 18:26:08 -0000      1.2
@@ -0,0 +1,11 @@
+if [ -f `dirname $ac_site_file`/cpu.$DEB_HOST_GNU_CPU ]; then
+       . `dirname $ac_site_file`/cpu.$DEB_HOST_GNU_CPU
+else
+       echo "can't find cpu config `dirname 
$ac_site_file`/cpu.$DEB_HOST_GNU_CPU"
+fi
+if [ -f `dirname $ac_site_file`/system.$DEB_HOST_GNU_SYSTEM ]; then
+       . `dirname $ac_site_file`/system.$DEB_HOST_GNU_SYSTEM
+else
+       echo "can't find system config `dirname 
$ac_site_file`/cpu.$DEB_HOST_GNU_CPU"
+fi
+
Index: cross/cpu.i386
===================================================================
RCS file: cross/cpu.i386
diff -N cross/cpu.i386
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cross/cpu.i386      23 Dec 2002 18:45:44 -0000      1.2
@@ -0,0 +1,18 @@
+#
+# i386 specific configure variables
+#
+ac_cv_c_bigendian=no
+ac_cv_c_char_unsigned=no
+ac_cv_sizeof_long_long=8
+ac_cv_sizeof_unsigned_long_long=8
+ac_cv_sizeof_long=4
+ac_cv_sizeof_unsigned_long=4
+ac_cv_sizeof_int=4
+ac_cv_sizeof_unsigned_int=4
+ac_cv_sizeof_short=2
+ac_cv_sizeof_unsigned_short=2
+ac_cv_sizeof_short=2
+ac_cv_sizeof_unsigned_short=2
+ac_cv_sizeof_float=4
+ac_cv_sizeof_double=8
+ac_cv_sizeof_long_double=12
Index: cross/cpu.m68k
===================================================================
RCS file: cross/cpu.m68k
diff -N cross/cpu.m68k
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cross/cpu.m68k      23 Dec 2002 18:45:44 -0000      1.2
@@ -0,0 +1,18 @@
+#
+# m68k specific configure variables
+#
+ac_cv_c_bigendian=yes
+ac_cv_c_char_unsigned=no
+ac_cv_sizeof_long_long=8
+ac_cv_sizeof_unsigned_long_long=8
+ac_cv_sizeof_long=4
+ac_cv_sizeof_unsigned_long=4
+ac_cv_sizeof_int=4
+ac_cv_sizeof_unsigned_int=4
+ac_cv_sizeof_short=2
+ac_cv_sizeof_unsigned_short=2
+ac_cv_sizeof_short=2
+ac_cv_sizeof_unsigned_short=2
+ac_cv_sizeof_float=4
+ac_cv_sizeof_double=8
+ac_cv_sizeof_long_double=12
Index: cross/cpu.mips
===================================================================
RCS file: cross/cpu.mips
diff -N cross/cpu.mips
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cross/cpu.mips      23 Dec 2002 18:45:44 -0000      1.2
@@ -0,0 +1,11 @@
+#
+# mips bigendian specific configure variables
+#
+ac_cv_c_bigendian=yes
+ac_cv_c_char_unsigned=no
+ac_cv_sizeof_long=4
+ac_cv_sizeof_int=4
+ac_cv_sizeof_char_p=4
+ac_cv_sizeof_long_long=8
+ac_cv_sizeof_unsigned_long=4
+ac_cv_sizeof_unsigned_int=4
Index: cross/cpu.powerpc
===================================================================
RCS file: cross/cpu.powerpc
diff -N cross/cpu.powerpc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cross/cpu.powerpc   23 Dec 2002 18:26:16 -0000      1.1
@@ -0,0 +1,18 @@
+#
+# powerpc specific configure variables
+#
+ac_cv_c_bigendian=yes
+ac_cv_c_char_unsigned=no
+ac_cv_sizeof_long_long=8
+ac_cv_sizeof_unsigned_long_long=8
+ac_cv_sizeof_long=4
+ac_cv_sizeof_unsigned_long=4
+ac_cv_sizeof_int=4
+ac_cv_sizeof_unsigned_int=4
+ac_cv_sizeof_short=2
+ac_cv_sizeof_unsigned_short=2
+ac_cv_sizeof_short=2
+ac_cv_sizeof_unsigned_short=2
+ac_cv_sizeof_float=4
+ac_cv_sizeof_double=8
+ac_cv_sizeof_long_double=8
Index: cross/system.gnu
===================================================================
RCS file: cross/system.gnu
diff -N cross/system.gnu
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cross/system.gnu    23 Dec 2002 18:45:44 -0000      1.2
@@ -0,0 +1,9 @@
+#
+# gnu (hurd) specific configure variables
+#
+ac_cv_header_stdc=yes
+ac_cv_func_closedir_void=no
+kb_cv_func_putenv_malloc=no
+ac_cv_func_vfork=yes
+ac_cv_func_setvbuf_reversed=no
+
Index: cross/system.linux
===================================================================
RCS file: cross/system.linux
diff -N cross/system.linux
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cross/system.linux  23 Dec 2002 18:45:44 -0000      1.2
@@ -0,0 +1,12 @@
+#
+# linux specific configure variables
+#
+ac_cv_header_stdc=yes
+ac_cv_func_closedir_void=no
+ac_cv_func_vfork=yes
+ac_cv_func_setvbuf_reversed=no
+ac_cv_func_getpgrp_void=yes
+ac_cv_sys_restartable_syscalls=yes
+ac_cv_func_fnmatch_works=yes
+ac_cv_func_getpagesize=yes
+
Index: debian/changelog
===================================================================
RCS file: /home/bastian/debian/cvs/dpkg/debian/changelog,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- debian/changelog    15 Sep 2002 18:22:38 -0000      1.1.1.1
+++ debian/changelog    23 Dec 2002 17:55:49 -0000      1.2
@@ -1,3 +1,9 @@
+dpkg (1.10.9.0.cross) unstable; urgency=low
+
+  * partialy merge dpkg-cross changes.
+
+ -- Bastian Blank <[email protected]>  Mon, 23 Dec 2002 18:53:58 +0100
+
 dpkg (1.10.9) unstable; urgency=low
 
   * Fix dereference in main/help.c:cu_closefd(), which was the cause of
Index: debian/dpkg-dev.conffiles
===================================================================
RCS file: /home/bastian/debian/cvs/dpkg/debian/dpkg-dev.conffiles,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- debian/dpkg-dev.conffiles   20 Nov 2000 22:03:32 -0000      1.1.1.1
+++ debian/dpkg-dev.conffiles   23 Dec 2002 18:47:28 -0000      1.3
@@ -1,2 +1,9 @@
+/etc/dpkg/cross/config
+/etc/dpkg/cross/cpu.i386
+/etc/dpkg/cross/cpu.m68k
+/etc/dpkg/cross/cpu.mips
+/etc/dpkg/cross/cpu.powerpc
+/etc/dpkg/cross/system.gnu
+/etc/dpkg/cross/system.linux
 /etc/dpkg/shlibs.default
 /etc/dpkg/shlibs.override
Index: debian/rules
===================================================================
RCS file: /home/bastian/debian/cvs/dpkg/debian/rules,v
retrieving revision 1.1.1.1
retrieving revision 1.4
diff -u -r1.1.1.1 -r1.4
--- debian/rules        29 Aug 2002 20:12:24 -0000      1.1.1.1
+++ debian/rules        23 Dec 2002 18:02:42 -0000      1.4
@@ -100,6 +100,7 @@
        install -d -m 755 -o root -g root $(TMP_DPKG)/sbin
        install -d -m 755 -o root -g root $(TMP_DPKG)/var/lib/dpkg
        -test -d $(INSTALL_TMP)/etc && cp -a $(INSTALL_TMP)/etc $(TMP_DPKG)/
+       rm -r $(TMP_DPKG)/etc/dpkg/cross/
        set -e ; for i in info alternatives parts updates ; do \
                cp -a $(INSTALL_TMP)/var/lib/dpkg/$$i $(TMP_DPKG)/var/lib/dpkg/ 
; \
        done
@@ -184,6 +185,8 @@
                $(TMP_DPKG_DEV)/etc/dpkg/
        install -p -m 644 -o root -g root debian/shlibs.override \
                $(TMP_DPKG_DEV)/etc/dpkg/
+       install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/etc/dpkg/cross
+       mv $(INSTALL_TMP)/etc/dpkg/cross/* $(TMP_DPKG_DEV)/etc/dpkg/cross/
        install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/lib/dpkg
        install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/share
        install -d -m 755 -o root -g root $(TMP_DPKG_DEV)/usr/bin
Index: scripts/dpkg-architecture.pl
===================================================================
RCS file: /home/bastian/debian/cvs/dpkg/scripts/dpkg-architecture.pl,v
retrieving revision 1.1.1.1
retrieving revision 1.6
diff -u -r1.1.1.1 -r1.6
--- scripts/dpkg-architecture.pl        15 Sep 2002 18:26:00 -0000      1.1.1.1
+++ scripts/dpkg-architecture.pl        23 Dec 2002 18:26:08 -0000      1.6
@@ -40,37 +40,43 @@
 #  1.0.7  -q should not imply -f, because this prevents setting
 #         make variables with non-standard names correctly.
 
-$version="1.0.0";
+use strict;
+use warnings;
+
+my $version="1.0.0";
 $0 = `basename $0`; chomp $0;
 
-$dpkglibdir="/usr/lib/dpkg";
+my $dpkglibdir="/usr/lib/dpkg";
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
 
-%archtable=('i386',            'i386-linux',
-           'sparc',            'sparc-linux',
-           'sparc64',          'sparc64-linux',
-           'alpha',            'alpha-linux',
-           'm68k',             'm68k-linux',
-            'arm',             'arm-linux',
-            'powerpc',         'powerpc-linux',
-           'mips',             'mips-linux',
-           'mipsel',           'mipsel-linux',
-           'sh3',              'sh3-linux',
-           'sh4',              'sh4-linux',
-           'sh3eb',            'sh3eb-linux',
-           'sh4eb',            'sh4eb-linux',
-           'hppa',             'hppa-linux',
-           'hurd-i386',        'i386-gnu',
-           's390',             's390-linux',
-           's390x',            's390x-linux',
-           'ia64',             'ia64-linux',
-           'openbsd-i386',     'i386-openbsd',
-           'freebsd-i386',     'i386-freebsd',
-           'darwin-powerpc',   'powerpc-darwin',
-           'darwin-i386',      'i386-darwin');
+my %archtable=(
+    'i386' =>          [ 'i386-linux', 'elf32-i386' ],
+    'sparc'=>          [ 'sparc-linux', 'unknown' ],
+    'sparc64' =>       [ 'sparc64-linux', 'unknown' ],
+    'alpha' =>         [ 'alpha-linux', 'unknown' ],
+    'm68k' =>          [ 'm68k-linux', 'unknown' ],
+    'arm' =>           [ 'arm-linux', 'unknown' ],
+    'powerpc' =>       [ 'powerpc-linux', 'elf32-powerpc' ],
+    'mips' =>          [ 'mips-linux', 'unknown' ],
+    'mipsel' =>                [ 'mipsel-linux', 'unknown' ],
+    'sh3' =>           [ 'sh3-linux', 'unknown' ],
+    'sh4' =>           [ 'sh4-linux', 'unknown' ],
+    'sh3eb' =>         [ 'sh3eb-linux', 'unknown' ],
+    'sh4eb' =>         [ 'sh4eb-linux', 'unknown' ],
+    'hppa' =>          [ 'hppa-linux', 'unknown' ],
+    'hurd-i386' =>     [ 'i386-gnu', 'unknown' ],
+    's390' =>          [ 's390-linux', 'unknown' ],
+    's390x' =>         [ 's390x-linux', 'unknown' ],
+    'ia64' =>          [ 'ia64-linux', 'unknown' ],
+    'openbsd-i386' =>  [ 'i386-openbsd', 'unknown' ],
+    'freebsd-i386' =>  [ 'i386-freebsd', 'unknown' ],
+    'darwin-powerpc' =>        [ 'powerpc-darwin', 'unknown' ],
+    'darwin-i386' =>   [ 'i386-darwin', 'unknown' ],
+);
 
 sub usageversion {
+    $_{$archtable{$_}->[0]} = 1 foreach keys %archtable;
     print STDERR
 "Debian $0 $version.  Copyright (C) 1999,2000,2001 Marcus Brinkmann.
 This is free software; see the GNU General Public Licence version 2
@@ -89,13 +95,13 @@
        -u                 print command to unset environment variables
        -c <command>       set environment and run the command in it.
 
-Known Debian Architectures are ".join(", ",keys %archtable)."
-Known GNU System Types are ".join(", ",map ($archtable{$_},keys %archtable))."
+Known Debian Architectures are ".join(", ",sort keys %archtable)."
+Known GNU System Types are ".join(", ",sort keys %_)."
 ";
 }
 
 sub rewrite_gnu_cpu {
-       local ($_) = @_;
+       $_ = shift;
 
        s/(?:i386|i486|i586|i686|pentium)(.*linux)/i386$1/;
        s/ppc/powerpc/;
@@ -103,73 +109,52 @@
 }
 
 sub gnu_to_debian {
-       local ($gnu) = @_;
-       local (@list);
-       local ($a);
+       my $gnu = shift;
+       my @list;
 
        $gnu = &rewrite_gnu_cpu($gnu);
 
-       foreach $a (keys %archtable) {
-               push @list, $a if $archtable{$a} eq $gnu;
+       foreach (keys %archtable) {
+               push @list, $_ if $archtable{$_}->[0] eq $gnu;
        }
        return @list;
 }
 
-# Set default values:
-
-$deb_build_arch = `dpkg --print-installation-architecture`;
-if ($?>>8) {
-       &syserr("dpkg --print-installation-architecture filed");
-}
-chomp $deb_build_arch;
-$deb_build_gnu_type = $archtable{$deb_build_arch};
-$deb_build_gnu_cpu = $deb_build_gnu_type;
-$deb_build_gnu_system = $deb_build_gnu_type;
-$deb_build_gnu_cpu =~ s/-.*$//;
-$deb_build_gnu_system =~ s/^.*-//;
-
-# Default host: Current gcc.
-$gcc = `\${CC:-gcc} --print-libgcc-file-name`;
-if ($?>>8) {
-    &warn("Couldn't determine gcc system type, falling back to default (native 
compilation)");
-    $gcc = '';
-} else {
-    $gcc =~ s!^.*gcc-lib/([^/]*)/(?:egcs-)?\d+(?:[.\da-z]*)/libgcc.*$!$1!s;
-    if (defined $1 and $1 ne '') {
-       $gcc = $1;
-    } else {
-       &warn("Couldn't determine gcc system type, falling back to default 
(native compilation)");
-       $gcc = '';
-    }
-}
-
-if ($gcc ne '') {
-    @list = &gnu_to_debian($gcc);
-    if ($#list == -1) {
-       &warn ("Unknown gcc system type $gcc, falling back to default (native 
compilation)"),
-    } elsif ($#list > 0) {
-       &warn ("Ambiguous gcc system type $gcc, you must specify Debian 
architecture, too (one of ".join(", ",@list).")");
-    } else {
-       $gcc=$archtable{$list[0]};
-       $deb_host_arch = $list[0];
-       $deb_host_gnu_type = $gcc;
-        ($deb_host_gnu_system = $gcc) =~ s/^.*-//;
-        ($deb_host_gnu_cpu = $gcc ) =~ s/-.*$//;
-    }
-}
-if (!defined($deb_host_arch)) {
-    # Default host: Native compilation.
-    $deb_host_arch = $deb_build_arch;
-    $deb_host_gnu_cpu = $deb_build_gnu_cpu;
-    $deb_host_gnu_system = $deb_build_gnu_system;
-    $deb_host_gnu_type = $deb_build_gnu_type;
-}
-
+my %env;
+my @list;
 
-$req_host_arch = '';
-$req_host_gnu_type = '';
-$action='l';
-$force=0;
+my @ordered_d = qw(
+    DEB_BUILD_ARCH
+    DEB_BUILD_GNU_CPU
+    DEB_BUILD_GNU_SYSTEM
+    DEB_BUILD_GNU_TYPE
+    DEB_BUILD_ELF_TYPE
+    DEB_HOST_ARCH
+    DEB_HOST_GNU_CPU
+    DEB_HOST_GNU_SYSTEM
+    DEB_HOST_GNU_TYPE
+    DEB_HOST_ELF_TYPE
+);
+
+my @ordered_r = qw(
+   CC
+   CXX
+   AS
+   AR
+   LD
+   RANLIB
+   STRIP
+   CONFIG_SITE
+   MAKEFLAGS
+   PKG_CONFIG_PATH
+);
+
+my $req_host_arch = '';
+my $req_host_gnu_type = '';
+my $req_variable_to_print;
+my $action = 'l';
+my $force = 0;
+my $type = 'd';
 
 while (@ARGV) {
     $_=shift(@ARGV);
@@ -188,14 +173,74 @@
     } elsif (m/^-c$/) {
        $action = 'c';
        last;
+    } elsif (m/^-r$/) {
+       $type = 'r';
     } else {
        usageerr("unknown option \`$_'");
     }
 }
 
+# Set default values:
+
+$env{'DEB_BUILD_ARCH'} = `dpkg --print-installation-architecture`;
+if ($?>>8) {
+       &syserr("dpkg --print-installation-architecture filed");
+}
+chomp $env{'DEB_BUILD_ARCH'};
+$env{'DEB_BUILD_GNU_TYPE'} = $env{'DEB_BUILD_GNU_CPU'} = 
$env{'DEB_BUILD_GNU_SYSTEM'} = $archtable{$env{'DEB_BUILD_ARCH'}}->[0];
+$env{'DEB_BUILD_GNU_CPU'} =~ s/-.*$//;
+$env{'DEB_BUILD_GNU_SYSTEM'} =~ s/^.*-//;
+$env{'DEB_BUILD_ELF_TYPE'} = $archtable{$env{'DEB_BUILD_ARCH'}}->[1];
+
+$env{CC} = "gcc";
+$env{CXX} = "g++";
+$env{AR} = "ar";
+$env{AS} = "as";
+$env{LD} = "ld";
+$env{RANLIB} = "ranlib";
+$env{STRIP} = "strip";
+
+# Default host: Current gcc.
+my $gcc = '';
+if (!$req_host_arch) {
+    $gcc = `\${CC:-gcc} --print-libgcc-file-name`;
+    if ($?>>8) {
+       &warn("Couldn't determine gcc system type, falling back to default 
(native compilation)");
+       $gcc = '';
+    } else {
+       $gcc =~ s#^.*gcc-lib/([^/]*)/(?:egcs-)?\d+(?:[.\da-z]*)/libgcc.*$#$1#s;
+       if (defined $1 and $1 ne '') {
+           $gcc = $1;
+       } else {
+           &warn("Couldn't determine gcc system type, falling back to default 
(native compilation)");
+           $gcc = '';
+       }
+    }
+}
+
+if ($gcc ne '') {
+    @list = &gnu_to_debian($gcc);
+    if ($#list == -1) {
+       &warn ("Unknown gcc system type $gcc, falling back to default (native 
compilation)"),
+    } elsif ($#list > 0) {
+       &warn ("Ambiguous gcc system type $gcc, you must specify Debian 
architecture, too (one of ".join(", ",@list).")");
+    } else {
+       $gcc=$archtable{$list[0]}->[0];
+       $env{'DEB_HOST_ARCH'} = $list[0];
+       $env{'DEB_HOST_GNU_TYPE'} = $gcc;
+        ($env{'DEB_HOST_GNU_SYSTEM'} = $gcc) =~ s/^.*-//;
+        ($env{'DEB_HOST_GNU_CPU'} = $gcc ) =~ s/-.*$//;
+       $env{'DEB_HOST_ELF_TYPE'} =  $archtable{$list[0]}->[1];
+    }
+}
+if (!defined($env{'DEB_HOST_ARCH'})) {
+    # Default host: Native compilation.
+    $env{'DEB_HOST_'.$_} = $env{'DEB_BUILD_'.$_} foreach qw(ARCH GNU_CPU 
GNU_SYSTEM GNU_TYPE ELF_TYPE);
+}
+
 if ($req_host_arch ne '' && $req_host_gnu_type eq '') {
     die ("unknown Debian architecture $req_host_arch, you must specify GNU 
system type, too") if !exists $archtable{$req_host_arch};
-    $req_host_gnu_type = $archtable{$req_host_arch}
+    $req_host_gnu_type = $archtable{$req_host_arch}->[0]
 }
 
 if ($req_host_gnu_type ne '' && $req_host_arch eq '') {
@@ -205,56 +250,73 @@
     $req_host_arch = $list[0];
 }
 
-if (exists $archtable{$req_host_arch}) {
-    &warn("Default GNU system type $archtable{$req_host_arch} for Debian arch 
$req_host_arch does not match specified GNU system type $req_host_gnu_type\n") 
if $archtable{$req_host_arch} ne $req_host_gnu_type;
+if (exists $archtable{$req_host_arch}->[0]) {
+    &warn("Default GNU system type ".$archtable{$req_host_arch}->[0]." for 
Debian arch $req_host_arch does not match specified GNU system type 
$req_host_gnu_type\n") if $archtable{$req_host_arch}->[0] ne $req_host_gnu_type;
 }
 
 die "couldn't parse GNU system type $req_host_gnu_type, must be arch-os or 
arch-vendor-os" if $req_host_gnu_type !~ m/^([\w\d]+(-[\w\d]+){1,2})?$/;
 
-$deb_host_arch = $req_host_arch if $req_host_arch ne '';
+$env{'DEB_HOST_ARCH'} = $req_host_arch if $req_host_arch ne '';
 if ($req_host_gnu_type ne '') {
-    $deb_host_gnu_cpu = $deb_host_gnu_system = $deb_host_gnu_type = 
$req_host_gnu_type;
-    $deb_host_gnu_cpu =~ s/-.*$//;
-    $deb_host_gnu_system =~ s/^.*-//;
+    $env{'DEB_HOST_GNU_CPU'} = $env{'DEB_HOST_GNU_SYSTEM'} = 
$env{'DEB_HOST_GNU_TYPE'} = $req_host_gnu_type;
+    $env{'DEB_HOST_GNU_CPU'} =~ s/-.*$//;
+    $env{'DEB_HOST_GNU_SYSTEM'} =~ s/^.*-//;
+    @list = &gnu_to_debian ($req_host_gnu_type);
+    $env{'DEB_HOST_ELF_TYPE'} = $archtable{$list[0]}->[1];
 }
 
-#$gcc = `\${CC:-gcc} --print-libgcc-file-name`;
-#$gcc =~ s!^.*gcc-lib/(.*)/\d+(?:.\d+)*/libgcc.*$!$1!s;
-&warn("Specified GNU system type $deb_host_gnu_type does not match gcc system 
type $gcc.") if ($gcc ne '') && ($gcc ne $deb_host_gnu_type);
+&warn("Specified GNU system type $env{'DEB_HOST_GNU_TYPE'} does not match gcc 
system type $gcc.") if ($gcc ne '') && ($gcc ne $env{'DEB_HOST_GNU_TYPE'});
+
+if ($env{'DEB_HOST_ARCH'} ne $env{'DEB_BUILD_ARCH'}) {
+    foreach (qw(CC CXX)) {
+       $env{$_} = $env{'DEB_HOST_GNU_TYPE'} . "-" . $env{$_};
+    }
+
+    $env{PKG_CONFIG_PATH} = "/usr/" . $env{'DEB_HOST_GNU_TYPE'} . 
"/lib/pkgconfig/";
+}
+else {
+    $env{PKG_CONFIG_PATH} = "/usr/lib/pkgconfig/";
+}
+if ($env{'DEB_HOST_GNU_CPU'} ne $env{'DEB_BUILD_GNU_CPU'}) {
+    foreach (qw(AR AS LD RANLIB STRIP)) {
+       $env{$_} = $env{'DEB_HOST_GNU_TYPE'} . "-" . $env{$_};
+    }
+}
+
+$env{CONFIG_SITE} = "/etc/dpkg/cross/config";
+
+my $makeflags = "w -- ";
+if (!$force and exists $ENV{'MAKEFLAGS'}) {
+       $makeflags = $ENV{'MAKEFLAGS'};
+       $makeflags .= " -- " if $makeflags !~ / -- /;
+}
+foreach (qw(CC CXX AR AS LD RANLIB STRIP)) {
+       $makeflags .= " $_=$env{$_}";
+}
+$env{'MAKEFLAGS'} = "\"$makeflags\"";
+
+my @ordered;
+
+if ($type eq 'd') {
+    @ordered = @ordered_d;
+}
+elsif ($type eq 'r') {
+    @ordered = @ordered_r;
+}
 
-%env = ();
 if (!$force) {
-    $deb_build_arch = $ENV{DEB_BUILD_ARCH} if (exists $ENV{DEB_BUILD_ARCH});
-    $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_gnu_cpu = $ENV{DEB_HOST_GNU_CPU} if (exists 
$ENV{DEB_HOST_GNU_CPU});
-    $deb_host_gnu_system = $ENV{DEB_HOST_GNU_SYSTEM} if (exists 
$ENV{DEB_HOST_GNU_SYSTEM});
-    $deb_host_gnu_type = $ENV{DEB_HOST_GNU_TYPE} if (exists 
$ENV{DEB_HOST_GNU_TYPE});
-}
-
-@ordered = qw(DEB_BUILD_ARCH DEB_BUILD_GNU_CPU
-             DEB_BUILD_GNU_SYSTEM DEB_BUILD_GNU_TYPE
-             DEB_HOST_ARCH DEB_HOST_GNU_CPU
-             DEB_HOST_GNU_SYSTEM DEB_HOST_GNU_TYPE);
-
-$env{'DEB_BUILD_ARCH'}=$deb_build_arch;
-$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_GNU_CPU'}=$deb_host_gnu_cpu;
-$env{'DEB_HOST_GNU_SYSTEM'}=$deb_host_gnu_system;
-$env{'DEB_HOST_GNU_TYPE'}=$deb_host_gnu_type;
+    foreach (@ordered) {
+       $env{$_} = $ENV{$_} if exists $ENV{$_};
+    }
+}
 
 if ($action eq 'l') {
-    foreach $k (@ordered) {
-       print "$k=$env{$k}\n";
+    foreach (@ordered) {
+       print "$_=$env{$_}\n";
     }
 } elsif ($action eq 's') {
-    foreach $k (@ordered) {
-       print "$k=$env{$k}; ";
+    foreach (@ordered) {
+       print "$_=$env{$_}; ";
     }
     print "export ".join(" ",@ordered)."\n";
 } elsif ($action eq 'u') {
Index: scripts/dpkg-buildpackage.sh
===================================================================
RCS file: /home/bastian/debian/cvs/dpkg/scripts/dpkg-buildpackage.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- scripts/dpkg-buildpackage.sh        25 May 2002 02:57:15 -0000      1.1.1.1
+++ scripts/dpkg-buildpackage.sh        23 Dec 2002 18:51:19 -0000      1.3
@@ -157,6 +157,12 @@
 pv="${package}_${sversion}"
 pva="${package}_${sversion}_${arch}"
 
+if [ "$arch" != "source" ]; then
+       if [ "$targetarch" ]; then
+               eval `dpkg-architecture -a${targetarch} -t${targetgnusystem} -s 
-r`
+       fi
+fi
+
 signfile () {
        if test "$signinterface" = "gpg" ; then
                (cat "../$1" ; echo "") | \
Index: scripts/dpkg-shlibdeps.pl
===================================================================
RCS file: /home/bastian/debian/cvs/dpkg/scripts/dpkg-shlibdeps.pl,v
retrieving revision 1.1.1.1
retrieving revision 1.5
diff -u -r1.1.1.1 -r1.5
--- scripts/dpkg-shlibdeps.pl   20 Jun 2001 16:30:15 -0000      1.1.1.1
+++ scripts/dpkg-shlibdeps.pl   23 Dec 2002 19:00:51 -0000      1.5
@@ -23,6 +23,13 @@
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
 
+$cross = 0;
+
+if (defined $ENV{'DEB_BUILD_ARCH'} and defined $ENV{'DEB_HOST_ARCH'} and 
$ENV{'DEB_BUILD_ARCH'} ne $ENV{'DEB_HOST_ARCH'}) {
+    $cross = 1;
+    $cross_arch = $ENV{'DEB_HOST_GNU_TYPE'};
+}
+
 sub usageversion {
     print STDERR
 "Debian dpkg-shlibdeps $version.
@@ -97,14 +104,16 @@
     # First we get an ldd output to see what libs + paths we have at out
     # disposal.
     my %so2path = ();
-    defined($c= open(P,"-|")) || syserr("cannot fork for ldd");
-    if (!$c) { exec("ldd","--",$exec[$i]); syserr("cannot exec ldd"); }
-    while (<P>) {
-       if (m,^\s+(\S+)\s+=>\s+(\S+)\s+\(0x.+\)?$,) {
-           $so2path{$1} = $2;
+    if (!$cross) {
+       defined($c= open(P,"-|")) || syserr("cannot fork for ldd");
+       if (!$c) { exec("ldd","--",$exec[$i]); syserr("cannot exec ldd"); }
+       while (<P>) {
+           if (m,^\s+(\S+)\s+=>\s+(\S+)\s+\(0x.+\)?$,) {
+               $so2path{$1} = $2;
+           }
        }
+       close(P); $? && subprocerr("ldd on \`$exec[$i]'");
     }
-    close(P); $? && subprocerr("ldd on \`$exec[$i]'");
 
     # Now we get the direct deps of the program. We then check back with
     # the ldd output from above to see what our path is.
@@ -116,13 +125,25 @@
            if (m,^\s*NEEDED\s+((\S+)\.so\.(\S+))$,) {
                push(@libname,$2); push(@libsoname,$3);
                push(@libf,$execf[$i]);
-               &warn("could not find path for $1") unless 
defined($so2path{$1});
-               push(@libfiles,$so2path{$1});
+               if ($cross) {
+                   &warn("could not find path for $1") unless -f 
"/usr/".$cross_arch."/lib/".$1;
+                   push(@libfiles,"/usr/".$cross_arch."/lib/".$1);
+               }
+               else {
+                   &warn("could not find path for $1") unless 
defined($so2path{$1});
+                   push(@libfiles,$so2path{$1});
+               }
            } elsif (m,^\s*NEEDED\s+((\S+)-(\S+)\.so)$,) {
                push(@libname,$2); push(@libsoname,$3);
                push(@libf,$execf[$i]);
-               &warn("could not find path for $1") unless 
defined($so2path{$1});
-               push(@libfiles,$so2path{$1});
+               if ($cross) {
+                   &warn("could not find path for $1") unless -f 
"/usr/".$cross_arch."/lib/".$1;
+                   push(@libfiles,"/usr/".$cross_arch."/lib/".$1);
+               }
+               else {
+                   &warn("could not find path for $1") unless 
defined($so2path{$1});
+                   push(@libfiles,$so2path{$1});
+               }
            } else {
                m,^\s*NEEDED\s+(\S+)$,;
                &warn("format of $1 not recognized");

Attachment: pgpkitn5DMQvC.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Hi!

On Sun, 2012-07-22 at 19:23:44 +0200, Guillem Jover wrote:
> On Sun, 2012-07-22 at 18:01:05 +0100, Wookey wrote:
> > +++ Neil Williams [2012-07-22 17:05 +0100]:
> > > On Wed, 18 Jul 2012 19:11:38 +0200 Guillem Jover wrote:
> > > > So, was checking this (and also the dpkg roadmap) and was wondering what
> > > > else is still missing to be merged from dpkg-cross? If the only problem
> > > > is the listed below, then it'd seem this bug has been resolved and it
> > > > can be closed.

So I'm doing this now, see below for rationale.

> > > Therefore, I think this bug will need to remain open, unless dpkg
> > > maintainers do not wish to integrate the cross architecture-specific
> > > metadata at all. (This data does not change until a new port is
> > > accepted by dpkg or an old port removed, at which point it is just a
> > > single file addition/removal containing data provided by the porters.)
> 
> > > e.g. for armel:
> > > ac_cv_c_bigendian=no
> > > ac_cv_c_char_unsigned=yes
> > > ac_cv_sizeof_long_long=8
> > > ac_cv_sizeof_unsigned_long_long=8
> > > ac_cv_sizeof_long=4
> 
> Something that has crossed my mind in the recent past is that cputable
> has most of this data, but not all, and it could make sense to add
> more information so that the architecture ABI is crystal clear from
> the tables alone. dpkg-cross or crossbuild-support or whatever could
> then generate an autoconf cache file at build time from the dpkg tables
> for example. Because I'd assume there's other cached values that will
> end up there and those would certainly not be appropriate for dpkg.

I think the current understanding is that these are derivable by
autoconf checks even when cross-building, at least with recent enough
autotools, so the correct fix is to update projects.

Also I've been pondering about these values and I'm not sure anymore
they belong in the arch tables. Many of these are C-type specific, and
might or might not apply at all to other run-times, of course we kind
of base our ABI based on the libc, but still.

> > I don't think that dpkg is the right place for this data. We want to
> > be able to update it easily without having to mess with important
> > things like dpkg. The core cross functionality is now in dpkg and apt.
> > We should discuss where remaining stuff like autoconf cache variables,
> > triplet-prefixed commands like <triplet>-pkg-config and
> > <triplet>-config scripts, cross-build-essential package lists and the
> > like should live, but I don't currently see good arguments to put any
> > more of it into dpkg.
> 
> Except for my comments above, I tend to agree with this.

Yeah, so given the above, I'm just going to close this now, as
everything else should already be supported in dpkg. If there's
something else still missing or lacking an already filed report, let's
open a new one to track it.

Thanks,
Guillem

--- End Message ---

Reply via email to