summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/newlib
diff options
context:
space:
mode:
authorAlejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>2018-03-26 17:20:25 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-06-15 17:56:24 +0100
commitae5e33ddc48802af6288deacfee59bf5bf4b5223 (patch)
tree1c001161ac140e49c91a1d28d4e8618651ae9e44 /meta/recipes-core/newlib
parentb6dbfabbadc3f980e8176f30f8cdf5cdb0775e3c (diff)
downloadpoky-ae5e33ddc48802af6288deacfee59bf5bf4b5223.tar.gz
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. (From OE-Core rev: fe490ff829440b94124317759d856e2e2daf5047) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/newlib')
-rw-r--r--meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch41
-rw-r--r--meta/recipes-core/newlib/libgloss/fix_makefile_include_arm_h.patch30
-rw-r--r--meta/recipes-core/newlib/libgloss_3.0.0.bb32
-rw-r--r--meta/recipes-core/newlib/newlib.inc58
-rw-r--r--meta/recipes-core/newlib/newlib_3.0.0.bb16
5 files changed, 177 insertions, 0 deletions
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 0000000000..c220fb8437
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch
@@ -0,0 +1,41 @@
1Upstream-Status: Inappropriate [OE-Specific]
2
3Make install tries to perform install for all variants, but some of them use the same
4name for crt0 in specific, so performing all of them results in an error during
5do_install, we simply modify the name of the objects so the installation can proceed
6and leave it to the user to select which object files to use.
7
8Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
9
10Index: newlib-3.0.0/libgloss/rs6000/Makefile.in
11===================================================================
12--- newlib-3.0.0.orig/libgloss/rs6000/Makefile.in
13+++ newlib-3.0.0/libgloss/rs6000/Makefile.in
14@@ -358,7 +358,7 @@ install-sim:
15 set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
16
17 install-mvme:
18- set -e; for x in ${MVME_CRT0} ${MVME_BSP} ${MVME_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
19+ set -e; for x in ${MVME_CRT0} ${MVME_BSP} ${MVME_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/mvme-$$x; done
20
21 install-solaris:
22 set -e; for x in ${SOLARIS_CRT0} ${SOLARIS_BSP} ${SOLARIS_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
23@@ -367,15 +367,15 @@ install-linux:
24 set -e; for x in ${LINUX_CRT0} ${LINUX_BSP} ${LINUX_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
25
26 install-yellowknife:
27- set -e; for x in ${YELLOWKNIFE_CRT0} ${YELLOWKNIFE_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
28+ set -e; for x in ${YELLOWKNIFE_CRT0} ${YELLOWKNIFE_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/yellowknife-$$x; done
29 set -e; for x in ${YELLOWKNIFE_SCRIPTS}; do ${INSTALL_DATA} $(srcdir)/$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
30
31 install-ads:
32- set -e; for x in ${ADS_CRT0} ${ADS_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
33+ set -e; for x in ${ADS_CRT0} ${ADS_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/ads-$$x; done
34 set -e; for x in ${ADS_SCRIPTS}; do ${INSTALL_DATA} $(srcdir)/$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
35
36 install-mbx:
37- set -e; for x in ${MBX_CRT0} ${MBX_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
38+ set -e; for x in ${MBX_CRT0} ${MBX_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/mbx-$$x; done
39 set -e; for x in ${MBX_SCRIPTS} ${MBX_SPECS}; do ${INSTALL_DATA} $(srcdir)/$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
40
41 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 0000000000..7645be7314
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss/fix_makefile_include_arm_h.patch
@@ -0,0 +1,30 @@
1Upstream-Status: Inappropriate [OE-Specific]
2
3When trying to build libgloss for an arm target, the build system
4complains about missing some include files:
5
6| fatal error: acle-compiat.h: No such file or directory
7| #include "acle-compat.h"
8| ^~~~~~~~~~~~~~~
9| compilation terminated.
10
11These include files come from the newlib source, but since we
12are building libgloss separately from newlib, libgloss is unaware
13of where they are, this patch fixes the INCLUDES so the build system
14can find such files.
15
16Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
17
18Index: newlib-3.0.0/libgloss/config/default.mh
19===================================================================
20--- newlib-3.0.0.orig/libgloss/config/default.mh
21+++ newlib-3.0.0/libgloss/config/default.mh
22@@ -1,7 +1,7 @@
23 NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
24 NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
25
26-INCLUDES = -I. -I$(srcdir)/..
27+INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../newlib/libc/machine/arm
28 # Note that when building the library, ${MULTILIB} is not the way multilib
29 # options are passed; they're passed in $(CFLAGS).
30 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 0000000000..664a922815
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss_3.0.0.bb
@@ -0,0 +1,32 @@
1require newlib.inc
2
3DEPENDS += "newlib"
4
5FILESEXTRAPATHS_prepend := "${THISDIR}/libgloss:"
6
7SRC_URI_append_powerpc = " file://fix-rs6000-crt0.patch"
8SRC_URI_append_arm = " file://fix_makefile_include_arm_h.patch"
9
10do_configure() {
11 ${S}/libgloss/configure ${EXTRA_OECONF}
12}
13
14do_install_prepend() {
15 # install doesn't create this itself, avoid install error
16 install -d ${D}${prefix}/${TARGET_SYS}/lib
17}
18
19do_install_append() {
20 # Move libs to default directories so they can be picked up later
21 mv -v ${D}${prefix}/${TARGET_SYS}/lib ${D}${libdir}
22
23 # Remove original directory
24 rmdir ${D}${prefix}/${TARGET_SYS}
25}
26
27# Split packages correctly
28FILES_${PN} += "${libdir}/*.ld ${libdir}/*.specs"
29FILES_${PN}-dev += "${libdir}/cpu-init/*"
30
31INHIBIT_PACKAGE_STRIP = "1"
32INHIBIT_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 0000000000..c97c7c276b
--- /dev/null
+++ b/meta/recipes-core/newlib/newlib.inc
@@ -0,0 +1,58 @@
1SUMMARY = "Newlib is a C library intended for use on embedded systems"
2HOMEPAGE = "https://sourceware.org/newlib/"
3DESCRIPTION = "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."
4SECTION = "libs"
5
6LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2"
7LIC_FILES_CHKSUM = " \
8 file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
9 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
10 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
11 file://COPYING.LIBGLOSS;md5=73f5c98779aea7dba4a6c94a74ab0ae2 \
12 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
13 file://COPYING.NEWLIB;md5=956a4b1487f7677cdcceeee8f05a21f0 \
14 file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \
15 file://newlib/libc/sys/linux/linuxthreads/LICENSE;md5=73640207fbc79b198c7ffd4ad4d97aa0 \
16 "
17
18SRC_URI = "ftp://sourceware.org/pub/newlib/newlib-${PV}.tar.gz"
19SRC_URI[md5sum] = "81ec873108b8593c586f91ca65963952"
20SRC_URI[sha256sum] = "c8566335ee74e5fcaeb8595b4ebd0400c4b043d6acb3263ecb1314f8f5501332"
21
22INHIBIT_DEFAULT_DEPS = "1"
23DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial"
24
25PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
26STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
27STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
28
29S = "${WORKDIR}/newlib-${PV}"
30B = "${WORKDIR}/build"
31
32## disable stdlib
33TARGET_CC_ARCH_append = " -nostdlib"
34
35EXTRA_OECONF = " \
36 --build=${BUILD_SYS} \
37 --target=${TARGET_SYS} \
38 --host=${HOST_SYS} \
39 --prefix=${prefix} \
40 --exec-prefix=${exec_prefix} \
41 --bindir=${bindir} \
42 --libdir=${libdir} \
43 --includedir=${includedir} \
44 --enable-languages=c \
45 --with-newlib \
46 --with-gnu-as \
47 --with-gnu-ld \
48 --disable-multilib \
49 "
50
51do_configure[cleandirs] = "${B}"
52
53do_install() {
54 oe_runmake install DESTDIR='${D}'
55}
56
57COMPATIBLE_HOST_libc-musl_class-target = "null"
58COMPATIBLE_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 0000000000..3380576b83
--- /dev/null
+++ b/meta/recipes-core/newlib/newlib_3.0.0.bb
@@ -0,0 +1,16 @@
1require newlib.inc
2
3PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc virtual/libiconv virtual/libintl"
4
5do_configure() {
6 ${S}/configure ${EXTRA_OECONF}
7}
8
9do_install_append() {
10 # Move include files and libs to default directories so they can be picked up later
11 mv -v ${D}${prefix}/${TARGET_SYS}/lib ${D}${libdir}
12 mv -v ${D}${prefix}/${TARGET_SYS}/include ${D}${includedir}
13
14 # Remove original directory
15 rmdir ${D}${prefix}/${TARGET_SYS}
16}