Gentoo Archives: gentoo-commits

From: "Diego Petteno (flameeyes)" <flameeyes@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-libs/glibc: ChangeLog glibc-2.12.1-r3.ebuild glibc-2.11.2-r3.ebuild
Date: Sun, 31 Oct 2010 21:02:39
Message-Id: 20101031210234.0D71D20051@flycatcher.gentoo.org
1 flameeyes 10/10/31 21:02:34
2
3 Modified: ChangeLog
4 Added: glibc-2.12.1-r3.ebuild glibc-2.11.2-r3.ebuild
5 Log:
6 Bump glibc version to fully cover the recent security issues.
7
8 (Portage version: 2.2.0_alpha2/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.727 sys-libs/glibc/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/glibc/ChangeLog?rev=1.727&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/glibc/ChangeLog?rev=1.727&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/glibc/ChangeLog?r1=1.726&r2=1.727
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/sys-libs/glibc/ChangeLog,v
20 retrieving revision 1.726
21 retrieving revision 1.727
22 diff -u -r1.726 -r1.727
23 --- ChangeLog 30 Oct 2010 10:03:24 -0000 1.726
24 +++ ChangeLog 31 Oct 2010 21:02:33 -0000 1.727
25 @@ -1,6 +1,13 @@
26 # ChangeLog for sys-libs/glibc
27 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/ChangeLog,v 1.726 2010/10/30 10:03:24 maekke Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/ChangeLog,v 1.727 2010/10/31 21:02:33 flameeyes Exp $
30 +
31 +*glibc-2.12.1-r3 (31 Oct 2010)
32 +*glibc-2.11.2-r3 (31 Oct 2010)
33 +
34 + 31 Oct 2010; Diego E. Pettenò <flameeyes@g.o>
35 + +glibc-2.11.2-r3.ebuild, +glibc-2.12.1-r3.ebuild:
36 + Bump glibc version to fully cover the recent security issues.
37
38 30 Oct 2010; Markus Meier <maekke@g.o> glibc-2.11.2-r2.ebuild:
39 x86 stable, bug #341755
40
41
42
43 1.1 sys-libs/glibc/glibc-2.12.1-r3.ebuild
44
45 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/glibc/glibc-2.12.1-r3.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/glibc/glibc-2.12.1-r3.ebuild?rev=1.1&content-type=text/plain
47
48 Index: glibc-2.12.1-r3.ebuild
49 ===================================================================
50 # Copyright 1999-2010 Gentoo Foundation
51 # Distributed under the terms of the GNU General Public License v2
52 # $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.12.1-r3.ebuild,v 1.1 2010/10/31 21:02:33 flameeyes Exp $
53
54 inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib
55
56 DESCRIPTION="GNU libc6 (also called glibc2) C library"
57 HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
58
59 LICENSE="LGPL-2"
60 KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
61 RESTRICT="strip" # strip ourself #46186
62 EMULTILIB_PKG="true"
63
64 # Configuration variables
65 if [[ ${PV} == *_p* ]] ; then
66 RELEASE_VER=${PV%_p*}
67 BRANCH_UPDATE=""
68 SNAP_VER=${PV#*_p}
69 else
70 RELEASE_VER=${PV}
71 BRANCH_UPDATE=""
72 SNAP_VER=""
73 fi
74 MANPAGE_VER="" # pregenerated manpages
75 INFOPAGE_VER="" # pregenerated infopages
76 LIBIDN_VER="" # it's integrated into the main tarball now
77 PATCH_VER="6" # Gentoo patchset
78 PORTS_VER= #${RELEASE_VER%.?} # version of glibc ports addon
79 LT_VER="" # version of linuxthreads addon
80 NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.9"} # min kernel version nptl requires
81 #LT_KERN_VER=${LT_KERN_VER:-"2.4.1"} # min kernel version linuxthreads requires
82
83 IUSE="debug gd glibc-omitfp hardened multilib nls selinux profile vanilla crosscompile_opts_headers-only ${LT_VER:+glibc-compat20 nptl nptlonly}"
84 S=${WORKDIR}/glibc-${RELEASE_VER}${SNAP_VER:+-${SNAP_VER}}
85
86 # Here's how the cross-compile logic breaks down ...
87 # CTARGET - machine that will target the binaries
88 # CHOST - machine that will host the binaries
89 # CBUILD - machine that will build the binaries
90 # If CTARGET != CHOST, it means you want a libc for cross-compiling.
91 # If CHOST != CBUILD, it means you want to cross-compile the libc.
92 # CBUILD = CHOST = CTARGET - native build/install
93 # CBUILD != (CHOST = CTARGET) - cross-compile a native build
94 # (CBUILD = CHOST) != CTARGET - libc for cross-compiler
95 # CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
96 # For install paths:
97 # CHOST = CTARGET - install into /
98 # CHOST != CTARGET - install into /usr/CTARGET/
99
100 export CBUILD=${CBUILD:-${CHOST}}
101 export CTARGET=${CTARGET:-${CHOST}}
102 if [[ ${CTARGET} == ${CHOST} ]] ; then
103 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
104 export CTARGET=${CATEGORY/cross-}
105 fi
106 fi
107
108 [[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.9/2.6.20}
109
110 is_crosscompile() {
111 [[ ${CHOST} != ${CTARGET} ]]
112 }
113 alt_libdir() {
114 if is_crosscompile ; then
115 echo /usr/${CTARGET}/$(get_libdir)
116 else
117 echo /$(get_libdir)
118 fi
119 }
120
121 if is_crosscompile ; then
122 SLOT="${CTARGET}-2.2"
123 else
124 # Why SLOT 2.2 you ask yourself while sippin your tea ?
125 # Everyone knows 2.2 > 0, duh.
126 SLOT="2.2"
127 PROVIDE="virtual/libc"
128 fi
129
130 # General: We need a new-enough binutils for as-needed
131 # arch: we need to make sure our binutils/gcc supports TLS
132 DEPEND=">=sys-devel/gcc-3.4.4
133 arm? ( >=sys-devel/binutils-2.16.90 >=sys-devel/gcc-4.1.0 )
134 x86? ( >=sys-devel/gcc-4.3 )
135 amd64? ( >=sys-devel/binutils-2.19 >=sys-devel/gcc-4.3 )
136 ppc? ( >=sys-devel/gcc-4.1.0 )
137 ppc64? ( >=sys-devel/gcc-4.1.0 )
138 >=sys-devel/binutils-2.15.94
139 ${LT_VER:+nptl? (} >=sys-kernel/linux-headers-${NPTL_KERN_VER} ${LT_VER:+)}
140 >=sys-devel/gcc-config-1.3.12
141 >=app-misc/pax-utils-0.1.10
142 virtual/os-headers
143 nls? ( sys-devel/gettext )
144 >=sys-apps/sandbox-1.2.18.1-r2
145 !<sys-apps/portage-2.1.2
146 selinux? ( sys-libs/libselinux )"
147 RDEPEND="!sys-kernel/ps3-sources
148 nls? ( sys-devel/gettext )
149 selinux? ( sys-libs/libselinux )"
150
151 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
152 DEPEND="${DEPEND} !crosscompile_opts_headers-only? ( ${CATEGORY}/gcc )"
153 [[ ${CATEGORY} == *-linux* ]] && DEPEND="${DEPEND} ${CATEGORY}/linux-headers"
154 else
155 DEPEND="${DEPEND} !vanilla? ( >=sys-libs/timezone-data-2007c )"
156 RDEPEND="${RDEPEND}
157 vanilla? ( !sys-libs/timezone-data )
158 !vanilla? ( sys-libs/timezone-data )"
159 fi
160
161 SRC_URI=$(
162 upstream_uris() {
163 echo mirror://gnu/glibc/$1 ftp://sources.redhat.com/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
164 }
165 gentoo_uris() {
166 local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
167 devspace=${devspace//HTTP/http://dev.gentoo.org/}
168 echo mirror://gentoo/$1 ${devspace//URI/$1}
169 }
170
171 TARNAME=${PN}
172 if [[ -n ${SNAP_VER} ]] ; then
173 TARNAME="${PN}-${RELEASE_VER}"
174 [[ -n ${PORTS_VER} ]] && PORTS_VER=${SNAP_VER}
175 upstream_uris ${TARNAME}-${SNAP_VER}.tar.bz2
176 else
177 upstream_uris ${TARNAME}-${RELEASE_VER}.tar.bz2
178 fi
179 [[ -n ${LIBIDN_VER} ]] && upstream_uris glibc-libidn-${LIBIDN_VER}.tar.bz2
180 [[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.bz2
181 [[ -n ${LT_VER} ]] && upstream_uris ${TARNAME}-linuxthreads-${LT_VER}.tar.bz2
182 [[ -n ${BRANCH_UPDATE} ]] && gentoo_uris glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
183 [[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
184 [[ -n ${MANPAGE_VER} ]] && gentoo_uris glibc-manpages-${MANPAGE_VER}.tar.bz2
185 [[ -n ${INFOPAGE_VER} ]] && gentoo_uris glibc-infopages-${INFOPAGE_VER}.tar.bz2
186 )
187
188 # eblit-include [--skip] <function> [version]
189 eblit-include() {
190 local skipable=false
191 [[ $1 == "--skip" ]] && skipable=true && shift
192 [[ $1 == pkg_* ]] && skipable=true
193
194 local e v func=$1 ver=$2
195 [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
196 for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
197 e="${FILESDIR}/eblits/${func}${v}.eblit"
198 if [[ -e ${e} ]] ; then
199 source "${e}"
200 return 0
201 fi
202 done
203 ${skipable} && return 0
204 die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
205 }
206
207 # eblit-run-maybe <function>
208 # run the specified function if it is defined
209 eblit-run-maybe() {
210 [[ $(type -t "$@") == "function" ]] && "$@"
211 }
212
213 # eblit-run <function> [version]
214 # aka: src_unpack() { eblit-run src_unpack ; }
215 eblit-run() {
216 eblit-include --skip common "${*:2}"
217 eblit-include "$@"
218 eblit-run-maybe eblit-$1-pre
219 eblit-${PN}-$1
220 eblit-run-maybe eblit-$1-post
221 }
222
223 src_unpack() { eblit-run src_unpack ; }
224 src_compile() { eblit-run src_compile ; }
225 src_test() { eblit-run src_test ; }
226 src_install() { eblit-run src_install ; }
227
228 # FILESDIR might not be available during binpkg install
229 for x in setup {pre,post}inst ; do
230 e="${FILESDIR}/eblits/pkg_${x}.eblit"
231 if [[ -e ${e} ]] ; then
232 . "${e}"
233 eval "pkg_${x}() { eblit-run pkg_${x} ; }"
234 fi
235 done
236
237 pkg_setup() {
238 eblit-run pkg_setup
239
240 # Static binary sanity check #332927
241 if [[ ${ROOT} == "/" ]] && \
242 has_version "<${CATEGORY}/${P}" && \
243 built_with_use sys-apps/coreutils static
244 then
245 eerror "Please rebuild coreutils with USE=-static, then install"
246 eerror "glibc, then you may rebuild coreutils with USE=static."
247 die "Avoiding system meltdown #332927"
248 fi
249 }
250
251 eblit-src_unpack-post() {
252 if use hardened ; then
253 cd "${S}"
254 einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
255 gcc-specs-pie && epatch "${FILESDIR}"/2.12/glibc-2.12-hardened-pie.patch
256 epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
257 epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
258
259 einfo "Patching Glibc to support older SSP __guard"
260 epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-ssp-compat.patch
261
262 einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
263 cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
264 debug/stack_chk_fail.c || die
265 cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
266 debug/chk_fail.c || die
267
268 if use debug ; then
269 # When using Hardened Gentoo stack handler, have smashes dump core for
270 # analysis - debug only, as core could be an information leak
271 # (paranoia).
272 sed -i \
273 -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
274 debug/Makefile \
275 || die "Failed to modify debug/Makefile for debug stack handler"
276 sed -i \
277 -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
278 debug/Makefile \
279 || die "Failed to modify debug/Makefile for debug fortify handler"
280 fi
281
282 # Build nscd with ssp-all
283 sed -i \
284 -e 's:-fstack-protector$:-fstack-protector-all:' \
285 nscd/Makefile \
286 || die "Failed to ensure nscd builds with ssp-all"
287 fi
288 }
289
290 maint_pkg_create() {
291 local base="/usr/local/src/gnu/glibc/glibc-${PV:0:1}_${PV:2:1}"
292 cd ${base}
293 local stamp=$(date +%Y%m%d)
294 local d
295 for d in libc ports ; do
296 #(cd ${d} && cvs up)
297 case ${d} in
298 libc) tarball="${P}";;
299 ports) tarball="${PN}-ports-${PV}";;
300 esac
301 rm -f ${tarball}*
302 ln -sf ${d} ${tarball}
303 tar hcf - ${tarball} --exclude-vcs | lzma > "${T}"/${tarball}.tar.lzma
304 du -b "${T}"/${tarball}.tar.lzma
305 done
306 }
307
308
309
310 1.1 sys-libs/glibc/glibc-2.11.2-r3.ebuild
311
312 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/glibc/glibc-2.11.2-r3.ebuild?rev=1.1&view=markup
313 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/glibc/glibc-2.11.2-r3.ebuild?rev=1.1&content-type=text/plain
314
315 Index: glibc-2.11.2-r3.ebuild
316 ===================================================================
317 # Copyright 1999-2010 Gentoo Foundation
318 # Distributed under the terms of the GNU General Public License v2
319 # $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.11.2-r3.ebuild,v 1.1 2010/10/31 21:02:33 flameeyes Exp $
320
321 inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib
322
323 DESCRIPTION="GNU libc6 (also called glibc2) C library"
324 HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
325
326 LICENSE="LGPL-2"
327 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
328 RESTRICT="strip" # strip ourself #46186
329 EMULTILIB_PKG="true"
330
331 # Configuration variables
332 if [[ ${PV} == *_p* ]] ; then
333 RELEASE_VER=${PV%_p*}
334 BRANCH_UPDATE=""
335 SNAP_VER=${PV#*_p}
336 else
337 RELEASE_VER=${PV}
338 BRANCH_UPDATE=""
339 SNAP_VER=""
340 fi
341 MANPAGE_VER="" # pregenerated manpages
342 INFOPAGE_VER="" # pregenerated infopages
343 LIBIDN_VER="" # it's integrated into the main tarball now
344 PATCH_VER="6" # Gentoo patchset
345 PORTS_VER=${RELEASE_VER%.?} # version of glibc ports addon
346 LT_VER="" # version of linuxthreads addon
347 NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.9"} # min kernel version nptl requires
348 #LT_KERN_VER=${LT_KERN_VER:-"2.4.1"} # min kernel version linuxthreads requires
349
350 IUSE="debug gd glibc-omitfp hardened multilib nls selinux profile vanilla crosscompile_opts_headers-only ${LT_VER:+glibc-compat20 nptl nptlonly}"
351 S=${WORKDIR}/glibc-${RELEASE_VER}${SNAP_VER:+-${SNAP_VER}}
352
353 # Here's how the cross-compile logic breaks down ...
354 # CTARGET - machine that will target the binaries
355 # CHOST - machine that will host the binaries
356 # CBUILD - machine that will build the binaries
357 # If CTARGET != CHOST, it means you want a libc for cross-compiling.
358 # If CHOST != CBUILD, it means you want to cross-compile the libc.
359 # CBUILD = CHOST = CTARGET - native build/install
360 # CBUILD != (CHOST = CTARGET) - cross-compile a native build
361 # (CBUILD = CHOST) != CTARGET - libc for cross-compiler
362 # CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
363 # For install paths:
364 # CHOST = CTARGET - install into /
365 # CHOST != CTARGET - install into /usr/CTARGET/
366
367 export CBUILD=${CBUILD:-${CHOST}}
368 export CTARGET=${CTARGET:-${CHOST}}
369 if [[ ${CTARGET} == ${CHOST} ]] ; then
370 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
371 export CTARGET=${CATEGORY/cross-}
372 fi
373 fi
374
375 [[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.9/2.6.20}
376
377 is_crosscompile() {
378 [[ ${CHOST} != ${CTARGET} ]]
379 }
380 alt_libdir() {
381 if is_crosscompile ; then
382 echo /usr/${CTARGET}/$(get_libdir)
383 else
384 echo /$(get_libdir)
385 fi
386 }
387
388 if is_crosscompile ; then
389 SLOT="${CTARGET}-2.2"
390 else
391 # Why SLOT 2.2 you ask yourself while sippin your tea ?
392 # Everyone knows 2.2 > 0, duh.
393 SLOT="2.2"
394 PROVIDE="virtual/libc"
395 fi
396
397 # General: We need a new-enough binutils for as-needed
398 # arch: we need to make sure our binutils/gcc supports TLS
399 DEPEND=">=sys-devel/gcc-3.4.4
400 arm? ( >=sys-devel/binutils-2.16.90 >=sys-devel/gcc-4.1.0 )
401 x86? ( >=sys-devel/gcc-4.3 )
402 amd64? ( >=sys-devel/binutils-2.19 >=sys-devel/gcc-4.3 )
403 ppc? ( >=sys-devel/gcc-4.1.0 )
404 ppc64? ( >=sys-devel/gcc-4.1.0 )
405 >=sys-devel/binutils-2.15.94
406 ${LT_VER:+nptl? (} >=sys-kernel/linux-headers-${NPTL_KERN_VER} ${LT_VER:+)}
407 >=sys-devel/gcc-config-1.3.12
408 >=app-misc/pax-utils-0.1.10
409 virtual/os-headers
410 nls? ( sys-devel/gettext )
411 >=sys-apps/sandbox-1.2.18.1-r2
412 !<sys-apps/portage-2.1.2
413 selinux? ( sys-libs/libselinux )"
414 RDEPEND="!sys-kernel/ps3-sources
415 nls? ( sys-devel/gettext )
416 selinux? ( sys-libs/libselinux )"
417
418 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
419 DEPEND="${DEPEND} !crosscompile_opts_headers-only? ( ${CATEGORY}/gcc )"
420 [[ ${CATEGORY} == *-linux* ]] && DEPEND="${DEPEND} ${CATEGORY}/linux-headers"
421 else
422 DEPEND="${DEPEND} !vanilla? ( >=sys-libs/timezone-data-2007c )"
423 RDEPEND="${RDEPEND}
424 vanilla? ( !sys-libs/timezone-data )
425 !vanilla? ( sys-libs/timezone-data )"
426 fi
427
428 SRC_URI=$(
429 upstream_uris() {
430 echo mirror://gnu/glibc/$1 ftp://sources.redhat.com/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
431 }
432 gentoo_uris() {
433 local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
434 devspace=${devspace//HTTP/http://dev.gentoo.org/}
435 echo mirror://gentoo/$1 ${devspace//URI/$1}
436 }
437
438 TARNAME=${PN}
439 if [[ -n ${SNAP_VER} ]] ; then
440 TARNAME="${PN}-${RELEASE_VER}"
441 [[ -n ${PORTS_VER} ]] && PORTS_VER=${SNAP_VER}
442 upstream_uris ${TARNAME}-${SNAP_VER}.tar.bz2
443 else
444 upstream_uris ${TARNAME}-${RELEASE_VER}.tar.bz2
445 fi
446 [[ -n ${LIBIDN_VER} ]] && upstream_uris glibc-libidn-${LIBIDN_VER}.tar.bz2
447 [[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.bz2
448 [[ -n ${LT_VER} ]] && upstream_uris ${TARNAME}-linuxthreads-${LT_VER}.tar.bz2
449 [[ -n ${BRANCH_UPDATE} ]] && gentoo_uris glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
450 [[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
451 [[ -n ${MANPAGE_VER} ]] && gentoo_uris glibc-manpages-${MANPAGE_VER}.tar.bz2
452 [[ -n ${INFOPAGE_VER} ]] && gentoo_uris glibc-infopages-${INFOPAGE_VER}.tar.bz2
453 )
454
455 # eblit-include [--skip] <function> [version]
456 eblit-include() {
457 local skipable=false
458 [[ $1 == "--skip" ]] && skipable=true && shift
459 [[ $1 == pkg_* ]] && skipable=true
460
461 local e v func=$1 ver=$2
462 [[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
463 for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
464 e="${FILESDIR}/eblits/${func}${v}.eblit"
465 if [[ -e ${e} ]] ; then
466 source "${e}"
467 return 0
468 fi
469 done
470 ${skipable} && return 0
471 die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
472 }
473
474 # eblit-run-maybe <function>
475 # run the specified function if it is defined
476 eblit-run-maybe() {
477 [[ $(type -t "$@") == "function" ]] && "$@"
478 }
479
480 # eblit-run <function> [version]
481 # aka: src_unpack() { eblit-run src_unpack ; }
482 eblit-run() {
483 eblit-include --skip common "${*:2}"
484 eblit-include "$@"
485 eblit-run-maybe eblit-$1-pre
486 eblit-${PN}-$1
487 eblit-run-maybe eblit-$1-post
488 }
489
490 src_unpack() { eblit-run src_unpack ; }
491 src_compile() { eblit-run src_compile ; }
492 src_test() { eblit-run src_test ; }
493 src_install() { eblit-run src_install ; }
494
495 # FILESDIR might not be available during binpkg install
496 for x in setup {pre,post}inst ; do
497 e="${FILESDIR}/eblits/pkg_${x}.eblit"
498 if [[ -e ${e} ]] ; then
499 . "${e}"
500 eval "pkg_${x}() { eblit-run pkg_${x} ; }"
501 fi
502 done
503
504 eblit-src_unpack-post() {
505 if use hardened ; then
506 cd "${S}"
507 einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
508 gcc-specs-pie && epatch "${FILESDIR}"/2.11/glibc-2.11-hardened-pie.patch
509 epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
510 epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
511
512 einfo "Patching Glibc to support older SSP __guard"
513 epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-ssp-compat.patch
514
515 einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
516 cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
517 debug/stack_chk_fail.c || die
518 cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
519 debug/chk_fail.c || die
520
521 if use debug ; then
522 # When using Hardened Gentoo stack handler, have smashes dump core for
523 # analysis - debug only, as core could be an information leak
524 # (paranoia).
525 sed -i \
526 -e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
527 debug/Makefile \
528 || die "Failed to modify debug/Makefile for debug stack handler"
529 sed -i \
530 -e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
531 debug/Makefile \
532 || die "Failed to modify debug/Makefile for debug fortify handler"
533 fi
534
535 # Build nscd with ssp-all
536 sed -i \
537 -e 's:-fstack-protector$:-fstack-protector-all:' \
538 nscd/Makefile \
539 || die "Failed to ensure nscd builds with ssp-all"
540 fi
541 }
542
543 maint_pkg_create() {
544 local base="/usr/local/src/gnu/glibc/glibc-${PV:0:1}_${PV:2:1}"
545 cd ${base}
546 local stamp=$(date +%Y%m%d)
547 local d
548 for d in libc ports ; do
549 #(cd ${d} && cvs up)
550 case ${d} in
551 libc) tarball="${P}";;
552 ports) tarball="${PN}-ports-${PV}";;
553 esac
554 rm -f ${tarball}*
555 ln -sf ${d} ${tarball}
556 tar hcf - ${tarball} --exclude-vcs | lzma > "${T}"/${tarball}.tar.lzma
557 du -b "${T}"/${tarball}.tar.lzma
558 done
559 }