Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 398 - (show annotations) (download)
Thu May 6 18:24:28 2010 UTC (13 years, 11 months ago) by niro
File size: 12217 byte(s)
-rev bump to -r2; missed some files needed by the ica-client and use mcore-split include to make life easier
1 # $Id$
2
3 PNAME="eglibc"
4 PVER="2.10.0_20091229"
5 PBUILD="r2"
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 src_prepare()
94 {
95 munpack ${SRCFILE} || die
96 cd ${SRCDIR}
97
98 # disable binutils -as-needed
99 sed -i 's/^have-as-needed.*/have-as-needed = no/' ${SRCDIR}/config.make.in || die
100
101 # fix permissions on some of the scripts
102 chmod u+x ${SRCDIR}/scripts/*.sh || die
103
104 install -d ${SRCDIR}/build || die
105 cd ${SRCDIR}/build
106
107 if [ ! -f /etc/ld.so.conf ]
108 then
109 touch /etc/ld.so.conf || die
110 fi
111
112 # disable some eglibc defaults:
113 # no ipv6 support
114 # sed -i "s:^\(OPTION_EGLIBC_ADVANCED_INET6 =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
115 # only some default charsets
116 # sed -i "s:^\(OPTION_EGLIBC_CHARSETS =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
117 # disable support for locales
118 # sed -i "s:^\(OPTION_EGLIBC_CATGETS =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
119 # sed -i "s:^\(OPTION_EGLIBC_LOCALES =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
120 # sed -i "s:^\(OPTION_EGLIBC_LOCALE_CODE =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
121 # disable mail aliases support
122 # sed -i "s:^\(OPTION_EGLIBC_DB_ALIASES =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
123 # # disable nis support
124 # sed -i "s:^\(OPTION_EGLIBC_NIS =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
125 # no remote services via rsh
126 # sed -i "s:^\(OPTION_EGLIBC_RCMD =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
127 # no sunrpc
128 # sed -i "s:^\(OPTION_EGLIBC_SUNRPC =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
129 # no support for old access of utmp
130 # sed -i "s:^\(OPTION_EGLIBC_UTMP =\).*:\1 n:" ${SRCDIR}/option-groups.defaults || die
131 }
132
133 src_compile()
134 {
135
136 # fixes some build issues;
137 # -> configure: error: no acceptable grep could be found
138 export ac_cv_path_GREP=/bin/grep
139
140 # support multilib lib64 dir (x86_64 only)
141 if [[ ${ARCH} = x86_64 ]]
142 then
143 # first build a -m32 version
144 install -d ${SRCDIR}/build-m32
145 cd ${SRCDIR}/build-m32
146
147 CC="gcc -m32" CXX="g++ -m32" \
148 ../configure \
149 --build=${CHOST} \
150 --host=i686-pc-linux-gnu \
151 --prefix=/usr \
152 --mandir=/usr/share/man \
153 --infodir=/usr/share/info \
154 --disable-profile \
155 --enable-add-ons=nptl \
156 --with-tls \
157 --with-__thread \
158 --enable-kernel=${ENABLE_KERNEL} \
159 --without-cvs \
160 --without-gd \
161 --libdir=/usr/lib \
162 --libexecdir=/usr/lib/eglibc \
163 --with-headers=${ALT_HEADERS} \
164 --disable-nls \
165 || die
166
167 make PARALLELMFLAGS="${MAKEOPTS}" || die
168 fi
169
170 cd ${SRCDIR}/build
171
172 if [[ ${ARCH} = x86_64 ]]; then
173 # make sure the -m64 libs goes really to /lib64
174 echo "slibdir=/$(mlibdir)" >> ${SRCDIR}/build/configparms || die
175 fi
176
177 # kernel-2.6 with nptl needs this
178 ../configure \
179 --build=${CHOST} \
180 --host=${CHOST} \
181 --prefix=/usr \
182 --mandir=/usr/share/man \
183 --infodir=/usr/share/info \
184 --disable-profile \
185 --enable-add-ons=nptl \
186 --with-tls \
187 --with-__thread \
188 --enable-kernel=2.6.0 \
189 --without-cvs \
190 --without-gd \
191 --libdir=/usr/$(mlibdir) \
192 --libexecdir=/usr/$(mlibdir)/eglibc \
193 --with-headers=${ALT_HEADERS} \
194 || die
195
196 make PARALLELMFLAGS="${MAKEOPTS}" || die
197 }
198
199 mcore_generic_src_install()
200 {
201 if [[ ${ARCH} = x86_64 ]]
202 then
203 # install -m32 libs
204 cd ${SRCDIR}/build-m32
205 make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
206 fi
207
208 cd ${SRCDIR}/build
209 make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die
210
211 # do not generate the locales here, let it the user do with the locale-gen tool
212 # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die
213
214 # install locales list and generate tools
215 # to generate this listing see the glibc-2.5/localedata/SUPPORTED file
216 minstalletc locale.gen || die
217 minstalldir /usr/sbin || die
218 minstallexec -s locale-gen /usr/sbin || die
219
220 # nsswitch configuration file
221 minstalletc nsswitch.conf || die
222
223 # nscd configuration file
224 minstalletc nscd.conf || die
225
226 # we use Berlin as default
227 cp --remove-destination ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die
228 [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; }
229 [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; }
230
231 # base environment
232 minstallenv eglibc.envd 00eglibc || die
233 if [[ ${ARCH} = x86_64 ]]
234 then
235 echo "LDPATH=\"/usr/local/$(mlibdir)\"" >> ${BINDIR}/etc/env.d/00eglibc || die
236 echo "LDPATH=\"/opt/$(mlibdir)\"" >> ${BINDIR}/etc/env.d/00eglibc || die
237 fi
238
239 # move some libs and tools to proper locations
240 # will suppress some ldconfig errors too
241 mv ${BINDIR}/$(mlibdir)/libmemusage.so ${BINDIR}/usr/$(mlibdir) || die
242 mv ${BINDIR}/$(mlibdir)/libpcprofile.so ${BINDIR}/usr/$(mlibdir) || die
243 mlink ../usr/$(mlibdir)/libmemusage.so /$(mlibdir)/libmemusage.so || die
244 mlink ../usr/$(mlibdir)/libpcprofile.so /$(mlibdir)/libpcprofile.so || die
245
246 # strip all binaries
247 find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
248
249 # strip all libraries
250 # want to be safe here; --strip-unneeded seems to cause pthread problems
251 # strip all but libpthread
252 install -d ${BUILDDIR}/thread-backup || die
253 mv ${BINDIR}/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die
254
255 # now strip
256 find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die
257 mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/$(mlibdir)/ || die
258 # remove stale directory
259 rm -rf ${BUILDDIR}/thread-backup || die
260
261 # prepare glibc for installation; slackware method
262 minstalldir /incoming || die
263 mv ${BINDIR}/$(mlibdir)/* ${BINDIR}/incoming || die
264 mv ${BINDIR}/incoming ${BINDIR}/$(mlibdir)/incoming || die
265 mv ${BINDIR}/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/$(mlibdir) || die
266 }
267
268 fix_db_files()
269 {
270 local i
271 local DB_ENTRY="${BUILDDIR}/${PKGNAME}"
272
273 for i in .files .symlinks .dirs
274 do
275 [ ! -f ${DB_ENTRY}/${i} ] && continue
276 [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue
277
278 echo " fixing /$(mlibdir)/incoming from db-entry '${i}' ..."
279
280 # /lib/incoming -> empty line; sed2 removes all empty lines
281 #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
282 # do not simply emtpy the line, but change it the the correct path,
283 # so no stale libs are around if the package gets updated!
284 sed -i -e "s:/$(mlibdir)/incoming:/$(mlibdir):g" \
285 -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
286 done
287 }
288
289 preinstall()
290 {
291 # remove libmemusage and libpcprofile as these libs now
292 # resides in /usr/lib and are symlinked to /lib
293 if [[ -f ${MROOT}/$(mlibdir)/libmemusage.so ]]
294 then
295 rm ${MROOT}/$(mlibdir)/libmemusage.so
296 fi
297
298 if [[ -f ${MROOT}/$(mlibdir)/libpcprofile.so ]]
299 then
300 rm ${MROOT}/$(mlibdir)/libpcprofile.so
301 fi
302 }
303
304 postinstall()
305 {
306 # first save the old libpthread.so.0;
307 # it will later used to determinate that there are no stale
308 # libpthreads that breaks ldconfig
309 local OLD_PTHREAD
310 OLD_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)"
311
312 # slackware install method
313
314 # we cannot easily install the glibc libs,
315 # because our tools for cp etc needs them to run
316
317 local file
318
319 echo " Switching to new glibc ..."
320 # swap libraries on the fly:
321 if [ -x /sbin/ldconfig -a -d /$(mlibdir)/incoming ] && [[ -z ${MROOT} ]]
322 then
323 # first create copies of the incoming libraries:
324 cd /$(mlibdir)/incoming
325 for file in $(find /$(mlibdir)/incoming -type f)
326 do
327 if [ ! -r "../$(basename ${file}).incoming" ]
328 then
329 cp -a ${file} ../$(basename ${file}).incoming
330 fi
331 done
332
333 # then switch to them all at once:
334 /sbin/ldconfig -l /$(mlibdir)/*.incoming 2> /dev/null
335
336 # finally, rename them and clean up:
337 cd /$(mlibdir)
338 for file in *.incoming
339 do
340 rm -f $(basename ${file} .incoming)
341 cp -a ${file} $(basename ${file} .incoming)
342 /sbin/ldconfig -l $(basename ${file} .incoming)
343 rm -f ${file}
344 done
345
346 # no ldconfig?
347 # good, it's safe to just jam it on home (and make links below):
348 else
349 (
350 cd ${MROOT}/$(mlibdir)/incoming
351 for file in *
352 do
353 cp -a ${file} ..
354 done
355
356 local my_sym
357 local my_dest
358
359 # rebuild symlinks
360 echo " Recreating Symlinks:"
361 for i in $(find ${MROOT}/$(mlibdir)/incoming -type l)
362 do
363 my_sym="$(readlink ${i})"
364 my_dest="$(basename ${i})"
365
366 echo " ${my_dest} -> ${my_dest}"
367
368 # assure to remove the old ones;
369 [ -L ${MROOT}/$(mlibdir)/"${my_dest}" ] && \
370 rm ${MROOT}/$(mlibdir)/"${my_dest}"
371
372 ln -snf "${my_sym}" ${MROOT}/$(mlibdir)/"${my_dest}"
373 done
374 )
375 fi
376
377 # now, get rid of the temporary directory:
378 rm -rf ${MROOT}/$(mlibdir)/incoming
379
380 # remove stale nptl libpthread-2.?.?.so,
381 # fix only needed for glibc with linuxthreads;
382 # prevent reloc errors such as:
383 # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
384
385 # get our new libpthread.so.0
386 local NEW_PTHREAD
387 NEW_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)"
388
389 if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ]
390 then
391 echo " Removing stale libpthread libraries ..."
392 for file in ${MROOT}/$(mlibdir)/libpthread-*
393 do
394 if [ "$(basename ${file})" != "${NEW_PTHREAD}" ]
395 then
396 rm -f ${file}
397 fi
398 done
399
400 #rm -f /lib/${OLD_PTHREAD}
401
402 ln -snf ${NEW_PTHREAD} ${MROOT}/$(mlibdir)/libpthread.so.0
403 fi
404
405 if [ -x /usr/sbin/iconvconfig ]
406 then
407 # generate fastloading iconv module configuration file.
408 echo " Generate iconv module config ..."
409 /usr/sbin/iconvconfig --prefix=${MROOT}/
410 fi
411
412 # not working with busybox
413 if [[ $(basename $(readlink /sbin/init)) != busybox ]]
414 then
415 # reloading init
416 echo " Reloading init ..."
417 [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null
418 fi
419
420 if [[ -x /usr/sbin/locale-gen ]] && [[ -z ${MROOT} ]]
421 then
422 # generating user def locales
423 echo " Generating user defined locales ..."
424 /usr/sbin/locale-gen
425 fi
426
427 # now we must fix the mage db files
428 # to stop the annoying errors messages
429 fix_db_files
430 }

Properties

Name Value
svn:keywords Id