public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sergei Trofimovich" <slyfox@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/newlib/
Date: Thu, 16 Apr 2020 07:43:19 +0000 (UTC)	[thread overview]
Message-ID: <1587022980.053e0364d33f0432ec0b168afa2067def74ef01d.slyfox@gentoo> (raw)

commit:     053e0364d33f0432ec0b168afa2067def74ef01d
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 16 07:35:50 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Apr 16 07:43:00 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=053e0364

sys-libs/newlib: restore newlib-3.1.0 for msp430

newlib-3.3.0 is not compatible with any released gcc.
https://sourceware.org/legacy-ml/newlib/2019/msg00343.html

This partially reverts commit ae8fe4521b047d71437f98218ff595715f41cfc9.

Reported-by: tomtom69
Bug: https://bugs.gentoo.org/717610
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/newlib/Manifest            |   1 +
 sys-libs/newlib/newlib-3.1.0.ebuild | 141 ++++++++++++++++++++++++++++++++++++
 2 files changed, 142 insertions(+)

diff --git a/sys-libs/newlib/Manifest b/sys-libs/newlib/Manifest
index 12a1c1b3017..a0726ef035a 100644
--- a/sys-libs/newlib/Manifest
+++ b/sys-libs/newlib/Manifest
@@ -1 +1,2 @@
+DIST newlib-3.1.0.tar.gz 17958952 BLAKE2B 3a84ae81fc07e442a4ed3da7a78e7ede34cc7e24b5d1c66a12624ed808e5f85f134751fcea0e4ce9eb39df287a582821f751a8610a088c149895b5e38eb06989 SHA512 efc4c3ab7153387780d141386bca5d3e20c9d25ae3e6b87cf94c8df9d301ce5926dacdff9bd33aeb9781559d933c3d0ae77f4e5b46120d90792f75dbfde702c7
 DIST newlib-3.3.0.tar.gz 18361083 BLAKE2B bdc81427955d0a2f550bf2973ca82c0b8b55aa170565cdf1cfe8ac926257fad6d3e860ce7b2e286949ab21be2677378b5b6d3c743c05fe8aa6df8a8c34a16945 SHA512 2f0c6666487520e1a0af0b6935431f85d2359e27ded0d01d02567d0d1c6479f2f0e6bbc60405e88e46b92c2a18780a01a60fc9281f7e311cfd40b8d5881d629c

diff --git a/sys-libs/newlib/newlib-3.1.0.ebuild b/sys-libs/newlib/newlib-3.1.0.ebuild
new file mode 100644
index 00000000000..db1a3fad9cf
--- /dev/null
+++ b/sys-libs/newlib/newlib-3.1.0.ebuild
@@ -0,0 +1,141 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+inherit flag-o-matic toolchain-funcs
+
+if [[ ${PV} == "9999" ]] ; then
+	EGIT_REPO_URI="https://sourceware.org/git/newlib-cygwin.git"
+	inherit git-r3
+else
+	SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
+	KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sparc ~x86"
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+DESCRIPTION="Newlib is a C library intended for use on embedded systems"
+HOMEPAGE="https://sourceware.org/newlib/"
+
+LICENSE="NEWLIB LIBGLOSS GPL-2"
+SLOT="0"
+IUSE="nls threads unicode headers-only nano"
+RESTRICT="strip"
+
+NEWLIBBUILD="${WORKDIR}/build"
+NEWLIBNANOBUILD="${WORKDIR}/build.nano"
+NEWLIBNANOTMPINSTALL="${WORKDIR}/nano_tmp_install"
+
+# Adding -U_FORTIFY_SOURCE to counter the effect of Gentoo's
+# auto-addition of _FORTIFY_SOURCE at gcc site: bug #656018#c4
+# Currently newlib can't be built itself when _FORTIFY_SOURCE
+# is set.
+CFLAGS_FULL="-ffunction-sections -fdata-sections -U_FORTIFY_SOURCE"
+CFLAGS_NANO="-Os -ffunction-sections -fdata-sections -U_FORTIFY_SOURCE"
+
+pkg_setup() {
+	# Reject newlib-on-glibc type installs
+	if [[ ${CTARGET} == ${CHOST} ]] ; then
+		case ${CHOST} in
+			*-newlib|*-elf) ;;
+			*) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
+		esac
+	fi
+}
+
+src_configure() {
+	# we should fix this ...
+	unset LDFLAGS
+	CHOST=${CTARGET} strip-unsupported-flags
+	CCASFLAGS_ORIG="${CCASFLAGS}"
+	CFLAGS_ORIG="${CFLAGS}"
+
+	local myconf=(
+		# Disable legacy syscall stub code in newlib.  These have been
+		# moved to libgloss for a long time now, so the code in newlib
+		# itself just gets in the way.
+		--disable-newlib-supplied-syscalls
+	)
+	[[ ${CTARGET} == "spu" ]] \
+		&& myconf+=( --disable-newlib-multithread ) \
+		|| myconf+=( $(use_enable threads newlib-multithread) )
+
+	mkdir -p "${NEWLIBBUILD}"
+	cd "${NEWLIBBUILD}"
+
+	export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
+	export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
+	ECONF_SOURCE=${S} \
+	econf \
+		$(use_enable unicode newlib-mb) \
+		$(use_enable nls) \
+		"${myconf[@]}"
+
+	# Build newlib-nano beside newlib (original)
+	# Based on https://tracker.debian.org/media/packages/n/newlib/rules-2.1.0%2Bgit20140818.1a8323b-2
+	if use nano ; then
+		mkdir -p "${NEWLIBNANOBUILD}" || die
+		cd "${NEWLIBNANOBUILD}" || die
+		export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
+		export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
+		ECONF_SOURCE=${S} \
+		econf \
+			$(use_enable unicode newlib-mb) \
+			$(use_enable nls) \
+			--enable-newlib-reent-small \
+			--disable-newlib-fvwrite-in-streamio \
+			--disable-newlib-fseek-optimization \
+			--disable-newlib-wide-orient \
+			--enable-newlib-nano-malloc \
+			--disable-newlib-unbuf-stream-opt \
+			--enable-lite-exit \
+			--enable-newlib-global-atexit \
+			--enable-newlib-nano-formatted-io \
+			${myconf}
+	fi
+}
+
+src_compile() {
+	export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
+	export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
+	emake -C "${NEWLIBBUILD}"
+
+	if use nano ; then
+		export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
+		export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
+		emake -C "${NEWLIBNANOBUILD}"
+	fi
+}
+
+src_install() {
+	cd "${NEWLIBBUILD}" || die
+	emake -j1 DESTDIR="${D}" install
+
+	if use nano ; then
+		cd "${NEWLIBNANOBUILD}" || die
+		emake -j1 DESTDIR="${NEWLIBNANOTMPINSTALL}" install
+		# Rename nano lib* files to lib*_nano and move to the real ${D}
+		local nanolibfiles=""
+		nanolibfiles=$(find "${NEWLIBNANOTMPINSTALL}" -regex ".*/lib\(c\|g\|rdimon\)\.a" -print)
+		for f in ${nanolibfiles}; do
+			local l="${f##${NEWLIBNANOTMPINSTALL}}"
+			mv -v "${f}" "${D}/${l%%\.a}_nano.a" || die
+		done
+
+		# Move newlib-nano's version of newlib.h to newlib-nano/newlib.h
+		mkdir -p "${D}/usr/${CTARGET}/include/newlib-nano" || die
+		mv "${NEWLIBNANOTMPINSTALL}/usr/${CTARGET}/include/newlib.h" \
+			"${D}/usr/${CTARGET}/include/newlib-nano/newlib.h" || die
+	fi
+
+	# minor hack to keep things clean
+	rm -rf "${D}"/usr/share/info || die
+	rm -rf "${D}"/usr/info || die
+}


             reply	other threads:[~2020-04-16  7:43 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16  7:43 Sergei Trofimovich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-23 17:42 [gentoo-commits] repo/gentoo:master commit in: sys-libs/newlib/ Sam James
2023-08-08  5:36 Sam James
2023-03-09  1:03 Sam James
2023-01-20 23:54 Mike Frysinger
2023-01-20 22:31 Mike Frysinger
2023-01-20 22:31 Mike Frysinger
2023-01-20 22:31 Mike Frysinger
2022-06-03 18:49 Steve Arnold
2022-05-31 22:03 Sam James
2022-01-01  1:42 Mike Frysinger
2021-11-24  3:11 Mike Frysinger
2021-09-28  1:45 Sam James
2021-03-06 19:31 Sergei Trofimovich
2020-12-22 20:24 Sergei Trofimovich
2020-11-21 18:35 Sergei Trofimovich
2020-05-17  9:33 Sergei Trofimovich
2020-05-17  9:33 Sergei Trofimovich
2020-04-16  7:43 Sergei Trofimovich
2020-03-31  7:02 Sergei Trofimovich
2020-03-31  7:02 Sergei Trofimovich
2020-03-16 21:23 Sergei Trofimovich
2020-03-05 18:21 Sergei Trofimovich
2019-11-24 11:37 Sergei Trofimovich
2019-11-14  0:47 Aaron Bauman
2019-10-23  6:48 Sergei Trofimovich
2018-11-25 15:13 Sergei Trofimovich
2018-03-14 16:08 Jason Zaman
2018-01-07 19:39 Sergei Trofimovich
2017-01-02 20:10 Mike Frysinger
2016-06-23 19:14 Mike Frysinger
2016-03-30  3:46 Mike Frysinger
2016-01-18 10:06 Mike Frysinger
2016-01-04 19:57 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1587022980.053e0364d33f0432ec0b168afa2067def74ef01d.slyfox@gentoo \
    --to=slyfox@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox