Magellan Linux

Contents of /smage/trunk/core/eglibc/eglibc-2.7.0_20080225-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:keywords Id