Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:keywords Id