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 = "GPL-2.0-only & LGPL-3.0-only & GPL-3.0-only & LGPL-2.0-only & BSD-2-Clause & BSD-3-Clause & TCL & Apache-2.0-with-LLVM-exception"
7LIC_FILES_CHKSUM = " \
8		file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
9		file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
10		file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
11		file://COPYING.LIBGLOSS;md5=c0469b6ebb847a75781066be515f032d \
12		file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
13		file://COPYING.NEWLIB;md5=4f1a15846ffee91e352418563e1bce27 \
14		file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \
15		"
16
17BASEVER = "4.4.0"
18PV = "${BASEVER}+git"
19SRC_URI = "git://sourceware.org/git/newlib-cygwin.git;protocol=https;branch=main"
20SRCREV="ad11e2587f83d61357a32c61c36d72ea4f39315e"
21
22INHIBIT_DEFAULT_DEPS = "1"
23DEPENDS = "virtual/${TARGET_PREFIX}gcc"
24
25S = "${WORKDIR}/git"
26B = "${WORKDIR}/build"
27
28## disable stdlib
29TARGET_CC_ARCH:append = " -nostdlib"
30
31# Both the C library and the application should share the same mcmodel.
32# Use the medium-any code model for the RISC-V 64 bit implementation,
33# since medlow can only access addresses below 0x80000000 and RAM
34# starts at 0x80000000 on RISC-V 64
35# Keep RISC-V 32 using -mcmodel=medlow (symbols lie between -2GB:2GB)
36TARGET_CFLAGS:append:qemuriscv64 = " -mcmodel=medany"
37
38
39EXTRA_OECONF = " \
40                --build=${BUILD_SYS}  \
41                --target=${TARGET_SYS} \
42		--host=${HOST_SYS} \
43                --prefix=${prefix}  \
44                --exec-prefix=${exec_prefix} \
45                --bindir=${bindir} \
46                --libdir=${libdir} \
47                --includedir=${includedir} \
48		--enable-languages=c \
49		--with-newlib \
50		--with-gnu-as \
51		--with-gnu-ld \
52		--disable-multilib \
53		--disable-newlib-supplied-syscalls \
54		"
55
56do_configure[cleandirs] = "${B}"
57
58# We need a dummy limits.h to pass preprocessor checks
59do_configure:append(){
60    install -d ${STAGING_INCDIR}
61    touch  ${STAGING_INCDIR}/limits.h
62}
63
64do_install() {
65	oe_runmake install DESTDIR='${D}'
66}
67
68COMPATIBLE_HOST:libc-musl:class-target = "null"
69COMPATIBLE_HOST:libc-glibc:class-target = "null"
70