diff mbox

CRDA and cross-compilation

Message ID 4A7A8F7E.6020503@redfish-solutions.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Philip Prindeville Aug. 6, 2009, 8:08 a.m. UTC
Who currently owns CRDA?

I started to stare at cross-compiling issues, but realized that we need
two versions of reglib.o and print-regdom.o...

One to link with regdumpdb (compiled with HOSTCC) and one to link with
everything else (compiled with TARGET_CC)...

No easy way to do this without a lot of changes.

Here's what I have so far.

Comments

Jon Loeliger Aug. 6, 2009, 2:46 p.m. UTC | #1
On Thu, 2009-08-06 at 01:08 -0700, Philip A. Prindeville wrote:
> Who currently owns CRDA?
> 
> I started to stare at cross-compiling issues, but realized that we need
> two versions of reglib.o and print-regdom.o...
> 
> One to link with regdumpdb (compiled with HOSTCC) and one to link with
> everything else (compiled with TARGET_CC)...
> 
> No easy way to do this without a lot of changes.

I posted a 5-part patch series to address this issue.
To the best of my knowledge, it has not been applied yet.

You can find it here:

http://article.gmane.org/gmane.linux.kernel.wireless.general/35350

HTH,
jdl


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
John W. Linville Aug. 6, 2009, 3:09 p.m. UTC | #2
On Thu, Aug 06, 2009 at 01:08:30AM -0700, Philip A. Prindeville wrote:
> Who currently owns CRDA?

Luis Rodriguez <mcgrof@gmail.com>
Luis R. Rodriguez <lrodriguez@atheros.com>
Pavel Roskin Aug. 6, 2009, 4:41 p.m. UTC | #3
On Thu, 2009-08-06 at 09:46 -0500, Jon Loeliger wrote:
> On Thu, 2009-08-06 at 01:08 -0700, Philip A. Prindeville wrote:
> > Who currently owns CRDA?
> > 
> > I started to stare at cross-compiling issues, but realized that we need
> > two versions of reglib.o and print-regdom.o...
> > 
> > One to link with regdumpdb (compiled with HOSTCC) and one to link with
> > everything else (compiled with TARGET_CC)...
> > 
> > No easy way to do this without a lot of changes.
> 
> I posted a 5-part patch series to address this issue.
> To the best of my knowledge, it has not been applied yet.
> 
> You can find it here:
> 
> http://article.gmane.org/gmane.linux.kernel.wireless.general/35350

I objected against using the misleading use of the "TARGET" work in some
variables, but there was no reaction.  Failure to react to objections is
the likely reason it wasn't applied.

I also think that you add too much complexity to the Makefile.

Also, the use of .config is not common.  Most valuables can be specified
on the command line.  That would override the definitions in Makefile,
and that's how it's done.

For instance, you can have this in Makefile:

HOSTCC = gcc
CC = $(HOSTCC)

Running "make CC=/opt/mips/bin/gcc" would override CC but not HOSTCC.
Luis Rodriguez Aug. 6, 2009, 4:56 p.m. UTC | #4
On Thu, Aug 6, 2009 at 9:41 AM, Pavel Roskin<proski@gnu.org> wrote:
> On Thu, 2009-08-06 at 09:46 -0500, Jon Loeliger wrote:
>> On Thu, 2009-08-06 at 01:08 -0700, Philip A. Prindeville wrote:
>> > Who currently owns CRDA?
>> >
>> > I started to stare at cross-compiling issues, but realized that we need
>> > two versions of reglib.o and print-regdom.o...
>> >
>> > One to link with regdumpdb (compiled with HOSTCC) and one to link with
>> > everything else (compiled with TARGET_CC)...
>> >
>> > No easy way to do this without a lot of changes.
>>
>> I posted a 5-part patch series to address this issue.
>> To the best of my knowledge, it has not been applied yet.
>>
>> You can find it here:
>>
>> http://article.gmane.org/gmane.linux.kernel.wireless.general/35350
>
> I objected against using the misleading use of the "TARGET" work in some
> variables, but there was no reaction.  Failure to react to objections is
> the likely reason it wasn't applied.

Indeed.

> I also think that you add too much complexity to the Makefile.

Agreed.

> Also, the use of .config is not common.  Most valuables can be specified
> on the command line.  That would override the definitions in Makefile,
> and that's how it's done.

Yeah for something so simple as CRDA it seems overkill to have a .config.

> For instance, you can have this in Makefile:
>
> HOSTCC = gcc
> CC = $(HOSTCC)
>
> Running "make CC=/opt/mips/bin/gcc" would override CC but not HOSTCC.

ACK, is it possible to make it simpler?

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Philip Prindeville Aug. 6, 2009, 5:38 p.m. UTC | #5
Luis R. Rodriguez wrote:
> On Thu, Aug 6, 2009 at 9:41 AM, Pavel Roskin<proski@gnu.org> wrote:
>> On Thu, 2009-08-06 at 09:46 -0500, Jon Loeliger wrote:
>>> On Thu, 2009-08-06 at 01:08 -0700, Philip A. Prindeville wrote:
>>>> Who currently owns CRDA?
>>>>
>>>> I started to stare at cross-compiling issues, but realized that we need
>>>> two versions of reglib.o and print-regdom.o...
>>>>
>>>> One to link with regdumpdb (compiled with HOSTCC) and one to link with
>>>> everything else (compiled with TARGET_CC)...
>>>>
>>>> No easy way to do this without a lot of changes.
>>> I posted a 5-part patch series to address this issue.
>>> To the best of my knowledge, it has not been applied yet.
>>>
>>> You can find it here:
>>>
>>> http://article.gmane.org/gmane.linux.kernel.wireless.general/35350
>> I objected against using the misleading use of the "TARGET" work in some
>> variables, but there was no reaction.  Failure to react to objections is
>> the likely reason it wasn't applied.
> 
> Indeed.
> 
>> I also think that you add too much complexity to the Makefile.
> 
> Agreed.
> 
>> Also, the use of .config is not common.  Most valuables can be specified
>> on the command line.  That would override the definitions in Makefile,
>> and that's how it's done.
> 
> Yeah for something so simple as CRDA it seems overkill to have a .config.
> 
>> For instance, you can have this in Makefile:
>>
>> HOSTCC = gcc
>> CC = $(HOSTCC)
>>
>> Running "make CC=/opt/mips/bin/gcc" would override CC but not HOSTCC.
> 
> ACK, is it possible to make it simpler?
> 
>   Luis

You could also have:

-include .config

HOSTCC ?= gcc
...

and that will only set (default) the unset variables...

-Philip

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- crda-1.1.0/Makefile.orig	2009-04-17 14:49:45.000000000 -0700
+++ crda-1.1.0/Makefile	2009-08-06 00:53:47.000000000 -0700
@@ -1,6 +1,6 @@ 
 # Modify as you see fit, note this is built into crda,
 # so if you change it here you will have to change crda.c
-REG_BIN?=/usr/lib/crda/regulatory.bin
+REG_BIN?=$(DESTDIR)/usr/lib/crda/regulatory.bin
 REG_GIT?=git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git
 
 PREFIX ?= /usr/
@@ -22,46 +22,74 @@  UDEV_RULE_DIR?=/lib/udev/rules.d/
 # with make PUBKEY_DIR=/usr/lib/crda/pubkeys
 PUBKEY_DIR?=pubkeys
 
+MKDIR ?= mkdir -p
+INSTALL ?= install
+
 CFLAGS += -Wall -g
 
 all: $(REG_BIN) crda intersect verify
 
-ifeq ($(USE_OPENSSL),1)
+ifeq ($(CROSS_COMPILE),)
+
+ ifeq ($(USE_OPENSSL),1)
 CFLAGS += -DUSE_OPENSSL `pkg-config --cflags openssl`
 LDLIBS += `pkg-config --libs openssl`
 
 reglib.o: keys-ssl.c
 
-else
+ else
 CFLAGS += -DUSE_GCRYPT
 LDLIBS += -lgcrypt
 
 reglib.o: keys-gcrypt.c
 
-endif
-MKDIR ?= mkdir -p
-INSTALL ?= install
+ endif
 
 NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y)
 NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y)
 
-ifeq ($(NL1FOUND),Y)
+ ifeq ($(NL1FOUND),Y)
 NLLIBNAME = libnl-1
-endif
+ endif
 
-ifeq ($(NL2FOUND),Y)
+ ifeq ($(NL2FOUND),Y)
 CFLAGS += -DCONFIG_LIBNL20
 NLLIBS += -lnl-genl
 NLLIBNAME = libnl-2.0
-endif
+ endif
 
-ifeq ($(NLLIBNAME),)
+ ifeq ($(NLLIBNAME),)
 $(error Cannot find development files for any supported version of libnl)
-endif
+ endif
 
 NLLIBS += `pkg-config --libs $(NLLIBNAME)`
 CFLAGS += `pkg-config --cflags $(NLLIBNAME)`
 
+else
+
+ ifeq ($(USE_OPENSSL),1)
+CFLAGS += -DUSE_OPENSSL
+LDLIBS += -lssl
+
+reglib.o: keys-ssl.c
+
+ else
+CFLAGS += -DUSE_GCRYPT
+LDLIBS += -lgcrypt
+
+reglib.o: keys-gcrypt.c
+
+ endif
+
+ ifeq ($(USE_LIBNL20),1)
+CFLAGS += DCONFIG_LIBNL20
+NLLIBS = -lnl-genl -lnl-2.0
+ else
+NLLIBS = -lnl
+ endif
+
+endif
+
 ifeq ($(V),1)
 Q=
 NQ=@true
@@ -111,6 +139,10 @@  verify: $(REG_BIN) regdbdump
 	@$(NQ) ' GZIP' $<
 	$(Q)gzip < $< > $@
 
+install-reg:
+	git clone $(REG_GIT) wireless-regdb
+	$(INSTALL) -m 0444 -D wireless-regdb/regulatory.bin $(REG_BIN)
+
 install: crda crda.8.gz regdbdump.8.gz
 	$(NQ) '  INSTALL  crda'
 	$(Q)$(MKDIR) $(DESTDIR)/$(SBINDIR)