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