Patchwork [1/5] multilib_header.bbclass: Add oe_multilib_header wrapper

login
register
mail settings
Submitter Richard Purdie
Date July 25, 2011, 1:47 p.m.
Message ID <bd2e16888f6520e2d02d3ff6c43b360d217572e4.1311601422.git.richard.purdie@linuxfoundation.org>
Download mbox | patch
Permalink /patch/8433/
State New, archived
Headers show

Comments

Richard Purdie - July 25, 2011, 1:47 p.m.
From: Mark Hatle <mark.hatle@windriver.com>

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 meta/classes/multilib_header.bbclass |   25 +++++++++++++++++
 scripts/multilib_header_wrapper.h    |   48 ++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100644 meta/classes/multilib_header.bbclass
 create mode 100644 scripts/multilib_header_wrapper.h
Phil Blundell - July 25, 2011, 1:54 p.m.
On Mon, 2011-07-25 at 14:47 +0100, Richard Purdie wrote:
> +/*  Copyright (c) 2005-2011 Wind River Systems, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License version 2.1 as
> + * published by the Free Software Foundation.

This is going to cause LGPL 2.1 content to appear in the output
packages.  For things like binutils this is probably not a big deal,
since they are GPL already, but for ncurses (previously MIT-licensed)
this is a potentially significant change.  In any case I think there
needs to be some way of making sure that the LICENSE is updated
appropriately when this file is included.

p.
Phil Blundell - July 25, 2011, 2:35 p.m.
On Mon, 2011-07-25 at 14:47 +0100, Richard Purdie wrote:
> +oe_multilib_header() {
> +	for each_header in "$@" ; do
> +	   if [ ! -f "${D}/${includedir}/$each_header" ]; then
> +	      bberror "oe_multilib_header: Unable to find header $each_header."
> +	      continue
> +	   fi
> +	   stem=$(echo $each_header | sed 's#\.h$##')
> +	   mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${SITEINFO_BITS}.h
> +
> +	   sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header
> +	done
> +}

I guess it would also be nice if this was conditionalized in some way so
that it only triggered if one was trying to do a multilib build (or, at
least, had a TARGET_ARCH which supported multiple different wordsizes).
I don't especially want to have all the headers on, say, arm wrapped in
wordsize conditionals since the word size is basically invariant there.

po.
Mark Hatle - July 25, 2011, 5:11 p.m.
On 7/25/11 8:54 AM, Phil Blundell wrote:
> On Mon, 2011-07-25 at 14:47 +0100, Richard Purdie wrote:
>> +/*  Copyright (c) 2005-2011 Wind River Systems, Inc.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU Lesser General Public License version 2.1 as
>> + * published by the Free Software Foundation.

I believe we're flexibly with the license statement in the file.. (Just
verifying it to make sure I am allowed to change it.)

I personally don't believe it's a big deal, but I understand the concern.  Is
there a different wording/license statement that would make more sense?  My
concern is that if we make the license dynamic it's a lot of pain for no real
technical reason.

I'd like to see if we (WR) can just put a statement on it that it can be used
for any purpose -- whatever the legalize is for that -- and if that would
satisfy your concerns.  (BTW: Our goal of course is NOT to change the license of
the produced binary in any way...)

> This is going to cause LGPL 2.1 content to appear in the output
> packages.  For things like binutils this is probably not a big deal,
> since they are GPL already, but for ncurses (previously MIT-licensed)
> this is a potentially significant change.  In any case I think there
> needs to be some way of making sure that the LICENSE is updated
> appropriately when this file is included.
> 
> p.
> 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Phil Blundell - July 25, 2011, 8:06 p.m.
On Mon, 2011-07-25 at 12:11 -0500, Mark Hatle wrote:
> On 7/25/11 8:54 AM, Phil Blundell wrote:
> > On Mon, 2011-07-25 at 14:47 +0100, Richard Purdie wrote:
> >> +/*  Copyright (c) 2005-2011 Wind River Systems, Inc.
> >> + *
> >> + * This program is free software; you can redistribute it and/or modify
> >> + * it under the terms of the GNU Lesser General Public License version 2.1 as
> >> + * published by the Free Software Foundation.
> 
> I believe we're flexibly with the license statement in the file.. (Just
> verifying it to make sure I am allowed to change it.)
> 
> I personally don't believe it's a big deal, but I understand the concern.  Is
> there a different wording/license statement that would make more sense?  My
> concern is that if we make the license dynamic it's a lot of pain for no real
> technical reason.

The metadata itself is MIT-licensed, and I believe the MIT license is
fairly uncontroversial/non-viral.  So that seems like the obvious choice
for the header as well (if we have to have it, though as I mentioned in
my mail in the other thread just now, maybe we'd be better off without
it).

> I'd like to see if we (WR) can just put a statement on it that it can be used
> for any purpose -- whatever the legalize is for that -- and if that would
> satisfy your concerns.  (BTW: Our goal of course is NOT to change the license of
> the produced binary in any way...)

Yes, I think that would be fine.  The GNU project has some boilerplate
text for disclaiming copyright and you might be able to just use that.

p.
Mark Hatle - July 26, 2011, 3:25 p.m.
On 7/25/11 12:11 PM, Mark Hatle wrote:
> On 7/25/11 8:54 AM, Phil Blundell wrote:
>> On Mon, 2011-07-25 at 14:47 +0100, Richard Purdie wrote:
>>> +/*  Copyright (c) 2005-2011 Wind River Systems, Inc.
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU Lesser General Public License version 2.1 as
>>> + * published by the Free Software Foundation.
> 
> I believe we're flexibly with the license statement in the file.. (Just
> verifying it to make sure I am allowed to change it.)
> 
> I personally don't believe it's a big deal, but I understand the concern.  Is
> there a different wording/license statement that would make more sense?  My
> concern is that if we make the license dynamic it's a lot of pain for no real
> technical reason.
> 
> I'd like to see if we (WR) can just put a statement on it that it can be used
> for any purpose -- whatever the legalize is for that -- and if that would
> satisfy your concerns.  (BTW: Our goal of course is NOT to change the license of
> the produced binary in any way...)

Looking for feedback, would the CC0:

http://creativecommons.org/publicdomain/zero/1.0/legalcode.txt

work, or would this still "contaminate" the license statement in your opinion?

--Mark

>> This is going to cause LGPL 2.1 content to appear in the output
>> packages.  For things like binutils this is probably not a big deal,
>> since they are GPL already, but for ncurses (previously MIT-licensed)
>> this is a potentially significant change.  In any case I think there
>> needs to be some way of making sure that the LICENSE is updated
>> appropriately when this file is included.
>>
>> p.
>>
>>
>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/multilib_header.bbclass b/meta/classes/multilib_header.bbclass
new file mode 100644
index 0000000..fedf247
--- /dev/null
+++ b/meta/classes/multilib_header.bbclass
@@ -0,0 +1,25 @@ 
+inherit siteinfo
+
+export SITEINFO_BITS
+
+#
+# This routine will allow someone to specify a list of headers that need to be
+# wrapped in a way that the bitsize of the target will be used to determine
+# which header to use.
+#
+# TODO: mips64 n32 is not yet recognized in this code
+# The check should be if the arch is mips64 and the bitsize is 32.
+# then the siteinfo_bits should be set to "n32".
+#
+oe_multilib_header() {
+	for each_header in "$@" ; do
+	   if [ ! -f "${D}/${includedir}/$each_header" ]; then
+	      bberror "oe_multilib_header: Unable to find header $each_header."
+	      continue
+	   fi
+	   stem=$(echo $each_header | sed 's#\.h$##')
+	   mv ${D}/${includedir}/$each_header ${D}/${includedir}/${stem}-${SITEINFO_BITS}.h
+
+	   sed -e "s#ENTER_HEADER_FILENAME_HERE#${stem}#g" ${COREBASE}/scripts/multilib_header_wrapper.h > ${D}/${includedir}/$each_header
+	done
+}
diff --git a/scripts/multilib_header_wrapper.h b/scripts/multilib_header_wrapper.h
new file mode 100644
index 0000000..8d9a3c4
--- /dev/null
+++ b/scripts/multilib_header_wrapper.h
@@ -0,0 +1,48 @@ 
+/*  Copyright (c) 2005-2011 Wind River Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <bits/wordsize.h>
+
+#ifdef __WORDSIZE
+
+#if __WORDSIZE == 32
+
+#ifdef _MIPS_SIM
+
+#if _MIPS_SIM == _ABIO32
+#include <ENTER_HEADER_FILENAME_HERE-32.h>
+#elif _MIPS_SIM == _ABIN32
+#include <ENTER_HEADER_FILENAME_HERE-n32.h>
+#else
+#error "Unknown _MIPS_SIM"
+#endif
+
+#else /* _MIPS_SIM is not defined */
+#include <ENTER_HEADER_FILENAME_HERE-32.h>
+#endif
+
+#elif __WORDSIZE == 64
+#include <ENTER_HEADER_FILENAME_HERE-64.h>
+#else
+#error "Unknown __WORDSIZE detected"
+#endif /* matches #if __WORDSIZE == 32 */
+
+#else /* __WORDSIZE is not defined */
+
+#error "__WORDSIZE is not defined"
+
+#endif
+