diff mbox series

newlib: Upgrade 4.2.0 -> 4.3.0

Message ID 20230127194330.419782-1-alejandro@enedino.org
State Accepted, archived
Commit 1c9cbb27dfe37ca4574c4285fb03ce394dee5ed1
Headers show
Series newlib: Upgrade 4.2.0 -> 4.3.0 | expand

Commit Message

Alejandro Enedino Hernandez Samaniego Jan. 27, 2023, 7:43 p.m. UTC
- Rebased fix-rs6000-crt0.patch
- Patch fix_makefile_include_arm_h.patch is no longer required, the newlib
  header dependency has been fixed upstream at 26f9cfd7
- LICENSE checksum change due to:
  - Adding SPDX identifier
  - Deleted Phoenix Systems from License and updated each licenses
  numbers accordingly.
- Add a dummy limits.h header, to make the improved preprocessor
  checks happy during configure.
- Add a patch for libgloss to maintain current behavior of TCLIBC=newlib
  by making libgloss DEPEND on newlib and use its installed headers.
- Switch to git fetcher to simplify fetching the sources and avoid future
  issues due to the way newlib release snapshots were being published.

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org>
---
 meta/conf/distro/include/maintainers.inc      |  4 +--
 .../newlib/libgloss/fix-rs6000-crt0.patch     | 24 +++++++++------
 .../libgloss-build-without-nostdinc.patch     | 30 +++++++++++++++++++
 .../{libgloss_4.2.0.bb => libgloss_4.3.0.bb}  |  5 +++-
 meta/recipes-core/newlib/newlib.inc           | 23 +++++++-------
 .../newlib/{newlib_4.2.0.bb => newlib_git.bb} |  0
 6 files changed, 63 insertions(+), 23 deletions(-)
 create mode 100644 meta/recipes-core/newlib/libgloss/libgloss-build-without-nostdinc.patch
 rename meta/recipes-core/newlib/{libgloss_4.2.0.bb => libgloss_4.3.0.bb} (75%)
 rename meta/recipes-core/newlib/{newlib_4.2.0.bb => newlib_git.bb} (100%)
diff mbox series

Patch

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 23c2e02d0d..ec7ea90d16 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -339,7 +339,7 @@  RECIPE_MAINTAINER:pn-libgcc-initial = "Khem Raj <raj.khem@gmail.com>"
 RECIPE_MAINTAINER:pn-libgcrypt = "Hongxu Jia <hongxu.jia@windriver.com>"
 RECIPE_MAINTAINER:pn-libgfortran = "Khem Raj <raj.khem@gmail.com>"
 RECIPE_MAINTAINER:pn-libgit2 = "Unassigned <unassigned@yoctoproject.org>"
-RECIPE_MAINTAINER:pn-libgloss = "Alejandro Hernandez <aehs29@gmail.com>"
+RECIPE_MAINTAINER:pn-libgloss = "Alejandro Hernandez <alejandro@enedino.org>"
 RECIPE_MAINTAINER:pn-libglu = "Ross Burton <ross.burton@arm.com>"
 RECIPE_MAINTAINER:pn-libgpg-error = "Hongxu Jia <hongxu.jia@windriver.com>"
 RECIPE_MAINTAINER:pn-libgudev = "Ross Burton <ross.burton@arm.com>"
@@ -535,7 +535,7 @@  RECIPE_MAINTAINER:pn-nativesdk-libtool = "Richard Purdie <richard.purdie@linuxfo
 RECIPE_MAINTAINER:pn-nativesdk-packagegroup-sdk-host = "Ross Burton <ross.burton@arm.com>"
 RECIPE_MAINTAINER:pn-nativesdk-qemu-helper = "Richard Purdie <richard.purdie@linuxfoundation.org>"
 RECIPE_MAINTAINER:pn-nativesdk-sdk-provides-dummy = "Richard Purdie <richard.purdie@linuxfoundation.org>"
-RECIPE_MAINTAINER:pn-newlib = "Alejandro Hernandez <aehs29@gmail.com>"
+RECIPE_MAINTAINER:pn-newlib = "Alejandro Hernandez <alejandro@enedino.org>"
 RECIPE_MAINTAINER:pn-ncurses = "Hongxu Jia <hongxu.jia@windriver.com>"
 RECIPE_MAINTAINER:pn-neard = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER:pn-net-tools = "Unassigned <unassigned@yoctoproject.org>"
diff --git a/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch b/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch
index c220fb8437..8c29fea8cf 100644
--- a/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch
+++ b/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch
@@ -5,35 +5,41 @@  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@xilinx.com>
 
-Index: newlib-3.0.0/libgloss/rs6000/Makefile.in
+01/2023: Rebased for libgloss 4.3.0
+
+Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org>
+
+
+Index: git/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
+--- git.orig/libgloss/rs6000/Makefile.in
++++ git/libgloss/rs6000/Makefile.in
+@@ -362,7 +362,7 @@ install-sim:
  
  install-mvme:
+ 	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
 -	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
+ 	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
+@@ -374,17 +374,17 @@ install-linux:
  
  install-yellowknife:
+ 	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
 -	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:
+ 	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
 -	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:
+ 	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
 -	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
diff --git a/meta/recipes-core/newlib/libgloss/libgloss-build-without-nostdinc.patch b/meta/recipes-core/newlib/libgloss/libgloss-build-without-nostdinc.patch
new file mode 100644
index 0000000000..2b66155eea
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss/libgloss-build-without-nostdinc.patch
@@ -0,0 +1,30 @@ 
+Upstream-Status: Inappropriate  [OE-Specific]
+
+Since commit e0c0ad82 libgloss started passing the -nostdinc to CC.
+
+They dont want to build against C library headers that are already in
+the system to avoid pollution, however, we purposely build libgloss
+against the newly built newlib C library, thats why we keep newlib
+and libgloss in separate recipes and create a dependency between them.
+
+This causes an issue where bitbake stops finding newlib headers while
+libgloss is being built.
+
+Do not pass -nostdinc to CC to maintain current behavior of
+TCLIBC=newlib
+
+
+Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org>
+Index: newlib-3.0.0/libgloss/configure
+===================================================================
+--- newlib-3.0.0.orig/libgloss/configure
++++ newlib-3.0.0/libgloss/configure
+@@ -5106,7 +5106,7 @@ fi
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_compiler_isystem" >&5
+ $as_echo "$libc_cv_compiler_isystem" >&6; }
+-CC="$CC -nostdinc $libc_cv_compiler_isystem"
++CC="$CC $libc_cv_compiler_isystem"
+ 
+ host_makefile_frag_path=$host_makefile_frag
+ 
diff --git a/meta/recipes-core/newlib/libgloss_4.2.0.bb b/meta/recipes-core/newlib/libgloss_4.3.0.bb
similarity index 75%
rename from meta/recipes-core/newlib/libgloss_4.2.0.bb
rename to meta/recipes-core/newlib/libgloss_4.3.0.bb
index 8c8ee91395..7e34e33c7a 100644
--- a/meta/recipes-core/newlib/libgloss_4.2.0.bb
+++ b/meta/recipes-core/newlib/libgloss_4.3.0.bb
@@ -4,8 +4,9 @@  DEPENDS += "newlib"
 
 FILESEXTRAPATHS:prepend := "${THISDIR}/libgloss:"
 
+SRC_URI:append = " file://libgloss-build-without-nostdinc.patch"
 SRC_URI:append:powerpc = " file://fix-rs6000-crt0.patch"
-SRC_URI:append:arm = " file://fix_makefile_include_arm_h.patch"
+SRC_URI:append:powerpc = " file://fix-rs6000-cflags.patch"
 
 do_configure() {
 	${S}/libgloss/configure ${EXTRA_OECONF}
@@ -28,6 +29,8 @@  do_install:append() {
 # Split packages correctly
 FILES:${PN} += "${libdir}/*.ld ${libdir}/*.specs"
 FILES:${PN}-dev += "${libdir}/cpu-init/*"
+# RiscV installation moved the syscall header to this location
+FILES:${PN}-dev += "${prefix}/${TARGET_SYS}/include/machine/*.h"
 
 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
index 27b52a43af..5351a9f991 100644
--- a/meta/recipes-core/newlib/newlib.inc
+++ b/meta/recipes-core/newlib/newlib.inc
@@ -10,24 +10,19 @@  LIC_FILES_CHKSUM = " \
 		file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
 		file://COPYING.LIBGLOSS;md5=c0469b6ebb847a75781066be515f032d \
 		file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
-		file://COPYING.NEWLIB;md5=8bb75595dbcc7d45e5c0d116d7bdf6ce \
+		file://COPYING.NEWLIB;md5=5a9d477b5f4eab20dccf655a77107a6e \
 		file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \
-		file://newlib/libc/sys/linux/linuxthreads/LICENSE;md5=73640207fbc79b198c7ffd4ad4d97aa0 \
 		"
 
-# Newlib maintainers sometimes publish the source
-# from a specific snapshot, after an upgrade we can
-# delete the following line and keep the empty default
-NEWLIB_SNAPSHOT = ".20211231"
-NEWLIB_SNAPSHOT ?= ""
-SRC_URI = "https://sourceware.org/pub/newlib/newlib-${PV}${NEWLIB_SNAPSHOT}.tar.gz"
-SRC_URI[sha256sum] = "c3a0e8b63bc3bef1aeee4ca3906b53b3b86c8d139867607369cb2915ffc54435"
-
+BASEVER = "4.3.0"
+PV = "${BASEVER}+git${SRCPV}"
+SRC_URI = "git://sourceware.org/git/newlib-cygwin.git;protocol=https;branch=main"
+SRCREV="9e09d6ed83cce4777a5950412647ccc603040409"
 
 INHIBIT_DEFAULT_DEPS = "1"
 DEPENDS = "virtual/${TARGET_PREFIX}gcc"
 
-S = "${WORKDIR}/newlib-${PV}${NEWLIB_SNAPSHOT}"
+S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
 
 ## disable stdlib
@@ -52,6 +47,12 @@  EXTRA_OECONF = " \
 
 do_configure[cleandirs] = "${B}"
 
+# We need a dummy limits.h to pass preprocessor checks
+do_configure:append(){
+    install -d ${STAGING_INCDIR}
+    touch  ${STAGING_INCDIR}/limits.h
+}
+
 do_install() {
 	oe_runmake install DESTDIR='${D}'
 }
diff --git a/meta/recipes-core/newlib/newlib_4.2.0.bb b/meta/recipes-core/newlib/newlib_git.bb
similarity index 100%
rename from meta/recipes-core/newlib/newlib_4.2.0.bb
rename to meta/recipes-core/newlib/newlib_git.bb