diff -ruN dpkg-1.10.10.org/archtable dpkg-1.10.10.0lib641-dep64/archtable
--- dpkg-1.10.10.org/archtable	2003-04-15 12:34:28.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/archtable	2003-07-23 05:48:05.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		i386		i486
+x86_64-linux-gnu	i386		i486
diff -ruN dpkg-1.10.10.org/debian/changelog dpkg-1.10.10.0lib641-dep64/debian/changelog
--- dpkg-1.10.10.org/debian/changelog	2003-04-26 16:11:53.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/debian/changelog	2003-07-23 05:46:44.000000000 -0400
@@ -1,3 +1,16 @@
+dpkg (1.10.10.0lib641-dep64) unstable; urgency=low
+
+  * removed amd64 architecture, using i386.
+  * added Depends: {64} for 64bit packages.
+
+ -- Bart Trojanowski <bart@jukie.net>  Wed, 23 Jul 2003 05:44:53 -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/control dpkg-1.10.10.0lib641-dep64/debian/control
--- dpkg-1.10.10.org/debian/control	2003-04-26 16:10:12.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/debian/control	2003-07-24 10:21:54.000000000 -0400
@@ -12,6 +12,7 @@
 Package: dpkg
 Architecture: any
 Essential: yes
+Depends: ${shlibs:Depends}
 Pre-Depends: dselect, ${shlibs:Pre-Depends}
 Conflicts: sysvinit (<< 2.82-1), dpkg-iasearch (<< 0.11), dpkg-static, dpkg-dev (<< 1.9)
 Replaces: dpkg-doc-ja, dpkg-static, manpages-de (<= 0.4-3)
@@ -29,6 +30,7 @@
 Package: dpkg-static
 Architecture: any
 Priority: optional
+Depends: ${shlibs:Depends}
 Pre-Depends: dselect, ${shlibs:Pre-Depends}
 Replaces: dpkg-doc-ja, dpkg, manpages-de (<= 0.4-3)
 Conflicts: sysvinit (<< 2.82-1), dpkg-iasearch (<< 0.11), dpkg, dpkg-dev (<< 1.9)
diff -ruN dpkg-1.10.10.org/debian/rules dpkg-1.10.10.0lib641-dep64/debian/rules
--- dpkg-1.10.10.org/debian/rules	2003-04-26 16:10:12.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/debian/rules	2003-07-24 15:49:29.000000000 -0400
@@ -175,6 +175,7 @@
 		$(TMP_DPKG)/sbin/start-stop-daemon \
 		`test -z "$(static)" && echo $(TMP_DPKG)/usr/bin/dpkg $(TMP_DPKG)/usr/bin/md5sum $(TMP_DPKG)/usr/bin/dpkg-deb`
 
+
 binary-dpkg binary-dpkg-static: %: %-most
 	$(GENCONTROL) -Tdebian/dpkg$(static).substvars -pdpkg$(static) -P$(TMP_DPKG)
 	dpkg --build $(TMP_DPKG) ..
@@ -196,7 +197,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 +205,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/include/dpkg-db.h dpkg-1.10.10.0lib641-dep64/include/dpkg-db.h
--- dpkg-1.10.10.org/include/dpkg-db.h	2002-05-06 12:18:15.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/include/dpkg-db.h	2003-07-23 15:08:54.000000000 -0400
@@ -196,7 +196,10 @@
   pdb_ignorefiles       =010  /* Ignore files info if we already have them             */
 };
 
-const char *illegal_packagename(const char *p, const char **ep);
+#define illegal_packagename(p,ep) \
+({ /* fprintf (stderr, "%s (%s:%d)\n", __FUNCTION__, __FILE__, __LINE__); */ \
+   __illegal_packagename (p, ep); })
+const char *__illegal_packagename(const char *p, const char **ep);
 int parsedb(const char *filename, enum parsedbflags, struct pkginfo **donep,
             FILE *warnto, int *warncount);
 void copy_dependency_links(struct pkginfo *pkg,
@@ -204,6 +207,9 @@
                            struct dependency *newdepends,
                            int available);
 
+/*** from hwdep.c ***/
+void assert_hw_dependency (const char *hwdep);
+
 /*** from parsehelp.c ***/
 
 struct namevalue {
diff -ruN dpkg-1.10.10.org/lib/fields.c dpkg-1.10.10.0lib641-dep64/lib/fields.c
--- dpkg-1.10.10.org/lib/fields.c	2002-08-24 15:47:47.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/lib/fields.c	2003-07-24 15:48:48.000000000 -0400
@@ -274,13 +274,14 @@
   static int depnameused= 0, versionused= 0;
   static char *depname= NULL, *version= NULL;
 
-  struct dependency *dyp, **ldypp;
+  struct dependency *dyp=NULL, **ldypp, *lldypp=NULL;
   struct deppossi *dop, **ldopp;
 
   if (!*value) return; /* empty fields are ignored */
   p= value;
   ldypp= &pifp->depends; while (*ldypp) ldypp= &(*ldypp)->next;
   for (;;) { /* loop creating new struct dependency's */
+    lldypp = ldypp;
     dyp= nfmalloc(sizeof(struct dependency));
     dyp->up= NULL; /* Set this to zero for now, as we don't know what our real
                  * struct pkginfo address (in the database) is going to be yet.
@@ -304,21 +305,33 @@
       if (!*depname)
         parseerr(NULL,filename,lno, warnto,warncount,pigp,0, _("`%s' field, missing"
                  " package name, or garbage where package name expected"), fip->name);
+      /* {...} is a hardware dependency */
+      if (*depname == '{') {
+	/* test the hardware dependency */
+	assert_hw_dependency (depname);
+	/* skip over the comma after this dependency */
+	while (isspace(*p)) p++;
+        if (*p == ',') p++; 
+	/* fall back to the previous dependency list link */
+	ldypp = lldypp;
+	(*ldypp) = NULL;
+	break;
+      }
       emsg= illegal_packagename(depname,NULL);
       if (emsg) parseerr(NULL,filename,lno, warnto,warncount,pigp,0, _("`%s' field,"
-                         " invalid package name `%.255s': %s"),
-                         fip->name,depname,emsg);
+                       " invalid package name `%.255s': %s"),
+                       fip->name,depname,emsg);
       dop= nfmalloc(sizeof(struct deppossi));
       dop->up= dyp;
       dop->ed= findpackage(depname);
       dop->next= NULL; *ldopp= dop; ldopp= &dop->next;
       dop->nextrev= NULL; /* Don't link this (which is after all only `newpig' from */
       dop->backrev= NULL; /* the main parsing loop in parsedb) into the depended on
-                        * packages' lists yet.  This will be done later when we
-                        * install this (in parse.c).  For the moment we do the
-                        * `forward' links in deppossi (`ed') only, and the backward
-                        * links from the depended on packages to dop are left undone.
-                        */
+                      * packages' lists yet.  This will be done later when we
+                      * install this (in parse.c).  For the moment we do the
+                      * `forward' links in deppossi (`ed') only, and the backward
+                      * links from the depended on packages to dop are left undone.
+                      */
       dop->cyclebreak= 0;
 /* skip whitespace after packagename */
       while (isspace(*p)) p++;
diff -ruN dpkg-1.10.10.org/lib/hwdep.c dpkg-1.10.10.0lib641-dep64/lib/hwdep.c
--- dpkg-1.10.10.org/lib/hwdep.c	1969-12-31 19:00:00.000000000 -0500
+++ dpkg-1.10.10.0lib641-dep64/lib/hwdep.c	2003-07-23 17:36:26.000000000 -0400
@@ -0,0 +1,69 @@
+#include <stdio.h>
+#include <string.h>
+#include <sys/utsname.h>
+
+static inline hw_is_64bit (const char*);
+
+void
+assert_hw_dependency (const char *hwdep)
+{
+        struct utsname utsname;
+        int rc;
+
+        rc = uname (&utsname);
+        if (rc<0) {
+                perror ("uname");
+                exit (1);
+        }
+
+        if (0 == strcmp (hwdep, "{64}")) {
+
+                if (hw_is_64bit (utsname.machine)) {
+			fprintf (stderr, "<<<<< %s supports %s >>>>>\n",
+					utsname.machine, hwdep);
+                        return;         /* all good */
+		}
+
+                fprintf (stdout, "64bit is not supported on %s\n",
+                                utsname.machine);
+
+
+        } else {
+
+                fprintf (stderr, "%s: invalid hardware dependency tag\n",
+                                hwdep);
+
+        }
+}
+
+static inline
+hw_is_64bit (const char *machine)
+{
+        static const char * valid_list[] = {
+                "x86_64", "amd64", "x86-64",
+                "sparc64",
+                "s390x",
+                NULL };
+        const char **p;
+
+        p = valid_list;
+        while (*p) {
+                if (0 == strcmp (machine, *p))
+                        return 1;
+                p++;
+        }
+
+        return 0;
+}
+
+#if 0
+int main (int argc, char *argv[])
+{
+        if (argc < 2) return 1;
+
+        assert_hw_dependency (argv[1]);
+
+        return 0;
+}
+#endif
+
diff -ruN dpkg-1.10.10.org/lib/Makefile.in dpkg-1.10.10.0lib641-dep64/lib/Makefile.in
--- dpkg-1.10.10.org/lib/Makefile.in	2002-05-24 01:16:43.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/lib/Makefile.in	2003-07-23 15:05:20.000000000 -0400
@@ -9,7 +9,7 @@
 SOURCES		= compat.c database.c dbmodify.c dump.c ehandle.c fields.c \
 		    lock.c mlib.c myopt.c nfmalloc.c parse.c parsehelp.c \
 		    showcright.c showpkg.c tarfn.c varbuf.c vercmp.c md5.c \
-		    utils.c startup.c
+		    utils.c startup.c hwdep.c
 
 OBJECTS		= $(patsubst %.c, %.o, $(SOURCES))
 GENFILES	= $(OBJECTS) libdpkg.a
diff -ruN dpkg-1.10.10.org/lib/parsehelp.c dpkg-1.10.10.0lib641-dep64/lib/parsehelp.c
--- dpkg-1.10.10.org/lib/parsehelp.c	2002-08-29 15:39:07.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/lib/parsehelp.c	2003-07-23 13:44:26.000000000 -0400
@@ -105,7 +105,7 @@
   {  NULL                           }
 };
 
-const char *illegal_packagename(const char *p, const char **ep) {
+const char *__illegal_packagename(const char *p, const char **ep) {
   static const char alsoallowed[]= "-+._"; /* _ is deprecated */
   static char buf[150];
   int c;
diff -ruN dpkg-1.10.10.org/main/packages.c dpkg-1.10.10.0lib641-dep64/main/packages.c
--- dpkg-1.10.10.org/main/packages.c	2002-05-06 12:18:15.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/main/packages.c	2003-07-24 14:11:21.000000000 -0400
@@ -350,6 +350,9 @@
     debug(dbg_depcondetail,"  checking group ...");
     matched= 0; varbufreset(&oemsgs);
     found= 0; /* 0=none, 1=defer, 2=withwarning, 3=ok */
+    /* if dep->list is NULL skip to tne next dependency entry */
+    if (dep->list == NULL)
+      continue;
     for (possi= dep->list; found != 3 && possi; possi= possi->next) {
       debug(dbg_depcondetail,"    checking possibility  -> %s",possi->ed->name);
       if (possi->cyclebreak) {
diff -ruN dpkg-1.10.10.org/scripts/controllib.pl dpkg-1.10.10.0lib641-dep64/scripts/controllib.pl
--- dpkg-1.10.10.org/scripts/controllib.pl	2002-05-24 22:46:50.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/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-dep64/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-dep64/scripts/dpkg-architecture.pl	2003-07-23 05:57:34.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',
+	    'i386',		'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-dep64/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-dep64/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-dep64/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-dep64/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-dep64/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-dep64/scripts/dpkg-libinfo.pl	2003-07-23 05:57:47.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',
+            'i386',		'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-shlibdeps.pl dpkg-1.10.10.0lib641-dep64/scripts/dpkg-shlibdeps.pl
--- dpkg-1.10.10.org/scripts/dpkg-shlibdeps.pl	2001-06-20 12:30:15.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/scripts/dpkg-shlibdeps.pl	2003-07-24 09:34:56.000000000 -0400
@@ -48,6 +48,8 @@
 
 $i=0; grep($depstrength{$_}= ++$i, @depfields);
 
+system ("echo @ARGV >> /tmp/foo");
+
 while (@ARGV) {
     $_=shift(@ARGV);
     if (m/^-T/) {
@@ -93,6 +95,17 @@
 
 for ($i=0;$i<=$#exec;$i++) {
     if (!isbin ($exec[$i])) { next; }
+
+    # test for 64bit binaries
+    defined($c= open(P,"-|")) || syserr("cannot fork for file");
+    if (!$c) { exec("file",$exec[$i]); syserr("cannot exec file"); }
+    while (<P>) {
+        if (m/:.*64-bit[^,]*executable/) {
+	    $hwdeps{"64"} = 1;
+	}
+    }
+    close(P); $? && subprocerr("ldd on \`$exec[$i]'");
+
     
     # First we get an ldd output to see what libs + paths we have at out
     # disposal.
@@ -280,6 +293,10 @@
 } else {
     $fh= 'STDOUT';
 }
+for $dh (keys %hwdeps) {
+    $defdepf{Depends}.= ', ' if length($defdepf{Depends});
+    $defdepf{Depends}.= "{$dh}";
+}
 for $dv (sort keys %predefdepfdep) {
     $lf= $predefdepfdep{$dv};
     $defdepf{$lf}.= ', ' if length($defdepf{$lf});
diff -ruN dpkg-1.10.10.org/scripts/dpkg-source.pl dpkg-1.10.10.0lib641-dep64/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-dep64/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-dep64/scripts/Makefile.in
--- dpkg-1.10.10.org/scripts/Makefile.in	2002-05-20 00:40:27.000000000 -0400
+++ dpkg-1.10.10.0lib641-dep64/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

