diff -ruN dpkg-1.10.10.org/archtable dpkg-1.10.10.0lib641+subarch/archtable
--- dpkg-1.10.10.org/archtable	2003-04-15 12:34:28.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/archtable	2003-07-12 15:39:03.000000000 -0400
@@ -58,3 +58,5 @@
 s390x-linux-gnu		s390x		s390x
 s390x-ibm-linux-gnu	s390x		s390x
 s390x-unknown-linux-gnu	s390x		s390x
+amd64-linux-gnu		amd64		amd64
+x86_64-linux-gnu	amd64		amd64
diff -ruN dpkg-1.10.10.org/debian/changelog dpkg-1.10.10.0lib641+subarch/debian/changelog
--- dpkg-1.10.10.org/debian/changelog	2003-04-26 16:11:53.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/debian/changelog	2003-07-15 21:17:08.000000000 -0400
@@ -1,3 +1,15 @@
+dpkg (1.10.10.0lib641+subarch) unstable; urgency=low
+
+  * added primitive subarchitecture support for dpkg 
+
+ -- Bart Trojanowski <bart@jukie.net>  Sat, 12 Jul 2003 16:10:23 -0400
+
+dpkg (1.10.10.0lib641) unstable; urgency=low
+
+  * lib64 support added.
+
+ -- Gerhard Tonn <gt@debian.org>  Thu,  9 Jun 2003 15:10:24 +0200
+
 dpkg (1.10.10) unstable; urgency=low
 
   * Update archtable for hurd.  Closes: #187509.
diff -ruN dpkg-1.10.10.org/debian/rules dpkg-1.10.10.0lib641+subarch/debian/rules
--- dpkg-1.10.10.org/debian/rules	2003-04-26 16:10:12.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/debian/rules	2003-07-12 15:39:03.000000000 -0400
@@ -196,7 +196,7 @@
 	set -e ; for i in dpkg-name dpkg-source dpkg-genchanges dpkg-gencontrol \
 		dpkg-shlibdeps dpkg-buildpackage dpkg-distaddfile 822-date \
 		dpkg-scanpackages dpkg-scansources dpkg-architecture \
-		dpkg-parsechangelog dpkg-checkbuilddeps ; do \
+		dpkg-parsechangelog dpkg-checkbuilddeps dpkg-libinfo ; do \
 		mv $(INSTALL_TMP)/usr/bin/$$i $(TMP_DPKG_DEV)/usr/bin/ ; \
 	done
 	set -e ; for i in "" de fr ja sv ; do \
@@ -204,7 +204,7 @@
 		for m in dpkg-name.1 dpkg-source.1 822-date.1 dpkg-architecture.1 \
 			dpkg-buildpackage.1 dpkg-distaddfile.1 dpkg-genchanges.1 \
 			dpkg-gencontrol.1 dpkg-parsechangelog.1 dpkg-shlibdeps.1 \
-			dpkg-checkbuilddeps.1 ; do \
+			dpkg-checkbuilddeps.1 dpkg-libinfo.1 ; do \
 			if [ -e $(INSTALL_TMP)/usr/share/man/$$i/man1/$$m ] ; then \
 				mv $(INSTALL_TMP)/usr/share/man/$$i/man1/$$m $(TMP_DPKG_DEV)/usr/share/man/$$i/man1/$$m ; \
 			fi ; \
diff -ruN dpkg-1.10.10.org/main/main.h dpkg-1.10.10.0lib641+subarch/main/main.h
--- dpkg-1.10.10.org/main/main.h	2002-05-20 01:56:01.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/main/main.h	2003-07-12 22:46:14.000000000 -0400
@@ -98,6 +98,10 @@
 
 void filesdbinit(void);
 
+/* from subarch.c */
+
+void assert_support_for_arch (const char *const arch);
+
 /* from archives.c */
 
 void archivefiles(const char *const *argv);
diff -ruN dpkg-1.10.10.org/main/Makefile.in dpkg-1.10.10.0lib641+subarch/main/Makefile.in
--- dpkg-1.10.10.org/main/Makefile.in	2002-08-24 15:54:18.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/main/Makefile.in	2003-07-12 22:40:09.000000000 -0400
@@ -8,7 +8,7 @@
 
 SOURCES		= main.c enquiry.c filesdb.c archives.c processarc.c \
 		  cleanup.c select.c packages.c configure.c remove.c \
-		  help.c depcon.c errors.c update.c 
+		  help.c depcon.c errors.c update.c subarch.c
 
 MAN8PAGES	= dpkg.8 dpkg-query.8
 
diff -ruN dpkg-1.10.10.org/main/processarc.c dpkg-1.10.10.0lib641+subarch/main/processarc.c
--- dpkg-1.10.10.org/main/processarc.c	2002-05-25 23:53:43.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/main/processarc.c	2003-07-15 21:37:43.000000000 -0400
@@ -207,12 +207,7 @@
     return;
   }
 
-  if (pkg->available.architecture && *pkg->available.architecture &&
-      strcmp(pkg->available.architecture,"all") &&
-      strcmp(pkg->available.architecture,architecture))
-    forcibleerr(fc_architecture,
-                _("package architecture (%s) does not match system (%s)"),
-                pkg->available.architecture,architecture);
+  assert_support_for_arch (pkg->available.architecture);
     
   if (!pkg->installed.valid) blankpackageperfile(&pkg->installed);
   assert(pkg->available.valid);
diff -ruN dpkg-1.10.10.org/main/subarch.c dpkg-1.10.10.0lib641+subarch/main/subarch.c
--- dpkg-1.10.10.org/main/subarch.c	1969-12-31 19:00:00.000000000 -0500
+++ dpkg-1.10.10.0lib641+subarch/main/subarch.c	2003-07-15 21:13:34.000000000 -0400
@@ -0,0 +1,313 @@
+/*
+ * dpkg - main program for package management
+ * processarc.c - the huge function process_archive
+ *
+ * Copyright (C) 1995 Ian Jackson <ian@chiark.greenend.org.uk>
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with dpkg; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <utime.h>
+#include <assert.h>
+#include <time.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <config.h>
+#include <dpkg.h>
+#include <dpkg-db.h>
+#include <tarfn.h>
+#include <myopt.h>
+
+#include "filesdb.h"
+#include "main.h"
+#include "archives.h"
+
+#define DPKG_SUBARCHTABLE "/usr/share/dpkg/subarchtable"
+
+/* the database storage */
+static char *archs_buf = NULL;
+typedef struct arch_s {
+	char  *name;
+	int    subarch_cnt;
+	char **subarchs;
+} arch_t;
+static arch_t *archs = NULL;
+static int arch_cnt = 0;
+
+/* local function prototypes */
+static int test_support_for_arch (const char *const deb_arch, 
+		const char *const sys_arch);
+static int parse_subarchs (void);
+static int parse_subarchs_line_helper (char *line, arch_t *arch);
+
+/* ------------------------------------------------------------------------ */
+/* main entry point into this module */
+
+/* this function returns only if the deb_arch can be installed on the running
+ * system. */
+void
+assert_support_for_arch (const char *const deb_arch)
+{
+	if (deb_arch && *deb_arch 
+			&& strcmp(deb_arch, "all") 
+			&& ! test_support_for_arch (deb_arch, architecture)) {
+		forcibleerr(fc_architecture,
+				_("package architecture (%s) does not "
+					"match system (%s)"),
+					deb_arch, architecture);
+	}
+}
+
+/* ------------------------------------------------------------------------ */
+/* helper functions */
+
+/* do a recursive test on subarchtable, parse DPKG_SUBARCHTABLE if needed;
+ * return non-zero if deb_arch can be installed on sys_arch */
+static int
+test_support_for_arch (const char *const deb_arch, const char *const sys_arch)
+{
+	int a, s;
+	arch_t *arch;
+
+	/* do we have a direct match */
+	if (0 == strcmp(deb_arch, sys_arch))
+		return 1;
+
+	/* continue only if we can parse the architectures file;
+	 * or have parsed it already */
+	if (! parse_subarchs ())
+		return 0;
+
+	for (a=0; a<arch_cnt; a++) {
+		arch = &archs[a];
+
+		/* if the system architecture does not */
+		if (strcmp (sys_arch, arch->name))
+			continue;
+
+		/* compare the debian architecture with each subarch */
+		for (s=0; s<arch->subarch_cnt; s++) {
+
+			/* if we find a match return success */
+			if (test_support_for_arch (deb_arch, 
+						arch->subarchs[s]))
+				return 1;
+		}
+	}
+
+	/* we found nothing compatible */
+	return 0;
+}
+
+/* parse the DPKG_SUBARCHTABLE file and store results in archs table;
+ * return 0 on failure, 1 on success */
+static int 
+parse_subarchs (void)
+{
+	int rc, fd, max;
+	struct stat st;
+	char *p, *t;
+
+	/* return success if we have a valid table already */
+	if (arch_cnt>0 && archs && archs_buf) 
+		return 1;
+
+	/* return ailure if we failed previously */
+	if (arch_cnt==-1)
+		return 0;
+
+	/* get the file */
+	fd = open (DPKG_SUBARCHTABLE, O_RDONLY);
+	if (fd < 0)
+		return 0;
+
+	rc = fstat (fd, &st);
+	if (rc < 0)
+		goto error_with_file;
+
+	/* get the flat file into a buffer */
+	archs_buf = malloc (st.st_size+1);
+	if (NULL == archs_buf)
+		goto error_with_file;
+
+	rc = read (fd, archs_buf, st.st_size);
+	if (rc < 0)
+		goto error_with_archs_buf;
+	archs_buf[rc] = 0;
+
+	/* count the maximum number of lines - we will assume we have this
+	 * many arches at maxium */
+	p = archs_buf;
+	max = 2;
+	while (*p) {
+		if (*p == '\n' || *p == '\r')
+			max ++;
+		p++;
+	}
+
+	if (!max)
+		goto error_with_archs_buf;
+
+	/* build the array of architectures */
+	archs = malloc ((max+1) * sizeof (arch_t));
+	if (NULL == archs)
+		goto error_with_archs_buf;
+
+	p = archs_buf;
+	arch_cnt = 0;
+	while ( (t = strsep (&p, "\n\r")) != NULL ) {
+
+		/* find first non space */
+		while (*t && isspace(*t)) t++;
+
+		/* end of line */
+		if (!*t || t>=p) 
+			continue;
+
+		/* comment */
+		if (*t == '#')
+			continue;
+
+		/* invalid first character */
+		if (!isalpha(*t)) { 
+			/* bail if we get a bad token */
+			ohshit(_("%s: invalid token in:\n\t%s\n"),
+					DPKG_SUBARCHTABLE, t);
+		}
+
+		rc = parse_subarchs_line_helper (t, &archs[arch_cnt]);
+		if (rc) {
+			/* bail if we cannot parse the line */
+			ohshit(_("%s: could not parse line:\n\t%s\n"),
+					DPKG_SUBARCHTABLE, t);
+		}
+		
+		/* advance */
+		arch_cnt++;
+	}
+	archs[arch_cnt].name = NULL;
+
+	/* and we are done */
+	close (fd);
+	return 1;
+
+	//free (archs);
+	//archs = NULL;
+error_with_archs_buf:
+	free (archs_buf);
+	archs_buf = NULL;
+error_with_file:
+	close (fd);
+	arch_cnt = -1;
+	return 0;
+}
+
+static inline char *
+ltrim (char *str)
+{
+	char *p = str;
+	while (*p && isspace(*p)) p++;
+	return p;
+}
+
+static inline char *
+rtrim (char *str)
+{
+	char *p = str;
+	while (*p && !isspace(*p)) p++;
+	*p=0;
+	return str;
+}
+
+static inline char *
+trim (char *str)
+{
+	return rtrim (ltrim (str));
+}
+
+static int
+parse_subarchs_line_helper (char *line, arch_t *arch)
+{
+	int rc;
+	char *p = line;
+	char *sub, *t;
+	int max, cnt;
+
+	/* assume failure */
+	rc = -EINVAL;
+
+	/* get the architecture name */
+	arch->name = strsep (&p, ":");
+	if (arch->name == NULL || p == NULL)
+		goto error_parsing_name;
+
+	/* remove leading and trailing spaces */
+	arch->name = trim (arch->name);
+
+	/* guess number of words */
+	t = p;
+	max = 1;
+	while (*t && *t!='#') {
+		max ++;
+		while (*t && isspace(*t)) t++;
+		while (*t && *t!='#' && !isspace(*t)) t++;
+	}
+	*t = 0;
+
+	/* allocate the array of pointers for this */
+	arch->subarchs = malloc (max * sizeof (char*));
+
+	/* parse for real */
+	cnt = 0;
+	while ( (sub = strsep (&p, " \n\t")) != NULL ) {
+
+		/* empty token */
+		if (!*sub || isspace (*sub))
+			continue;
+
+		/* comment on rest of line */
+		if (*sub == '#')
+			break;
+
+		/* invalid first character */
+		if (!isalpha(*sub))
+			goto error_parsing_line;
+
+		/* store and advance */
+		arch->subarchs[cnt++] = sub;
+	}
+	arch->subarch_cnt = cnt;
+	arch->subarchs[cnt] = NULL;
+
+	return 0;
+
+error_parsing_line:
+	free (arch->subarchs);
+	arch->subarchs = NULL;
+error_parsing_name:
+	arch->name = NULL;
+	return rc;
+}
+
diff -ruN dpkg-1.10.10.org/Makefile.in dpkg-1.10.10.0lib641+subarch/Makefile.in
--- dpkg-1.10.10.org/Makefile.in	2003-04-26 12:26:19.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/Makefile.in	2003-07-15 21:15:57.000000000 -0400
@@ -19,6 +19,7 @@
 	$(mkinstalldirs) $(DESTDIR)$(dpkgsharedir)/origins
 	$(INSTALL_DATA) $(srcdir)/origin $(DESTDIR)$(dpkgconfdir)/origins/debian
 	$(INSTALL_DATA) $(srcdir)/archtable $(DESTDIR)$(dpkgsharedir)/archtable
+	$(INSTALL_DATA) $(srcdir)/subarchtable $(DESTDIR)$(dpkgsharedir)/subarchtable
 
 clean: clean-recursive
 	rm -f $(GENFILES)
diff -ruN dpkg-1.10.10.org/scripts/controllib.pl dpkg-1.10.10.0lib641+subarch/scripts/controllib.pl
--- dpkg-1.10.10.org/scripts/controllib.pl	2002-05-24 22:46:50.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/scripts/controllib.pl	2003-07-12 15:39:03.000000000 -0400
@@ -144,11 +144,25 @@
     open(CDATA,"< $controlfile") || &error("cannot read control file $controlfile: $!");
     $indices= &parsecdata('C',1,"control file $controlfile");
     $indices >= 2 || &error("control file must have at least one binary package part");
+    $lib64_arch=`dpkg-libinfo -qDEB_LIB64_ARCH`;
 
     for ($i=1;$i<$indices;$i++) {
         defined($fi{"C$i Package"}) ||
             &error("per-package paragraph $i in control info file is ".
                    "missing Package line");
+	if (defined($fi{"C$i Package.64"}) && $lib64_arch == 1) {
+	    if (defined($fi{"C$i Substvarname"})) {
+	        $substvar{$fi{"C$i Substvarname"}} = $fi{"C$i Package.64"};
+	    } else {
+	        $substvar{$fi{"C$i Package"}} = $fi{"C$i Package.64"};
+	    }
+	} else {
+	    if (defined($fi{"C$i Substvarname"})) {
+	        $substvar{$fi{"C$i Substvarname"}} = $fi{"C$i Package"};
+	    } else {
+	        $substvar{$fi{"C$i Package"}} = $fi{"C$i Package"};
+	    }
+	}
     }
 }
 
@@ -182,7 +196,10 @@
     # many=1: many paragraphs like in source control file
     # many=-1: single paragraph of control data optionally signed
     local ($index,$cf,$paraborder);
+    local ($pkg,$pkg64,$vold,$lib64_arch);
     $index=''; $cf=''; $paraborder=1;
+    $pkg=0; $pkg64=0;
+    $lib64_arch=`dpkg-libinfo -qDEB_LIB64_ARCH`;
     while (<CDATA>) {
         s/\s*\n$//;
 	next if (m/^$/ and $paraborder);
@@ -191,7 +208,8 @@
             $cf=$1; $v=$2;
             $cf= &capit($cf);
             $fi{"$source$index $cf"}= $v;
-            if (lc $cf eq 'package') { $p2i{"$source $v"}= $index; }
+            if (lc $cf eq 'package.64' && $lib64_arch == 1) { if ($pkg == 1) { $vold = $fi{"$source$index Package"}; delete $p2i{"$source $vold"}; } $p2i{"$source $v"}= $index; $pkg64 = 1;}
+            elsif (lc $cf eq 'package' && $pkg64 == 0) { $p2i{"$source $v"}= $index; $pkg = 1;}
         } elsif (m/^\s+\S/) {
             length($cf) || &syntax("continued value line not in field");
             $fi{"$source$index $cf"}.= "\n$_";
@@ -201,6 +219,7 @@
             $many= -2;
         } elsif (m/^$/) {
 	    $paraborder = 1;
+    	    $pkg=0; $pkg64=0;
             if ($many>0) {
                 $index++; $cf='';
             } elsif ($many == -2) {
diff -ruN dpkg-1.10.10.org/scripts/dpkg-architecture.pl dpkg-1.10.10.0lib641+subarch/scripts/dpkg-architecture.pl
--- dpkg-1.10.10.org/scripts/dpkg-architecture.pl	2003-04-15 12:34:28.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/scripts/dpkg-architecture.pl	2003-07-12 15:39:03.000000000 -0400
@@ -40,7 +40,7 @@
 #  1.0.7  -q should not imply -f, because this prevents setting
 #         make variables with non-standard names correctly.
 
-$version="1.0.0";
+$version="1.10.10";
 $0 = `basename $0`; chomp $0;
 
 $dpkglibdir="/usr/lib/dpkg";
@@ -69,7 +69,8 @@
 	    'freebsd-i386',	'i386-freebsd',
 	    'netbsd-i386',	'i386-netbsdelf-gnu',
 	    'darwin-powerpc',	'powerpc-darwin',
-	    'darwin-i386',	'i386-darwin');
+	    'darwin-i386',	'i386-darwin',
+	    'amd64',		'x86_64-linux');
 
 sub usageversion {
     print STDERR
@@ -134,9 +135,13 @@
     &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;
+    if ($gcc =~ m!^.*gcc-lib/([^/]*)/(?:egcs-)?\d+(?:[.\da-z]*)/(64/)?libgcc.*$!) {
+	# special hack for a biarch i386/x86_64 compiler
+	if (defined $1 and $1 eq 'i386-linux' and defined $2 and $2 eq '64/' ) {
+	   $gcc = 'x86_64-linux';
+	} elsif (defined $1 and $1 ne '') {
+	   $gcc = $1;
+	}
     } else {
 	&warn("Couldn't determine gcc system type, falling back to default (native compilation)");
 	$gcc = '';
diff -ruN dpkg-1.10.10.org/scripts/dpkg-genchanges.pl dpkg-1.10.10.0lib641+subarch/scripts/dpkg-genchanges.pl
--- dpkg-1.10.10.org/scripts/dpkg-genchanges.pl	2002-07-02 03:47:47.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/scripts/dpkg-genchanges.pl	2003-07-12 15:39:03.000000000 -0400
@@ -156,6 +156,8 @@
     close(FL);
 }
 
+$lib64_arch=`dpkg-libinfo -qDEB_LIB64_ARCH`;
+
 for $_ (keys %fi) {
     $v= $fi{$_};
     if (s/^C //) {
@@ -166,7 +168,10 @@
 	elsif (m/|^X[BS]+-|^Standards-Version$/i) { }
 	else { &unknown('general section of control info file'); }
     } elsif (s/^C(\d+) //) {
-	$i=$1; $p=$fi{"C$i Package"}; $a=$fi{"C$i Architecture"};
+	$i=$1; 
+	if (defined($fi{"C$i Package.64"}) && $lib64_arch==1) { $p=$fi{"C$i Package.64"}; }
+	else { $p=$fi{"C$i Package"}; }
+	$a=$fi{"C$i Architecture"};
 	if (!defined($p2f{$p}) && not $sourceonly) {
 	    if ($a eq 'any' || ($a eq 'all' && !$archspecific) ||
 		grep($_ eq $substvar{'Arch'}, split(/\s+/, $a))) {
@@ -200,7 +205,7 @@
 		    $v = '';
 		}
 		push(@archvalues,$v) unless !$v || $archadded{$v}++;
-	    } elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/ ||
+	    } elsif (m/^(Package|Package.64|Substvarname|Essential|Pre-Depends|Depends|Provides)$/ ||
 		     m/^(Recommends|Suggests|Enhances|Optional|Conflicts|Replaces)$/ ||
 		     m/^X[CS]+-/i) {
 	    } else {
diff -ruN dpkg-1.10.10.org/scripts/dpkg-gencontrol.pl dpkg-1.10.10.0lib641+subarch/scripts/dpkg-gencontrol.pl
--- dpkg-1.10.10.org/scripts/dpkg-gencontrol.pl	2002-05-24 23:04:04.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/scripts/dpkg-gencontrol.pl	2003-07-12 15:39:03.000000000 -0400
@@ -46,7 +46,7 @@
 }
 
 $i=100;grep($fieldimps{$_}=$i--,
-          qw(Package Version Section Priority Architecture Essential
+          qw(Package Package.64 Substvarname Version Section Priority Architecture Essential
              Pre-Depends Depends Recommends Suggests Enhances Optional 
 	     Conflicts Replaces Provides Installed-Size Origin Maintainer
 	     Bugs Source Description Build-Depends Build-Depends-Indep
@@ -96,6 +96,8 @@
     }
 }
 
+$lib64_arch=`dpkg-libinfo -qDEB_LIB64_ARCH`;
+
 &findarch;
 &parsechangelog;
 &parsecontrolfile;
@@ -124,9 +126,13 @@
         else { &unknown('general section of control info file'); }
     } elsif (s/^C$myindex //) {
 #print STDERR "P key >$_< value >$v<\n";
-        if (m/^(Package|Description|Essential|Pre-Depends|Depends)$/ ||
+        if (m/^(Description|Essential|Pre-Depends|Depends)$/ ||
             m/^(Recommends|Suggests|Enhances|Optional|Conflicts|Provides|Replaces)$/) {
             $f{$_}= $v;
+        } elsif (m/^Package$/) {
+           if (defined($fi{"C$myindex Package.64"}) && $lib64_arch==1) { $f{$_}= $fi{"C$myindex Package.64"}; }
+           else { $f{$_}= $v; }
+        } elsif (m/^Package.64$|^Substvarname$/) {
         } elsif (m/^Section$|^Priority$/) {
             $spvalue{$_}= $v;
         } elsif (m/^Architecture$/) {
diff -ruN dpkg-1.10.10.org/scripts/dpkg-libinfo.pl dpkg-1.10.10.0lib641+subarch/scripts/dpkg-libinfo.pl
--- dpkg-1.10.10.org/scripts/dpkg-libinfo.pl	1969-12-31 19:00:00.000000000 -0500
+++ dpkg-1.10.10.0lib641+subarch/scripts/dpkg-libinfo.pl	2003-07-12 15:39:03.000000000 -0400
@@ -0,0 +1,147 @@
+#! /usr/bin/perl
+#
+# dpkg-libinfo
+#
+# Copyright 2003 Gerhard Tonn <gt@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+# History
+#  0.0.1  Initial release.
+
+$version="0.0.1";
+$0 = `basename $0`; chomp $0;
+
+$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',
+            'netbsd-i386',      'i386-netbsdelf-gnu',
+            'darwin-powerpc',   'powerpc-darwin',
+            'darwin-i386',      'i386-darwin',
+            'amd64',            'x86_64-linux');
+
+sub usageversion {
+    print STDERR
+"Debian $0 $version.  Copyright (C) 2003 Gerhard Tonn.
+This is free software; see the GNU General Public Licence version 2
+or later for copying conditions.  There is NO warranty.
+
+Usage:
+  $0 [<option> ...] [<action>]
+Options:
+       -a<debian-arch>    set Debian architecture
+Actions:
+       -l                 list variables (default)
+       -q<variable>       prints only the value of <variable>.
+
+Known Debian Architectures are ".join(", ",keys %archtable)."
+";
+}
+
+$deb_host_arch = `dpkg-architecture -qDEB_HOST_ARCH`;
+chomp $deb_host_arch;
+
+$action='l';
+
+while (@ARGV) {
+    $_=shift(@ARGV);
+    if (m/^-a/) {
+        $req_host_arch = $';
+    } elsif (m/^-[lsu]$/) {
+	$action = $_;
+	$action =~ s/^-//;
+    } elsif (m/^-q/) {
+        $req_variable_to_print = $';
+        $action = 'q';
+    } else {
+	usageerr("unknown option \`$_'");
+    }
+}
+
+$deb_host_arch = $req_host_arch if $req_host_arch ne '';
+
+if ($deb_host_arch eq "amd64" || $deb_host_arch eq "s390x") {
+	$deb_libqual="64";
+	$deb_lib64_arch=1;
+} else {
+	$deb_libqual="";
+	$deb_lib64_arch=0;
+}
+$deb_libname="lib$deb_libqual";
+$deb_libdir="/usr/$deb_libname";
+
+@ordered = qw(DEB_LIBQUAL DEB_LIBNAME DEB_LIBDIR
+              DEB_LIB64_ARCH);
+
+$env{'DEB_LIBQUAL'}=$deb_libqual;
+$env{'DEB_LIBNAME'}=$deb_libname;
+$env{'DEB_LIBDIR'}=$deb_libdir;
+$env{'DEB_LIB64_ARCH'}=$deb_lib64_arch;
+
+if ($action eq 'l') {
+    foreach $k (@ordered) {
+	print "$k=$env{$k}\n";
+    }
+} elsif ($action eq 'q') {
+    if (exists $env{$req_variable_to_print}) {
+        print "$env{$req_variable_to_print}\n";
+    } else {
+        die "$req_variable_to_print is not a supported variable name";
+    }
+}
+
+__END__
+
+=head1 NAME
+
+dpkg-libinfo - determine the locations of libraries for package building
+
+=head1 SYNOPSIS
+
+dpkg-libinfo [options] [action]
+
+Valid options:
+B<-a>Debian-Architecture
+
+Valid actions:
+B<-l>, B<-q>Variable-Name Command
+
+=head1 DESCRIPTION
+
+dpkg-libinfo provides a facility to determine the locations of libraries
+for package building, i.e. /lib and /usr/lib or /lib64 and /usr/lib64,
+respectively.
+
diff -ruN dpkg-1.10.10.org/scripts/dpkg-source.pl dpkg-1.10.10.0lib641+subarch/scripts/dpkg-source.pl
--- dpkg-1.10.10.org/scripts/dpkg-source.pl	2002-07-04 20:36:28.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/scripts/dpkg-source.pl	2003-07-12 15:39:03.000000000 -0400
@@ -189,6 +189,7 @@
             } elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/i ||
                      m/^(Recommends|Suggests|Optional|Conflicts|Replaces)$/i ||
                      m/^(Description|Section|Priority)$/i ||
+                     m/^(Package.64|Substvarname)$/i ||
                      m/^X[CS]+-/i) {
             } else {
                 &unknown("package's section of control info file");
diff -ruN dpkg-1.10.10.org/scripts/Makefile.in dpkg-1.10.10.0lib641+subarch/scripts/Makefile.in
--- dpkg-1.10.10.org/scripts/Makefile.in	2002-05-20 00:40:27.000000000 -0400
+++ dpkg-1.10.10.0lib641+subarch/scripts/Makefile.in	2003-07-12 15:39:03.000000000 -0400
@@ -9,7 +9,8 @@
 			  dpkg-gencontrol dpkg-shlibdeps dpkg-buildpackage \
 			  dpkg-parsechangelog dpkg-distaddfile 822-date \
 			  dpkg-scanpackages dpkg-scansources \
-			  dpkg-architecture dpkg-checkbuilddeps
+			  dpkg-architecture dpkg-checkbuilddeps \
+			  dpkg-libinfo
 
 SBIN_SCRIPTS		= update-alternatives install-info \
 			  dpkg-divert dpkg-statoverride cleanup-info
diff -ruN dpkg-1.10.10.org/subarchtable dpkg-1.10.10.0lib641+subarch/subarchtable
--- dpkg-1.10.10.org/subarchtable	1969-12-31 19:00:00.000000000 -0500
+++ dpkg-1.10.10.0lib641+subarch/subarchtable	2003-07-15 21:15:10.000000000 -0400
@@ -0,0 +1,14 @@
+# s390 family
+s390x: s390
+
+# sparc family
+sparc64: sparc
+
+# ppc family
+ppc64: ppc
+
+# x86 family
+amd64: i686
+i686: i586
+i586: i486
+i486: i386

