blob: be2d76d096dcc2469326e571268626e13f9ef414 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_unpack.eblit,v 1.22 2013/04/05 00:25:16 vapier Exp $
int_to_KV() {
local version=$1 major minor micro
major=$((version / 65536))
minor=$(((version % 65536) / 256))
micro=$((version % 256))
echo ${major}.${minor}.${micro}
}
eend_KV() {
[[ $(KV_to_int $1) -ge $(KV_to_int $2) ]]
eend $?
}
get_kheader_version() {
printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
$(tc-getCPP ${CTARGET}) -I "$(alt_build_headers)" | \
tail -n 1
}
check_nptl_support() {
# don't care about the compiler here as we arent using it
just_headers && return
local run_kv build_kv want_kv
run_kv=$(int_to_KV $(get_KV))
build_kv=$(int_to_KV $(get_kheader_version))
want_kv=${NPTL_KERN_VER}
ebegin "Checking gcc for __thread support"
if ! eend $(want__thread ; echo $?) ; then
echo
eerror "Could not find a gcc that supports the __thread directive!"
eerror "Please update your binutils/gcc and try again."
die "No __thread support in gcc!"
fi
if ! is_crosscompile && ! tc-is-cross-compiler ; then
# Building fails on an non-supporting kernel
ebegin "Checking kernel version (${run_kv} >= ${want_kv})"
if ! eend_KV ${run_kv} ${want_kv} ; then
echo
eerror "You need a kernel of at least ${want_kv} for NPTL support!"
die "Kernel version too low!"
fi
fi
ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
if ! eend_KV ${build_kv} ${want_kv} ; then
echo
eerror "You need linux-headers of at least ${want_kv} for NPTL support!"
die "linux-headers version too low!"
fi
}
unpack_pkg() {
local a=${PN}
[[ -n ${SNAP_VER} ]] && a="${a}-${RELEASE_VER}"
[[ -n $1 ]] && a="${a}-$1"
if [[ -n ${SNAP_VER} ]] ; then
a="${a}-${SNAP_VER}"
else
if [[ -n $2 ]] ; then
a="${a}-$2"
else
a="${a}-${RELEASE_VER}"
fi
fi
if has ${a}.tar.xz ${A} ; then
unpacker ${a}.tar.xz
else
unpack ${a}.tar.bz2
fi
[[ -n $1 ]] && { mv ${a} $1 || die ; }
}
toolchain-glibc_src_unpack() {
# Check NPTL support _before_ we unpack things to save some time
want_nptl && check_nptl_support
if [[ -n ${EGIT_REPO_URIS} ]] ; then
local i d
for ((i=0; i<${#EGIT_REPO_URIS[@]}; ++i)) ; do
EGIT_REPO_URI=${EGIT_REPO_URIS[$i]}
EGIT_SOURCEDIR=${EGIT_SOURCEDIRS[$i]}
git-2_src_unpack
done
else
unpack_pkg
fi
cd "${S}"
touch locale/C-translit.h #185476 #218003
[[ -n ${LT_VER} ]] && unpack_pkg linuxthreads ${LT_VER}
[[ -n ${PORTS_VER} ]] && unpack_pkg ports ${PORTS_VER}
[[ -n ${LIBIDN_VER} ]] && unpack_pkg libidn
if [[ -n ${PATCH_VER} ]] ; then
cd "${WORKDIR}"
unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
# pull out all the addons
local d
for d in extra/*/configure ; do
d=${d%/configure}
[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
mv "${d}" "${S}" || die "moving ${d} failed"
done
fi
# XXX: We should do the branchupdate, before extracting the manpages and
# infopages else it does not help much (mtimes change if there is a change
# to them with branchupdate)
if [[ -n ${BRANCH_UPDATE} ]] ; then
cd "${S}"
epatch "${DISTDIR}"/glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
# Snapshot date patch
einfo "Patching version to display snapshot date ..."
sed -i -e "s:\(#define RELEASE\).*:\1 \"${BRANCH_UPDATE}\":" version.h
fi
# tag, glibc is it
cd "${S}"
if ! version_is_at_least 2.17 ; then
[[ -e csu/Banner ]] && die "need new banner location"
glibc_banner > csu/Banner
fi
if [[ -n ${PATCH_VER} ]] && ! use vanilla ; then
cd "${S}"
EPATCH_MULTI_MSG="Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..." \
EPATCH_EXCLUDE=${GLIBC_PATCH_EXCLUDE} \
EPATCH_SUFFIX="patch" \
ARCH=$(tc-arch) \
epatch "${WORKDIR}"/patches
fi
if just_headers ; then
if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
# mips peeps like to screw with us. if building headers,
# we don't have a real compiler, so we can't let them
# insert -mabi on us.
sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
fi
fi
epatch_user
gnuconfig_update
}
eblit-glibc-src_unpack() {
setup_env
toolchain-glibc_src_unpack
# Glibc is stupid sometimes, and doesn't realize that with a
# static C-Only gcc, -lgcc_eh doesn't exist.
# http://sourceware.org/ml/libc-alpha/2003-09/msg00100.html
# http://sourceware.org/ml/libc-alpha/2005-02/msg00042.html
# But! Finally fixed in recent versions:
# http://sourceware.org/ml/libc-alpha/2012-05/msg01865.html
if ! version_is_at_least 2.16 ; then
echo 'int main(){}' > "${T}"/gcc_eh_test.c
if ! $(tc-getCC ${CTARGET}) "${T}"/gcc_eh_test.c -lgcc_eh 2>/dev/null ; then
sed -i -e 's:-lgcc_eh::' Makeconfig || die "sed gcc_eh"
fi
fi
cd "${WORKDIR}"
find . -type f '(' -size 0 -o -name "*.orig" ')' -exec rm -f {} \;
find . -name configure -exec touch {} \;
# Fix permissions on some of the scripts
chmod u+x "${S}"/scripts/*.sh
}
|