Magellan Linux

Contents of /trunk/core/glibc-nptl/glibc-nptl-2.8.0_20081006-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:keywords Id