[OE-core] [PATCH 1/5] multilib_header.bbclass: Add oe_multilib_header wrapper

Richard Purdie richard.purdie at linuxfoundation.org
Mon Jul 25 13:47:16 UTC 2011


From: Mark Hatle <mark.hatle at windriver.com>

Signed-off-by: Mark Hatle <mark.hatle at 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

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
+  
-- 
1.7.4.1





More information about the Openembedded-core mailing list