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