| 1 |
# Copyright 1999-2013 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.15-r2.ebuild,v 1.29 2013/02/12 15:53:08 jer Exp $
|
| 4 |
|
| 5 |
inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib unpacker multiprocessing
|
| 6 |
|
| 7 |
DESCRIPTION="GNU libc6 (also called glibc2) C library"
|
| 8 |
HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
|
| 9 |
|
| 10 |
LICENSE="LGPL-2.1+ BSD HPND inner-net"
|
| 11 |
KEYWORDS="alpha amd64 arm -hppa ia64 ~mips ppc ppc64 s390 ~sh sparc x86"
|
| 12 |
RESTRICT="strip" # strip ourself #46186
|
| 13 |
EMULTILIB_PKG="true"
|
| 14 |
|
| 15 |
# Configuration variables
|
| 16 |
RELEASE_VER=""
|
| 17 |
BRANCH_UPDATE=""
|
| 18 |
SNAP_VER=""
|
| 19 |
case ${PV} in
|
| 20 |
9999*)
|
| 21 |
EGIT_REPO_URIS=( "git://sourceware.org/git/glibc.git" "git://sourceware.org/git/glibc-ports.git" )
|
| 22 |
EGIT_SOURCEDIRS=( "${S}" "${S}/ports" )
|
| 23 |
inherit git-2
|
| 24 |
;;
|
| 25 |
*_p*)
|
| 26 |
RELEASE_VER=${PV%_p*}
|
| 27 |
SNAP_VER=${PV#*_p}
|
| 28 |
;;
|
| 29 |
*)
|
| 30 |
RELEASE_VER=${PV}
|
| 31 |
;;
|
| 32 |
esac
|
| 33 |
LIBIDN_VER="" # it's integrated into the main tarball now
|
| 34 |
PATCH_VER="21" # Gentoo patchset
|
| 35 |
PORTS_VER=${RELEASE_VER} # version of glibc ports addon
|
| 36 |
NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.9"} # min kernel version nptl requires
|
| 37 |
|
| 38 |
IUSE="debug gd hardened multilib selinux profile vanilla crosscompile_opts_headers-only"
|
| 39 |
[[ -n ${RELEASE_VER} ]] && S=${WORKDIR}/glibc-${RELEASE_VER}${SNAP_VER:+-${SNAP_VER}}
|
| 40 |
|
| 41 |
# Here's how the cross-compile logic breaks down ...
|
| 42 |
# CTARGET - machine that will target the binaries
|
| 43 |
# CHOST - machine that will host the binaries
|
| 44 |
# CBUILD - machine that will build the binaries
|
| 45 |
# If CTARGET != CHOST, it means you want a libc for cross-compiling.
|
| 46 |
# If CHOST != CBUILD, it means you want to cross-compile the libc.
|
| 47 |
# CBUILD = CHOST = CTARGET - native build/install
|
| 48 |
# CBUILD != (CHOST = CTARGET) - cross-compile a native build
|
| 49 |
# (CBUILD = CHOST) != CTARGET - libc for cross-compiler
|
| 50 |
# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler
|
| 51 |
# For install paths:
|
| 52 |
# CHOST = CTARGET - install into /
|
| 53 |
# CHOST != CTARGET - install into /usr/CTARGET/
|
| 54 |
|
| 55 |
export CBUILD=${CBUILD:-${CHOST}}
|
| 56 |
export CTARGET=${CTARGET:-${CHOST}}
|
| 57 |
if [[ ${CTARGET} == ${CHOST} ]] ; then
|
| 58 |
if [[ ${CATEGORY} == cross-* ]] ; then
|
| 59 |
export CTARGET=${CATEGORY#cross-}
|
| 60 |
fi
|
| 61 |
fi
|
| 62 |
|
| 63 |
[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.9/2.6.20}
|
| 64 |
|
| 65 |
is_crosscompile() {
|
| 66 |
[[ ${CHOST} != ${CTARGET} ]]
|
| 67 |
}
|
| 68 |
|
| 69 |
# Why SLOT 2.2 you ask yourself while sippin your tea ?
|
| 70 |
# Everyone knows 2.2 > 0, duh.
|
| 71 |
SLOT="2.2"
|
| 72 |
|
| 73 |
# General: We need a new-enough binutils for as-needed
|
| 74 |
# arch: we need to make sure our binutils/gcc supports TLS
|
| 75 |
DEPEND=">=sys-devel/gcc-3.4.4
|
| 76 |
arm? ( >=sys-devel/binutils-2.16.90 >=sys-devel/gcc-4.1.0 )
|
| 77 |
x86? ( >=sys-devel/gcc-4.3 )
|
| 78 |
amd64? ( >=sys-devel/binutils-2.19 >=sys-devel/gcc-4.3 )
|
| 79 |
ppc? ( >=sys-devel/gcc-4.1.0 )
|
| 80 |
ppc64? ( >=sys-devel/gcc-4.1.0 )
|
| 81 |
>=sys-devel/binutils-2.15.94
|
| 82 |
>=app-misc/pax-utils-0.1.10
|
| 83 |
virtual/os-headers
|
| 84 |
!<sys-apps/sandbox-1.2.18.1-r2
|
| 85 |
!<sys-apps/portage-2.1.2
|
| 86 |
!<sys-devel/patch-2.6
|
| 87 |
selinux? ( sys-libs/libselinux )"
|
| 88 |
RDEPEND="!sys-kernel/ps3-sources
|
| 89 |
selinux? ( sys-libs/libselinux )
|
| 90 |
!sys-libs/nss-db"
|
| 91 |
|
| 92 |
if [[ ${CATEGORY} == cross-* ]] ; then
|
| 93 |
DEPEND="${DEPEND} !crosscompile_opts_headers-only? ( ${CATEGORY}/gcc )"
|
| 94 |
[[ ${CATEGORY} == *-linux* ]] && DEPEND="${DEPEND} ${CATEGORY}/linux-headers"
|
| 95 |
else
|
| 96 |
DEPEND="${DEPEND} !vanilla? ( >=sys-libs/timezone-data-2007c )"
|
| 97 |
RDEPEND="${RDEPEND}
|
| 98 |
vanilla? ( !sys-libs/timezone-data )
|
| 99 |
!vanilla? ( sys-libs/timezone-data )"
|
| 100 |
fi
|
| 101 |
|
| 102 |
SRC_URI=$(
|
| 103 |
upstream_uris() {
|
| 104 |
echo mirror://gnu/glibc/$1 ftp://sourceware.org/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
|
| 105 |
}
|
| 106 |
gentoo_uris() {
|
| 107 |
local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
|
| 108 |
devspace=${devspace//HTTP/http://dev.gentoo.org/}
|
| 109 |
echo mirror://gentoo/$1 ${devspace//URI/$1}
|
| 110 |
}
|
| 111 |
|
| 112 |
TARNAME=${PN}
|
| 113 |
if [[ -n ${SNAP_VER} ]] ; then
|
| 114 |
TARNAME="${PN}-${RELEASE_VER}"
|
| 115 |
[[ -n ${PORTS_VER} ]] && PORTS_VER=${SNAP_VER}
|
| 116 |
upstream_uris ${TARNAME}-${SNAP_VER}.tar.bz2
|
| 117 |
elif [[ -z ${EGIT_REPO_URIS} ]] ; then
|
| 118 |
upstream_uris ${TARNAME}-${RELEASE_VER}.tar.xz
|
| 119 |
fi
|
| 120 |
[[ -n ${LIBIDN_VER} ]] && upstream_uris glibc-libidn-${LIBIDN_VER}.tar.bz2
|
| 121 |
[[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.xz
|
| 122 |
[[ -n ${BRANCH_UPDATE} ]] && gentoo_uris glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
|
| 123 |
[[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
|
| 124 |
)
|
| 125 |
|
| 126 |
# eblit-include [--skip] <function> [version]
|
| 127 |
eblit-include() {
|
| 128 |
local skipable=false
|
| 129 |
[[ $1 == "--skip" ]] && skipable=true && shift
|
| 130 |
[[ $1 == pkg_* ]] && skipable=true
|
| 131 |
|
| 132 |
local e v func=$1 ver=$2
|
| 133 |
[[ -z ${func} ]] && die "Usage: eblit-include <function> [version]"
|
| 134 |
for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do
|
| 135 |
e="${FILESDIR}/eblits/${func}${v}.eblit"
|
| 136 |
if [[ -e ${e} ]] ; then
|
| 137 |
source "${e}"
|
| 138 |
return 0
|
| 139 |
fi
|
| 140 |
done
|
| 141 |
${skipable} && return 0
|
| 142 |
die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/"
|
| 143 |
}
|
| 144 |
|
| 145 |
# eblit-run-maybe <function>
|
| 146 |
# run the specified function if it is defined
|
| 147 |
eblit-run-maybe() {
|
| 148 |
[[ $(type -t "$@") == "function" ]] && "$@"
|
| 149 |
}
|
| 150 |
|
| 151 |
# eblit-run <function> [version]
|
| 152 |
# aka: src_unpack() { eblit-run src_unpack ; }
|
| 153 |
eblit-run() {
|
| 154 |
eblit-include --skip common "${*:2}"
|
| 155 |
eblit-include "$@"
|
| 156 |
eblit-run-maybe eblit-$1-pre
|
| 157 |
eblit-${PN}-$1
|
| 158 |
eblit-run-maybe eblit-$1-post
|
| 159 |
}
|
| 160 |
|
| 161 |
src_unpack() { eblit-run src_unpack ; }
|
| 162 |
src_compile() { eblit-run src_compile ; }
|
| 163 |
src_test() { eblit-run src_test ; }
|
| 164 |
src_install() { eblit-run src_install ; }
|
| 165 |
|
| 166 |
# FILESDIR might not be available during binpkg install
|
| 167 |
for x in setup {pre,post}inst ; do
|
| 168 |
e="${FILESDIR}/eblits/pkg_${x}.eblit"
|
| 169 |
if [[ -e ${e} ]] ; then
|
| 170 |
. "${e}"
|
| 171 |
eval "pkg_${x}() { eblit-run pkg_${x} ; }"
|
| 172 |
fi
|
| 173 |
done
|
| 174 |
|
| 175 |
eblit-src_unpack-post() {
|
| 176 |
if use hardened ; then
|
| 177 |
cd "${S}"
|
| 178 |
einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
|
| 179 |
gcc-specs-pie && epatch "${FILESDIR}"/2.12/glibc-2.12-hardened-pie.patch
|
| 180 |
epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
|
| 181 |
epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
|
| 182 |
|
| 183 |
einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
|
| 184 |
cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
|
| 185 |
debug/stack_chk_fail.c || die
|
| 186 |
cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
|
| 187 |
debug/chk_fail.c || die
|
| 188 |
|
| 189 |
if use debug ; then
|
| 190 |
# When using Hardened Gentoo stack handler, have smashes dump core for
|
| 191 |
# analysis - debug only, as core could be an information leak
|
| 192 |
# (paranoia).
|
| 193 |
sed -i \
|
| 194 |
-e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
|
| 195 |
debug/Makefile \
|
| 196 |
|| die "Failed to modify debug/Makefile for debug stack handler"
|
| 197 |
sed -i \
|
| 198 |
-e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
|
| 199 |
debug/Makefile \
|
| 200 |
|| die "Failed to modify debug/Makefile for debug fortify handler"
|
| 201 |
fi
|
| 202 |
|
| 203 |
# Build nscd with ssp-all
|
| 204 |
sed -i \
|
| 205 |
-e 's:-fstack-protector$:-fstack-protector-all:' \
|
| 206 |
nscd/Makefile \
|
| 207 |
|| die "Failed to ensure nscd builds with ssp-all"
|
| 208 |
fi
|
| 209 |
}
|
| 210 |
|
| 211 |
eblit-pkg_preinst-post() {
|
| 212 |
if [[ ${CTARGET} == arm* ]] ; then
|
| 213 |
# Backwards compat support for renaming hardfp ldsos #417287
|
| 214 |
local oldso='/lib/ld-linux.so.3'
|
| 215 |
local nldso='/lib/ld-linux-armhf.so.3'
|
| 216 |
if [[ -e ${D}${nldso} ]] ; then
|
| 217 |
if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
|
| 218 |
ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
|
| 219 |
ewarn "Please rebuild all packages using this old ldso as compat"
|
| 220 |
ewarn "support will be dropped in the future."
|
| 221 |
ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
|
| 222 |
fi
|
| 223 |
fi
|
| 224 |
fi
|
| 225 |
}
|