Hello,

I have changed the script somewhat. It now tries to guess the default target
gnu os from gcc, and warns if there is some inconsistency.

Also, existing environment is honoured unless -f (force) flag is given.

I was able to build a Debian package with modified versions of
dpkg-buildpackage, dpkg-gencontrol and controllib.pl and my script (and
dpkg-cross): 

dpkg-buildpackage -B -rfakeroot

  produced i386 package.

dpkg-buildpackage -B -rfakeroot -ahurd-i386

  produced hurd package.

CC=i386-gnu-gcc dpkg-buildpackage -B -rfakeroot

  produced hurd (!) package.

Please look at the script in my master home dir (marcus), and also try to
take a look at the diff's, which are very small, therefore I append them
here. The diff's below are the only changes needed to dpkg-dev!

I would like to make this happen really soon now (I won't rush it though).

Thanks,
Marcus

--- /usr/lib/dpkg/controllib.pl Sun Nov  1 18:50:46 1998
+++ controllib.pl       Mon Jan 11 19:32:08 1999
@@ -62,9 +62,13 @@
 }
 
 sub findarch {
-    $arch=`dpkg --print-architecture`;
-    $? && &subprocerr("dpkg --print-architecture");
-    $arch =~ s/\n$//;
+    if (exists $ENV{DEB_TARGET_ARCH}) {
+       $arch=$ENV{DEB_TARGET_ARCH};
+    } else {
+       $arch=`dpkg --print-architecture`;
+       $? && &subprocerr("dpkg --print-architecture");
+       chomp $arch;
+    }
     $substvar{'Arch'}= $arch;
 }

--- /usr/bin/dpkg-buildpackage.orig     Sun Nov  1 18:50:45 1998
+++ dpkg-buildpackage   Mon Jan 11 18:40:30 1999
@@ -73,6 +73,7 @@
        -sa)    sourcestyle=-sa ;;
        -sd)    sourcestyle=-sd ;;
        -tc)    cleansource=true ;;
+       -t*)    targetgnusystem="$value" ;;          # Order DOES matter!
        -nc)    noclean=true; binaryonly=-b ;;
        -b)     binaryonly=-b ;;
        -B)     binaryonly=-B; binarytarget=binary-arch ;;
@@ -109,7 +110,9 @@
 mustsetvar version "`dpkg-parsechangelog | sed -n 's/^Version: //p'`" "source 
version"
 if [ -n "$maint" ]; then maintainer="$maint"; 
 else mustsetvar maintainer "`dpkg-parsechangelog | sed -n 's/^Maintainer: 
//p'`" "source maintainer"; fi
+command -v dpkg-architecture > /dev/null 2>&1 && eval `dpkg-architecture 
-a${arch} -t${targetgnusystem} -s`
 test "${opt_a}" \
+       || arch=${DEB_TARGET_ARCH} && test "${arch}" \
        || mustsetvar arch "`dpkg --print-architecture`" "build architecture"
 
 sversion=`echo "$version" | perl -pe 's/^\d+://'`

--- /usr/bin/dpkg-gencontrol    Sun Nov  1 18:50:44 1998
+++ dpkg-gencontrol     Mon Jan 11 19:12:02 1999
@@ -88,10 +88,14 @@
 }
 
 $arch = $override{Architecture} or do {
+    if (exists $ENV{DEB_TARGET_ARCH}) {
+       $arch=$ENV{DEB_TARGET_ARCH};
+    } else {
        $arch=`dpkg --print-architecture`;
        $? && &subprocerr("dpkg --print-architecture");
+    }
 };
-$arch =~ s/\n$//;
+chomp $arch;
 
 &parsechangelog;
 &parsecontrolfile;
 


-- 
"Rhubarb is no Egyptian god."        Debian GNU/Linux        finger brinkmd@ 
Marcus Brinkmann                   http://www.debian.org    master.debian.org
[EMAIL PROTECTED]                        for public  PGP Key
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       PGP Key ID 36E7CD09

Reply via email to