]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
tclibc-newlib: Adds a new TCLIBC variant to build with newlib as C library
authorAlejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
Fri, 27 Apr 2018 20:21:20 +0000 (13:21 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 15 Jun 2018 07:54:19 +0000 (08:54 +0100)
This patch adds the posibility to build using TCLIBC=newlib.

It allows users to build baremetal applications with the use of a
C library.

Newlib is a lightweight C library meant to be used on embedded systems,
it is meant to be easily portable for new platforms and to provide
basic functionality on them, by design, it provides stubs for some of
these core functions declared as weak, so they can be built correctly
and then linked against some other library which provides specifics
about the platform being used if need be, libgloss takes care of these
in some cases, but it can also be extended, this patch also allows the
user to easily add other libraries to it by adding them to
NEWLIB_EXTENDED for this specific reason.

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
meta/classes/cross-canadian.bbclass
meta/conf/distro/include/tclibc-newlib.inc [new file with mode: 0644]
meta/recipes-core/newlib/newlib_3.0.0.bb
meta/recipes-devtools/gcc/libgcc-common.inc

index ee8aa6142a3295d22fd5142126b636213800c0ce..acde331ef924b4b0c9b7d9ecdb7b828799e23cd7 100644 (file)
@@ -30,7 +30,7 @@ python () {
     if d.getVar("MODIFYTOS") != "1":
         return
 
-    if d.getVar("TCLIBC") == "baremetal":
+    if d.getVar("TCLIBC") in [ 'baremetal', 'newlib' ]:
         return
 
     tos = d.getVar("TARGET_OS")
diff --git a/meta/conf/distro/include/tclibc-newlib.inc b/meta/conf/distro/include/tclibc-newlib.inc
new file mode 100644 (file)
index 0000000..dc631d8
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Newlib configuration
+#
+
+LIBCEXTENSION = "-newlib"
+LIBCOVERRIDE = ":libc-newlib"
+
+PREFERRED_PROVIDER_virtual/libc ?= "newlib"
+PREFERRED_PROVIDER_virtual/libiconv ?= "newlib"
+PREFERRED_PROVIDER_virtual/libintl ?= "newlib"
+PREFERRED_PROVIDER_virtual/nativesdk-libintl ?= "nativesdk-glibc"
+PREFERRED_PROVIDER_virtual/nativesdk-libiconv ?= "nativesdk-glibc"
+
+DISTRO_FEATURES_BACKFILL_CONSIDERED += "ldconfig"
+
+#USE_NLS ?= "no"
+
+IMAGE_LINGUAS = ""
+
+LIBC_DEPENDENCIES = "\
+    newlib-dbg \
+    newlib-dev \
+    libgloss \
+    libgloss-dev \
+    libgloss-dbg \
+    libgcc-dev \
+    libgcc-dbg \
+    "
+
+# compilerlibs defaults to gcc-runtime, but we get runtime from libgloss
+# we set ASSUME_PROVIDED because we cant set PREFERRED_PROVIDER
+# for compilerlibs since its overridden by tcmode-default
+ASSUME_PROVIDED += "virtual/${TARGET_PREFIX}compilerlibs virtual/crypt"
+
+# Its useful to be able to extend newlib, but we dont provide a native variant of libgloss
+NEWLIB_EXTENDED ?=  "libgloss libgcc"
+BASE_DEFAULT_DEPS_append_class-target = " ${NEWLIB_EXTENDED}"
+
+TARGET_OS = "elf"
+TARGET_OS_arm = "eabi"
+
+TOOLCHAIN_HOST_TASK ?= "packagegroup-cross-canadian-${MACHINE}"
+TOOLCHAIN_TARGET_TASK ?= "${LIBC_DEPENDENCIES}"
+TOOLCHAIN_NEED_CONFIGSITE_CACHE_remove = "zlib ncurses"
index 3380576b830f566480665ac4b3f92f6e0fce1713..09238fe006b1f267f822739b13fc0544505b1c43 100644 (file)
@@ -14,3 +14,6 @@ do_install_append() {
        # Remove original directory
        rmdir ${D}${prefix}/${TARGET_SYS}
 }
+
+# No rpm package is actually created but -dev depends on it, avoid dnf error
+RDEPENDS_${PN}-dev_libc-newlib = ""
index 848a476207b19c50cbe146dc3b3533ccc904eed4..d959566c3f00ea89375483cc60959d2f78352671 100644 (file)
@@ -47,8 +47,13 @@ do_install () {
 do_install_append_libc-baremetal () {
        rmdir ${D}${base_libdir}
 }
+do_install_append_libc-newlib () {
+       rmdir ${D}${base_libdir}
+}
 
+# No rpm package is actually created but -dev depends on it, avoid dnf error
 RDEPENDS_${PN}-dev_libc-baremetal = ""
+RDEPENDS_${PN}-dev_libc-newlib = ""
 
 BBCLASSEXTEND = "nativesdk"