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:12:56
Message-Id: 0c0b9c2c720b4f1a8ff314a131d2a37365024338.blueness@gentoo
1 commit: 0c0b9c2c720b4f1a8ff314a131d2a37365024338
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:12:42 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=0c0b9c2c
7
8 sys-devel/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 | 358 ++-----------------------------
15 4 files changed, 284 insertions(+), 406 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..4bfac8d 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 +KEYWORDS="-* ~amd64 ~x86"
417 +IUSE="savedconfig"
418 RESTRICT="strip"
419
420 RDEPEND=""
421 -if [[ -n $CTARGET && ${CTARGET} != ${CHOST} ]]; then
422 - DEPEND=">=cross-${CTARGET}/binutils-2.21.51.0.7"
423 - SLOT="${CTARGET}"
424 -else
425 - DEPEND="virtual/os-headers app-misc/pax-utils"
426 - SLOT="0"
427 -fi
428 +DEPEND=""
429
430 S=${WORKDIR}/${MY_P}
431
432 -alt_build_kprefix() {
433 - if [[ ${CBUILD} == ${CHOST} && ${CTARGET} == ${CHOST} ]] \
434 - || [[ -n ${UCLIBC_AND_GLIBC} ]]
435 - then
436 - echo /usr/include
437 - else
438 - echo /usr/${CTARGET}/usr/include
439 - fi
440 -}
441 -
442 -just_headers() {
443 - use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
444 -}
445 -
446 -uclibc_endian() {
447 - # XXX: this wont work for a toolchain which is bi-endian, but we
448 - # dont have any such thing at the moment, so not a big deal
449 - touch "${T}"/endian.s
450 - $(tc-getAS ${CTARGET}) "${T}"/endian.s -o "${T}"/endian.o
451 - case $(file "${T}"/endian.o) in
452 - *" MSB "*) echo "big";;
453 - *" LSB "*) echo "little";;
454 - *) echo "NFC";;
455 - esac
456 - rm -f "${T}"/endian.{s,o}
457 -}
458 -
459 -pkg_setup() {
460 - just_headers && return 0
461 - has_version ${CATEGORY}/uclibc || return 0
462 - [[ -n ${UCLIBC_AND_GLIBC} ]] && return 0
463 - [[ ${ROOT} != "/" ]] && return 0
464 - [[ ${CATEGORY} == cross-* ]] && return 0
465 -
466 -}
467 -
468 -PIE_STABLE="arm mips ppc x86"
469 -
470 -CPU_ALPHA=""
471 -CPU_AMD64=""
472 -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}}"
473 -CPU_IA64=""
474 -CPU_M68K=""
475 -CPU_MIPS="MIPS_ISA_{1,2,3,4,MIPS{32{,R2},64}} MIPS_{N64,O32,N32}_ABI"
476 -CPU_PPC=""
477 -CPU_SH="SH{2,2A,3,4,5}"
478 -CPU_SPARC="SPARC_V{7,8,9,9B}"
479 -CPU_X86="GENERIC_386 {3,4,5,6}86 586MMX PENTIUM{II,III,4} K{6,7} ELAN CRUSOE WINCHIP{C6,2} CYRIXIII NEHEMIAH"
480 -IUSE_UCLIBC_CPU="${CPU_ARM} ${CPU_MIPS} ${CPU_PPC} ${CPU_SH} ${CPU_SPARC} ${CPU_X86}"
481 -
482 -check_cpu_opts() {
483 - local cpu_var="CPU_$(echo $(tc-arch) | tr [a-z] [A-Z])"
484 - [[ -z ${!cpu_var} ]] && return 0
485 -
486 - if [[ -z ${UCLIBC_CPU} ]] ; then
487 - ewarn "You really should consider setting UCLIBC_CPU"
488 - ewarn "Otherwise, the build will be generic (read: slow)."
489 - ewarn "Available CPU options:"
490 - UCLIBC_CPU=$(eval echo ${!cpu_var})
491 - echo ${UCLIBC_CPU}
492 - case ${CTARGET} in
493 - mips[1234]*) export UCLIBC_CPU="MIPS_ISA_${CTARGET:4:1}";;
494 - sh[2345]*) export UCLIBC_CPU="SH${CTARGET:2:1}";;
495 - i[456]86*) export UCLIBC_CPU="${CTARGET:1:1}86";;
496 - *) export UCLIBC_CPU=${UCLIBC_CPU%% *};;
497 - esac
498 - else
499 - local cpu found=0
500 - for cpu in $(eval echo ${!cpu_var}) ; do
501 - [[ ${UCLIBC_CPU} == "${cpu}" ]] && found=1 && break
502 - done
503 - if [[ ${found} -eq 0 ]] ; then
504 - ewarn "UCLIBC_CPU choice '${UCLIBC_CPU}' not supported"
505 - ewarn "Valid choices:"
506 - eval echo ${!cpu_var}
507 - die "pick a supported cpu type"
508 - fi
509 - fi
510 -}
511 -
512 -set_opt() {
513 - sed -i -e "/^\# $1 is not set/d" -e "/^$1=.*/d" .config
514 - echo "$1=$2" >> .config
515 -}
516 -get_opt() {
517 - (
518 - unset $1
519 - . ${2:-"${S}"/.config}
520 - echo ${!1}
521 - )
522 -}
523 -
524 -src_unpack() {
525 - [[ -n ${ESVN_REPO_URI} ]] \
526 - && subversion_src_unpack \
527 - || unpack ${A}
528 - cd "${S}"
529 -
530 - check_cpu_opts
531 -
532 - echo
533 - einfo "Runtime Prefix: /"
534 - einfo "Devel Prefix: /usr"
535 - einfo "Kernel Prefix: $(alt_build_kprefix)"
536 - einfo "CBUILD: ${CBUILD}"
537 - einfo "CHOST: ${CHOST}"
538 - einfo "CTARGET: ${CTARGET}"
539 - einfo "CPU: ${UCLIBC_CPU:-default}"
540 - einfo "ENDIAN: $(uclibc_endian)"
541 - echo
542 -
543 - ########## PATCHES ##########
544 -
545 - [[ -n ${SVN_VER} ]] && \
546 - epatch "${WORKDIR}"/${MY_P}-cvs-update-${SVN_VER}.patch
547 -
548 - if [[ -n ${PATCH_VER} ]] ; then
549 - unpack ${MY_P}-patches-${PATCH_VER}.tar.bz2
550 - EPATCH_SUFFIX="patch"
551 - epatch "${WORKDIR}"/patch
552 - fi
553 -
554 +src_prepare() {
555 epatch "${FILESDIR}"/${P}-BJA-sandbox.patch
556 epatch "${FILESDIR}"/${P}-fix_epoll.patch
557 +}
558
559 - ########## CPU SELECTION ##########
560 -
561 - local target config_target
562 - case $(tc-arch) in
563 - alpha) target="alpha"; config_target="no cpu-specific options";;
564 - amd64) target="x86_64"; config_target="no cpu-specific options";;
565 - arm) target="arm"; config_target="GENERIC_ARM";;
566 - avr) target="avr32"; config_target="no cpu-specific options";;
567 - ia64) target="ia64"; config_target="no cpu-specific options";;
568 - m68k) target="m68k"; config_target="no cpu-specific options";;
569 - mips) target="mips"; config_target="MIPS_ISA_1";;
570 - ppc) target="powerpc"; config_target="no cpu-specific options";;
571 - sh) target="sh"; config_target="SH4";;
572 - sparc) target="sparc"; config_target="no cpu-specific options";;
573 - x86) target="i386"; config_target="GENERIC_386";;
574 - *) die "$(tc-arch) lists no defaults :/";;
575 - esac
576 - sed -i -e "s:default CONFIG_${config_target}:default CONFIG_${UCLIBC_CPU:-${config_target}}:" \
577 - extra/Configs/Config.${target}
578 - sed -i -e "s:^HOSTCC.*=.*:HOSTCC=$(tc-getBUILD_CC):" Rules.mak
579 -
580 - ########## CONFIG SETUP ##########
581 -
582 - make ARCH=${target} defconfig >/dev/null || die "could not config"
583 -
584 - for def in DO{DEBUG{,_PT},ASSERTS} SUPPORT_LD_DEBUG{,_EARLY} UCLIBC_HAS_PROFILING; do
585 - sed -i -e "s:${def}=y:# ${def} is not set:" .config
586 - done
587 - if use debug ; then
588 - set_opt SUPPORT_LD_DEBUG y
589 - set_opt DODEBUG y
590 - fi
591 -
592 - sed -i -e '/ARCH_.*_ENDIAN/d' .config
593 - set_opt "ARCH_WANTS_$(uclibc_endian | tr [a-z] [A-Z])_ENDIAN" y
594 -
595 - if [[ $(tc-is-softfloat) != "no" ]] ; then
596 - set_opt UCLIBC_HAS_FPU n
597 - fi
598 -
599 - if [[ ${CTARGET/eabi} != ${CTARGET} ]] ; then
600 - set_opt CONFIG_ARM_OABI n
601 - set_opt CONFIG_ARM_EABI y
602 - fi
603 -
604 - local moredefs="COMPAT_ATEXIT"
605 - local compat_sym=atexit
606 -
607 - # We need todo this for a few months. .30 is a major upgrade.
608 - # Don't do it from cross-compiling case though
609 - if ! use uclibc-compat ; then
610 - if [[ -z ${UCLIBC_AND_GLIBC} ]] && [[ -z ${UCLIBC_SCANNED_COMPAT} ]] && \
611 - ! just_headers && [[ ${CHOST} == ${CTARGET} ]] ; then
612 - local fnames=""
613 - einfo "Doing a scanelf in paths for bins containing the ${compat_sym} symbol"
614 - fnames=$(scanelf -pyqs${compat_sym} -F%F#s)
615 - if [[ -z ${fnames} ]] ; then
616 - einfo "This system is clean."
617 - einfo "To prevent the scanning of files again in the future you can export UCLIBC_SCANNED_COMPAT=1"
618 - moredefs=""
619 - else
620 - ewarn "You need to remerge the packages that contain the following files before you can remerge ${P} without USE=uclibc-compat enabled."
621 - ewarn "qfile -Cq $(echo ${fnames}) | sort | uniq"
622 - echo
623 - ewarn "Leaving on ${moredefs}"
624 - fi
625 - else
626 - moredefs=""
627 - fi
628 - fi
629 - 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
630 - set_opt "${def}" y
631 - done
632 - set_opt UCLIBC_HAS_CTYPE_UNSAFE n
633 - set_opt UCLIBC_HAS_LOCALE n
634 - set_opt HAS_NO_THREADS n
635 -
636 - use nptl && set_opt LINUXTHREADS_NEW y
637 -
638 - use ipv6 && set_opt UCLIBC_HAS_IPV6 y
639 -
640 - use wordexp && set_opt UCLIBC_HAS_WORDEXP y
641 -
642 - # we need to do it independently of hardened to get ssp.c built into libc
643 - set_opt UCLIBC_HAS_SSP y
644 - set_opt UCLIBC_HAS_SSP_COMPAT y
645 - set_opt UCLIBC_HAS_ARC4RANDOM y
646 - set_opt PROPOLICE_BLOCK_ABRT n
647 - set_opt PROPOLICE_BLOCK_SEGV y
648 -
649 - # arm/mips do not emit PT_GNU_STACK, but if we enable this here
650 - # it will be emitted as RWE, ppc has to be checked, x86 needs it
651 - # this option should be used independently of hardened
652 - if has $(tc-arch) x86 || has $(tc-arch) ppc; then
653 - set_opt UCLIBC_BUILD_NOEXECSTACK y
654 - else
655 - set_opt UCLIBC_BUILD_NOEXECSTACK n
656 - fi
657 - set_opt UCLIBC_BUILD_RELRO y
658 - if use hardened ; then
659 - if has $(tc-arch) ${PIE_STABLE} ; then
660 - set_opt UCLIBC_BUILD_PIE y
661 - else
662 - set_opt UCLIBC_BUILD_PIE n
663 - fi
664 - set_opt UCLIBC_BUILD_NOW y
665 - use ssp && {
666 - set_opt SSP_QUICK_CANARY n
667 - set_opt UCLIBC_BUILD_SSP y
668 - }
669 - else
670 - set_opt UCLIBC_BUILD_PIE n
671 - set_opt SSP_QUICK_CANARY y
672 - set_opt UCLIBC_BUILD_SSP n
673 - set_opt UCLIBC_BUILD_NOW n
674 - fi
675 -
676 - restore_config .config
677 -
678 - # setup build and run paths
679 - local cross=${CTARGET}-
680 - type -p ${cross}ar > /dev/null || cross=""
681 - sed -i \
682 - -e "/^CROSS_COMPILER_PREFIX/s:=.*:=\"${cross}\":" \
683 - -e "/^KERNEL_HEADERS/s:=.*:=\"$(alt_build_kprefix)\":" \
684 - -e "/^SHARED_LIB_LOADER_PREFIX/s:=.*:=\"/$(get_libdir)\":" \
685 - -e "/^DEVEL_PREFIX/s:=.*:=\"/usr\":" \
686 - -e "/^RUNTIME_PREFIX/s:=.*:=\"/\":" \
687 - -e "/^UCLIBC_EXTRA_CFLAGS/s:=.*:=\"${UCLIBC_EXTRA_CFLAGS}\":" \
688 - .config || die
689 -
690 +src_configure() {
691 + cp $"{FILESDIR}"/uclibc.config .config
692 yes "" 2> /dev/null | make -s oldconfig > /dev/null || die "could not make oldconfig"
693 -
694 - cp .config myconfig
695 -
696 - emake -s clean > /dev/null || die "could not clean"
697 }
698
699 src_compile() {
700 - cp myconfig .config
701 -
702 emake headers || die "make headers failed"
703 - just_headers && return 0
704 -
705 emake || die "make failed"
706 - if [[ ${CTARGET} != ${CHOST} ]] ; then
707 - emake -C utils hostutils || die "make hostutils failed"
708 - elif [[ ${CHOST} == *-uclibc* ]] ; then
709 - emake utils || die "make utils failed"
710 - fi
711 -}
712 -
713 -src_test() {
714 - [[ ${CHOST} != ${CTARGET} ]] && return 0
715 - [[ ${CBUILD} != ${CHOST} ]] && return 0
716 -
717 - # assert test fails on pax/grsec enabled kernels - normal
718 - # vfork test fails in sandbox (both glibc/uclibc)
719 - make UCLIBC_ONLY=1 check || die "test failed"
720 + emake utils || die "make utils failed"
721 }
722
723 src_install() {
724 - local sysroot=${D}
725 - [[ ${CHOST} != ${CTARGET} ]] && sysroot="${sysroot}/usr/${CTARGET}"
726 -
727 - local target="install"
728 - just_headers && target="install_headers"
729 - emake DESTDIR="${sysroot}" ${target} || die "install failed"
730 -
731 - save_config .config
732 + emake DESTDIR="${D}" install || die "install failed"
733
734 # remove files coming from kernel-headers
735 - rm -rf "${sysroot}"/usr/include/{linux,asm*}
736 -
737 - # Make sure we install the sys-include symlink so that when
738 - # we build a 2nd stage cross-compiler, gcc finds the target
739 - # system headers correctly. See gcc/doc/gccinstall.info
740 - if [[ ${CTARGET} != ${CHOST} ]] ; then
741 - dosym usr/include /usr/${CTARGET}/sys-include
742 - if ! just_headers && [[ -n $(get_opt HAVE_SHARED) ]] ; then
743 - newbin utils/ldconfig.host ${CTARGET}-ldconfig || die
744 - newbin utils/ldd.host ${CTARGET}-ldd || die
745 - fi
746 - return 0
747 - fi
748 -
749 - if [[ ${CHOST} == *-uclibc* ]] ; then
750 - emake DESTDIR="${D}" install_utils || die "install-utils failed"
751 - dobin extra/scripts/getent
752 - fi
753 + rm -rf "${D}"/usr/include/{linux,asm*}
754
755 + emake DESTDIR="${D}" install_utils || die "install-utils failed"
756 + dobin extra/scripts/getent
757 dodoc Changelog* README TODO docs/*.txt DEDICATION.mjn3
758 }
759
760 pkg_postinst() {
761 - [[ ${CTARGET} != ${CHOST} ]] && return 0
762 - [[ ${CHOST} != *-uclibc* ]] && return 0
763 -
764 - if [[ ! -e ${ROOT}/etc/TZ ]] ; then
765 - ewarn "Please remember to set your timezone in /etc/TZ"
766 - [[ ! -d ${ROOT}/etc ]] && mkdir -p "${ROOT}"/etc
767 - echo "UTC" > "${ROOT}"/etc/TZ
768 - fi
769 - [[ ${ROOT} != "/" ]] && return 0
770 - # update cache before reloading init
771 + echo "UTC" > "${ROOT}"/etc/TZ
772 /sbin/ldconfig
773 - # reload init ...
774 [[ -x /sbin/telinit ]] && /sbin/telinit U &> /dev/null
775 }