Skip to contentSkip to conversation

toolchain-linaro: move license code to handler due to elt_get_*_version() scope

PATCH New Denys Dmytriyenko 1 participant 4 messages Feb 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 toolchain-linaro: move license code to handler due to elt_get_*_version() scope

Since elt_get_*_version() functions are only available when building with Linaro toolchain, invoking them to set licenses inside the recipe breaks parsing when other toolchains are used. Mimic setting version variables in a handler and set license variables similarly.

---
 .../conf/distro/include/toolchain-linaro.inc       | 37 ++++++++++++++++++++++
 .../meta/external-linaro-toolchain.bbappend        | 28 +++++-----------
 2 files changed, 45 insertions(+), 20 deletions(-)
meta-arago-distro/conf/distro/include/toolchain-linaro.inc +37 -0
index 65b7beb..c1a57f7 100644
@@ -59,3 +59,40 @@ PREFERRED_VERSION_linux-libc-headers ?= "${LINUXLIBCVERSION}"
 PREFERRED_VERSION_glibc ?= "${GLIBCVERSION}"
 PREFERRED_VERSION_glibc-locale ?= "${GLIBCVERSION}"
 PREFERRED_VERSION_glibc-initial ?= "${GLIBCINITVERSION}"
+
+# Licenses set for main components of the toolchain:
+# (g)libc is always LGPL version 2 (or later)
+# gcc has switched from GPL version 2 (or later) to version 3 (or later) after 4.2.1,
+#    see this announcement - http://gcc.gnu.org/ml/gcc-announce/2007/msg00003.html
+# libgcc and libstdc++ always had exceptions to GPL called Runtime Library Exception, but
+#    it was based on GPL version 2 (or later), until new GPL version 3 (or later) exception
+#    was introduced on 27 Jan 2009 - http://gcc.gnu.org/ml/gcc-announce/2009/msg00000.html
+#    and http://www.gnu.org/licenses/gcc-exception.html, which was several days after
+#    gcc 4.3.3 was released - http://gcc.gnu.org/releases.html
+# gdb/gdbserver version 6.6 was the last one under GPL version 2 (or later), according
+#    to the release schedule - http://www.gnu.org/software/gdb/schedule/
+# binutils version 2.17 was the last one under GPL version 2 (or later), according
+#    to the published releases - http://ftp.gnu.org/gnu/binutils/
+
+python external_linaro_toolchain_license_handler () {
+	if not isinstance(e, bb.event.ConfigParsed):
+		return
+	d = e.data
+	ld = d.createCopy()
+	ld.finalize()
+
+	lc_libc = "LGPL-2.1"
+	lc_gcc = ["GPL-3.0", "GPL-2.0"][elt_get_gcc_version(ld) <= "4.2.1"]
+	lc_rle = ["GPL-3.0-with-GCC-exception", "GPL-2.0-with-GCC-exception"][elt_get_gcc_version(ld) <= "4.3.3"]
+	lc_gdb = ["GPL-3.0", "GPL-2.0"][elt_get_gdb_version(ld) <= "6.6"]
+#	lc_bfd = ["GPL-3.0", "GPL-2.0"][elt_get_bfd_version(ld) <= "2.17"]
+
+	d.setVar('ELT_LIC_LIBC', lc_libc)
+	d.setVar('ELT_LIC_GCC', lc_gcc)
+	d.setVar('ELT_LIC_RLE', lc_rle)
+	d.setVar('ELT_LIC_GDB', lc_gdb)
+#	d.setVar('ELT_LIC_BFD', lc_bfd)
+
+	d.setVar('ELT_LICENSE', "%s&%s&%s&%s" % (lc_libc, lc_gcc, lc_rle, lc_gdb))
+}
+addhandler external_linaro_toolchain_license_handler
meta-arago-extras/recipes-core/meta/external-linaro-toolchain.bbappend +8 -20
index aefa99e..5f42413 100644
@@ -103,26 +103,14 @@ FILES_libgomp-dev += "\
 	${libdir}/gcc/${ELT_TARGET_SYS} \
 "
 
-# Licenses set for main components of the toolchain:
-# (g)libc is always LGPL version 2 (or later)
-# gcc has switched from GPL version 2 (or later) to version 3 (or later) after 4.2.1,
-#    see this announcement - http://gcc.gnu.org/ml/gcc-announce/2007/msg00003.html
-# libgcc and libstdc++ always had exceptions to GPL called Runtime Library Exception, but
-#    it was based on GPL version 2 (or later), until new GPL version 3 (or later) exception
-#    was introduced on 27 Jan 2009 - http://gcc.gnu.org/ml/gcc-announce/2009/msg00000.html
-#    and http://www.gnu.org/licenses/gcc-exception.html, which was several days after
-#    gcc 4.3.3 was released - http://gcc.gnu.org/releases.html
-# gdb/gdbserver version 6.6 was the last one under GPL version 2 (or later), according
-#    to the release schedule - http://www.gnu.org/software/gdb/schedule/
-# binutils version 2.17 was the last one under GPL version 2 (or later), according
-#    to the published releases - http://ftp.gnu.org/gnu/binutils/
-ELT_LIC_LIBC := "LGPL-2.1"
-ELT_LIC_GCC := "${@["GPL-3", "GPL-2"][elt_get_gcc_version(d) <= "4.2.1"]}"
-ELT_LIC_RLE := "${@["GPL-3-with-GCC-exception", "GPL-2-with-GCC-exception"][elt_get_gcc_version(d) <= "4.3.3"]}"
-ELT_LIC_GDB := "${@["GPL-3", "GPL-2"][elt_get_gdb_version(d) <= "6.6"]}"
-#ELT_LIC_BFD := "${@["GPL-3", "GPL-2"][elt_get_bfd_version(d) <= "2.17"]}"
-
-LICENSE = "${ELT_LIC_LIBC}&${ELT_LIC_GCC}&${ELT_LIC_RLE}&${ELT_LIC_GDB}"
+ELT_LIC_LIBC ?= ""
+ELT_LIC_GCC ?= ""
+ELT_LIC_RLE ?= ""
+ELT_LIC_GDB ?= ""
+ELT_LIC_BFD ?= ""
+ELT_LICENSE ?= "MIT"
+
+LICENSE = "${ELT_LICENSE}"
 LICENSE_ldd = "${ELT_LIC_LIBC}"
 LICENSE_glibc = "${ELT_LIC_LIBC}"
 LICENSE_glibc-thread-db = "${ELT_LIC_LIBC}"
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/4 external-linaro-toolchain: only make supporting symlinks when ELT_TARGET_SYS != TARGET_SYS

E.g. when Linaro uses "arm-linux-gnueabihf", while OE expects "arm-linux-gnueabi" instead. The links are there to allow OE-built compiler to re-use Linaro-provided runtime. When their TARGET_SYS matches, there's no need for the links.

---
 .../recipes-core/meta/external-linaro-toolchain.bbappend          | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta-arago-extras/recipes-core/meta/external-linaro-toolchain.bbappend +6 -2
index 5f42413..31f5ba0 100644
@@ -141,12 +141,16 @@ do_install_append() {
 	install -d ${D}/include
 	install -d ${D}${includedir}
 	cp -a ${TOOLCHAIN_PATH}/${ELT_TARGET_SYS}/include/* ${D}${includedir}
-	ln -sf ${ELT_TARGET_SYS} ${D}${includedir}/c++/${ELT_VER_GCC}/${TARGET_SYS}
+	if [ ${ELT_TARGET_SYS} != ${TARGET_SYS} ]; then
+		ln -sf ${ELT_TARGET_SYS} ${D}${includedir}/c++/${ELT_VER_GCC}/${TARGET_SYS}
+	fi
 	ln -sf ../usr/include/c++ ${D}/include/c++
 
 	install -d ${D}${libdir}/gcc/${TARGET_SYS}/${ELT_VER_GCC}/include
 	cp -a ${TOOLCHAIN_PATH}/${base_libdir}/gcc/${ELT_TARGET_SYS}/${ELT_VER_GCC}/include/omp.h ${D}${libdir}/gcc/${TARGET_SYS}/${ELT_VER_GCC}/include
-	ln -sf ${TARGET_SYS} ${D}${libdir}/gcc/${ELT_TARGET_SYS}
+	if [ ${ELT_TARGET_SYS} != ${TARGET_SYS} ]; then
+		ln -sf ${TARGET_SYS} ${D}${libdir}/gcc/${ELT_TARGET_SYS}
+	fi
 
 	${@base_conditional('PREFERRED_PROVIDER_linux-libc-headers', 'external-linaro-toolchain', '', 'rm -rf ${D}${includedir}/asm*; rm -rf ${D}${includedir}/drm; rm -rf ${D}${includedir}/linux; rm -rf ${D}${includedir}/mtd; rm -rf ${D}${includedir}/rdma; rm -rf ${D}${includedir}/sound; rm -rf ${D}${includedir}/video', d)}
 	${@base_conditional('PREFERRED_PROVIDER_linux-libc-headers', 'external-linaro-toolchain', '', 'rm -rf ${D}${includedir}/uapi/.install; rm -rf ${D}${includedir}/misc/.install; rm -rf ${D}${includedir}/misc/cxl.h; rm -rf ${D}${includedir}/scsi/.install; rm -rf ${D}${includedir}/scsi/scsi_netlink*; rm -rf ${D}${includedir}/scsi/scsi_bsg*; rm -rf ${D}${includedir}/scsi/cxlflash_ioctl.h; rm -rf ${D}${includedir}/scsi/fc; rm -rf ${D}${includedir}/xen', d)}
Signature · 1 line
2.7.4
#2 lore raw

PATCH 3/4 toolchain-linaro: set proper ELT_TARGET_SYS for different architectures

In reply to Denys Dmytriyenko
---
 meta-arago-distro/conf/distro/include/toolchain-linaro.inc | 2 ++
 1 file changed, 2 insertions(+)
meta-arago-distro/conf/distro/include/toolchain-linaro.inc +2 -0
index c1a57f7..20a6517 100644
@@ -3,6 +3,8 @@ TCMODE = "external-linaro"
 TCLIBC = "external-linaro-toolchain"
 
 ELT_TARGET_SYS = "arm-linux-gnueabihf"
+ELT_TARGET_SYS_armv5 = "arm-linux-gnueabi"
+ELT_TARGET_SYS_aarch64 = "aarch64-linux-gnu"
 TARGET_VENDOR = ""
 
 PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-intermediate = "external-linaro-toolchain"
Signature · 1 line
2.7.4
#3 lore raw

PATCH 4/4 arago.conf: make "linaro" default sane toolchain option

In reply to Denys Dmytriyenko

Since old gcc-4.5 based Arago toolchain has been deprecated for some time now.

---
 meta-arago-distro/conf/distro/arago.conf | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta-arago-distro/conf/distro/arago.conf +1 -4
index b434509..3fb48ab 100644
@@ -104,12 +104,9 @@ ARAGO_SYSTEST_ENABLE ?= "0"
 ARAGO_KERNEL_SUFFIX_append = "${@base_conditional("ARAGO_SYSTEST_ENABLE", "1", "-systest", "", d)}"
 IMAGE_FSTYPES_remove = "${@['','ubi'][d.getVar('ARAGO_SYSTEST_ENABLE', True) == '1']}"
 
-# ARM9 is not supported by the Linaro toolchain so default back to the Arago
-# toolchain for ARM9 based SOCs.
-TC_SANE_DEFAULT := "${@bb.utils.contains('SOC_FAMILY','omapl138','arago','linaro',d)}"
-
 # Toolchain should be selected by setting TOOLCHAIN_BRAND in local.conf
 # Set some sane defaults, in case someone forgets to set them in local.conf
+TC_SANE_DEFAULT ?= "linaro"
 TOOLCHAIN_TYPE ?= "external"
 TOOLCHAIN_BRAND ?= "${@[d.getVar('TC_SANE_DEFAULT', True),'gcc'][d.getVar('TOOLCHAIN_TYPE', True) == 'internal']}"
 
Signature · 1 line
2.7.4