Re: How to detect 32 or 64 bit at build time?

2009-09-10 Thread Felipe Sateler
Laurent Guignard wrote:

 On Tue, 08 Sep 2009 00:05:55 -0400, Felipe Sateler wrote:
 Sven Joachim wrote:
 
  On 2009-09-07 12:54 +0200, Sven Joachim wrote:
  
  How about DEB_HOST_ARCH_BITS?  This needs dpkg 1.15.4, though.
  
  Sorry, that should have been DEB_BUILD_ARCH_BITS.
 
 As Neil would have pointed out if he were still subscribed to -mentors,
 DEB_BUILD_* is almost always the wrong choice, otherwise it will
 cross-build incorrectly.
 
 --
 Felipe Sateler
 
 
 Is there any documentation about this ?
 Why is it a wrong choice when you want to create a package from sources
 for a specific architecture ?

Because you want the package to build for the architecture you plan to run 
it in. Cross compilation means compiling in one architecture for another. A 
common case is using an amd64 machine to build arm binaries, because amd64 
is so much faster. If you use DEB_BUILD_*, you would are detecting on the 
amd64 host, instead of the arm you really want, which you would get with 
DEB_HOST_*.

In this case, if you look for DEB_BUILD_*, and the package was being cross-
compiled from amd64 to i386, it would get ARB_64=1 instead of ARB_64=0.


-- 
Felipe Sateler


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to detect 32 or 64 bit at build time?

2009-09-08 Thread Mike Hommey
On Tue, Sep 08, 2009 at 12:05:55AM -0400, Felipe Sateler wrote:
 Sven Joachim wrote:
 
  On 2009-09-07 12:54 +0200, Sven Joachim wrote:
  
  How about DEB_HOST_ARCH_BITS?  This needs dpkg 1.15.4, though.
  
  Sorry, that should have been DEB_BUILD_ARCH_BITS.
 
 As Neil would have pointed out if he were still subscribed to -mentors, 
 DEB_BUILD_* is almost always the wrong choice, otherwise it will cross-build 
 incorrectly.

Note it's always a pain that dpkg-architecture and autoconf use the same
word for an opposite meaning.

autoconf dpkg-architecture
host DEB_BUILD_
target   DEB_HOST_

Mike


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to detect 32 or 64 bit at build time?

2009-09-08 Thread Jakub Wilk

* Mike Hommey m...@glandium.org, 2009-09-08, 08:47:

Note it's always a pain that dpkg-architecture and autoconf use the same
word for an opposite meaning.

autoconf dpkg-architecture
host DEB_BUILD_
target   DEB_HOST_


Wrong, they don't.

autoconf-build == DEB_BUILD_* (the machine the package is built *on*).

autoconf-host == DEB_HOST_* (the machine the package is built *for*).

autoconf-target should be irrelevant as long as you don't (cross-)compile 
compilers.



Sources:
* dpkg-architecture(1);
* /usr/share/doc/autoconf-doc/autoconf.html, 14.1 Specifying target triplets.

--
Jakub Wilk


--
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to detect 32 or 64 bit at build time?

2009-09-08 Thread Boyd Stephen Smith Jr.
In 20090908085536.gb3...@jwilk.net, Jakub Wilk wrote:
autoconf-build == DEB_BUILD_* (the machine the package is built *on*).

autoconf-host == DEB_HOST_* (the machine the package is built *for*).

autoconf-target should be irrelevant as long as you don't (cross-)compile
compilers.

Even then it shouldn't matter unless you are cross-compiling a cross-compiler.  
Normally a compiler will output executables for its host [the system it was 
built for; the system it is running on] but if it needs to output executables 
for a different system, you can specify the target [the system it's output 
is built for].
-- 
Boyd Stephen Smith Jr.   ,= ,-_-. =.
b...@iguanasuicide.net   ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/\_/



signature.asc
Description: This is a digitally signed message part.


Re: How to detect 32 or 64 bit at build time?

2009-09-08 Thread Laurent Guignard
On Tue, 08 Sep 2009 00:05:55 -0400, Felipe Sateler wrote:
 Sven Joachim wrote:
 
  On 2009-09-07 12:54 +0200, Sven Joachim wrote:
  
  How about DEB_HOST_ARCH_BITS?  This needs dpkg 1.15.4, though.
  
  Sorry, that should have been DEB_BUILD_ARCH_BITS.
 
 As Neil would have pointed out if he were still subscribed to -mentors, 
 DEB_BUILD_* is almost always the wrong choice, otherwise it will cross-build 
 incorrectly.
 
 -- 
 Felipe Sateler
 

Is there any documentation about this ?
Why is it a wrong choice when you want to create a package from sources for a 
specific architecture ?

Regards,
Laurent

-- 
Laurent Guignard, Registered as user #301590 with the Linux Counter
Site : http://www.famille-guignard.org
Blog : http://blog.famille-guignard.org
Projet : http://sicontact.sourceforge.net
GULL de Villefranche sur Saône : http://www.cagull.org


signature.asc
Description: Digital signature


Re: How to detect 32 or 64 bit at build time?

2009-09-07 Thread David Paleino
On Mon, 7 Sep 2009 12:32:27 +0200, Andreas Tille wrote:

 Hi,

Hello Andreas :)

 the new version of arb I want to package requires to set a variable
 
ARB_64=0/11=compile 64 bit version
 
 to specify whether it will be compiled on 32 or 64 bit architecture.  Is
 there any safe way to set this variable automatically from environment?
 I expected dpkg-architecture to provide this information but it does not.
 
 Am I missing something?

Doesn't dpkg-architecture do this?

$ dpkg-architecture | grep BITS
DEB_BUILD_ARCH_BITS=32
DEB_HOST_ARCH_BITS=32

(and I'm on i386). 

$ apt-cache policy dpkg | grep \*
 *** 1.15.4 0

Kindly,
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 | http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174


signature.asc
Description: PGP signature


Re: How to detect 32 or 64 bit at build time?

2009-09-07 Thread Sven Joachim
On 2009-09-07 12:32 +0200, Andreas Tille wrote:

 Hi,

 the new version of arb I want to package requires to set a variable

ARB_64=0/11=compile 64 bit version

 to specify whether it will be compiled on 32 or 64 bit architecture.  Is
 there any safe way to set this variable automatically from environment?
 I expected dpkg-architecture to provide this information but it does not.

 Am I missing something?

How about DEB_HOST_ARCH_BITS?  This needs dpkg 1.15.4, though.

Sven


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to detect 32 or 64 bit at build time?

2009-09-07 Thread Sven Joachim
On 2009-09-07 12:54 +0200, Sven Joachim wrote:

 How about DEB_HOST_ARCH_BITS?  This needs dpkg 1.15.4, though.

Sorry, that should have been DEB_BUILD_ARCH_BITS.

Sven


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to detect 32 or 64 bit at build time?

2009-09-07 Thread Andreas Tille
On Mon, Sep 07, 2009 at 10:50:54AM +, Bart Martens wrote:
 I guess that you're looking for:
 
dpkg --print-architecture

No.  The result is equivalent to

   dpkg-architecture | grep -w DEB_BUILD_ARCH

I'm locking for something that responds with 0 for 32 bit architectures
and 1 for 64 bit architectures.  With the suggestion above I would have
to implement a case statement for all existing architectures and would
have to keep this up to date.

Kind regards

Andreas.

-- 
http://fam-tille.de
Klarmachen zum Ändern!


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to detect 32 or 64 bit at build time?

2009-09-07 Thread Andreas Tille
On Mon, Sep 07, 2009 at 12:58:59PM +0200, Sven Joachim wrote:
  How about DEB_HOST_ARCH_BITS?  This needs dpkg 1.15.4, though.
 
 Sorry, that should have been DEB_BUILD_ARCH_BITS.

Cool, the version in unstable is the key.

Thanks for the hint

Andreas.

-- 
http://fam-tille.de
Klarmachen zum Ändern!


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to detect 32 or 64 bit at build time?

2009-09-07 Thread Steffen Moeller
Andreas Tille wrote:
 On Mon, Sep 07, 2009 at 12:58:59PM +0200, Sven Joachim wrote:
 How about DEB_HOST_ARCH_BITS?  This needs dpkg 1.15.4, though.
 Sorry, that should have been DEB_BUILD_ARCH_BITS.
 
 Cool, the version in unstable is the key.

This is nice, indeed.

$ dpkg-architecture -qDEB_BUILD_ARCH_BITS
64

but karmic does not know about this yet, which would be a no for the grid 
packages at least.

What we have in debian/rules of the Globus packages is

DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)

ifneq (,$(filter $(DEB_HOST_ARCH_CPU), amd64 alpha ia64 s390x ppc64 sparc64))
flavor = gcc64pthr
enable64 = yes
else
flavor = gcc32pthr
enable64 = no
endif

One could obviously combine the two approaches ...

Steffen


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to detect 32 or 64 bit at build time?

2009-09-07 Thread Felipe Sateler
Sven Joachim wrote:

 On 2009-09-07 12:54 +0200, Sven Joachim wrote:
 
 How about DEB_HOST_ARCH_BITS?  This needs dpkg 1.15.4, though.
 
 Sorry, that should have been DEB_BUILD_ARCH_BITS.

As Neil would have pointed out if he were still subscribed to -mentors, 
DEB_BUILD_* is almost always the wrong choice, otherwise it will cross-build 
incorrectly.

-- 
Felipe Sateler


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: How to detect 32 or 64 bit at build time?

2009-09-07 Thread Sven Joachim
On 2009-09-08 06:05 +0200, Felipe Sateler wrote:

 Sven Joachim wrote:

 On 2009-09-07 12:54 +0200, Sven Joachim wrote:
 
 How about DEB_HOST_ARCH_BITS?  This needs dpkg 1.15.4, though.
 
 Sorry, that should have been DEB_BUILD_ARCH_BITS.

 As Neil would have pointed out if he were still subscribed to -mentors, 
 DEB_BUILD_* is almost always the wrong choice, otherwise it will cross-build 
 incorrectly.

Thanks for correcting me, I always mix build and host up. :-/

While we're at it, it is dpkg-dev (=1.15.4) that you need to
build-depend upon for this feature, rather than dpkg:

,
| (zsh) % dpkg -S =dpkg-architecture 
| dpkg-dev: /usr/bin/dpkg-architecture
`

Sven


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org