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