Magellan Linux

Contents of /smage/trunk/core/eglibc/eglibc-2.10.0_20091229-r3.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:keywords Id