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

Re: Debian for SuperH bootstrapping



Hi,

At Sun, 30 Dec 2001 07:21:25 +0900,
YAEGASHI Takeshi wrote:

> We need to update packaging tools such as dpkg and dpkg-cross.  For
> dpkg it works for me with following patch.  (NIIBE said he had another
> patch for main/enquiry.c)

Here is the updated patch including NIIBE's.  It is against the CVS
dpkg (v1_9 branch).

It seems there are chages to adapt to the cross package building
environment with dpkg-cross - it might need some explaination for this
patch to be adopted.

BTW, which Debian mailing list is appropriate for the discussion on
cross package building with dpkg-cross?


Index: archtable
===================================================================
RCS file: /cvs/dpkg/dpkg/archtable,v
retrieving revision 1.18.2.1
diff -u -r1.18.2.1 archtable
--- archtable	2001/05/13 21:50:59	1.18.2.1
+++ archtable	2001/12/30 11:45:21
@@ -35,13 +35,10 @@
 i386-gnu0.2		hurd-i386	undefined
 ia64-linux-gnu		ia64		ia64
 ia64-unknown-linux	ia64		ia64
-sh-linux-gnu		sh		sh
-sheb-linux-gnu		sheb		sheb
-shel-linux-gnu		sh		sh
-sh3-linux-gnu		sh		sh
-sh4-linux-gnu		sh		sh
-sh3eb-linux-gnu		sheb		sheb
-sh4eb-linux-gnu		sheb		sheb
+sh3-linux-gnu		sh3		sh3
+sh4-linux-gnu		sh4		sh4
+sh3eb-linux-gnu		sh3eb		sh3eb
+sh4eb-linux-gnu		sh4eb		sh4eb
 hppa-linux-gnu		hppa		hppa
 hppa1.1-linux-gnu	hppa		hppa
 hppa2.0-linux-gnu	hppa		hppa
Index: main/enquiry.c
===================================================================
RCS file: /cvs/dpkg/dpkg/main/enquiry.c,v
retrieving revision 1.43
diff -u -r1.43 enquiry.c
--- main/enquiry.c	2001/04/24 00:42:33	1.43
+++ main/enquiry.c	2001/12/30 11:45:22
@@ -682,36 +682,41 @@
 
   ccompiler= getenv("CC");
   if (!ccompiler) ccompiler= "gcc";
-  varbufinit(&vb);
-  m_pipe(p1);
-  ccpipe= fdopen(p1[0],"r"); if (!ccpipe) ohshite(_("failed to fdopen CC pipe"));
-  if (!(c1= m_fork())) {
-    m_dup2(p1[1],1); close(p1[0]); close(p1[1]);
-    execlp(ccompiler,ccompiler,"--print-libgcc-file-name",(char*)0);
-    /* if we have a problem excuting the C compiler, we don't
-     * want to fail. If there is a problem with the compiler,
-     * like not being installed, or CC being set incorrectly,
-     * then important problems will show up elsewhere, not in
-     * dpkg. If a C compiler is not important to the reason we
-     * are being called, then we should just give them the built
-     * in arch.
-     */
-    if (printf("/usr/lib/gcc-lib/%s-none/0.0.0/libgcc.a\n",architecture) == EOF)
-      werr("stdout");
-    if (fflush(stdout)) werr("stdout");
-    exit(0);
+  if (!strncmp(ccompiler, "gcc", 3)) {
+    varbufinit(&vb);
+    m_pipe(p1);
+    ccpipe= fdopen(p1[0],"r"); if (!ccpipe) ohshite(_("failed to fdopen CC pipe"));
+    if (!(c1= m_fork())) {
+      m_dup2(p1[1],1); close(p1[0]); close(p1[1]);
+      execlp(ccompiler,ccompiler,"--print-libgcc-file-name",(char*)0);
+      /* if we have a problem excuting the C compiler, we don't
+       * want to fail. If there is a problem with the compiler,
+       * like not being installed, or CC being set incorrectly,
+       * then important problems will show up elsewhere, not in
+       * dpkg. If a C compiler is not important to the reason we
+       * are being called, then we should just give them the built
+       * in arch.
+       */
+      if (printf("/usr/lib/gcc-lib/%s-none/0.0.0/libgcc.a\n",architecture) == EOF)
+	werr("stdout");
+      if (fflush(stdout)) werr("stdout");
+      exit(0);
+    }
+    close(p1[1]);
+    fd_vbuf_copy(fileno(ccpipe), &vb, -1, _("error reading from CC pipe"));
+    waitsubproc(c1,"gcc --print-libgcc-file-name",0);
+    if (!vb.used) badlgccfn(ccompiler,"",_("empty output"));
+    varbufaddc(&vb,0);
+    if (vb.buf[vb.used-2] != '\n') badlgccfn(ccompiler,vb.buf,_("no newline"));
+    vb.used-= 2; varbufaddc(&vb,0);
+    p= strstr(vb.buf,"/gcc-lib/");
+    if (!p) badlgccfn(ccompiler,vb.buf,_("no gcc-lib component"));
+    p+= 9;
+    q= strchr(p,'/'); if (!q) badlgccfn(ccompiler,vb.buf,_("no slash after gcc-lib"));
+  } else {
+    p= ccompiler;
+    q= strrchr(p, '-');
   }
-  close(p1[1]);
-  fd_vbuf_copy(fileno(ccpipe), &vb, -1, _("error reading from CC pipe"));
-  waitsubproc(c1,"gcc --print-libgcc-file-name",0);
-  if (!vb.used) badlgccfn(ccompiler,"",_("empty output"));
-  varbufaddc(&vb,0);
-  if (vb.buf[vb.used-2] != '\n') badlgccfn(ccompiler,vb.buf,_("no newline"));
-  vb.used-= 2; varbufaddc(&vb,0);
-  p= strstr(vb.buf,"/gcc-lib/");
-  if (!p) badlgccfn(ccompiler,vb.buf,_("no gcc-lib component"));
-  p+= 9;
-  q= strchr(p,'/'); if (!q) badlgccfn(ccompiler,vb.buf,_("no slash after gcc-lib"));
   ll= q-p;
   for (archp=archtable;
        archp->from && strncmp(archp->from,p,ll);
Index: scripts/dpkg-architecture.pl
===================================================================
RCS file: /cvs/dpkg/dpkg/scripts/dpkg-architecture.pl,v
retrieving revision 1.19.2.3
diff -u -r1.19.2.3 dpkg-architecture.pl
--- scripts/dpkg-architecture.pl	2001/06/20 00:39:27	1.19.2.3
+++ scripts/dpkg-architecture.pl	2001/12/30 11:45:23
@@ -56,8 +56,10 @@
             'powerpc',   'powerpc-linux',
 	    'mips',      'mips-linux',
 	    'mipsel',    'mipsel-linux',
-	    'sh',        'sh-linux',
-	    'sheb',      'sheb-linux',
+	    'sh3',       'sh3-linux',
+	    'sh3eb',     'sh3eb-linux',
+	    'sh4',       'sh4-linux',
+	    'sh4eb',     'sh4eb-linux',
 	    'hppa',      'hppa-linux',
 	    'hurd-i386', 'i386-gnu',
 	    's390',	 's390-linux',
@@ -94,7 +96,6 @@
 
 	s/(?:i386|i486|i586|i686|pentium)(.*linux)/i386$1/;
 	s/ppc/powerpc/;
-	s/sh[34]/sh/;
 	return $_;
 }
 
@@ -125,17 +126,21 @@
 $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 = '';
+if ($ENV{'CC'} =~ m/^(.*)-gcc$/) {
+    $gcc = $1;
 } else {
-    $gcc =~ s!^.*gcc-lib/([^/]*)/(?:egcs-)?\d+(?:[.\da-z]*)/libgcc.*$!$1!s;
-    if (defined $1 and $1 ne '') {
-	$gcc = $1;
-    } else {
+    $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 = '';
+	}
     }
 }

-- 
YAEGASHI Takeshi <t@keshi.org> <takeshi@yaegashi.jp> <yaegashi@dodes.org>



Reply to: