Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-dev:uclibc commit in: sys-libs/uclibc/, sys-libs/uclibc/files/
Date: Sat, 31 Dec 2011 19:19:45
Message-Id: 00b82b174715e534e78f6742c3389726932cece8.blueness@gentoo
1 commit: 00b82b174715e534e78f6742c3389726932cece8
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 31 19:12:42 2011 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 31 19:18:53 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=00b82b17
7
8 sys-libs/uclibc: use config file from FILESDIR
9
10 ---
11 sys-libs/uclibc/files/uclibc.config | 265 +++++++++++++++++++++++
12 sys-libs/uclibc/metadata.xml | 10 +-
13 sys-libs/uclibc/uclibc-0.9.32-r1.ebuild | 57 -----
14 sys-libs/uclibc/uclibc-0.9.32.ebuild | 356 ++-----------------------------
15 4 files changed, 283 insertions(+), 405 deletions(-)
16
17 diff --git a/sys-libs/uclibc/files/uclibc.config b/sys-libs/uclibc/files/uclibc.config
18 new file mode 100644
19 index 0000000..f575ca2
20 --- /dev/null
21 +++ b/sys-libs/uclibc/files/uclibc.config
22 @@ -0,0 +1,265 @@
23 +#
24 +# Automatically generated make config: don't edit
25 +# Version: 0.9.32
26 +# Sat Dec 31 16:47:23 2011
27 +#
28 +# TARGET_alpha is not set
29 +# TARGET_arm is not set
30 +# TARGET_avr32 is not set
31 +# TARGET_bfin is not set
32 +# TARGET_cris is not set
33 +# TARGET_e1 is not set
34 +# TARGET_frv is not set
35 +# TARGET_h8300 is not set
36 +# TARGET_hppa is not set
37 +TARGET_i386=y
38 +# TARGET_i960 is not set
39 +# TARGET_ia64 is not set
40 +# TARGET_m68k is not set
41 +# TARGET_microblaze is not set
42 +# TARGET_mips is not set
43 +# TARGET_nios is not set
44 +# TARGET_nios2 is not set
45 +# TARGET_powerpc is not set
46 +# TARGET_sh is not set
47 +# TARGET_sh64 is not set
48 +# TARGET_sparc is not set
49 +# TARGET_v850 is not set
50 +# TARGET_vax is not set
51 +# TARGET_x86_64 is not set
52 +# TARGET_xtensa is not set
53 +# TARGET_c6x is not set
54 +
55 +#
56 +# Target Architecture Features and Options
57 +#
58 +TARGET_ARCH="i386"
59 +FORCE_OPTIONS_FOR_ARCH=y
60 +# CONFIG_GENERIC_386 is not set
61 +# CONFIG_386 is not set
62 +# CONFIG_486 is not set
63 +CONFIG_586=y
64 +# CONFIG_586MMX is not set
65 +# CONFIG_686 is not set
66 +# CONFIG_PENTIUMII is not set
67 +# CONFIG_PENTIUMIII is not set
68 +# CONFIG_PENTIUM4 is not set
69 +# CONFIG_K6 is not set
70 +# CONFIG_K7 is not set
71 +# CONFIG_ELAN is not set
72 +# CONFIG_CRUSOE is not set
73 +# CONFIG_WINCHIPC6 is not set
74 +# CONFIG_WINCHIP2 is not set
75 +# CONFIG_CYRIXIII is not set
76 +# CONFIG_NEHEMIAH is not set
77 +TARGET_SUBARCH="i586"
78 +
79 +#
80 +# Using ELF file format
81 +#
82 +ARCH_LITTLE_ENDIAN=y
83 +
84 +#
85 +# Using Little Endian
86 +#
87 +ARCH_HAS_MMU=y
88 +ARCH_USE_MMU=y
89 +UCLIBC_HAS_FLOATS=y
90 +UCLIBC_HAS_FPU=y
91 +DO_C99_MATH=y
92 +DO_XSI_MATH=y
93 +UCLIBC_HAS_FENV=y
94 +UCLIBC_HAS_LONG_DOUBLE_MATH=y
95 +KERNEL_HEADERS="/usr/include"
96 +HAVE_DOT_CONFIG=y
97 +
98 +#
99 +# General Library Settings
100 +#
101 +# HAVE_NO_PIC is not set
102 +DOPIC=y
103 +# ARCH_HAS_NO_SHARED is not set
104 +# ARCH_HAS_NO_LDSO is not set
105 +HAVE_SHARED=y
106 +FORCE_SHAREABLE_TEXT_SEGMENTS=y
107 +LDSO_LDD_SUPPORT=y
108 +LDSO_CACHE_SUPPORT=y
109 +LDSO_PRELOAD_ENV_SUPPORT=y
110 +LDSO_PRELOAD_FILE_SUPPORT=y
111 +LDSO_BASE_FILENAME="ld.so"
112 +UCLIBC_STATIC_LDCONFIG=y
113 +LDSO_RUNPATH=y
114 +LDSO_SEARCH_INTERP_PATH=y
115 +UCLIBC_CTOR_DTOR=y
116 +LDSO_GNU_HASH_SUPPORT=y
117 +# HAS_NO_THREADS is not set
118 +LINUXTHREADS_OLD=y
119 +# LINUXTHREADS_NEW is not set
120 +# UCLIBC_HAS_THREADS_NATIVE is not set
121 +UCLIBC_HAS_THREADS=y
122 +PTHREADS_DEBUG_SUPPORT=y
123 +UCLIBC_HAS_SYSLOG=y
124 +UCLIBC_HAS_LFS=y
125 +# MALLOC is not set
126 +# MALLOC_SIMPLE is not set
127 +MALLOC_STANDARD=y
128 +MALLOC_GLIBC_COMPAT=y
129 +UCLIBC_DYNAMIC_ATEXIT=y
130 +COMPAT_ATEXIT=y
131 +UCLIBC_SUSV3_LEGACY=y
132 +UCLIBC_SUSV3_LEGACY_MACROS=y
133 +UCLIBC_SUSV4_LEGACY=y
134 +UCLIBC_STRICT_HEADERS=y
135 +UCLIBC_HAS_STUBS=y
136 +UCLIBC_HAS_SHADOW=y
137 +UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
138 +UCLIBC_HAS___PROGNAME=y
139 +UCLIBC_HAS_PTY=y
140 +ASSUME_DEVPTS=y
141 +UNIX98PTY_ONLY=y
142 +UCLIBC_HAS_GETPT=y
143 +UCLIBC_HAS_LIBUTIL=y
144 +UCLIBC_HAS_TM_EXTENSIONS=y
145 +UCLIBC_HAS_TZ_CACHING=y
146 +UCLIBC_HAS_TZ_FILE=y
147 +UCLIBC_HAS_TZ_FILE_READ_MANY=y
148 +UCLIBC_TZ_FILE_PATH="/etc/TZ"
149 +UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
150 +
151 +#
152 +# Advanced Library Settings
153 +#
154 +UCLIBC_PWD_BUFFER_SIZE=256
155 +UCLIBC_GRP_BUFFER_SIZE=256
156 +
157 +#
158 +# Support various families of functions
159 +#
160 +UCLIBC_LINUX_MODULE_24=y
161 +UCLIBC_LINUX_SPECIFIC=y
162 +UCLIBC_HAS_GNU_ERROR=y
163 +UCLIBC_BSD_SPECIFIC=y
164 +UCLIBC_HAS_BSD_ERR=y
165 +# UCLIBC_HAS_OBSOLETE_BSD_SIGNAL is not set
166 +# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
167 +# UCLIBC_NTP_LEGACY is not set
168 +# UCLIBC_SV4_DEPRECATED is not set
169 +UCLIBC_HAS_REALTIME=y
170 +UCLIBC_HAS_ADVANCED_REALTIME=y
171 +UCLIBC_HAS_EPOLL=y
172 +UCLIBC_HAS_XATTR=y
173 +# UCLIBC_HAS_PROFILING is not set
174 +UCLIBC_HAS_CRYPT_IMPL=y
175 +UCLIBC_HAS_CRYPT=y
176 +UCLIBC_HAS_NETWORK_SUPPORT=y
177 +UCLIBC_HAS_SOCKET=y
178 +UCLIBC_HAS_IPV4=y
179 +UCLIBC_HAS_IPV6=y
180 +UCLIBC_HAS_RPC=y
181 +UCLIBC_HAS_FULL_RPC=y
182 +UCLIBC_HAS_REENTRANT_RPC=y
183 +UCLIBC_USE_NETLINK=y
184 +UCLIBC_SUPPORT_AI_ADDRCONFIG=y
185 +UCLIBC_HAS_BSD_RES_CLOSE=y
186 +UCLIBC_HAS_COMPAT_RES_STATE=y
187 +UCLIBC_HAS_EXTRA_COMPAT_RES_STATE=y
188 +UCLIBC_HAS_LIBRESOLV_STUB=y
189 +UCLIBC_HAS_LIBNSL_STUB=y
190 +
191 +#
192 +# String and Stdio Support
193 +#
194 +UCLIBC_HAS_STRING_GENERIC_OPT=y
195 +UCLIBC_HAS_STRING_ARCH_OPT=y
196 +UCLIBC_HAS_CTYPE_TABLES=y
197 +UCLIBC_HAS_CTYPE_SIGNED=y
198 +# UCLIBC_HAS_CTYPE_UNSAFE is not set
199 +UCLIBC_HAS_CTYPE_CHECKED=y
200 +# UCLIBC_HAS_CTYPE_ENFORCED is not set
201 +UCLIBC_HAS_WCHAR=y
202 +# UCLIBC_HAS_LOCALE is not set
203 +UCLIBC_HAS_HEXADECIMAL_FLOATS=y
204 +UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
205 +UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
206 +UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
207 +# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
208 +# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
209 +# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
210 +# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
211 +# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
212 +UCLIBC_HAS_STDIO_BUFSIZ_4096=y
213 +# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
214 +UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
215 +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
216 +# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
217 +# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
218 +UCLIBC_HAS_STDIO_GETC_MACRO=y
219 +UCLIBC_HAS_STDIO_PUTC_MACRO=y
220 +UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
221 +UCLIBC_HAS_FOPEN_LARGEFILE_MODE=y
222 +UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
223 +UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
224 +UCLIBC_HAS_PRINTF_M_SPEC=y
225 +UCLIBC_HAS_ERRNO_MESSAGES=y
226 +UCLIBC_HAS_SYS_ERRLIST=y
227 +UCLIBC_HAS_SIGNUM_MESSAGES=y
228 +UCLIBC_HAS_SYS_SIGLIST=y
229 +UCLIBC_HAS_GNU_GETOPT=y
230 +UCLIBC_HAS_GNU_GETSUBOPT=y
231 +
232 +#
233 +# Big and Tall
234 +#
235 +UCLIBC_HAS_REGEX=y
236 +UCLIBC_HAS_REGEX_OLD=y
237 +UCLIBC_HAS_FNMATCH=y
238 +UCLIBC_HAS_FNMATCH_OLD=y
239 +UCLIBC_HAS_WORDEXP=y
240 +UCLIBC_HAS_NFTW=y
241 +UCLIBC_HAS_FTW=y
242 +UCLIBC_HAS_FTS=y
243 +UCLIBC_HAS_GLOB=y
244 +UCLIBC_HAS_GNU_GLOB=y
245 +UCLIBC_HAS_UTMPX=y
246 +
247 +#
248 +# Library Installation Options
249 +#
250 +RUNTIME_PREFIX="/"
251 +DEVEL_PREFIX="/usr"
252 +MULTILIB_DIR="lib"
253 +HARDWIRED_ABSPATH=y
254 +
255 +#
256 +# Security options
257 +#
258 +UCLIBC_BUILD_PIE=y
259 +UCLIBC_HAS_ARC4RANDOM=y
260 +# HAVE_NO_SSP is not set
261 +UCLIBC_HAS_SSP=y
262 +# UCLIBC_HAS_SSP_COMPAT is not set
263 +# SSP_QUICK_CANARY is not set
264 +# PROPOLICE_BLOCK_ABRT is not set
265 +PROPOLICE_BLOCK_SEGV=y
266 +UCLIBC_BUILD_SSP=y
267 +UCLIBC_BUILD_RELRO=y
268 +UCLIBC_BUILD_NOW=y
269 +UCLIBC_BUILD_NOEXECSTACK=y
270 +
271 +#
272 +# uClibc development/debugging options
273 +#
274 +CROSS_COMPILER_PREFIX="i386-gentoo-linux-uclibc-"
275 +UCLIBC_EXTRA_CFLAGS=""
276 +# DODEBUG is not set
277 +# DODEBUG_PT is not set
278 +DOSTRIP=y
279 +# DOASSERTS is not set
280 +# SUPPORT_LD_DEBUG is not set
281 +# SUPPORT_LD_DEBUG_EARLY is not set
282 +# UCLIBC_MALLOC_DEBUGGING is not set
283 +# UCLIBC_HAS_BACKTRACE is not set
284 +WARNINGS="-Wall"
285 +# EXTRA_WARNINGS is not set
286 +# DOMULTI is not set
287 +# UCLIBC_MJN3_ONLY is not set
288
289 diff --git a/sys-libs/uclibc/metadata.xml b/sys-libs/uclibc/metadata.xml
290 index bcb329d..e217c37 100644
291 --- a/sys-libs/uclibc/metadata.xml
292 +++ b/sys-libs/uclibc/metadata.xml
293 @@ -2,10 +2,8 @@
294 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
295 <pkgmetadata>
296 <herd>hardened</herd>
297 - <use>
298 - <flag name='ssp'>Force the use of ssp to be built into a hardened uclibc setup</flag>
299 - <flag name='savedconfig'>Adds support for user defined configs</flag>
300 - <flag name='uclibc-compat'>Build uclibc with backwards compatible options</flag>
301 - <flag name='wordexp'>Add support for word expansion (wordexp.h)</flag>
302 - </use>
303 + <maintainer>
304 + <email>blueness@g.o</email>
305 + <name>Anthony G. Basile</name>
306 + </maintainer>
307 </pkgmetadata>
308
309 diff --git a/sys-libs/uclibc/uclibc-0.9.32-r1.ebuild b/sys-libs/uclibc/uclibc-0.9.32-r1.ebuild
310 deleted file mode 100644
311 index 42b99f4..0000000
312 --- a/sys-libs/uclibc/uclibc-0.9.32-r1.ebuild
313 +++ /dev/null
314 @@ -1,57 +0,0 @@
315 -# Copyright 1999-2011 Gentoo Foundation
316 -# Distributed under the terms of the GNU General Public License v2
317 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/uclibc/uclibc-0.9.30.1-r1.ebuild,v 1.9 2011/04/20 18:10:38 ulm Exp $
318 -
319 -EAPI="4"
320 -
321 -inherit eutils savedconfig
322 -
323 -MY_P=uClibc-0.9.32
324 -DESCRIPTION="C library for developing embedded Linux systems"
325 -HOMEPAGE="http://www.uclibc.org/"
326 -SRC_URI="http://uclibc.org/downloads/${MY_P}.tar.bz2"
327 -
328 -LICENSE="LGPL-2"
329 -SLOT="0"
330 -KEYWORDS="-* ~amd64 ~x86"
331 -IUSE="savedconfig"
332 -RESTRICT="strip"
333 -
334 -RDEPEND=""
335 -DEPEND=""
336 -
337 -S=${WORKDIR}/${MY_P}
338 -
339 -src_prepare() {
340 - epatch "${FILESDIR}"/${P}-BJA-sandbox.patch
341 - epatch "${FILESDIR}"/${P}-fix_epoll.patch
342 -}
343 -
344 -src_configure() {
345 - use savedconfig && restore_config .config
346 -}
347 -
348 -src_compile() {
349 - emake headers || die "make headers failed"
350 - emake || die "make failed"
351 - emake utils || die "make utils failed"
352 -}
353 -
354 -src_install() {
355 - emake DESTDIR="${D}" install || die "install failed"
356 -
357 - use savedconfig && save_config .config
358 -
359 - # remove files coming from kernel-headers
360 - rm -rf "${D}"/usr/include/{linux,asm*}
361 -
362 - emake DESTDIR="${D}" install_utils || die "install-utils failed"
363 - dobin extra/scripts/getent
364 - dodoc Changelog* README TODO docs/*.txt DEDICATION.mjn3
365 -}
366 -
367 -pkg_postinst() {
368 - echo "UTC" > "${ROOT}"/etc/TZ
369 - /sbin/ldconfig
370 - [[ -x /sbin/telinit ]] && /sbin/telinit U &> /dev/null
371 -}
372
373 diff --git a/sys-libs/uclibc/uclibc-0.9.32.ebuild b/sys-libs/uclibc/uclibc-0.9.32.ebuild
374 index 97990b7..43d630b 100644
375 --- a/sys-libs/uclibc/uclibc-0.9.32.ebuild
376 +++ b/sys-libs/uclibc/uclibc-0.9.32.ebuild
377 @@ -2,383 +2,55 @@
378 # Distributed under the terms of the GNU General Public License v2
379 # $Header: /var/cvsroot/gentoo-x86/sys-libs/uclibc/uclibc-0.9.30.1-r1.ebuild,v 1.9 2011/04/20 18:10:38 ulm Exp $
380
381 -#ESVN_REPO_URI="svn://uclibc.org/trunk/uClibc"
382 -#inherit subversion
383 -inherit eutils flag-o-matic toolchain-funcs savedconfig
384 +EAPI="4"
385
386 -export CBUILD=${CBUILD:-${CHOST}}
387 -export CTARGET=${CTARGET:-${CHOST}}
388 -if [[ ${CTARGET} == ${CHOST} ]] ; then
389 - if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
390 - export CTARGET=${CATEGORY/cross-}
391 - fi
392 -fi
393 -# Handle the case where we want uclibc on glibc ...
394 -if [[ ${CTARGET} == ${CHOST} ]] && [[ ${CHOST} != *-uclibc* ]] ; then
395 - export UCLIBC_AND_GLIBC="sitting in a tree"
396 - export CTARGET=${CHOST%%-*}-pc-linux-uclibc
397 -fi
398 +inherit eutils
399
400 MY_P=uClibc-0.9.32
401 -PATCH_VER=""
402 -SVN_VER=""
403 DESCRIPTION="C library for developing embedded Linux systems"
404 HOMEPAGE="http://www.uclibc.org/"
405 SRC_URI="http://uclibc.org/downloads/${MY_P}.tar.bz2"
406
407 -[[ -z ${SVN_VER} ]] || \
408 - SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-svn-update-${SVN_VER}.patch.bz2"
409 -[[ -z ${PATCH_VER} ]] || \
410 - SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-patches-${PATCH_VER}.tar.bz2"
411 -
412 LICENSE="LGPL-2"
413 SLOT="0"
414 KEYWORDS="-* amd64 x86"
415 -IUSE="build uclibc-compat debug hardened ssp ipv6 minimal nptl wordexp crosscompile_opts_headers-only"
416 +IUSE="savedconfig"
417 RESTRICT="strip"
418
419 RDEPEND=""
420 -if [[ -n $CTARGET && ${CTARGET} != ${CHOST} ]]; then
421 - DEPEND=">=cross-${CTARGET}/binutils-2.21.51.0.7"
422 - SLOT="${CTARGET}"
423 -else
424 - DEPEND="virtual/os-headers app-misc/pax-utils"
425 - SLOT="0"
426 -fi
427 +DEPEND=""
428
429 S=${WORKDIR}/${MY_P}
430
431 -alt_build_kprefix() {
432 - if [[ ${CBUILD} == ${CHOST} && ${CTARGET} == ${CHOST} ]] \
433 - || [[ -n ${UCLIBC_AND_GLIBC} ]]
434 - then
435 - echo /usr/include
436 - else
437 - echo /usr/${CTARGET}/usr/include
438 - fi
439 -}
440 -
441 -just_headers() {
442 - use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
443 -}
444 -
445 -uclibc_endian() {
446 - # XXX: this wont work for a toolchain which is bi-endian, but we
447 - # dont have any such thing at the moment, so not a big deal
448 - touch "${T}"/endian.s
449 - $(tc-getAS ${CTARGET}) "${T}"/endian.s -o "${T}"/endian.o
450 - case $(file "${T}"/endian.o) in
451 - *" MSB "*) echo "big";;
452 - *" LSB "*) echo "little";;
453 - *) echo "NFC";;
454 - esac
455 - rm -f "${T}"/endian.{s,o}
456 -}
457 -
458 -pkg_setup() {
459 - just_headers && return 0
460 - has_version ${CATEGORY}/uclibc || return 0
461 - [[ -n ${UCLIBC_AND_GLIBC} ]] && return 0
462 - [[ ${ROOT} != "/" ]] && return 0
463 - [[ ${CATEGORY} == cross-* ]] && return 0
464 -
465 -}
466 -
467 -PIE_STABLE="arm mips ppc x86"
468 -
469 -CPU_ALPHA=""
470 -CPU_AMD64=""
471 -CPU_ARM="GENERIC_ARM ARM{610,710,7TDMI,720T,920T,922T,926T,10T,1136JF_S,1176JZ{_,F_}S,_{SA110,SA1100,XSCALE,IWMMXT},_CORTEX_{M3,M1}}"
472 -CPU_IA64=""
473 -CPU_M68K=""
474 -CPU_MIPS="MIPS_ISA_{1,2,3,4,MIPS{32{,R2},64}} MIPS_{N64,O32,N32}_ABI"
475 -CPU_PPC=""
476 -CPU_SH="SH{2,2A,3,4,5}"
477 -CPU_SPARC="SPARC_V{7,8,9,9B}"
478 -CPU_X86="GENERIC_386 {3,4,5,6}86 586MMX PENTIUM{II,III,4} K{6,7} ELAN CRUSOE WINCHIP{C6,2} CYRIXIII NEHEMIAH"
479 -IUSE_UCLIBC_CPU="${CPU_ARM} ${CPU_MIPS} ${CPU_PPC} ${CPU_SH} ${CPU_SPARC} ${CPU_X86}"
480 -
481 -check_cpu_opts() {
482 - local cpu_var="CPU_$(echo $(tc-arch) | tr [a-z] [A-Z])"
483 - [[ -z ${!cpu_var} ]] && return 0
484 -
485 - if [[ -z ${UCLIBC_CPU} ]] ; then
486 - ewarn "You really should consider setting UCLIBC_CPU"
487 - ewarn "Otherwise, the build will be generic (read: slow)."
488 - ewarn "Available CPU options:"
489 - UCLIBC_CPU=$(eval echo ${!cpu_var})
490 - echo ${UCLIBC_CPU}
491 - case ${CTARGET} in
492 - mips[1234]*) export UCLIBC_CPU="MIPS_ISA_${CTARGET:4:1}";;
493 - sh[2345]*) export UCLIBC_CPU="SH${CTARGET:2:1}";;
494 - i[456]86*) export UCLIBC_CPU="${CTARGET:1:1}86";;
495 - *) export UCLIBC_CPU=${UCLIBC_CPU%% *};;
496 - esac
497 - else
498 - local cpu found=0
499 - for cpu in $(eval echo ${!cpu_var}) ; do
500 - [[ ${UCLIBC_CPU} == "${cpu}" ]] && found=1 && break
501 - done
502 - if [[ ${found} -eq 0 ]] ; then
503 - ewarn "UCLIBC_CPU choice '${UCLIBC_CPU}' not supported"
504 - ewarn "Valid choices:"
505 - eval echo ${!cpu_var}
506 - die "pick a supported cpu type"
507 - fi
508 - fi
509 -}
510 -
511 -set_opt() {
512 - sed -i -e "/^\# $1 is not set/d" -e "/^$1=.*/d" .config
513 - echo "$1=$2" >> .config
514 -}
515 -get_opt() {
516 - (
517 - unset $1
518 - . ${2:-"${S}"/.config}
519 - echo ${!1}
520 - )
521 -}
522 -
523 -src_unpack() {
524 - [[ -n ${ESVN_REPO_URI} ]] \
525 - && subversion_src_unpack \
526 - || unpack ${A}
527 - cd "${S}"
528 -
529 - check_cpu_opts
530 -
531 - echo
532 - einfo "Runtime Prefix: /"
533 - einfo "Devel Prefix: /usr"
534 - einfo "Kernel Prefix: $(alt_build_kprefix)"
535 - einfo "CBUILD: ${CBUILD}"
536 - einfo "CHOST: ${CHOST}"
537 - einfo "CTARGET: ${CTARGET}"
538 - einfo "CPU: ${UCLIBC_CPU:-default}"
539 - einfo "ENDIAN: $(uclibc_endian)"
540 - echo
541 -
542 - ########## PATCHES ##########
543 -
544 - [[ -n ${SVN_VER} ]] && \
545 - epatch "${WORKDIR}"/${MY_P}-cvs-update-${SVN_VER}.patch
546 -
547 - if [[ -n ${PATCH_VER} ]] ; then
548 - unpack ${MY_P}-patches-${PATCH_VER}.tar.bz2
549 - EPATCH_SUFFIX="patch"
550 - epatch "${WORKDIR}"/patch
551 - fi
552 -
553 +src_prepare() {
554 epatch "${FILESDIR}"/${P}-BJA-sandbox.patch
555 epatch "${FILESDIR}"/${P}-fix_epoll.patch
556 +}
557
558 - ########## CPU SELECTION ##########
559 -
560 - local target config_target
561 - case $(tc-arch) in
562 - alpha) target="alpha"; config_target="no cpu-specific options";;
563 - amd64) target="x86_64"; config_target="no cpu-specific options";;
564 - arm) target="arm"; config_target="GENERIC_ARM";;
565 - avr) target="avr32"; config_target="no cpu-specific options";;
566 - ia64) target="ia64"; config_target="no cpu-specific options";;
567 - m68k) target="m68k"; config_target="no cpu-specific options";;
568 - mips) target="mips"; config_target="MIPS_ISA_1";;
569 - ppc) target="powerpc"; config_target="no cpu-specific options";;
570 - sh) target="sh"; config_target="SH4";;
571 - sparc) target="sparc"; config_target="no cpu-specific options";;
572 - x86) target="i386"; config_target="GENERIC_386";;
573 - *) die "$(tc-arch) lists no defaults :/";;
574 - esac
575 - sed -i -e "s:default CONFIG_${config_target}:default CONFIG_${UCLIBC_CPU:-${config_target}}:" \
576 - extra/Configs/Config.${target}
577 - sed -i -e "s:^HOSTCC.*=.*:HOSTCC=$(tc-getBUILD_CC):" Rules.mak
578 -
579 - ########## CONFIG SETUP ##########
580 -
581 - make ARCH=${target} defconfig >/dev/null || die "could not config"
582 -
583 - for def in DO{DEBUG{,_PT},ASSERTS} SUPPORT_LD_DEBUG{,_EARLY} UCLIBC_HAS_PROFILING; do
584 - sed -i -e "s:${def}=y:# ${def} is not set:" .config
585 - done
586 - if use debug ; then
587 - set_opt SUPPORT_LD_DEBUG y
588 - set_opt DODEBUG y
589 - fi
590 -
591 - sed -i -e '/ARCH_.*_ENDIAN/d' .config
592 - set_opt "ARCH_WANTS_$(uclibc_endian | tr [a-z] [A-Z])_ENDIAN" y
593 -
594 - if [[ $(tc-is-softfloat) != "no" ]] ; then
595 - set_opt UCLIBC_HAS_FPU n
596 - fi
597 -
598 - if [[ ${CTARGET/eabi} != ${CTARGET} ]] ; then
599 - set_opt CONFIG_ARM_OABI n
600 - set_opt CONFIG_ARM_EABI y
601 - fi
602 -
603 - local moredefs="COMPAT_ATEXIT"
604 - local compat_sym=atexit
605 -
606 - # We need todo this for a few months. .30 is a major upgrade.
607 - # Don't do it from cross-compiling case though
608 - if ! use uclibc-compat ; then
609 - if [[ -z ${UCLIBC_AND_GLIBC} ]] && [[ -z ${UCLIBC_SCANNED_COMPAT} ]] && \
610 - ! just_headers && [[ ${CHOST} == ${CTARGET} ]] ; then
611 - local fnames=""
612 - einfo "Doing a scanelf in paths for bins containing the ${compat_sym} symbol"
613 - fnames=$(scanelf -pyqs${compat_sym} -F%F#s)
614 - if [[ -z ${fnames} ]] ; then
615 - einfo "This system is clean."
616 - einfo "To prevent the scanning of files again in the future you can export UCLIBC_SCANNED_COMPAT=1"
617 - moredefs=""
618 - else
619 - ewarn "You need to remerge the packages that contain the following files before you can remerge ${P} without USE=uclibc-compat enabled."
620 - ewarn "qfile -Cq $(echo ${fnames}) | sort | uniq"
621 - echo
622 - ewarn "Leaving on ${moredefs}"
623 - fi
624 - else
625 - moredefs=""
626 - fi
627 - fi
628 - for def in ${moredefs} MALLOC_GLIBC_COMPAT DO_C99_MATH UCLIBC_HAS_{RPC,FULL_RPC,CTYPE_CHECKED,WCHAR,HEXADECIMAL_FLOATS,GLIBC_CUSTOM_PRINTF,FOPEN_EXCLUSIVE_MODE,GLIBC_CUSTOM_STREAMS,PRINTF_M_SPEC,FTW} UCLIBC_HAS_REENTRANT_RPC UCLIBC_HAS_GNU_GLOB PTHREADS_DEBUG_SUPPORT UCLIBC_HAS_TZ_FILE_READ_MANY UCLIBC_HAS_FENV UCLIBC_SUSV3_LEGACY UCLIBC_SUSV3_LEGACY_MACROS UCLIBC_HAS_PROGRAM_INVOCATION_NAME ; do
629 - set_opt "${def}" y
630 - done
631 - set_opt UCLIBC_HAS_CTYPE_UNSAFE n
632 - set_opt UCLIBC_HAS_LOCALE n
633 - set_opt HAS_NO_THREADS n
634 -
635 - use nptl && set_opt LINUXTHREADS_NEW y
636 -
637 - use ipv6 && set_opt UCLIBC_HAS_IPV6 y
638 -
639 - use wordexp && set_opt UCLIBC_HAS_WORDEXP y
640 -
641 - # we need to do it independently of hardened to get ssp.c built into libc
642 - set_opt UCLIBC_HAS_SSP y
643 - set_opt UCLIBC_HAS_SSP_COMPAT y
644 - set_opt UCLIBC_HAS_ARC4RANDOM y
645 - set_opt PROPOLICE_BLOCK_ABRT n
646 - set_opt PROPOLICE_BLOCK_SEGV y
647 -
648 - # arm/mips do not emit PT_GNU_STACK, but if we enable this here
649 - # it will be emitted as RWE, ppc has to be checked, x86 needs it
650 - # this option should be used independently of hardened
651 - if has $(tc-arch) x86 || has $(tc-arch) ppc; then
652 - set_opt UCLIBC_BUILD_NOEXECSTACK y
653 - else
654 - set_opt UCLIBC_BUILD_NOEXECSTACK n
655 - fi
656 - set_opt UCLIBC_BUILD_RELRO y
657 - if use hardened ; then
658 - if has $(tc-arch) ${PIE_STABLE} ; then
659 - set_opt UCLIBC_BUILD_PIE y
660 - else
661 - set_opt UCLIBC_BUILD_PIE n
662 - fi
663 - set_opt UCLIBC_BUILD_NOW y
664 - use ssp && {
665 - set_opt SSP_QUICK_CANARY n
666 - set_opt UCLIBC_BUILD_SSP y
667 - }
668 - else
669 - set_opt UCLIBC_BUILD_PIE n
670 - set_opt SSP_QUICK_CANARY y
671 - set_opt UCLIBC_BUILD_SSP n
672 - set_opt UCLIBC_BUILD_NOW n
673 - fi
674 -
675 - restore_config .config
676 -
677 - # setup build and run paths
678 - local cross=${CTARGET}-
679 - type -p ${cross}ar > /dev/null || cross=""
680 - sed -i \
681 - -e "/^CROSS_COMPILER_PREFIX/s:=.*:=\"${cross}\":" \
682 - -e "/^KERNEL_HEADERS/s:=.*:=\"$(alt_build_kprefix)\":" \
683 - -e "/^SHARED_LIB_LOADER_PREFIX/s:=.*:=\"/$(get_libdir)\":" \
684 - -e "/^DEVEL_PREFIX/s:=.*:=\"/usr\":" \
685 - -e "/^RUNTIME_PREFIX/s:=.*:=\"/\":" \
686 - -e "/^UCLIBC_EXTRA_CFLAGS/s:=.*:=\"${UCLIBC_EXTRA_CFLAGS}\":" \
687 - .config || die
688 -
689 +src_configure() {
690 + cp "${FILESDIR}"/uclibc.config .config
691 yes "" 2> /dev/null | make -s oldconfig > /dev/null || die "could not make oldconfig"
692 -
693 - cp .config myconfig
694 -
695 - emake -s clean > /dev/null || die "could not clean"
696 }
697
698 src_compile() {
699 - cp myconfig .config
700 -
701 emake headers || die "make headers failed"
702 - just_headers && return 0
703 -
704 emake || die "make failed"
705 - if [[ ${CTARGET} != ${CHOST} ]] ; then
706 - emake -C utils hostutils || die "make hostutils failed"
707 - elif [[ ${CHOST} == *-uclibc* ]] ; then
708 - emake utils || die "make utils failed"
709 - fi
710 -}
711 -
712 -src_test() {
713 - [[ ${CHOST} != ${CTARGET} ]] && return 0
714 - [[ ${CBUILD} != ${CHOST} ]] && return 0
715 -
716 - # assert test fails on pax/grsec enabled kernels - normal
717 - # vfork test fails in sandbox (both glibc/uclibc)
718 - make UCLIBC_ONLY=1 check || die "test failed"
719 + emake utils || die "make utils failed"
720 }
721
722 src_install() {
723 - local sysroot=${D}
724 - [[ ${CHOST} != ${CTARGET} ]] && sysroot="${sysroot}/usr/${CTARGET}"
725 -
726 - local target="install"
727 - just_headers && target="install_headers"
728 - emake DESTDIR="${sysroot}" ${target} || die "install failed"
729 -
730 - save_config .config
731 + emake DESTDIR="${D}" install || die "install failed"
732
733 # remove files coming from kernel-headers
734 - rm -rf "${sysroot}"/usr/include/{linux,asm*}
735 -
736 - # Make sure we install the sys-include symlink so that when
737 - # we build a 2nd stage cross-compiler, gcc finds the target
738 - # system headers correctly. See gcc/doc/gccinstall.info
739 - if [[ ${CTARGET} != ${CHOST} ]] ; then
740 - dosym usr/include /usr/${CTARGET}/sys-include
741 - if ! just_headers && [[ -n $(get_opt HAVE_SHARED) ]] ; then
742 - newbin utils/ldconfig.host ${CTARGET}-ldconfig || die
743 - newbin utils/ldd.host ${CTARGET}-ldd || die
744 - fi
745 - return 0
746 - fi
747 -
748 - if [[ ${CHOST} == *-uclibc* ]] ; then
749 - emake DESTDIR="${D}" install_utils || die "install-utils failed"
750 - dobin extra/scripts/getent
751 - fi
752 + rm -rf "${D}"/usr/include/{linux,asm*}
753
754 + emake DESTDIR="${D}" install_utils || die "install-utils failed"
755 + dobin extra/scripts/getent
756 dodoc Changelog* README TODO docs/*.txt DEDICATION.mjn3
757 }
758
759 pkg_postinst() {
760 - [[ ${CTARGET} != ${CHOST} ]] && return 0
761 - [[ ${CHOST} != *-uclibc* ]] && return 0
762 -
763 - if [[ ! -e ${ROOT}/etc/TZ ]] ; then
764 - ewarn "Please remember to set your timezone in /etc/TZ"
765 - [[ ! -d ${ROOT}/etc ]] && mkdir -p "${ROOT}"/etc
766 - echo "UTC" > "${ROOT}"/etc/TZ
767 - fi
768 - [[ ${ROOT} != "/" ]] && return 0
769 - # update cache before reloading init
770 + echo "UTC" > "${ROOT}"/etc/TZ
771 /sbin/ldconfig
772 - # reload init ...
773 [[ -x /sbin/telinit ]] && /sbin/telinit U &> /dev/null
774 }