Santiago Vila wrote:
> On Tue, 13 Nov 2007, Neil Williams wrote:
> 
>> dialog needs a simple patch to support cross-building by detecting
>> the cross environment in debian/rules and passing --build and 
>> --host to ./configure.
>>
>> This occurs because the cross building tools have been rewritten to
>> support CC_FOR_BUILD for packages that compile internal build tools 
>> and therefore the tools no longer explicitly override the MAKEFLAGS.
>>
>> Thanks.
>>
>>
>> *** crossbuild.diff
>> --- dialog-1.1-20071028/debian/rules 
>> +++ dialog.new/debian/rules 
>> @@ -24,6 +24,15 @@
>>  INSTALL_SCRIPT = install
>>  STRIP = true
>>  
>> +DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
>> +DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
>> +ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
>> +CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
>> +CC=$(DEB_HOST_GNU_TYPE)-gcc
>> +else
>> +CROSS= --build $(DEB_BUILD_GNU_TYPE)
>> +endif
>> +
> 
> Seems a little bit longer than required.
> 
> Would it work if both --build and --host are always used and only CC
> is redefined ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) ?

No. That would cause the native build to have --host defined which means
that even native builds would look for a cross compiler.

See the autotools-dev README.Debian - --build is needed for both, --host
must only be specified when cross building.

If you want to remove the need for the redefinition of CC, remove the CC
setting from the call to configure, it is completely redundant and
actually quite obstructive.

build:
        CC="$(CC)" CFLAGS="$(CFLAGS)" ./configure --prefix=/usr \
                --enable-nls --with-ncursesw $(CROSS)

build:
        CFLAGS="$(CFLAGS)" ./configure --prefix=/usr \
                --enable-nls --with-ncursesw $(CROSS)


I only added the definition of CC because your layout of debian/rules
requires it and I wanted to keep the patch to purely cross building issues.

Please see
http://lists.debian.org/debian-devel/2007/11/msg00116.html
and
/usr/share/doc/autotools-dev/README.Debian.gz

If you want a smaller patch, fix the ./configure call at the same time:

-CC=gcc
 CFLAGS = -g -Wall
 INSTALL_PROGRAM = install
 INSTALL_SCRIPT = install
 STRIP = true

+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+else
+CROSS= --build $(DEB_BUILD_GNU_TYPE)
+endif
+
 ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
   CFLAGS += -O2
 endif
@@ -33,8 +41,8 @@
 endif

 build:
-       CC="$(CC)" CFLAGS="$(CFLAGS)" ./configure --prefix=/usr \
-               --enable-nls --with-ncursesw
+       CFLAGS="$(CFLAGS)" ./configure --prefix=/usr \
+               --enable-nls --with-ncursesw $(CROSS)
        $(MAKE)
        touch build

If you remove the CC prefix to ./configure, also remove the CC=gcc
setting higher in debian/rules as it has no effect.

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to