[oe-commits] [openembedded-core] 02/04: newlib: Adds newlib and libgloss recipes

git at git.openembedded.org git at git.openembedded.org
Fri Jun 15 07:55:45 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit fe490ff829440b94124317759d856e2e2daf5047
Author: Alejandro Enedino Hernandez Samaniego <alejandr at xilinx.com>
AuthorDate: Mon Mar 26 17:20:25 2018 -0700

    newlib: Adds newlib and libgloss recipes
    
    Newlib is a C library that is intended to be used on embedded systems.
    It is a conglomeration of several library parts, all under free software
    licenses that make them easily usable on embedded products.
    
    Newlib provides a C library alternative that can run on baremetal, mainly
    for resource constrained devices.
    
    Libgloss is the BSP part of the C library, which can be easily modified
    to port for new hardware platforms.
    
    Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr at xilinx.com>
---
 .../newlib/libgloss/fix-rs6000-crt0.patch          | 41 +++++++++++++++
 .../libgloss/fix_makefile_include_arm_h.patch      | 30 +++++++++++
 meta/recipes-core/newlib/libgloss_3.0.0.bb         | 32 ++++++++++++
 meta/recipes-core/newlib/newlib.inc                | 58 ++++++++++++++++++++++
 meta/recipes-core/newlib/newlib_3.0.0.bb           | 16 ++++++
 meta/recipes-devtools/gcc/gcc-cross.inc            |  1 +
 6 files changed, 178 insertions(+)

diff --git a/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch b/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch
new file mode 100644
index 0000000..c220fb8
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch
@@ -0,0 +1,41 @@
+Upstream-Status: Inappropriate  [OE-Specific]
+
+Make install tries to perform install for all variants, but some of them use the same
+name for crt0 in specific, so performing all of them results in an error during
+do_install, we simply modify the name of the objects so the installation can proceed
+and leave it to the user to select which object files to use.
+
+Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr at xilinx.com>
+
+Index: newlib-3.0.0/libgloss/rs6000/Makefile.in
+===================================================================
+--- newlib-3.0.0.orig/libgloss/rs6000/Makefile.in
++++ newlib-3.0.0/libgloss/rs6000/Makefile.in
+@@ -358,7 +358,7 @@ install-sim:
+ 	set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+ 
+ install-mvme:
+-	set -e; for x in ${MVME_CRT0} ${MVME_BSP} ${MVME_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
++	set -e; for x in ${MVME_CRT0} ${MVME_BSP} ${MVME_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/mvme-$$x; done
+ 
+ install-solaris:
+ 	set -e; for x in ${SOLARIS_CRT0} ${SOLARIS_BSP} ${SOLARIS_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+@@ -367,15 +367,15 @@ install-linux:
+ 	set -e; for x in ${LINUX_CRT0} ${LINUX_BSP} ${LINUX_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+ 
+ install-yellowknife:
+-	set -e; for x in ${YELLOWKNIFE_CRT0} ${YELLOWKNIFE_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
++	set -e; for x in ${YELLOWKNIFE_CRT0} ${YELLOWKNIFE_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/yellowknife-$$x; done
+ 	set -e; for x in ${YELLOWKNIFE_SCRIPTS}; do ${INSTALL_DATA} $(srcdir)/$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+ 
+ install-ads:
+-	set -e; for x in ${ADS_CRT0} ${ADS_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
++	set -e; for x in ${ADS_CRT0} ${ADS_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/ads-$$x; done
+ 	set -e; for x in ${ADS_SCRIPTS}; do ${INSTALL_DATA} $(srcdir)/$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+ 
+ install-mbx:
+-	set -e; for x in ${MBX_CRT0} ${MBX_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
++	set -e; for x in ${MBX_CRT0} ${MBX_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/mbx-$$x; done
+ 	set -e; for x in ${MBX_SCRIPTS} ${MBX_SPECS}; do ${INSTALL_DATA} $(srcdir)/$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+ 
+ install-xil:
diff --git a/meta/recipes-core/newlib/libgloss/fix_makefile_include_arm_h.patch b/meta/recipes-core/newlib/libgloss/fix_makefile_include_arm_h.patch
new file mode 100644
index 0000000..7645be7
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss/fix_makefile_include_arm_h.patch
@@ -0,0 +1,30 @@
+Upstream-Status: Inappropriate  [OE-Specific]
+
+When trying to build libgloss for an arm target, the build system
+complains about missing some include files:
+
+| fatal error: acle-compiat.h: No such file or directory
+|  #include "acle-compat.h"
+|           ^~~~~~~~~~~~~~~
+| compilation terminated.
+
+These include files come from the newlib source, but since we
+are building libgloss separately from newlib, libgloss is unaware
+of where they are, this patch fixes the INCLUDES so the build system
+can find such files.
+
+Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr at xilinx.com>
+
+Index: newlib-3.0.0/libgloss/config/default.mh
+===================================================================
+--- newlib-3.0.0.orig/libgloss/config/default.mh
++++ newlib-3.0.0/libgloss/config/default.mh
+@@ -1,7 +1,7 @@
+ NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
+ NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
+ 
+-INCLUDES = -I. -I$(srcdir)/..
++INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../newlib/libc/machine/arm
+ # Note that when building the library, ${MULTILIB} is not the way multilib
+ # options are passed; they're passed in $(CFLAGS).
+ CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
diff --git a/meta/recipes-core/newlib/libgloss_3.0.0.bb b/meta/recipes-core/newlib/libgloss_3.0.0.bb
new file mode 100644
index 0000000..664a922
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss_3.0.0.bb
@@ -0,0 +1,32 @@
+require newlib.inc
+
+DEPENDS += "newlib"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/libgloss:"
+
+SRC_URI_append_powerpc = " file://fix-rs6000-crt0.patch"
+SRC_URI_append_arm = " file://fix_makefile_include_arm_h.patch"
+
+do_configure() {
+	${S}/libgloss/configure ${EXTRA_OECONF}
+}
+
+do_install_prepend() {
+	# install doesn't create this itself, avoid install error
+	install -d ${D}${prefix}/${TARGET_SYS}/lib
+}
+
+do_install_append() {
+	# Move libs to default directories so they can be picked up later
+	mv -v ${D}${prefix}/${TARGET_SYS}/lib ${D}${libdir}
+
+	# Remove original directory
+	rmdir ${D}${prefix}/${TARGET_SYS}
+}
+
+# Split packages correctly
+FILES_${PN} += "${libdir}/*.ld ${libdir}/*.specs"
+FILES_${PN}-dev += "${libdir}/cpu-init/*"
+
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta/recipes-core/newlib/newlib.inc b/meta/recipes-core/newlib/newlib.inc
new file mode 100644
index 0000000..c97c7c2
--- /dev/null
+++ b/meta/recipes-core/newlib/newlib.inc
@@ -0,0 +1,58 @@
+SUMMARY = "Newlib is a C library intended for use on embedded systems"
+HOMEPAGE = "https://sourceware.org/newlib/"
+DESCRIPTION = "C library intended for use on embedded systems. It is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products."
+SECTION = "libs"
+
+LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2"
+LIC_FILES_CHKSUM = " \
+		file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+		file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+		file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+		file://COPYING.LIBGLOSS;md5=73f5c98779aea7dba4a6c94a74ab0ae2 \
+		file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
+		file://COPYING.NEWLIB;md5=956a4b1487f7677cdcceeee8f05a21f0 \
+		file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \
+		file://newlib/libc/sys/linux/linuxthreads/LICENSE;md5=73640207fbc79b198c7ffd4ad4d97aa0 \
+		"
+
+SRC_URI = "ftp://sourceware.org/pub/newlib/newlib-${PV}.tar.gz"
+SRC_URI[md5sum] = "81ec873108b8593c586f91ca65963952"
+SRC_URI[sha256sum] = "c8566335ee74e5fcaeb8595b4ebd0400c4b043d6acb3263ecb1314f8f5501332"
+
+INHIBIT_DEFAULT_DEPS = "1"
+DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial"
+
+PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
+STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
+STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
+
+S = "${WORKDIR}/newlib-${PV}"
+B = "${WORKDIR}/build"
+
+## disable stdlib
+TARGET_CC_ARCH_append = " -nostdlib"
+
+EXTRA_OECONF = " \
+                --build=${BUILD_SYS}  \
+                --target=${TARGET_SYS} \
+		--host=${HOST_SYS} \
+                --prefix=${prefix}  \
+                --exec-prefix=${exec_prefix} \
+                --bindir=${bindir} \
+                --libdir=${libdir} \
+                --includedir=${includedir} \
+		--enable-languages=c \
+		--with-newlib \
+		--with-gnu-as \
+		--with-gnu-ld \
+		--disable-multilib \
+		"
+
+do_configure[cleandirs] = "${B}"
+
+do_install() {
+	oe_runmake install DESTDIR='${D}'
+}
+
+COMPATIBLE_HOST_libc-musl_class-target = "null"
+COMPATIBLE_HOST_libc-glibc_class-target = "null"
diff --git a/meta/recipes-core/newlib/newlib_3.0.0.bb b/meta/recipes-core/newlib/newlib_3.0.0.bb
new file mode 100644
index 0000000..3380576
--- /dev/null
+++ b/meta/recipes-core/newlib/newlib_3.0.0.bb
@@ -0,0 +1,16 @@
+require newlib.inc
+
+PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc virtual/libiconv virtual/libintl"
+
+do_configure() {
+	${S}/configure ${EXTRA_OECONF}
+}
+
+do_install_append() {
+	# Move include files and libs to default directories so they can be picked up later
+	mv -v ${D}${prefix}/${TARGET_SYS}/lib ${D}${libdir}
+	mv -v ${D}${prefix}/${TARGET_SYS}/include ${D}${includedir}
+
+	# Remove original directory
+	rmdir ${D}${prefix}/${TARGET_SYS}
+}
diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc
index 1e184a6..95f5968 100644
--- a/meta/recipes-devtools/gcc/gcc-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross.inc
@@ -35,6 +35,7 @@ EXTRA_OECONF += "\
 DEPENDS_remove_libc-baremetal := "virtual/${TARGET_PREFIX}libc-for-gcc"
 EXTRA_OECONF_append_libc-baremetal = " --without-headers"
 EXTRA_OECONF_remove_libc-baremetal = "--enable-threads=posix"
+EXTRA_OECONF_remove_libc-newlib = "--enable-threads=posix"
 
 EXTRA_OECONF_PATHS = "\
     --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list