Contents of /trunk/core/glibc/glibc-2.17-r1.smage2
Parent Directory
|
Revision Log
Revision 14490 -
(show annotations)
(download)
Fri Dec 28 19:26:32 2012 UTC (11 years, 5 months ago) by niro
File size: 11008 byte(s)
Fri Dec 28 19:26:32 2012 UTC (11 years, 5 months ago) by niro
File size: 11008 byte(s)
auto added: ver bump to 2.17-r1
1 | # $Id$ |
2 | |
3 | PNAME="glibc" |
4 | PVER="2.17" |
5 | PBUILD="r1" |
6 | |
7 | PCAT="sys-libs" |
8 | |
9 | DESCRIPTION="GNU libc6 (also called glibc2) C library with NPTL Threads." |
10 | HOMEPAGE="http://www.gnu.org/software/libc/libc.html" |
11 | |
12 | DEPEND=">= sys-apps/base-files-0.1" |
13 | |
14 | # we force headers to one specific version |
15 | SDEPEND="== sys-kernel/linux-libc-headers-3.6.7" |
16 | PROVIDE="virtual/glibc" |
17 | |
18 | # functions to include in the mage file |
19 | SPECIAL_FUNCTIONS="fix_db_files" |
20 | |
21 | SRCFILE="glibc-${PVER}.tar.xz" |
22 | SRCDIR="${BUILDDIR}/glibc-${PVER}" |
23 | |
24 | ENVD_REV="1.2" |
25 | |
26 | sminclude mtools |
27 | |
28 | SRC_URI=( |
29 | ftp://sources.redhat.com/pub/glibc/releases/${SRCFILE} |
30 | ftp://sources.redhat.com/pub/glibc/snapshots/${SRCFILE} |
31 | gnu://${PNAME}/${SRCFILE} |
32 | mirror://${PNAME}/${SRCFILE} |
33 | mirror://${PNAME}/glibc.envd-${ENVD_REV} |
34 | mirror://${PNAME}/locale.gen-header |
35 | mirror://${PNAME}/locale-gen |
36 | ) |
37 | |
38 | # sed line: on 2 digits add an zero: 2.7 -> 2.7.0 |
39 | UP2DATE="updatecmd_gnu ${PNAME/-nptl/} | sed 's/^\([0-9]\.[0-9]\$\)/\1.0/'" |
40 | |
41 | # glibc don't like strong CFLAGS |
42 | export CFLAGS="${CFLAGS//-O?} -O2" |
43 | # glibc -> nptl thread don't like striping |
44 | msetfeature "!strip" |
45 | # gcc 3.0 - 3.3 needs this: |
46 | export CFLAGS="${CFLAGS} -finline-limit=2000" |
47 | export CXXFLAGS="${CFLAGS}" |
48 | export LDFLAGS="${LDFLAGS//-Wl,--relax}" |
49 | |
50 | # hack to fix NPTL issues with xen, only required on 32bit arches |
51 | if [[ ${ARCH} = i*86 ]] |
52 | then |
53 | export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs" |
54 | fi |
55 | |
56 | # glibc-2.6.1 and above needs march CFLAGS: -march=${ARCH} -mtune=generic |
57 | # first filter -mtune and -march from flags |
58 | for flag in ${CFLAGS} |
59 | do |
60 | case ${flag} in |
61 | -mtune=*) continue ;; |
62 | -march=*) continue ;; |
63 | esac |
64 | newflags="${newflags} ${flag}" |
65 | done |
66 | export CFLAGS="${newflags}" |
67 | |
68 | # than add our defaults for glibc |
69 | [[ ${ARCH} = i*86 ]] && export CFLAGS="${CFLAGS} -march=${ARCH}" # only i*86 |
70 | export CFLAGS="${CFLAGS} -mtune=generic" # all arches |
71 | export CXXFLAGS="${CFLAGS}" |
72 | |
73 | # use other linux-headers |
74 | [[ -z ${ALT_HEADERS} ]] && export ALT_HEADERS="/usr/include" |
75 | |
76 | # kernel support |
77 | export ENABLE_KERNEL=2.6.32 |
78 | |
79 | src_prepare() |
80 | { |
81 | munpack ${SRCFILE} || die |
82 | cd ${SRCDIR} |
83 | |
84 | # scripts/test-installation.pl sometime fails |
85 | # |
86 | # CC="gcc" /usr/bin/perl scripts/test-installation.pl |
87 | # /usr/src/glibc-2.16.0.bld/ |
88 | # Unmatched ( in regex; marked by <-- HERE in m/$( <-- HERE if $(abi-32-ld-soname),$(abi-32-ld-soname),ld/ at scripts/test-installation.pl line 172, <LDD> |
89 | # line 1 |
90 | sed -i 's:CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)::' Makefile || die |
91 | |
92 | # binutils patch needs reconf |
93 | # autoconf --force || die |
94 | |
95 | # fix permissions on some of the scripts |
96 | chmod u+x ${SRCDIR}/scripts/*.sh || die |
97 | |
98 | install -d ${SRCDIR}/build || die |
99 | cd ${SRCDIR}/build |
100 | |
101 | if [ ! -f /etc/ld.so.conf ] |
102 | then |
103 | touch /etc/ld.so.conf || die |
104 | fi |
105 | } |
106 | |
107 | src_compile() |
108 | { |
109 | local myopts |
110 | |
111 | # generic pathes |
112 | myopts="--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info" |
113 | # disable profiling |
114 | myopts+=" --disable-profile" |
115 | # enable addons |
116 | myopts+=" --enable-add-ons=nptl,libidn" |
117 | # enable tls |
118 | myopts+=" --with-tls --with-__thread" |
119 | # supported kernel-release |
120 | myopts+=" --enable-kernel=${ENABLE_KERNEL}" |
121 | # disable cvs and gd support |
122 | myopts+=" --without-cvs --without-gd" |
123 | # enable bindnow |
124 | myopts+=" --enable-bind-now" |
125 | # enable obsolete rpc implementation |
126 | myopts+=" --enable-obsolete-rpc" |
127 | |
128 | # support multilib lib64 dir (x86_64 only) |
129 | if [[ ${ARCH} = x86_64 ]] |
130 | then |
131 | # first build a -m32 version |
132 | install -d ${SRCDIR}/build-m32 |
133 | cd ${SRCDIR}/build-m32 |
134 | |
135 | CC="gcc -m32" CXX="g++ -m32" \ |
136 | CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \ |
137 | CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \ |
138 | ../configure \ |
139 | --build=${CHOST} \ |
140 | --host=i686-pc-linux-gnu \ |
141 | --libdir=/usr/lib \ |
142 | --libexecdir=/usr/lib/glibc \ |
143 | ${myopts} \ |
144 | || die |
145 | |
146 | make PARALLELMFLAGS="${MAKEOPTS}" || die |
147 | fi |
148 | |
149 | cd ${SRCDIR}/build |
150 | |
151 | if [[ ${ARCH} = x86_64 ]]; then |
152 | # make sure the -m64 libs goes really to /lib64 |
153 | echo "slibdir=/$(mlibdir)" >> ${SRCDIR}/build/configparms || die |
154 | fi |
155 | |
156 | # kernel-2.6 with nptl needs this |
157 | ../configure \ |
158 | --build=${CHOST} \ |
159 | --host=${CHOST} \ |
160 | --libdir=/usr/$(mlibdir) \ |
161 | --libexecdir=/usr/$(mlibdir)/glibc \ |
162 | ${myopts} \ |
163 | || die |
164 | |
165 | make PARALLELMFLAGS="${MAKEOPTS}" || die |
166 | } |
167 | |
168 | src_install() |
169 | { |
170 | if [[ ${ARCH} = x86_64 ]] |
171 | then |
172 | # install -m32 libs |
173 | cd ${SRCDIR}/build-m32 |
174 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} slibdir=/usr/lib rootsbindir=/usr/sbin install || die |
175 | fi |
176 | |
177 | cd ${SRCDIR}/build |
178 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} slibdir=/usr/$(mlibdir) rootsbindir=/usr/sbin install || die |
179 | |
180 | # do not generate the locales here, let it the user do with the locale-gen tool |
181 | # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die |
182 | |
183 | # install locales list and generate tools |
184 | # generate locale.gen file from localedata/SUPPORTED file |
185 | minstalletc locale.gen-header locale.gen || die |
186 | sed \ |
187 | -e 's:/: :g' \ |
188 | -e 's:\\: :g' \ |
189 | -e 's:SUPPORTED-LOCALES=::' \ |
190 | -e 's:\ \ $::g' \ |
191 | -e '/^#/d' \ |
192 | -e 's:^:#:g' \ |
193 | ${SRCDIR}/localedata/SUPPORTED \ |
194 | >> ${BINDIR}/etc/locale.gen || die |
195 | minstalldir /usr/sbin || die |
196 | minstallexec -s locale-gen /usr/sbin || die |
197 | |
198 | # nsswitch configuration file |
199 | minstalletc ${SRCDIR}/nss/nsswitch.conf || die |
200 | |
201 | # nscd configuration file |
202 | minstalletc ${SRCDIR}/nscd/nscd.conf || die |
203 | |
204 | # gai configuration file |
205 | minstalletc ${SRCDIR}/posix/gai.conf || die |
206 | |
207 | # now in tzdata |
208 | ## we use Berlin as default |
209 | ## busybox compat |
210 | #local args |
211 | #if need_busybox_support /bin/cp |
212 | #then |
213 | # args="-f" |
214 | #else |
215 | # args="--remove-destination" |
216 | #fi |
217 | #cp ${args} ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die |
218 | [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; } |
219 | [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; } |
220 | |
221 | # base environment |
222 | minstallenv glibc.envd-${ENVD_REV} 00glibc || die |
223 | if [[ ${ARCH} = x86_64 ]] |
224 | then |
225 | MCONFIG="/etc/env.d/00glibc" |
226 | maddconfig "LDPATH=\"/$(mlibdir)\"" || die |
227 | maddconfig "LDPATH=\"/usr/$(mlibdir)\"" || die |
228 | maddconfig "LDPATH=\"/usr/local/$(mlibdir)\"" || die |
229 | maddconfig "LDPATH=\"/opt/$(mlibdir)\"" || die |
230 | fi |
231 | |
232 | # strip all binaries |
233 | find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die |
234 | |
235 | # strip all libraries |
236 | # want to be safe here; --strip-unneeded seems to cause pthread problems |
237 | # strip all but libpthread |
238 | install -d ${BUILDDIR}/thread-backup || die |
239 | mv ${BINDIR}/usr/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die |
240 | |
241 | # now strip |
242 | find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die |
243 | mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/usr/$(mlibdir)/ || die |
244 | # remove stale directory |
245 | rm -rf ${BUILDDIR}/thread-backup || die |
246 | |
247 | # prepare glibc for installation; slackware method |
248 | minstalldir /incoming || die |
249 | mv ${BINDIR}/usr/$(mlibdir)/*.so ${BINDIR}/incoming || die |
250 | mv ${BINDIR}/usr/$(mlibdir)/*.so.* ${BINDIR}/incoming || die |
251 | mv ${BINDIR}/incoming ${BINDIR}/usr/$(mlibdir)/incoming || die |
252 | mv ${BINDIR}/usr/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/usr/$(mlibdir) || die |
253 | } |
254 | |
255 | fix_db_files() |
256 | { |
257 | local i |
258 | local DB_ENTRY="${BUILDDIR}/${PKGNAME}" |
259 | |
260 | for i in .files .symlinks .dirs |
261 | do |
262 | [ ! -f ${DB_ENTRY}/${i} ] && continue |
263 | [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue |
264 | |
265 | echo " fixing /usr/$(mlibdir)/incoming from db-entry '${i}' ..." |
266 | |
267 | # /usr/lib/incoming -> empty line; sed2 removes all empty lines |
268 | #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i} |
269 | # do not simply emtpy the line, but change it the the correct path, |
270 | # so no stale libs are around if the package gets updated! |
271 | sed -i \ |
272 | -e "s:/usr/$(mlibdir)/incoming:/usr/$(mlibdir):g" \ |
273 | -e "s:/usr/$(mlibdir)/incoming.*::g" \ |
274 | -e '/^$/d' ${DB_ENTRY}/${i} |
275 | done |
276 | } |
277 | |
278 | postinstall() |
279 | { |
280 | # first save the old libpthread.so.0; |
281 | # it will later used to determinate that there are no stale |
282 | # libpthreads that breaks ldconfig |
283 | local OLD_PTHREAD |
284 | OLD_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
285 | |
286 | # slackware install method |
287 | |
288 | # we cannot easily install the glibc libs, |
289 | # because our tools for cp etc needs them to run |
290 | |
291 | local file |
292 | |
293 | echo " Switching to new glibc ..." |
294 | # swap libraries on the fly: |
295 | if [ -x /usr/sbin/ldconfig -a -d /usr/$(mlibdir)/incoming ] && [[ -z ${MROOT} ]] |
296 | then |
297 | # first create copies of the incoming libraries: |
298 | cd /usr/$(mlibdir)/incoming |
299 | for file in $(find /usr/$(mlibdir)/incoming -type f) |
300 | do |
301 | if [ ! -r "../$(basename ${file}).incoming" ] |
302 | then |
303 | cp -a ${file} ../$(basename ${file}).incoming |
304 | fi |
305 | done |
306 | |
307 | # then switch to them all at once: |
308 | /usr/sbin/ldconfig -l /usr/$(mlibdir)/*.incoming 2> /dev/null |
309 | |
310 | # finally, rename them and clean up: |
311 | cd /usr/$(mlibdir) |
312 | for file in *.incoming |
313 | do |
314 | rm -f $(basename ${file} .incoming) |
315 | cp -a ${file} $(basename ${file} .incoming) |
316 | /usr/sbin/ldconfig -l $(basename ${file} .incoming) |
317 | rm -f ${file} |
318 | done |
319 | |
320 | # no ldconfig? |
321 | # good, it's safe to just jam it on home (and make links below): |
322 | else |
323 | ( |
324 | cd ${MROOT}/usr/$(mlibdir)/incoming |
325 | for file in * |
326 | do |
327 | cp -a ${file} .. |
328 | done |
329 | |
330 | local my_sym |
331 | local my_dest |
332 | |
333 | # rebuild symlinks |
334 | echo " Recreating Symlinks:" |
335 | for i in $(find ${MROOT}/usr/$(mlibdir)/incoming -type l) |
336 | do |
337 | my_sym="$(readlink ${i})" |
338 | my_dest="$(basename ${i})" |
339 | |
340 | echo " ${my_dest} -> ${my_dest}" |
341 | |
342 | # assure to remove the old ones; |
343 | [ -L ${MROOT}/usr/$(mlibdir)/"${my_dest}" ] && \ |
344 | rm ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
345 | |
346 | ln -snf "${my_sym}" ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
347 | done |
348 | ) |
349 | fi |
350 | |
351 | # now, get rid of the temporary directory: |
352 | rm -rf ${MROOT}/usr/$(mlibdir)/incoming |
353 | |
354 | # remove stale nptl libpthread-2.?.?.so, |
355 | # fix only needed for glibc with linuxthreads; |
356 | # prevent reloc errors such as: |
357 | # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory |
358 | |
359 | # get our new libpthread.so.0 |
360 | local NEW_PTHREAD |
361 | NEW_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
362 | |
363 | if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ] |
364 | then |
365 | echo " Removing stale libpthread libraries ..." |
366 | for file in ${MROOT}/usr/$(mlibdir)/libpthread-* |
367 | do |
368 | if [ "$(basename ${file})" != "${NEW_PTHREAD}" ] |
369 | then |
370 | rm -f ${file} |
371 | fi |
372 | done |
373 | |
374 | #rm -f /lib/${OLD_PTHREAD} |
375 | |
376 | ln -snf ${NEW_PTHREAD} ${MROOT}/usr/$(mlibdir)/libpthread.so.0 |
377 | fi |
378 | |
379 | if [ -x /usr/sbin/iconvconfig ] |
380 | then |
381 | # generate fastloading iconv module configuration file. |
382 | echo " Generate iconv module config ..." |
383 | /usr/sbin/iconvconfig --prefix=${MROOT}/ |
384 | fi |
385 | |
386 | # not working with busybox |
387 | if ! need_busybox_support /sbin/init |
388 | then |
389 | # reloading init |
390 | echo " Reloading init ..." |
391 | [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null |
392 | fi |
393 | |
394 | # generating user def locales |
395 | echo " Generating user defined locales ..." |
396 | [[ -z ${MROOT} ]] && /usr/sbin/locale-gen |
397 | |
398 | # now we must fix the mage db files |
399 | # to stop the annoying errors messages |
400 | fix_db_files |
401 | } |