Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/newlib/
Date: Thu, 05 Mar 2020 18:21:32
Message-Id: 1583432482.1d7428bbf54aa06190af89c2090b96975703f273.slyfox@gentoo
1 commit: 1d7428bbf54aa06190af89c2090b96975703f273
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 5 18:21:09 2020 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 5 18:21:22 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d7428bb
7
8 sys-libs/newlib: bump up to 3.3.0
9
10 Package-Manager: Portage-2.3.92, Repoman-2.3.20
11 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
12
13 sys-libs/newlib/Manifest | 1 +
14 sys-libs/newlib/newlib-3.3.0.ebuild | 141 ++++++++++++++++++++++++++++++++++++
15 2 files changed, 142 insertions(+)
16
17 diff --git a/sys-libs/newlib/Manifest b/sys-libs/newlib/Manifest
18 index c1e9635145e..ac2c4dc6a96 100644
19 --- a/sys-libs/newlib/Manifest
20 +++ b/sys-libs/newlib/Manifest
21 @@ -1,3 +1,4 @@
22 DIST newlib-2.2.0.tar.gz 16521910 BLAKE2B 530290c8f219774885e3c408889b7f58bbeefe5c092f004c9ad61de8642b725df1f8fd2a00760ebde814e5bf379ae0320a589d2318113f371a733c5abaca2ba7 SHA512 ab9161f16845367c823b6709e3c5708969f29f05c77edb1cf969ff4202f358648f1e55080974599dcefed2fbced4694dc73748596e76c1aa37c50cddff6e4be3
23 DIST newlib-2.5.0.tar.gz 17912392 BLAKE2B bc89491758d59f3529c72308e963c5b3e39044d6d586ef3814cc19cf55aee33948656c544df7dfcbe3915105e7373f53d7b2baf96b9b8147e3af780c1d08e670 SHA512 4c99e8dfcb4a7ad0769b9e173ff06628d82e4993ef87d3adf9d6b5578626b14de81b4b3c5f0673ddbb49dc9f3d3628f9f8d4432dcded91f5cd3d27b7d44343cd
24 DIST newlib-3.1.0.tar.gz 17958952 BLAKE2B 3a84ae81fc07e442a4ed3da7a78e7ede34cc7e24b5d1c66a12624ed808e5f85f134751fcea0e4ce9eb39df287a582821f751a8610a088c149895b5e38eb06989 SHA512 efc4c3ab7153387780d141386bca5d3e20c9d25ae3e6b87cf94c8df9d301ce5926dacdff9bd33aeb9781559d933c3d0ae77f4e5b46120d90792f75dbfde702c7
25 +DIST newlib-3.3.0.tar.gz 18361083 BLAKE2B bdc81427955d0a2f550bf2973ca82c0b8b55aa170565cdf1cfe8ac926257fad6d3e860ce7b2e286949ab21be2677378b5b6d3c743c05fe8aa6df8a8c34a16945 SHA512 2f0c6666487520e1a0af0b6935431f85d2359e27ded0d01d02567d0d1c6479f2f0e6bbc60405e88e46b92c2a18780a01a60fc9281f7e311cfd40b8d5881d629c
26
27 diff --git a/sys-libs/newlib/newlib-3.3.0.ebuild b/sys-libs/newlib/newlib-3.3.0.ebuild
28 new file mode 100644
29 index 00000000000..b955419a1da
30 --- /dev/null
31 +++ b/sys-libs/newlib/newlib-3.3.0.ebuild
32 @@ -0,0 +1,141 @@
33 +# Copyright 1999-2020 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI="7"
37 +
38 +inherit flag-o-matic toolchain-funcs
39 +
40 +if [[ ${PV} == "9999" ]] ; then
41 + EGIT_REPO_URI="git://sourceware.org/git/newlib-cygwin.git"
42 + inherit git-r3
43 +else
44 + SRC_URI="ftp://sourceware.org/pub/newlib/${P}.tar.gz"
45 + KEYWORDS="-* ~arm ~hppa ~m68k ~mips ~ppc ~ppc64 ~sh ~sparc ~x86"
46 +fi
47 +
48 +export CBUILD=${CBUILD:-${CHOST}}
49 +export CTARGET=${CTARGET:-${CHOST}}
50 +if [[ ${CTARGET} == ${CHOST} ]] ; then
51 + if [[ ${CATEGORY} == cross-* ]] ; then
52 + export CTARGET=${CATEGORY#cross-}
53 + fi
54 +fi
55 +
56 +DESCRIPTION="Newlib is a C library intended for use on embedded systems"
57 +HOMEPAGE="https://sourceware.org/newlib/"
58 +
59 +LICENSE="NEWLIB LIBGLOSS GPL-2"
60 +SLOT="0"
61 +IUSE="nls threads unicode headers-only nano"
62 +RESTRICT="strip"
63 +
64 +NEWLIBBUILD="${WORKDIR}/build"
65 +NEWLIBNANOBUILD="${WORKDIR}/build.nano"
66 +NEWLIBNANOTMPINSTALL="${WORKDIR}/nano_tmp_install"
67 +
68 +# Adding -U_FORTIFY_SOURCE to counter the effect of Gentoo's
69 +# auto-addition of _FORTIFY_SOURCE at gcc site: bug #656018#c4
70 +# Currently newlib can't be built itself when _FORTIFY_SOURCE
71 +# is set.
72 +CFLAGS_FULL="-ffunction-sections -fdata-sections -U_FORTIFY_SOURCE"
73 +CFLAGS_NANO="-Os -ffunction-sections -fdata-sections -U_FORTIFY_SOURCE"
74 +
75 +pkg_setup() {
76 + # Reject newlib-on-glibc type installs
77 + if [[ ${CTARGET} == ${CHOST} ]] ; then
78 + case ${CHOST} in
79 + *-newlib|*-elf) ;;
80 + *) die "Use sys-devel/crossdev to build a newlib toolchain" ;;
81 + esac
82 + fi
83 +}
84 +
85 +src_configure() {
86 + # we should fix this ...
87 + unset LDFLAGS
88 + CHOST=${CTARGET} strip-unsupported-flags
89 + CCASFLAGS_ORIG="${CCASFLAGS}"
90 + CFLAGS_ORIG="${CFLAGS}"
91 +
92 + local myconf=(
93 + # Disable legacy syscall stub code in newlib. These have been
94 + # moved to libgloss for a long time now, so the code in newlib
95 + # itself just gets in the way.
96 + --disable-newlib-supplied-syscalls
97 + )
98 + [[ ${CTARGET} == "spu" ]] \
99 + && myconf+=( --disable-newlib-multithread ) \
100 + || myconf+=( $(use_enable threads newlib-multithread) )
101 +
102 + mkdir -p "${NEWLIBBUILD}"
103 + cd "${NEWLIBBUILD}"
104 +
105 + export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
106 + export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
107 + ECONF_SOURCE=${S} \
108 + econf \
109 + $(use_enable unicode newlib-mb) \
110 + $(use_enable nls) \
111 + "${myconf[@]}"
112 +
113 + # Build newlib-nano beside newlib (original)
114 + # Based on https://tracker.debian.org/media/packages/n/newlib/rules-2.1.0%2Bgit20140818.1a8323b-2
115 + if use nano ; then
116 + mkdir -p "${NEWLIBNANOBUILD}" || die
117 + cd "${NEWLIBNANOBUILD}" || die
118 + export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
119 + export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
120 + ECONF_SOURCE=${S} \
121 + econf \
122 + $(use_enable unicode newlib-mb) \
123 + $(use_enable nls) \
124 + --enable-newlib-reent-small \
125 + --disable-newlib-fvwrite-in-streamio \
126 + --disable-newlib-fseek-optimization \
127 + --disable-newlib-wide-orient \
128 + --enable-newlib-nano-malloc \
129 + --disable-newlib-unbuf-stream-opt \
130 + --enable-lite-exit \
131 + --enable-newlib-global-atexit \
132 + --enable-newlib-nano-formatted-io \
133 + ${myconf}
134 + fi
135 +}
136 +
137 +src_compile() {
138 + export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_FULL}"
139 + export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_FULL}"
140 + emake -C "${NEWLIBBUILD}"
141 +
142 + if use nano ; then
143 + export "CFLAGS_FOR_TARGET=${CFLAGS_ORIG} ${CFLAGS_NANO}"
144 + export "CCASFLAGS=${CCASFLAGS_ORIG} ${CFLAGS_NANO}"
145 + emake -C "${NEWLIBNANOBUILD}"
146 + fi
147 +}
148 +
149 +src_install() {
150 + cd "${NEWLIBBUILD}" || die
151 + emake -j1 DESTDIR="${D}" install
152 +
153 + if use nano ; then
154 + cd "${NEWLIBNANOBUILD}" || die
155 + emake -j1 DESTDIR="${NEWLIBNANOTMPINSTALL}" install
156 + # Rename nano lib* files to lib*_nano and move to the real ${D}
157 + local nanolibfiles=""
158 + nanolibfiles=$(find "${NEWLIBNANOTMPINSTALL}" -regex ".*/lib\(c\|g\|rdimon\)\.a" -print)
159 + for f in ${nanolibfiles}; do
160 + local l="${f##${NEWLIBNANOTMPINSTALL}}"
161 + mv -v "${f}" "${D}/${l%%\.a}_nano.a" || die
162 + done
163 +
164 + # Move newlib-nano's version of newlib.h to newlib-nano/newlib.h
165 + mkdir -p "${D}/usr/${CTARGET}/include/newlib-nano" || die
166 + mv "${NEWLIBNANOTMPINSTALL}/usr/${CTARGET}/include/newlib.h" \
167 + "${D}/usr/${CTARGET}/include/newlib-nano/newlib.h" || die
168 + fi
169 +
170 + # minor hack to keep things clean
171 + rm -rf "${D}"/usr/share/info || die
172 + rm -rf "${D}"/usr/info || die
173 +}