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