Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/uclibc-ng/
Date: Sat, 17 Nov 2018 12:46:27
Message-Id: 1542458776.44e3a4e02ff0450aa321c16a38ce788cdfd1c189.blueness@gentoo
1 commit: 44e3a4e02ff0450aa321c16a38ce788cdfd1c189
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 17 12:45:59 2018 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 17 12:46:16 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44e3a4e0
7
8 sys-libs/uclibc-ng: version bump to 1.0.31
9
10 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
11 Package-Manager: Portage-2.3.51, Repoman-2.3.11
12
13 sys-libs/uclibc-ng/Manifest | 1 +
14 sys-libs/uclibc-ng/uclibc-ng-1.0.31.ebuild | 401 +++++++++++++++++++++++++++++
15 2 files changed, 402 insertions(+)
16
17 diff --git a/sys-libs/uclibc-ng/Manifest b/sys-libs/uclibc-ng/Manifest
18 index 41ecc16a496..646c35652be 100644
19 --- a/sys-libs/uclibc-ng/Manifest
20 +++ b/sys-libs/uclibc-ng/Manifest
21 @@ -1,2 +1,3 @@
22 DIST uClibc-ng-1.0.26.tar.bz2 2285709 BLAKE2B 6276f1d080f0c90b5a0ce4a4fc3556070852ad157b9c0a15305108b2f46a2d0f5371dde12ac0a8f05cad7db942cceb8057b5ef351e100a52609f2ebdc6b19634 SHA512 48c37ab2000af13848ef007ce89f226bded5188f37839c11371bab48497670d30d39fda2a031c6aff95f429a4abadc431ddd77c0e023810a341e2c2d2645f71b
23 DIST uClibc-ng-1.0.30.tar.bz2 2302796 BLAKE2B 21888dfe5a68f83b7ba56bb557ecc5aa19fd75cedc82f2ed48073f47655888719feb27943e0309f8101a24fd2fd9165af31d5679f21c00b12f27ebfccf354bac SHA512 ddd1d91dcfdf7be8471afecf13196563ad348c41e2fa8b63ae50b83f103cf8ed8d9f003b51a54a58db2935b84692b7c011a4779582f30610ede44cb583aae742
24 +DIST uClibc-ng-1.0.31.tar.bz2 2351728 BLAKE2B e2cad8500fdafdd98db11cbc756f3277845fedf545598c9861b1d1ef51b3a24744afe635d6894929eb537891323b0627577c2a5e5dbe1ff0ae588c5aa53a1219 SHA512 489e5f5e8952ebfad1d8a5528a04420d9d2e58fa5092029ccdae91d81dfcf8b3e00092453432da94c76fc18cab542192040bfb271e367fa42ca4926f4b45c372
25
26 diff --git a/sys-libs/uclibc-ng/uclibc-ng-1.0.31.ebuild b/sys-libs/uclibc-ng/uclibc-ng-1.0.31.ebuild
27 new file mode 100644
28 index 00000000000..4f1d00a3cb4
29 --- /dev/null
30 +++ b/sys-libs/uclibc-ng/uclibc-ng-1.0.31.ebuild
31 @@ -0,0 +1,401 @@
32 +# Copyright 1999-2018 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI="6"
36 +
37 +inherit flag-o-matic multilib savedconfig toolchain-funcs versionator
38 +
39 +if [[ ${PV} == "9999" ]] ; then
40 + EGIT_REPO_URI="git://uclibc-ng.org/git/uclibc-ng"
41 + inherit git-r3
42 + MY_P=uclibc-ng-${PV}
43 +else
44 + MY_P=uClibc-ng-${PV}
45 +fi
46 +
47 +DESCRIPTION="C library for developing embedded Linux systems"
48 +HOMEPAGE="https://uclibc-ng.org/"
49 +if [[ ${PV} != "9999" ]] ; then
50 + PATCH_VER=""
51 + SRC_URI="https://downloads.uclibc-ng.org/releases/${PV}/${MY_P}.tar.bz2"
52 + KEYWORDS="-* ~amd64 ~arm ~mips ~ppc ~x86"
53 +fi
54 +
55 +LICENSE="LGPL-2"
56 +SLOT="0"
57 +IUSE="debug hardened iconv ipv6 symlink-compat headers-only"
58 +RESTRICT="strip"
59 +
60 +# 1) We can't upgrade from uclibc to uclibc-ng via a soft blocker since portage
61 +# will delete the ld.so sym link prematurely and break the system. So we
62 +# will hard block and give manual migration instructions.
63 +# 2) Currently uclibc and uclibc-ng's iconv are in bad shape. We've been using
64 +# the breakout library. The disadvantage here is that we have to sprinkle
65 +# LDFAGS=-liconv on build systems that need to link against libiconv.
66 +RDEPEND="
67 + !!sys-libs/uclibc
68 + iconv? ( dev-libs/libiconv )"
69 +
70 +S=${WORKDIR}/${MY_P}
71 +
72 +export CBUILD=${CBUILD:-${CHOST}}
73 +export CTARGET=${CTARGET:-${CHOST}}
74 +if [[ ${CHOST} == ${CTARGET} ]] ; then
75 + if [[ ${CATEGORY} == cross-* ]] ; then
76 + export CTARGET=${CATEGORY#cross-}
77 + fi
78 +fi
79 +
80 +is_crosscompile() {
81 + [[ ${CHOST} != ${CTARGET} ]]
82 +}
83 +
84 +alt_build_kprefix() {
85 + if [[ ${CBUILD} == ${CHOST} && ${CHOST} == ${CTARGET} ]] ; then
86 + echo /usr/include
87 + else
88 + echo /usr/${CTARGET}/usr/include
89 + fi
90 +}
91 +
92 +just_headers() {
93 + use headers-only && is_crosscompile
94 +}
95 +
96 +uclibc_endian() {
97 + # XXX: this wont work for a toolchain which is bi-endian, but we
98 + # dont have any such thing at the moment, so not a big deal
99 + touch "${T}"/endian.s
100 + $(tc-getAS ${CTARGET}) "${T}"/endian.s -o "${T}"/endian.o
101 + case $(file "${T}"/endian.o) in
102 + *" MSB "*) echo "BIG";;
103 + *" LSB "*) echo "LITTLE";;
104 + *) echo "NFC";;
105 + esac
106 + rm -f "${T}"/endian.{s,o}
107 +}
108 +
109 +kconfig_q_opt() {
110 + local flag=$1; shift
111 + case ${flag} in
112 + y|n) ;;
113 + *) flag=$(usex ${flag} y n) ;;
114 + esac
115 +
116 + local var="defs_${flag}"
117 + eval "${var}+=( $* )"
118 +}
119 +
120 +get_opt() {
121 + (
122 + unset ${1}
123 + . ${2:-"${S}"/.config}
124 + echo ${!1}
125 + )
126 +}
127 +
128 +make_oldconfig() {
129 + yes "" 2>/dev/null | emake -s oldconfig >/dev/null
130 +}
131 +
132 +make_config() {
133 + restore_config .config
134 + if [ -f .config ]; then
135 + make_oldconfig
136 + return 0
137 + else
138 + ewarn "Could not locate user configfile, so we will save a default one"
139 + fi
140 +
141 + emake ARCH=$1 defconfig >/dev/null
142 +
143 + local defs_{y,n}
144 +
145 + # These are forced off
146 + defs_n=(
147 + DOASSERTS
148 + DODEBUG_PT
149 + HAS_NO_THREADS
150 + PROPOLICE_BLOCK_ABRT
151 + SSP_QUICK_CANARY
152 + SUPPORT_LD_DEBUG_EARLY
153 + UCLIBC_HAS_CTYPE_UNSAFE
154 + UCLIBC_HAS_LOCALE
155 + LDSO_SAFE_RUNPATH
156 + )
157 +
158 + # These are forced on
159 + defs_y=(
160 + DO_C99_MATH
161 + DO_XSI_MATH
162 + FORCE_SHAREABLE_TEXT_SEGMENTS
163 + LDSO_GNU_HASH_SUPPORT
164 + LDSO_PRELOAD_FILE_SUPPORT
165 + LDSO_RUNPATH
166 + LDSO_RUNPATH_OF_EXECUTABLE
167 + LDSO_STANDALONE_SUPPORT
168 + PROPOLICE_BLOCK_SEGV
169 + PTHREADS_DEBUG_SUPPORT
170 + UCLIBC_HAS_ARC4RANDOM
171 + UCLIBC_HAS_BACKTRACE
172 + UCLIBC_HAS_BSD_RES_CLOSE
173 + UCLIBC_HAS_CONTEXT_FUNCS
174 + UCLIBC_HAS_CTYPE_CHECKED
175 + UCLIBC_HAS_EXTRA_COMPAT_RES_STATE
176 + UCLIBC_HAS_FENV
177 + UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE
178 + UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE
179 + UCLIBC_HAS_FOPEN_LARGEFILE_MODE
180 + UCLIBC_HAS_FTS
181 + UCLIBC_HAS_FTW
182 + UCLIBC_HAS_GETPT
183 + UCLIBC_HAS_GLIBC_CUSTOM_PRINTF
184 + UCLIBC_HAS_GLIBC_CUSTOM_STREAMS
185 + UCLIBC_HAS_GNU_GLOB
186 + UCLIBC_HAS_HEXADECIMAL_FLOATS
187 + UCLIBC_HAS_LIBUTIL
188 + UCLIBC_HAS_NFTW
189 + UCLIBC_HAS_OBSOLETE_BSD_SIGNAL
190 + UCLIBC_HAS_PRINTF_M_SPEC
191 + UCLIBC_HAS_PROGRAM_INVOCATION_NAME
192 + UCLIBC_HAS_RESOLVER_SUPPORT
193 + UCLIBC_HAS_SHA256_CRYPT_IMPL
194 + UCLIBC_HAS_SHA512_CRYPT_IMPL
195 + UCLIBC_HAS_SSP
196 + UCLIBC_HAS_STUBS
197 + UCLIBC_HAS_SYS_ERRLIST
198 + UCLIBC_HAS_SYS_SIGLIST
199 + UCLIBC_HAS_THREADS_NATIVE
200 + UCLIBC_HAS_TZ_FILE_READ_MANY
201 + UCLIBC_HAS_UTMP
202 + UCLIBC_HAS_UTMPX
203 + UCLIBC_HAS_WCHAR
204 + UCLIBC_HAS_WORDEXP
205 + UCLIBC_NTP_LEGACY
206 + UCLIBC_SUPPORT_AI_ADDRCONFIG
207 + UCLIBC_SUSV2_LEGACY
208 + UCLIBC_SUSV3_LEGACY
209 + UCLIBC_SUSV3_LEGACY_MACROS
210 + UCLIBC_SUSV4_LEGACY
211 + UCLIBC_USE_NETLINK
212 + )
213 +
214 + sed -i -e '/ARCH_.*_ENDIAN/d' .config
215 + kconfig_q_opt y "ARCH_WANTS_$(uclibc_endian)_ENDIAN"
216 +
217 + kconfig_q_opt debug DODEBUG
218 + kconfig_q_opt debug SUPPORT_LD_DEBUG
219 + kconfig_q_opt debug UCLIBC_HAS_PROFILING
220 +
221 + kconfig_q_opt ipv6 UCLIBC_HAS_IPV6
222 +
223 + kconfig_q_opt hardened UCLIBC_BUILD_NOEXECSTACK
224 + kconfig_q_opt hardened UCLIBC_BUILD_NOW
225 + kconfig_q_opt hardened UCLIBC_BUILD_PIE
226 + kconfig_q_opt hardened UCLIBC_BUILD_RELRO
227 + kconfig_q_opt hardened UCLIBC_BUILD_SSP
228 +
229 + local count def
230 + for count in 1 2 ; do
231 + # Run twice as some config opts depend on others being enabled first.
232 + for def in ${defs_y[@]} ; do
233 + sed -i -e "s|.*\<${def}\>.*set|${def}=y|g" .config
234 + done
235 + for def in ${defs_n[@]} ; do
236 + sed -i -e "s|${def}=y|# ${def} is not set|g" .config
237 + done
238 + make_oldconfig
239 + done
240 +
241 + einfo "Enabled options:"
242 + for def in ${defs_y[@]} ; do
243 + einfo " " $(grep "^${def}=y" .config || echo "could not find ${def}")
244 + done
245 + einfo "Disabled options:"
246 + for def in ${defs_n[@]} ; do
247 + einfo " " $(grep "^# ${def} is not set" .config || echo "could not find ${def}")
248 + done
249 +
250 + # setup build and run paths
251 + sed -i \
252 + -e "/^CROSS_COMPILER_PREFIX/s|=.*|=\"${CTARGET}-\"|" \
253 + -e "/^KERNEL_HEADERS/s|=.*|=\"$(alt_build_kprefix)\"|" \
254 + -e "/^SHARED_LIB_LOADER_PREFIX/s|=.*|=\"/$(get_libdir)\"|" \
255 + -e "/^DEVEL_PREFIX/s|=.*|=\"/usr\"|" \
256 + -e "/^RUNTIME_PREFIX/s|=.*|=\"/\"|" \
257 + -e "/^UCLIBC_EXTRA_CFLAGS/s|=.*|=\"${UCLIBC_EXTRA_CFLAGS}\"|" \
258 + .config || die
259 +
260 + make_oldconfig
261 +}
262 +
263 +pkg_setup() {
264 + # Make sure our CHOST is a uclibc toolchain for native compiling
265 + if [[ ${CHOST} == ${CTARGET} ]]; then
266 + case ${CHOST} in
267 + *-uclinux*|*-uclibc*) ;;
268 + *) die "Use sys-devel/crossdev to build a uclibc toolchain" ;;
269 + esac
270 + fi
271 +
272 + # uClibc-ng doesn't carry old Linux threads, and since we force
273 + # threading our only choice is NPTL which requires i486 and later.
274 + [[ ${CTARGET} == i386* ]] && die "i386 can't support Native Posix Threads (NPTL)."
275 +}
276 +
277 +src_prepare() {
278 + local version subversion extraversion
279 +
280 + # uclibc-ng tries to create a two sym link with ld.so,
281 + # ld-uClibc.so.{0,MAJOR_VERSION} -> ld-uClibc-<version>.so
282 + # where MAJOR_VERSION != 0 indicates the ABI verison.
283 + # We want to get rid of this and just have ABI = 0.
284 + eapply "${FILESDIR}"/uclibc-compat-r1.patch
285 +
286 + # We need to change the major.minor.sublevel of uclibc-ng.
287 + # Upstream sets MAJOR_VERSION = 1 which breaks runtime linking.
288 + # If we really want the ABI bump, we'll have to hack the gcc
289 + # spec file and change the '*link:' rule.
290 + version=( $(get_version_components) )
291 + if [[ -z ${version[1]} ]]; then
292 + subversion=0
293 + extraversion=0
294 + else
295 + subversion=${version[1]}
296 + if [[ -z ${version[2]} ]]; then
297 + extraversion=0
298 + else
299 + extraversion=.${version[2]}
300 + fi
301 + fi
302 +
303 + sed -i \
304 + -e "/^MAJOR_VERSION/s|:=.*|:= 0|" \
305 + -e "/^MINOR_VERSION/s|:=.*|:= ${version[0]}|" \
306 + -e "/^SUBLEVEL/s|:=.*|:= ${subversion}|" \
307 + -e "/^EXTRAVERSION/s|:=.*|:= ${extraversion}|" \
308 + Rules.mak || die
309 +
310 + eapply_user
311 +}
312 +
313 +src_configure() {
314 + # Map our toolchain arch name to the name expected by uClibc-ng.
315 + local target=$(tc-arch)
316 + case ${target} in
317 + amd64) target="x86_64";;
318 + arm) target="arm";;
319 + mips) target="mips";;
320 + ppc) target="powerpc";;
321 + x86) target="i386";;
322 + esac
323 +
324 + # Do arch specific configuration by changing the defaults in
325 + # extra/Configs/Config.<arch>. If these are not overridden
326 + # by an save .config, they will be selected by default.
327 +
328 + # For i386, i486, i586 and i686
329 + local cpu
330 + if [[ ${target} == "i386" ]]; then
331 + [[ ${CTARGET} == i[456]86* ]] && cpu="${CTARGET:1:1}86"
332 + sed -i -e "s|default CONFIG_686|default CONFIG_${cpu:-486}|" \
333 + extra/Configs/Config.i386 || die
334 + fi
335 +
336 + # For arm
337 + if [[ ${target} == "arm" ]]; then
338 + sed -i -e '/Build for EABI/a \\tdefault y' extra/Configs/Config.arm
339 + fi
340 +
341 + # We set HOSTCC to the proper tuple rather than just 'gcc'
342 + sed -i -e "s|^HOSTCC.*=.*|HOSTCC=$(tc-getBUILD_CC)|" Rules.mak
343 +
344 + make_config ${target}
345 +
346 + einfo
347 + einfo "Runtime Prefix: /"
348 + einfo "Devel Prefix: /usr"
349 + einfo "Kernel Prefix: $(alt_build_kprefix)"
350 + einfo "CBUILD: ${CBUILD}"
351 + einfo "CHOST: ${CHOST}"
352 + einfo "CTARGET: ${CTARGET}"
353 + einfo "ABI: ${ABI}"
354 + einfo "ENDIAN: $(uclibc_endian)"
355 + einfo
356 +}
357 +
358 +src_compile() {
359 + emake headers
360 + just_headers && return 0
361 +
362 + emake
363 + if is_crosscompile ; then
364 + emake -C utils hostutils
365 + else
366 + emake utils
367 + fi
368 +}
369 +
370 +src_test() {
371 + is_crosscompile && return 0
372 +
373 + # assert test fails on pax/grsec enabled kernels
374 + # normal vfork test fails in sandbox (both glibc/uclibc)
375 + emake UCLIBC_ONLY=1 check
376 +}
377 +
378 +src_install() {
379 + local sysroot=${D}
380 + is_crosscompile && sysroot+="/usr/${CTARGET}"
381 +
382 + local target="install"
383 + just_headers && target="install_headers"
384 + emake DESTDIR="${sysroot}" ${target}
385 +
386 + save_config .config
387 +
388 + # remove files coming from kernel-headers
389 + rm -rf "${sysroot}"/usr/include/{linux,asm*}
390 +
391 + # Make sure we install the sys-include symlink so that when
392 + # we build a 2nd stage cross-compiler, gcc finds the target
393 + # system headers correctly. See gcc/doc/gccinstall.info
394 + if is_crosscompile ; then
395 + dosym usr/include /usr/${CTARGET}/sys-include
396 + if ! just_headers && [[ -n $(get_opt HAVE_SHARED) ]] ; then
397 + newbin utils/ldconfig.host ${CTARGET}-ldconfig
398 + newbin utils/ldd.host ${CTARGET}-ldd
399 + fi
400 + return 0
401 + fi
402 +
403 + if use symlink-compat; then
404 + dosym libc.so.0 "${DESTDIR}"/lib/libcrypt.so.0
405 + dosym libc.so.0 "${DESTDIR}"/lib/libdl.so.0
406 + dosym libc.so.0 "${DESTDIR}"/lib/libm.so.0
407 + dosym libc.so.0 "${DESTDIR}"/lib/libpthread.so.0
408 + dosym libc.so.0 "${DESTDIR}"/lib/librt.so.0
409 + dosym libc.so.0 "${DESTDIR}"/lib/libresolv.so.0
410 + dosym libc.so.0 "${DESTDIR}"/lib/libubacktrace.so.0
411 + dosym libc.so.0 "${DESTDIR}"/lib/libutil.so.0
412 + fi
413 +
414 + emake DESTDIR="${D}" install_utils
415 + dobin extra/scripts/getent
416 + dodoc README docs/*.txt
417 +}
418 +
419 +pkg_postinst() {
420 + is_crosscompile && return 0
421 +
422 + if [ ! -e "${ROOT}"/etc/TZ ] ; then
423 + ewarn "Please remember to set your timezone in /etc/TZ"
424 + mkdir -p "${ROOT}"/etc
425 + echo "UTC" > "${ROOT}"/etc/TZ
426 + fi
427 + [ "${ROOT}" != "/" ] && return 0
428 + # update cache before reloading init
429 + ldconfig
430 + # reload init ...
431 + /sbin/telinit U 2>/dev/null
432 +}