Magellan Linux

Contents of /smage/trunk/core/eglibc/eglibc-2.9.0_20090111-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:keywords Id