Bug#250225: grub build patch for amd64

Robert Millan Robert Millan <rmh@debian.org>, 250225@bugs.debian.org
Fri, 1 Oct 2004 21:35:47 +0200


tags 250225 - patch
thanks

On Thu, Sep 30, 2004 at 10:44:31PM +0200, Frederik Schueler wrote:
> 
> Hi Robert,
> 
> good news: gcc-3.4 can build 32bit binaries using ia32-libs-dev on
> amd64, see attached patch. 

Hi!

Thanks Andreas and Frederik, this is great news.  However, both patches are
wrong since they break the architecture generation logic in debian/control.in.

Please could you send a fixed patch?  Since the patch has no effect on release
arches and -8 is already in testing I'd set "urgency=high".  So if you send it
soon it can make it into sarge.

See my comments below:

> diff -ruN grub-0.95+cvs20040624.orig/debian/control grub-0.95+cvs20040624/debian/control
> --- grub-0.95+cvs20040624.orig/debian/control	2004-09-30 22:13:24.791494720 +0200
> +++ grub-0.95+cvs20040624/debian/control	2004-09-30 22:12:25.192283242 +0200

debian/control is auto-generated and changes to it don't need to be included.

> diff -ruN grub-0.95+cvs20040624.orig/debian/control.in grub-0.95+cvs20040624/debian/control.in
> --- grub-0.95+cvs20040624.orig/debian/control.in	2004-09-30 22:13:24.796493899 +0200
> +++ grub-0.95+cvs20040624/debian/control.in	2004-09-30 22:12:39.149990841 +0200
> @@ -3,12 +3,12 @@
>  Priority: optional
>  Maintainer: Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>
>  Uploaders: Jason Thomas <jason@debian.org>, Robert Millan <rmh@debian.org>
> -Build-Depends: debhelper (>= 4.0.0), automake1.8, autoconf, texinfo, libncurses5-dev | libncurses-dev, type-handling (>= 0.2.0)
> +Build-Depends: debhelper (>= 4.0.0), automake1.8, autoconf, texinfo, libncurses5-dev | libncurses-dev, type-handling (>= 0.2.0), ia32-libs-dev [amd64], gcc-3.4 [amd64]

For dpkg, "amd64" implies Linux, but your changes are not Linux-specific.
This should be generated dynamicaly like we do for all arches using i386 cpu.
(the magic for this is in type-handling invocations in debian/rules)

What we want here is:  ia32-libs-dev [@x86_64@], gcc-3.4 [@x86_64@]

Then debian/rules has to be set to replace it with `type-handling x86_64 any`.

>  Package: grub
> -Architecture: @i386@
> +Architecture: amd64 @i386@

Here, something like "@arches@" so we can parse both in the same run, like
this:

  `type-handling i386,x86_64 any`

> diff -ruN grub-0.95+cvs20040624.orig/debian/grub-floppy grub-0.95+cvs20040624/debian/grub-floppy
> --- grub-0.95+cvs20040624.orig/debian/grub-floppy	2004-09-30 22:13:24.916474193 +0200
> +++ grub-0.95+cvs20040624/debian/grub-floppy	2004-09-30 21:54:23.579926313 +0200
> @@ -19,7 +19,8 @@
>  
>  # Initialize some variables.
>  dd=`which dd`
> -pkglibdir=/lib/grub/i386-pc
> +pkglibdir=$( [ -d /lib/grub/i386-pc ] && echo /lib/grub/i386-pc || \
> +             [ -d /lib/grub/x64_64-pc ] && echo /lib/grub/x86_64-pc )
>  stage1=$pkglibdir/stage1
>  stage2=$pkglibdir/stage2

How about "[ -d /lib/grub/*-* ] && echo /lib/grub/*-*" ?
 
> diff -ruN grub-0.95+cvs20040624.orig/debian/rules grub-0.95+cvs20040624/debian/rules
> --- grub-0.95+cvs20040624.orig/debian/rules	2004-09-30 22:13:24.796493899 +0200
> +++ grub-0.95+cvs20040624/debian/rules	2004-09-30 21:59:49.143456043 +0200
> @@ -48,6 +48,13 @@
>  filesystems=e2fs ffs ufs2
>  endif
>  
> +ifeq (amd64,$(shell dpkg-architecture -qDEB_BUILD_ARCH))
> +	LDFLAGS=-static
> +	CC=gcc-3.4
> +else
> +	CC=gcc-3.3
> +endif
> +

Again, DEB_BUILD_ARCH values imply Linux and can't be used to check for the
CPU portably.  Please use DEB_HOST_GNU_CPU instead.  I would appreciate if you
followed this advice for other packages too, since using the wrong checks
introduces lots of FTBFS bugs that affect kernel ports (like kfreebsd-gnu).

The rest of the patch seems fine.  Please fix these minor issues and I'll
commit/upload.

Thanks!

-- 
 .''`.   Proudly running Debian GNU/kFreeBSD unstable/unreleased (on UFS2+S)
: :' :
`. `'    http://www.debian.org/ports/kfreebsd-gnu
  `-