|
Added
Link Here
|
| 1 |
# Copyright 1999-2004 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.3.3.20040420-r1.ebuild,v 1.7 2004/09/29 05:24:47 vapier Exp $ |
| 4 |
|
| 5 |
inherit eutils flag-o-matic gcc |
| 6 |
|
| 7 |
# Branch update support. Following will disable: |
| 8 |
# BRANCH_UPDATE= |
| 9 |
BRANCH_UPDATE="20040420" |
| 10 |
|
| 11 |
|
| 12 |
# Minimum kernel version for --enable-kernel |
| 13 |
export MIN_KV="2.4.1" |
| 14 |
# Minimum kernel version for enabling TLS and NPTL ... |
| 15 |
# NOTE: do not change this if you do not know what |
| 16 |
# you are doing ! |
| 17 |
export MIN_NPTL_KV="2.6.0" |
| 18 |
|
| 19 |
#MY_PV="${PV/_}" |
| 20 |
MY_PV="2.3.2" |
| 21 |
#S="${WORKDIR}/${P%_*}" |
| 22 |
S="${WORKDIR}/${PN}-${MY_PV}" |
| 23 |
DESCRIPTION="GNU libc6 (also called glibc2) C library" |
| 24 |
HOMEPAGE="http://www.gnu.org/software/libc/libc.html" |
| 25 |
SRC_URI="http://ftp.gnu.org/gnu/glibc/glibc-${MY_PV}.tar.bz2 |
| 26 |
ftp://sources.redhat.com/pub/glibc/snapshots/glibc-${MY_PV}.tar.bz2 |
| 27 |
http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-${MY_PV}.tar.bz2 |
| 28 |
ftp://sources.redhat.com/pub/glibc/snapshots/glibc-linuxthreads-${MY_PV}.tar.bz2 |
| 29 |
mirror://gentoo/${PN}-2.3.3-branch-update-${BRANCH_UPDATE}.patch.bz2 |
| 30 |
hppa? ( mirror://gentoo/${PN}-${MY_PV}-hppa-patches-p1.tar.bz2 )" |
| 31 |
|
| 32 |
LICENSE="LGPL-2" |
| 33 |
SLOT="2.2" |
| 34 |
#KEYWORDS="~x86 ~mips ~sparc ~amd64 -hppa ~ia64 ~ppc" # breaks on ~alpha |
| 35 |
KEYWORDS="~x86 ~ppc ~sparc" |
| 36 |
IUSE="nls pic build nptl erandom debug hardened" |
| 37 |
|
| 38 |
# We need new cleanup attribute support from gcc for NPTL among things ... |
| 39 |
DEPEND=">=sys-devel/gcc-3.2.3-r1 |
| 40 |
nptl? ( >=sys-devel/gcc-3.3.1-r1 ) |
| 41 |
>=sys-devel/binutils-2.14.90.0.6-r1 |
| 42 |
virtual/os-headers |
| 43 |
nls? ( sys-devel/gettext )" |
| 44 |
RDEPEND="virtual/os-headers |
| 45 |
sys-apps/baselayout |
| 46 |
nls? ( sys-devel/gettext )" |
| 47 |
PROVIDE="virtual/glibc virtual/libc" |
| 48 |
|
| 49 |
|
| 50 |
# Try to get a kernel source tree with version equal or greater |
| 51 |
# than $1. We basically just try a few default locations. The |
| 52 |
# version need to be that which KV_to_int() returns ... |
| 53 |
get_KHV() { |
| 54 |
local headers= |
| 55 |
|
| 56 |
[ -z "$1" ] && return 1 |
| 57 |
|
| 58 |
# - First check if linux-headers are installed (or symlink |
| 59 |
# to current kernel ...) |
| 60 |
# - Ok, do we have access to the current kernel's headers ? |
| 61 |
# - Last option ... maybe its a weird bootstrap with /lib |
| 62 |
# binded to the chroot ... |
| 63 |
|
| 64 |
# We do not really support more than 2 arguments ... |
| 65 |
if [ -n "$2" ] |
| 66 |
then |
| 67 |
headers="$2" |
| 68 |
else |
| 69 |
# Things should be pretty stable kernel side now, so try |
| 70 |
# /usr/include first, then the current kernel's headers. |
| 71 |
headers="${ROOT}/usr/include \ |
| 72 |
/lib/modules/`uname -r`/build/include \ |
| 73 |
${ROOT}/lib/modules/`uname -r`/build/include \ |
| 74 |
/usr/src/linux/include \ |
| 75 |
${ROOT}/usr/src/linux/include" |
| 76 |
fi |
| 77 |
|
| 78 |
for x in ${headers} |
| 79 |
do |
| 80 |
local header="${x}/linux/version.h" |
| 81 |
|
| 82 |
if [ -f ${header} ] |
| 83 |
then |
| 84 |
|
| 85 |
local version="`grep 'LINUX_VERSION_CODE' ${header} | \ |
| 86 |
sed -e 's:^.*LINUX_VERSION_CODE[[:space:]]*::'`" |
| 87 |
|
| 88 |
if [ "${version}" -ge "$1" ] |
| 89 |
then |
| 90 |
echo "${x}" |
| 91 |
|
| 92 |
return 0 |
| 93 |
fi |
| 94 |
fi |
| 95 |
done |
| 96 |
|
| 97 |
return 1 |
| 98 |
} |
| 99 |
|
| 100 |
use_nptl() { |
| 101 |
# Enable NPTL support if: |
| 102 |
# - We have 'nptl' in USE |
| 103 |
# - We have linux-2.5 or later kernel (should prob check for 2.4.20 ...) |
| 104 |
if use nptl && [ "`get_KV`" -ge "`KV_to_int ${MIN_NPTL_KV}`" ] |
| 105 |
then |
| 106 |
# Enable NPTL support if: |
| 107 |
# - We have 'x86' in USE and: |
| 108 |
# - a CHOST of "i486-pc-linux-gnu" |
| 109 |
# - a CHOST of "i586-pc-linux-gnu" |
| 110 |
# - a CHOST of "i686-pc-linux-gnu" |
| 111 |
# - Or we have 'alpha' in USE |
| 112 |
# - Or we have 'amd64' in USE |
| 113 |
# - Or we have 'mips' in USE |
| 114 |
# - Or we have 'ppc' in USE |
| 115 |
case ${ARCH} in |
| 116 |
"x86") |
| 117 |
if [ "${CHOST/-*}" = "i486" -o \ |
| 118 |
"${CHOST/-*}" = "i586" -o \ |
| 119 |
"${CHOST/-*}" = "i686" ] |
| 120 |
then |
| 121 |
return 0 |
| 122 |
fi |
| 123 |
;; |
| 124 |
"alpha"|"amd64"|"ia64"|"mips"|"ppc"|"sparc") |
| 125 |
return 0 |
| 126 |
;; |
| 127 |
*) |
| 128 |
return 1 |
| 129 |
;; |
| 130 |
esac |
| 131 |
fi |
| 132 |
|
| 133 |
return 1 |
| 134 |
} |
| 135 |
|
| 136 |
glibc_setup() { |
| 137 |
# Check if we are going to downgrade, we don't like that |
| 138 |
#local old_version |
| 139 |
# |
| 140 |
#old_version="`best_version glibc`" |
| 141 |
#old_version="${old_version/sys-libs\/glibc-/}" |
| 142 |
# |
| 143 |
#if [ "$old_version" ]; then |
| 144 |
# The vercmp fails if this ebuild is -r[0-9..] Please fix. |
| 145 |
# if [ `python -c "import portage; print int(portage.vercmp(\"${PV}\",\"$old_version\"))"` -lt 0 ]; then |
| 146 |
# if [ "${FORCE_DOWNGRADE}" ]; then |
| 147 |
# ewarn "downgrading glibc, still not recommended, but we'll do as you wish" |
| 148 |
# else |
| 149 |
# eerror "Downgrading glibc is not supported and we strongly recommend that" |
| 150 |
# eerror "you don't do it as it WILL break all applications compiled against" |
| 151 |
# eerror "the new version (most likely including python and portage)." |
| 152 |
# eerror "If you are REALLY sure that you want to do it set " |
| 153 |
# eerror " FORCE_DOWNGRADE=1" |
| 154 |
# eerror "when you try it again." |
| 155 |
# die "glibc downgrade" |
| 156 |
# fi |
| 157 |
# fi |
| 158 |
#fi |
| 159 |
|
| 160 |
# We need gcc 3.2 or later ... |
| 161 |
if [ "`gcc-major-version`" -ne "3" -o "`gcc-minor-version`" -lt "2" ] |
| 162 |
then |
| 163 |
echo |
| 164 |
eerror "As of glibc-2.3, gcc-3.2 or later is needed" |
| 165 |
eerror "for the build to succeed." |
| 166 |
die "GCC too old" |
| 167 |
fi |
| 168 |
|
| 169 |
echo |
| 170 |
|
| 171 |
if use_nptl |
| 172 |
then |
| 173 |
# The use_nptl should have already taken care of kernel version, |
| 174 |
# arch and CHOST, so now just check if we can find suitable kernel |
| 175 |
# source tree or headers .... |
| 176 |
einfon "Checking for sufficient version kernel headers ... " |
| 177 |
if ! get_KHV "`KV_to_int ${MIN_NPTL_KV}`" &> /dev/null |
| 178 |
then |
| 179 |
echo "no" |
| 180 |
echo |
| 181 |
eerror "Could not find a kernel source tree or headers with" |
| 182 |
eerror "version ${MIN_NPTL_KV} or later! Please correct this" |
| 183 |
eerror "and try again." |
| 184 |
die "Insufficient kernel headers present!" |
| 185 |
else |
| 186 |
echo "yes" |
| 187 |
fi |
| 188 |
fi |
| 189 |
|
| 190 |
if [ "$(KV_to_int $(uname -r))" -gt "`KV_to_int '2.5.68'`" ] |
| 191 |
then |
| 192 |
local KERNEL_HEADERS="$(get_KHV "`KV_to_int ${MIN_NPTL_KV}`")" |
| 193 |
|
| 194 |
einfon "Checking kernel headers for broken sysctl.h ... " |
| 195 |
if ! gcc -I"${KERNEL_HEADERS}" \ |
| 196 |
-c ${FILESDIR}/test-sysctl_h.c -o ${T}/test1.o &> /dev/null |
| 197 |
then |
| 198 |
echo "yes" |
| 199 |
echo |
| 200 |
eerror "Your version of:" |
| 201 |
echo |
| 202 |
eerror " ${KERNEL_HEADERS}/linux/sysctl.h" |
| 203 |
echo |
| 204 |
eerror "is broken (from a user space perspective). Please apply" |
| 205 |
eerror "the following patch:" |
| 206 |
echo |
| 207 |
eerror "*******************************************************" |
| 208 |
cat ${FILESDIR}/fix-sysctl_h.patch |
| 209 |
eerror "*******************************************************" |
| 210 |
echo |
| 211 |
einfo "To fix, just do this:" |
| 212 |
einfo "cd ${KERNEL_HEADERS}/linux/" |
| 213 |
einfo "patch -p3 < ${FILESDIR}/fix-sysctl_h.patch" |
| 214 |
echo |
| 215 |
die "Broken linux/sysctl.h header included in kernel sources!" |
| 216 |
else |
| 217 |
echo "no" |
| 218 |
fi |
| 219 |
fi |
| 220 |
|
| 221 |
if use_nptl |
| 222 |
then |
| 223 |
einfon "Checking gcc for __thread support ... " |
| 224 |
if ! gcc -c ${FILESDIR}/test-__thread.c -o ${T}/test2.o &> /dev/null |
| 225 |
then |
| 226 |
echo "no" |
| 227 |
echo |
| 228 |
eerror "Could not find a gcc that supports the __thread directive!" |
| 229 |
eerror "please update to gcc-3.2.2-r1 or later, and try again." |
| 230 |
die "No __thread support in gcc!" |
| 231 |
else |
| 232 |
echo "yes" |
| 233 |
fi |
| 234 |
|
| 235 |
elif use nptl &> /dev/null |
| 236 |
then |
| 237 |
echo |
| 238 |
# Just tell the user not to expect too much ... |
| 239 |
ewarn "You have \"nptl\" in your USE, but your kernel version or" |
| 240 |
ewarn "architecture does not support it!" |
| 241 |
fi |
| 242 |
|
| 243 |
echo |
| 244 |
} |
| 245 |
|
| 246 |
src_unpack() { |
| 247 |
|
| 248 |
local LOCAL_P="${PN}-${MY_PV}" |
| 249 |
|
| 250 |
# we only need to check this one time. Bug #61856 |
| 251 |
glibc_setup |
| 252 |
|
| 253 |
unpack glibc-${MY_PV}.tar.bz2 |
| 254 |
|
| 255 |
# Extract pre-made man pages. Otherwise we need perl, which is a no-no. |
| 256 |
mkdir -p ${S}/man; cd ${S}/man |
| 257 |
use_nptl || tar xjf ${FILESDIR}/glibc-manpages-${MY_PV}.tar.bz2 |
| 258 |
|
| 259 |
cd ${S} |
| 260 |
# Extract our threads package ... |
| 261 |
if ! use_nptl && [ -z "${BRANCH_UPDATE}" ] |
| 262 |
then |
| 263 |
unpack glibc-linuxthreads-${MY_PV}.tar.bz2 |
| 264 |
fi |
| 265 |
|
| 266 |
if [ -n "${BRANCH_UPDATE}" ] |
| 267 |
then |
| 268 |
epatch ${DISTDIR}/${PN}-2.3.3-branch-update-${BRANCH_UPDATE}.patch.bz2 |
| 269 |
fi |
| 270 |
|
| 271 |
if use_nptl |
| 272 |
then |
| 273 |
epatch ${FILESDIR}/2.3.2/${LOCAL_P}-redhat-nptl-fixes.patch |
| 274 |
else |
| 275 |
epatch ${FILESDIR}/2.3.2/${LOCAL_P}-redhat-linuxthreads-fixes.patch |
| 276 |
fi |
| 277 |
|
| 278 |
epatch ${FILESDIR}/glibc-sec-hotfix-20040804.patch |
| 279 |
|
| 280 |
# To circumvent problems with propolice __guard and |
| 281 |
# __guard_setup__stack_smash_handler |
| 282 |
# |
| 283 |
# http://www.gentoo.org/proj/en/hardened/etdyn-ssp.xml |
| 284 |
if [ "${ARCH}" != "hppa" -a "${ARCH}" != "hppa64" ] |
| 285 |
then |
| 286 |
cd ${S} |
| 287 |
epatch ${FILESDIR}/2.3.3/${LOCAL_P}-propolice-guard-functions-v3.patch |
| 288 |
cp ${FILESDIR}/2.3.3/ssp.c ${S}/sysdeps/unix/sysv/linux || \ |
| 289 |
die "failed to copy ssp.c to ${S}/sysdeps/unix/sysv/linux/" |
| 290 |
# gcc 3.4 nukes ssp without this patch |
| 291 |
if [ "`gcc-major-version`" -ge "3" -a "`gcc-minor-version`" -ge "4" ] |
| 292 |
then |
| 293 |
epatch ${FILESDIR}/2.3.3/glibc-2.3.3-ssp-gcc34-after-frandom.patch |
| 294 |
fi |
| 295 |
fi |
| 296 |
|
| 297 |
# sparc fails when building the components for the normal crt1.o |
| 298 |
# with -K PIC automatically via hardened PIE and SSP specs files |
| 299 |
if use sparc && use hardened |
| 300 |
then |
| 301 |
einfo "adding crt1.o bugfix for hardened gcc on sparc glibc" |
| 302 |
sed -i "s|CPPFLAGS += -DHAVE_INITFINI|CPPFLAGS += -DHAVE_INITFINI -fno-pie -fno-PIE|" \ |
| 303 |
"${WORKDIR}/glibc-2.3.2/csu/Makefile" |
| 304 |
|
| 305 |
# check if it worked |
| 306 |
grep -q "CPPFLAGS += -DHAVE_INITFINI -fno-pie -fno-PIE" \ |
| 307 |
"${WORKDIR}/glibc-2.3.2/csu/Makefile" |
| 308 |
|
| 309 |
if [ $? -ne 0 ] |
| 310 |
then |
| 311 |
eerror "sed failure: could not add sparc crt1.o PIC bugfix" |
| 312 |
exit 1 |
| 313 |
fi |
| 314 |
fi |
| 315 |
|
| 316 |
# patch this regardless of architecture, although it's ssp-related |
| 317 |
epatch ${FILESDIR}/2.3.3/${PN}-2.3.3-frandom-detect.patch |
| 318 |
|
| 319 |
# |
| 320 |
# *** PaX related patches starts here *** |
| 321 |
# |
| 322 |
|
| 323 |
# localedef contains nested function trampolines, which trigger |
| 324 |
# segfaults under PaX -solar |
| 325 |
# Debian Bug (#231438, #198099) |
| 326 |
epatch ${FILESDIR}/2.3.3/glibc-2.3.3-localedef-fix-trampoline.patch |
| 327 |
|
| 328 |
|
| 329 |
# With latest versions of glibc, a lot of apps failed on a PaX enabled |
| 330 |
# system with: |
| 331 |
# |
| 332 |
# cannot enable executable stack as shared object requires: Permission denied |
| 333 |
# |
| 334 |
# This is due to PaX 'exec-protecting' the stack, and ld.so then trying |
| 335 |
# to make the stack executable due to some libraries not containing the |
| 336 |
# PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003). |
| 337 |
cd ${S}; epatch ${FILESDIR}/2.3.3/${PN}-2.3.3-dl_execstack-PaX-support.patch |
| 338 |
|
| 339 |
# Program header support for PaX. |
| 340 |
cd ${S}; epatch ${FILESDIR}/2.3.3/${PN}-2.3.3_pre20040117-pt_pax.diff |
| 341 |
|
| 342 |
# Suppress unresolvable relocation against symbol `main' in Scrt1.o |
| 343 |
# can be reproduced with compiling net-dns/bind-9.2.2-r3 using -pie |
| 344 |
epatch ${FILESDIR}/2.3.3/${PN}-2.3.3_pre20040117-got-fix.diff |
| 345 |
|
| 346 |
# |
| 347 |
# *** PaX related patches ends here *** |
| 348 |
# |
| 349 |
|
| 350 |
# Improved handled temporary files. bug #66358 |
| 351 |
epatch ${FILESDIR}/2.3.3/${PN}-2.3.3-tempfile.patch |
| 352 |
|
| 353 |
# Fix an assert when running libc.so from commandline, bug #34733. |
| 354 |
# cd ${S}; epatch ${FILESDIR}/2.3.2/${PN}-2.3.2-rtld-assert-fix.patch |
| 355 |
|
| 356 |
# This next patch fixes a test that will timeout due to ReiserFS' slow handling of sparse files |
| 357 |
# cd ${S}/io; epatch ${FILESDIR}/glibc-2.2.2-test-lfs-timeout.patch |
| 358 |
|
| 359 |
# This add back glibc 2.2 compadibility. See bug #8766 and #9586 for more info, |
| 360 |
# and also: |
| 361 |
# |
| 362 |
# http://lists.debian.org/debian-glibc/2002/debian-glibc-200210/msg00093.html |
| 363 |
# |
| 364 |
# We should think about remoing it in the future after things have settled. |
| 365 |
# |
| 366 |
# Thanks to Jan Gutter <jangutter@tuks.co.za> for reporting it. |
| 367 |
# |
| 368 |
# <azarah@gentoo.org> (26 Oct 2002). |
| 369 |
cd ${S}; epatch ${FILESDIR}/2.3.1/${PN}-2.3.1-ctype-compat-v3.patch |
| 370 |
|
| 371 |
# One more compat issue which breaks sun-jdk-1.3.1. See bug #8766 for more |
| 372 |
# info, and also: |
| 373 |
# |
| 374 |
# http://sources.redhat.com/ml/libc-alpha/2002-04/msg00143.html |
| 375 |
# |
| 376 |
# Thanks to Jan Gutter <jangutter@tuks.co.za> for reporting it. |
| 377 |
# |
| 378 |
# <azarah@gentoo.org> (30 Oct 2002). |
| 379 |
cd ${S}; epatch ${FILESDIR}/2.3.1/${PN}-2.3.1-libc_wait-compat.patch |
| 380 |
|
| 381 |
# One more compat issue ... libc_stack_end is missing from ld.so. |
| 382 |
# Got this one from diffing redhat glibc tarball .. would help if |
| 383 |
# they used patches and not modified tarball ... |
| 384 |
# |
| 385 |
# <azarah@gentoo.org> (7 Nov 2002). |
| 386 |
# cd ${S}; epatch ${FILESDIR}/2.3.1/${PN}-2.3.1-stack_end-compat.patch |
| 387 |
|
| 388 |
# The mathinline.h header omits the middle term of a ?: expression. This |
| 389 |
# is a gcc extension, but since the ISO standard forbids it, it's a |
| 390 |
# GLIBC bug (bug #27142). See also: |
| 391 |
# |
| 392 |
# http://bugs.gentoo.org/show_bug.cgi?id=27142 |
| 393 |
# |
| 394 |
# cd ${S}; epatch ${FILESDIR}/2.3.2/${LOCAL_P}-fix-omitted-operand-in-mathinline_h.patch |
| 395 |
|
| 396 |
# We do not want name_insert() in iconvconfig.c to be defined inside |
| 397 |
# write_output() as it causes issues with trampolines/PaX. |
| 398 |
cd ${S}; epatch ${FILESDIR}/2.3.2/${LOCAL_P}-iconvconfig-name_insert.patch |
| 399 |
|
| 400 |
# A few patches only for the MIPS platform. Descriptions of what they |
| 401 |
# do can be found in the patch headers. |
| 402 |
# <tuxus@gentoo.org> thx <dragon@gentoo.org> (11 Jan 2003) |
| 403 |
# <kumba@gentoo.org> remove tst-rndseek-mips & ulps-mips patches |
| 404 |
if [ "${ARCH}" = "mips" ] |
| 405 |
then |
| 406 |
cd ${S} |
| 407 |
epatch ${FILESDIR}/2.3.1/${PN}-2.3.1-fpu-cw-mips.patch |
| 408 |
epatch ${FILESDIR}/2.3.1/${PN}-2.3.1-librt-mips.patch |
| 409 |
epatch ${FILESDIR}/2.3.2/${LOCAL_P}-mips-add-n32-n64-sysdep-cancel.patch |
| 410 |
epatch ${FILESDIR}/2.3.2/${LOCAL_P}-mips-configure-for-n64-symver.patch |
| 411 |
epatch ${FILESDIR}/2.3.3/${PN}-2.3.3_pre20040420-mips-dl-machine-calls.diff |
| 412 |
epatch ${FILESDIR}/2.3.3/${PN}-2.3.3_pre20040420-mips-incl-sgidefs.diff |
| 413 |
epatch ${FILESDIR}/2.3.3/mips-addabi.diff |
| 414 |
epatch ${FILESDIR}/2.3.3/mips-syscall.h.diff |
| 415 |
epatch ${FILESDIR}/2.3.3/semtimedop.diff |
| 416 |
epatch ${FILESDIR}/2.3.3/mips-sysify.diff |
| 417 |
##### epatch ${FILESDIR}/2.3.3/mips-n32n64regs.diff |
| 418 |
fi |
| 419 |
|
| 420 |
if [ "${ARCH}" = "alpha" ] |
| 421 |
then |
| 422 |
cd ${S} |
| 423 |
# Fix compatability with compaq compilers by ifdef'ing out some |
| 424 |
# 2.3.2 additions. |
| 425 |
# <taviso@gentoo.org> (14 Jun 2003). |
| 426 |
epatch ${FILESDIR}/2.3.2/${LOCAL_P}-decc-compaq.patch |
| 427 |
|
| 428 |
# Fix compilation with >=gcc-3.2.3 (01 Nov 2003 agriffis) |
| 429 |
# epatch ${FILESDIR}/2.3.2/${LOCAL_P}-alpha-pwrite.patch |
| 430 |
fi |
| 431 |
|
| 432 |
if [ "${ARCH}" = "amd64" ] |
| 433 |
then |
| 434 |
cd ${S}; epatch ${FILESDIR}/2.3.2/${LOCAL_P}-amd64-nomultilib.patch |
| 435 |
fi |
| 436 |
|
| 437 |
if [ "${ARCH}" = "ia64" ] |
| 438 |
then |
| 439 |
# The basically problem is glibc doesn't store information about |
| 440 |
# what the kernel interface is so that it can't efficiently set up |
| 441 |
# parameters for system calls. This patch from H.J. Lu fixes it: |
| 442 |
# |
| 443 |
# http://sources.redhat.com/ml/libc-alpha/2003-09/msg00165.html |
| 444 |
# |
| 445 |
#cd ${S}; epatch ${FILESDIR}/2.3.2/${LOCAL_P}-ia64-LOAD_ARGS-fixup.patch |
| 446 |
: |
| 447 |
fi |
| 448 |
|
| 449 |
if [ "${ARCH}" = "hppa" ] |
| 450 |
then |
| 451 |
local x= |
| 452 |
|
| 453 |
cd ${WORKDIR} |
| 454 |
unpack ${LOCAL_P}-hppa-patches-p1.tar.bz2 |
| 455 |
cd ${S} |
| 456 |
EPATCH_EXCLUDE="0[123459]0* 055* 1[2379]0* 200* 230*" |
| 457 |
for x in ${EPATCH_EXCLUDE} |
| 458 |
do |
| 459 |
rm -f ${WORKDIR}/${LOCAL_P}-hppa-patches/${x} |
| 460 |
done |
| 461 |
for x in ${WORKDIR}/${LOCAL_P}-hppa-patches/* |
| 462 |
do |
| 463 |
epatch ${x} |
| 464 |
done |
| 465 |
epatch ${FILESDIR}/2.3.1/glibc23-07-hppa-atomicity.dpatch |
| 466 |
fi |
| 467 |
|
| 468 |
cd ${S} |
| 469 |
epatch ${FILESDIR}/2.3.4/glibc-2.3.4-hardened-sysdep-shared.patch |
| 470 |
|
| 471 |
# Fix permissions on some of the scripts |
| 472 |
chmod u+x ${S}/scripts/*.sh |
| 473 |
} |
| 474 |
|
| 475 |
setup_flags() { |
| 476 |
# Over-zealous CFLAGS can often cause problems. What may work for one person may not |
| 477 |
# work for another. To avoid a large influx of bugs relating to failed builds, we |
| 478 |
# strip most CFLAGS out to ensure as few problems as possible. |
| 479 |
strip-flags |
| 480 |
strip-unsupported-flags |
| 481 |
|
| 482 |
# -freorder-blocks for all but ia64 s390 s390x |
| 483 |
use ppc || append-flags "-freorder-blocks" |
| 484 |
|
| 485 |
# Sparc/Sparc64 support |
| 486 |
if use sparc |
| 487 |
then |
| 488 |
|
| 489 |
# Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though. |
| 490 |
replace-flags "-fcall-used-g7" "" |
| 491 |
append-flags "-fcall-used-g6" |
| 492 |
|
| 493 |
# Sparc64 Only support... |
| 494 |
if [ "${PROFILE_ARCH}" = "sparc64" ] |
| 495 |
then |
| 496 |
|
| 497 |
# Get rid of -mcpu options, the CHOST will fix this up |
| 498 |
replace-flags "-mcpu=ultrasparc" "" |
| 499 |
replace-flags "-mcpu=v9" "" |
| 500 |
|
| 501 |
# Get rid of flags known to fail |
| 502 |
replace-flags "-mvis" "" |
| 503 |
|
| 504 |
# Setup the CHOST properly to insure "sparcv9" |
| 505 |
# This passes -mcpu=ultrasparc -Wa,-Av9a to the compiler |
| 506 |
[ "${CHOST}" == "sparc-unknown-linux-gnu" ] && \ |
| 507 |
export CHOST="sparcv9-unknown-linux-gnu" |
| 508 |
fi |
| 509 |
fi |
| 510 |
|
| 511 |
if [ "`gcc-major-version`" -ge "3" -a "`gcc-minor-version`" -ge "4" ]; then |
| 512 |
# broken in 3.4.x |
| 513 |
replace-flags -march=pentium-m -mtune=pentium3 |
| 514 |
fi |
| 515 |
|
| 516 |
# We don't want these flags for glibc |
| 517 |
filter-flags -fomit-frame-pointer -malign-double |
| 518 |
filter-ldflags -pie |
| 519 |
|
| 520 |
# Lock glibc at -O2 -- linuxthreads needs it and we want to be conservative here |
| 521 |
append-flags -O2 |
| 522 |
export LDFLAGS="${LDFLAGS//-Wl,--relax}" |
| 523 |
} |
| 524 |
|
| 525 |
src_compile() { |
| 526 |
local myconf= |
| 527 |
local myconf_nptl= |
| 528 |
|
| 529 |
setup_flags |
| 530 |
|
| 531 |
# These should not be set, else the |
| 532 |
# zoneinfo do not always get installed ... |
| 533 |
unset LANGUAGE LANG LC_ALL |
| 534 |
|
| 535 |
use nls || myconf="${myconf} --disable-nls" |
| 536 |
|
| 537 |
use erandom || myconf="${myconf} --disable-dev-erandom" |
| 538 |
|
| 539 |
if use_nptl |
| 540 |
then |
| 541 |
local kernelheaders="$(get_KHV "`KV_to_int ${MIN_NPTL_KV}`")" |
| 542 |
|
| 543 |
# NTPL and Thread Local Storage support. |
| 544 |
myconf="${myconf} --with-tls --with-__thread \ |
| 545 |
--enable-add-ons=nptl \ |
| 546 |
--enable-kernel=${MIN_NPTL_KV} \ |
| 547 |
--with-headers=${kernelheaders}" |
| 548 |
else |
| 549 |
myconf="${myconf} --without-__thread \ |
| 550 |
--enable-add-ons=linuxthreads" |
| 551 |
|
| 552 |
# If we build for the build system we use the kernel headers from the target |
| 553 |
# We also now set it without "build" as well, else it might use the |
| 554 |
# current kernel's headers, which might just fail (the linux-headers |
| 555 |
# package is usually well tested...) |
| 556 |
# ( use build || use sparc ) \ |
| 557 |
# && myconf="${myconf} --with-headers=${ROOT}usr/include" |
| 558 |
myconf="${myconf} --with-headers=${ROOT}usr/include" |
| 559 |
|
| 560 |
# If kernel version and headers in ${ROOT}/usr/include are ok, |
| 561 |
# then enable --enable-kernel=${MIN_KV} ... |
| 562 |
if [ "`get_KV`" -ge "`KV_to_int ${MIN_KV}`" -a \ |
| 563 |
-n "$(get_KHV "`KV_to_int ${MIN_KV}`" "${ROOT}/usr/include")" ] |
| 564 |
then |
| 565 |
myconf="${myconf} --enable-kernel=${MIN_KV}" |
| 566 |
else |
| 567 |
myconf="${myconf} --enable-kernel=2.2.5" |
| 568 |
fi |
| 569 |
fi |
| 570 |
|
| 571 |
# some silly people set LD_RUN_PATH and that breaks things. |
| 572 |
# see bug 19043 |
| 573 |
unset LD_RUN_PATH |
| 574 |
|
| 575 |
einfo "Configuring GLIBC..." |
| 576 |
rm -rf ${S}/buildhere |
| 577 |
mkdir -p ${S}/buildhere |
| 578 |
cd ${S}/buildhere |
| 579 |
../configure --build=${CHOST} \ |
| 580 |
--host=${CHOST} \ |
| 581 |
--with-gd=no \ |
| 582 |
--without-cvs \ |
| 583 |
--disable-profile \ |
| 584 |
--prefix=/usr \ |
| 585 |
--mandir=/usr/share/man \ |
| 586 |
--infodir=/usr/share/info \ |
| 587 |
--libexecdir=/usr/lib/misc \ |
| 588 |
${myconf} || die |
| 589 |
|
| 590 |
einfo "Building GLIBC..." |
| 591 |
cd ${S}/buildhere |
| 592 |
make PARALLELMFLAGS="${MAKEOPTS}" || die |
| 593 |
# einfo "Doing GLIBC checks..." |
| 594 |
# make check |
| 595 |
} |
| 596 |
|
| 597 |
src_install() { |
| 598 |
local buildtarget="buildhere" |
| 599 |
|
| 600 |
setup_flags |
| 601 |
|
| 602 |
# These should not be set, else the |
| 603 |
# zoneinfo do not always get installed ... |
| 604 |
unset LANGUAGE LANG LC_ALL |
| 605 |
|
| 606 |
einfo "Installing GLIBC..." |
| 607 |
make PARALLELMFLAGS="${MAKEOPTS}" \ |
| 608 |
install_root=${D} \ |
| 609 |
install -C ${buildtarget} || die |
| 610 |
|
| 611 |
# If librt.so is a symlink, change it into linker script (Redhat) |
| 612 |
if [ -L "${D}/usr/lib/librt.so" -a "${LIBRT_LINKERSCRIPT}" = "yes" ] |
| 613 |
then |
| 614 |
local LIBRTSO="`cd ${D}/lib; echo librt.so.*`" |
| 615 |
local LIBPTHREADSO="`cd ${D}/lib; echo libpthread.so.*`" |
| 616 |
|
| 617 |
rm -f ${D}/usr/lib/librt.so |
| 618 |
cat > ${D}/usr/lib/librt.so <<EOF |
| 619 |
/* GNU ld script |
| 620 |
librt.so.1 needs libpthread.so.0 to come before libc.so.6* |
| 621 |
in search scope. */ |
| 622 |
EOF |
| 623 |
grep "OUTPUT_FORMAT" ${D}/usr/lib/libc.so >> ${D}/usr/lib/librt.so |
| 624 |
echo "GROUP ( /lib/${LIBPTHREADSO} /lib/${LIBRTSO} )" \ |
| 625 |
>> ${D}/usr/lib/librt.so |
| 626 |
|
| 627 |
for x in ${D}/usr/lib/librt.so.[1-9] |
| 628 |
do |
| 629 |
[ -L "${x}" ] && rm -f ${x} |
| 630 |
done |
| 631 |
fi |
| 632 |
|
| 633 |
if ! use build |
| 634 |
then |
| 635 |
einfo "Installing Info pages..." |
| 636 |
make PARALLELMFLAGS="${MAKEOPTS}" \ |
| 637 |
install_root=${D} \ |
| 638 |
info -C ${buildtarget} || die |
| 639 |
|
| 640 |
einfo "Installing Locale data..." |
| 641 |
make PARALLELMFLAGS="${MAKEOPTS}" \ |
| 642 |
install_root=${D} \ |
| 643 |
localedata/install-locales -C ${buildtarget} || die |
| 644 |
|
| 645 |
# Compatibility hack: this locale has vanished from glibc, |
| 646 |
# but some other programs are still using it. |
| 647 |
keepdir /usr/lib/locale/ru_RU/LC_MESSAGES |
| 648 |
|
| 649 |
einfo "Installing man pages and docs..." |
| 650 |
# Install linuxthreads man pages |
| 651 |
use_nptl || { |
| 652 |
dodir /usr/share/man/man3 |
| 653 |
doman ${S}/man/*.3thr |
| 654 |
} |
| 655 |
|
| 656 |
# Install nscd config file |
| 657 |
insinto /etc ; doins ${FILESDIR}/nscd.conf |
| 658 |
exeinto /etc/init.d ; doexe ${FILESDIR}/nscd |
| 659 |
|
| 660 |
dodoc BUGS ChangeLog* CONFORMANCE FAQ INTERFACE \ |
| 661 |
NEWS NOTES PROJECTS README* |
| 662 |
else |
| 663 |
rm -rf ${D}/usr/share ${D}/usr/lib/gconv |
| 664 |
|
| 665 |
einfo "Installing Timezone data..." |
| 666 |
make PARALLELMFLAGS="${MAKEOPTS}" \ |
| 667 |
install_root=${D} \ |
| 668 |
timezone/install-others -C ${buildtarget} || die |
| 669 |
fi |
| 670 |
|
| 671 |
if use pic |
| 672 |
then |
| 673 |
find ${S}/${buildtarget}/ -name "soinit.os" -exec cp {} ${D}/lib/soinit.o \; |
| 674 |
find ${S}/${buildtarget}/ -name "sofini.os" -exec cp {} ${D}/lib/sofini.o \; |
| 675 |
find ${S}/${buildtarget}/ -name "*_pic.a" -exec cp {} ${D}/lib \; |
| 676 |
find ${S}/${buildtarget}/ -name "*.map" -exec cp {} ${D}/lib \; |
| 677 |
for i in ${D}/lib/*.map |
| 678 |
do |
| 679 |
mv ${i} ${i%.map}_pic.map |
| 680 |
done |
| 681 |
fi |
| 682 |
|
| 683 |
# Is this next line actually needed or does the makefile get it right? |
| 684 |
# It previously has 0755 perms which was killing things. |
| 685 |
fperms 4711 /usr/lib/misc/pt_chown |
| 686 |
|
| 687 |
# Currently libraries in /usr/lib/gconv do not get loaded if not |
| 688 |
# in search path ... |
| 689 |
# insinto /etc/env.d |
| 690 |
# doins ${FILESDIR}/03glibc |
| 691 |
|
| 692 |
rm -f ${D}/etc/ld.so.cache |
| 693 |
|
| 694 |
# Prevent overwriting of the /etc/localtime symlink. We'll handle the |
| 695 |
# creation of the "factory" symlink in pkg_postinst(). |
| 696 |
rm -f ${D}/etc/localtime |
| 697 |
|
| 698 |
# Some things want this, notably ash. |
| 699 |
dosym /usr/lib/libbsd-compat.a /usr/lib/libbsd.a |
| 700 |
} |
| 701 |
|
| 702 |
pkg_postinst() { |
| 703 |
# Correct me if I am wrong here, but my /etc/localtime is a file |
| 704 |
# created by zic .... |
| 705 |
# I am thinking that it should only be recreated if no /etc/localtime |
| 706 |
# exists, or if it is an invalid symlink. |
| 707 |
# |
| 708 |
# For invalid symlink: |
| 709 |
# -f && -e will fail |
| 710 |
# -L will succeed |
| 711 |
# |
| 712 |
if [ ! -e ${ROOT}/etc/localtime ] |
| 713 |
then |
| 714 |
echo "Please remember to set your timezone using the zic command." |
| 715 |
rm -f ${ROOT}/etc/localtime |
| 716 |
ln -s ../usr/share/zoneinfo/Factory ${ROOT}/etc/localtime |
| 717 |
fi |
| 718 |
|
| 719 |
if [ -x ${ROOT}/usr/sbin/iconvconfig ] |
| 720 |
then |
| 721 |
# Generate fastloading iconv module configuration file. |
| 722 |
${ROOT}/usr/sbin/iconvconfig --prefix=${ROOT} |
| 723 |
fi |
| 724 |
|
| 725 |
# Reload init ... |
| 726 |
if [ "${ROOT}" = "/" ] |
| 727 |
then |
| 728 |
/sbin/init U &> /dev/null |
| 729 |
fi |
| 730 |
} |
| 731 |
|