Annotation of /smage/trunk/core/glibc/glibc-2.15-r1.smage2
Parent Directory | Revision Log
Revision 3611 -
(hide annotations)
(download)
Tue Jul 10 15:03:26 2012 UTC (11 years, 10 months ago) by niro
File size: 19847 byte(s)
Tue Jul 10 15:03:26 2012 UTC (11 years, 10 months ago) by niro
File size: 19847 byte(s)
-fixed so installation
1 | niro | 3599 | # $Id$ |
2 | |||
3 | PNAME="glibc" | ||
4 | PVER="2.15" | ||
5 | PBUILD="r1" | ||
6 | |||
7 | niro | 3602 | SPLIT_PACKAGES="glibc glibc-dev" |
8 | |||
9 | niro | 3599 | PCAT="sys-libs" |
10 | |||
11 | niro | 3602 | GLIBC_DEPEND=">= sys-apps/base-files-0.1" |
12 | niro | 3599 | |
13 | # we force headers to one specific version | ||
14 | # (for x86_64 2.6.12.0-r2 bi-arch headers are needed!) | ||
15 | niro | 3602 | SDEPEND="== sys-kernel/linux-libc-headers-3.4.4 |
16 | ${GLIBC_DEPEND}" | ||
17 | niro | 3599 | |
18 | # functions to include in the mage file | ||
19 | SPECIAL_FUNCTIONS="fix_db_files" | ||
20 | |||
21 | SRCFILE="glibc-${PVER/.0/}.tar.xz" | ||
22 | SRCDIR="${BUILDDIR}/glibc-${PVER/.0/}" | ||
23 | |||
24 | ENVD_REV="1.2" | ||
25 | |||
26 | niro | 3602 | sminclude mtools cleanutils alx |
27 | niro | 3599 | |
28 | SRC_URI=( | ||
29 | ftp://sources.redhat.com/pub/glibc/releases/${SRCFILE} | ||
30 | ftp://sources.redhat.com/pub/glibc/snapshots/${SRCFILE} | ||
31 | gnu://${PNAME}/${SRCFILE} | ||
32 | mirror://${PNAME}/${SRCFILE} | ||
33 | mirror://${PNAME}/glibc.envd-${ENVD_REV} | ||
34 | mirror://${PNAME}/locale.gen-header | ||
35 | mirror://${PNAME}/locale-gen | ||
36 | mirror://${PNAME}/${PNAME}-2.12.1-bz4781.patch | ||
37 | mirror://${PNAME}/${PNAME}-2.12.1-i686.patch | ||
38 | mirror://${PNAME}/${PNAME}-2.12.2-ignore-origin-of-privileged-program.patch | ||
39 | mirror://${PNAME}/${PNAME}-2.13-dlclose-search-reset.patch | ||
40 | mirror://${PNAME}/${PNAME}-2.14-libdl-crash.patch | ||
41 | mirror://${PNAME}/${PNAME}-2.14-reexport-rpc-interface.patch | ||
42 | mirror://${PNAME}/${PNAME}-2.14-reinstall-nis-rpc-headers.patch | ||
43 | mirror://${PNAME}/${PNAME}-${PVER}-fix-res_query-assert.patch | ||
44 | mirror://${PNAME}/${PNAME}-${PVER}-lddebug-scopes.patch | ||
45 | mirror://${PNAME}/${PNAME}-${PVER}-revert-c5a0802a.patch | ||
46 | mirror://${PNAME}/${PNAME}-${PVER}-scanf.patch | ||
47 | mirror://${PNAME}/${PNAME}-${PVER}-ifunc.patch | ||
48 | mirror://${PNAME}/${PNAME}-${PVER}-avx.patch | ||
49 | mirror://${PNAME}/${PNAME}-${PVER}-strcasecmp-disable-avx.patch | ||
50 | mirror://${PNAME}/${PNAME}-${PVER}-gb18030.patch | ||
51 | mirror://${PNAME}/${PNAME}-${PVER}-revert-netlink-cache.patch | ||
52 | mirror://${PNAME}/${PNAME}-${PVER}-arena.patch | ||
53 | mirror://${PNAME}/${PNAME}-${PVER}-negative-result-cache.patch | ||
54 | mirror://${PNAME}/${PNAME}-${PVER}-multiarch-x86-strcmp.patch | ||
55 | mirror://${PNAME}/${PNAME}-${PVER}-vdso.patch | ||
56 | mirror://${PNAME}/${PNAME}-${PVER}-feraiseexcept-plt.patch | ||
57 | mirror://${PNAME}/${PNAME}-${PVER}-vfprintf-nargs.patch | ||
58 | mirror://${PNAME}/${PNAME}-${PVER}-__libc_res_nquerydomain-out-of-bounds.patch | ||
59 | mirror://${PNAME}/${PNAME}-${PVER}-fmtmsg-locking.patch | ||
60 | mirror://${PNAME}/${PNAME}-${PVER}-non-signalling-comparisons.patch | ||
61 | mirror://${PNAME}/${PNAME}-${PVER}-rintf-rounding.patch | ||
62 | mirror://${PNAME}/${PNAME}-${PVER}-nearbyintf-rounding.patch | ||
63 | mirror://${PNAME}/${PNAME}-${PVER}-confstr-local-buffer-extent.patch | ||
64 | mirror://${PNAME}/${PNAME}-${PVER}-testsuite.patch | ||
65 | ) | ||
66 | |||
67 | # sed line: on 2 digits add an zero: 2.7 -> 2.7.0 | ||
68 | UP2DATE="updatecmd_gnu ${PNAME/-nptl/} | sed 's/^\([0-9]\.[0-9]\$\)/\1.0/'" | ||
69 | |||
70 | # glibc don't like strong CFLAGS | ||
71 | export CFLAGS="${CFLAGS//-O?} -O2" | ||
72 | # glibc -> nptl thread don't like striping | ||
73 | msetfeature "!strip" | ||
74 | # gcc 3.0 - 3.3 needs this: | ||
75 | export CFLAGS="${CFLAGS} -finline-limit=2000" | ||
76 | export CXXFLAGS="${CFLAGS}" | ||
77 | export LDFLAGS="${LDFLAGS//-Wl,--relax}" | ||
78 | |||
79 | # hack to fix NPTL issues with xen, only required on 32bit arches | ||
80 | if [[ ${ARCH} = i*86 ]] | ||
81 | then | ||
82 | export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs" | ||
83 | fi | ||
84 | |||
85 | # glibc-2.6.1 and above needs march CFLAGS: -march=${ARCH} -mtune=generic | ||
86 | # first filter -mtune and -march from flags | ||
87 | for flag in ${CFLAGS} | ||
88 | do | ||
89 | case ${flag} in | ||
90 | -mtune=*) continue ;; | ||
91 | -march=*) continue ;; | ||
92 | esac | ||
93 | newflags="${newflags} ${flag}" | ||
94 | done | ||
95 | export CFLAGS="${newflags}" | ||
96 | |||
97 | # than add our defaults for glibc | ||
98 | [[ ${ARCH} = i*86 ]] && export CFLAGS="${CFLAGS} -march=${ARCH}" # only i*86 | ||
99 | export CFLAGS="${CFLAGS} -mtune=generic" # all arches | ||
100 | export CXXFLAGS="${CFLAGS}" | ||
101 | |||
102 | # use other linux-headers | ||
103 | [[ -z ${ALT_HEADERS} ]] && export ALT_HEADERS="/usr/include" | ||
104 | |||
105 | # kernel support | ||
106 | export ENABLE_KERNEL=2.6.32 | ||
107 | |||
108 | niro | 3602 | split_info_glibc() |
109 | { | ||
110 | DESCRIPTION="GNU libc6 (also called glibc2) C library with NPTL Threads." | ||
111 | DEPEND="${GLIBC_DEPEND}" | ||
112 | PROVIDE="virtual/glibc" | ||
113 | } | ||
114 | |||
115 | split_info_glibc-dev() | ||
116 | { | ||
117 | DESCRIPTION="Development files for sys-libs/glibc-${PVER}." | ||
118 | DEPEND="== sys-libs/glibc-${PVER}" | ||
119 | } | ||
120 | |||
121 | niro | 3599 | src_prepare() |
122 | { | ||
123 | munpack ${SRCFILE} || die | ||
124 | cd ${SRCDIR} | ||
125 | |||
126 | # http://sources.redhat.com/bugzilla/show_bug.cgi?id=4781 | ||
127 | mpatch ${PNAME}-2.12.1-bz4781.patch || die | ||
128 | |||
129 | # http://sources.redhat.com/bugzilla/show_bug.cgi?id=411 | ||
130 | # http://sourceware.org/ml/libc-alpha/2009-07/msg00072.html | ||
131 | mpatch ${PNAME}-2.12.1-i686.patch || die | ||
132 | |||
133 | # security fix, fixes CVE-2010-3847 | ||
134 | # see: http://www.exploit-db.com/exploits/15274/ | ||
135 | mpatch ${PNAME}-2.12.2-ignore-origin-of-privileged-program.patch || die | ||
136 | |||
137 | # http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=675155e9 (fedora branch) | ||
138 | # http://sourceware.org/ml/libc-alpha/2011-06/msg00006.html | ||
139 | mpatch ${PNAME}-2.14-libdl-crash.patch || die | ||
140 | |||
141 | # re-export RPC interface until libtirpc is ready as a replacement | ||
142 | # http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=acee4873 (fedora branch) | ||
143 | mpatch ${PNAME}-2.14-reexport-rpc-interface.patch || die | ||
144 | # http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdd816a3 (fedora branch) | ||
145 | mpatch ${PNAME}-2.14-reinstall-nis-rpc-headers.patch || die | ||
146 | |||
147 | # fix res_query assertion | ||
148 | # http://sourceware.org/bugzilla/show_bug.cgi?id=13013 | ||
149 | mpatch ${PNAME}-${PVER}-fix-res_query-assert.patch || die | ||
150 | |||
151 | # fix up regcomp/regexec | ||
152 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=2ba92745 | ||
153 | # mpatch ${PNAME}-${PVER}-regex.patch | ||
154 | |||
155 | # propriety nvidia crash - https://bugzilla.redhat.com/show_bug.cgi?id=737223 | ||
156 | # http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=0c95ab64 (fedora branch) | ||
157 | mpatch ${PNAME}-${PVER}-lddebug-scopes.patch || die | ||
158 | |||
159 | # revert commit c5a0802a - causes various hangs | ||
160 | # https://bugzilla.redhat.com/show_bug.cgi?id=769421 | ||
161 | # Note: fedora may have actual fix (not submitted upstream yet...) | ||
162 | # http://pkgs.fedoraproject.org/gitweb/?p=glibc.git;a=blob_plain;f=glibc-rh552960-2.patch | ||
163 | mpatch ${PNAME}-${PVER}-revert-c5a0802a.patch || die | ||
164 | |||
165 | # fix realloc usage in vfscanf | ||
166 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=20b38e03 | ||
167 | mpatch ${PNAME}-${PVER}-scanf.patch || die | ||
168 | |||
169 | # fix ifunc relocations | ||
170 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=6ee65ed6 | ||
171 | mpatch ${PNAME}-${PVER}-ifunc.patch || die | ||
172 | |||
173 | # fix AVX detection | ||
174 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=afc5ed09 | ||
175 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=08cf777f | ||
176 | mpatch ${PNAME}-${PVER}-avx.patch || die | ||
177 | # and "fix" strcasecmp | ||
178 | mpatch ${PNAME}-${PVER}-strcasecmp-disable-avx.patch || die | ||
179 | |||
180 | # fix GB18030 charmap | ||
181 | # http://sourceware.org/bugzilla/show_bug.cgi?id=11837 | ||
182 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=2a57bd79 (fedora branch) | ||
183 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=3d828a61 (fedora branch) | ||
184 | mpatch ${PNAME}-${PVER}-gb18030.patch || die | ||
185 | |||
186 | # fix crash in __nscd_get_mapping if nscd not running | ||
187 | # http://sourceware.org/bugzilla/show_bug.cgi?id=13594 (potential fix in comment) | ||
188 | # reverts commit 3a2c0242 and other necessary following changes... | ||
189 | mpatch ${PNAME}-${PVER}-revert-netlink-cache.patch || die | ||
190 | |||
191 | # handle ARENA_TEST correctly | ||
192 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=41b81892 | ||
193 | mpatch ${PNAME}-${PVER}-arena.patch || die | ||
194 | |||
195 | # do not cache negative results in nscd if these are transient | ||
196 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=3e1aa84e | ||
197 | mpatch ${PNAME}-${PVER}-negative-result-cache.patch || die | ||
198 | |||
199 | # strcasecmp_l, strncasecmp_l act as strcmp for multiarch x86 | ||
200 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=0bab47b6 | ||
201 | mpatch ${PNAME}-${PVER}-multiarch-x86-strcmp.patch || die | ||
202 | |||
203 | # always set l_used for vDSO. | ||
204 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=1f393a11 | ||
205 | mpatch ${PNAME}-${PVER}-vdso.patch || die | ||
206 | |||
207 | # fix x86 PLT slot usage for feraiseexcept | ||
208 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=7c35ffed | ||
209 | mpatch ${PNAME}-${PVER}-feraiseexcept-plt.patch || die | ||
210 | |||
211 | # vfprintf nargs overflow - CVE-2012-0864 | ||
212 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=7c1f4834 | ||
213 | mpatch ${PNAME}-${PVER}-vfprintf-nargs.patch || die | ||
214 | |||
215 | # avoid out ouf bounds read in __libc_res_nquerydomain | ||
216 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=8fdceb2e | ||
217 | mpatch ${PNAME}-${PVER}-__libc_res_nquerydomain-out-of-bounds.patch || die | ||
218 | |||
219 | # make fmtmsg function thread-safe | ||
220 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=7724defc | ||
221 | mpatch ${PNAME}-${PVER}-fmtmsg-locking.patch || die | ||
222 | |||
223 | # use non-signaling floating-point comparisons in math functions | ||
224 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=92221550 | ||
225 | mpatch ${PNAME}-${PVER}-non-signalling-comparisons.patch || die | ||
226 | |||
227 | # fix rintf rounding. | ||
228 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=fe45ce09 | ||
229 | mpatch ${PNAME}-${PVER}-rintf-rounding.patch || die | ||
230 | |||
231 | # fix nearbyintf rounding | ||
232 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=6cbeae47 | ||
233 | mpatch ${PNAME}-${PVER}-nearbyintf-rounding.patch || die | ||
234 | |||
235 | # fix varaible scope issue in confstr | ||
236 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=ac4c54f0 | ||
237 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=d6a403f9 | ||
238 | mpatch ${PNAME}-${PVER}-confstr-local-buffer-extent.patch || die | ||
239 | |||
240 | # fix testsuite failures with --as-needed | ||
241 | # http://sourceware.org/git/?p=glibc.git;a=commit;h=d4c2917f | ||
242 | mpatch ${PNAME}-${PVER}-testsuite.patch || die | ||
243 | |||
244 | # binutils patch needs reconf | ||
245 | autoconf --force || die | ||
246 | |||
247 | # fix permissions on some of the scripts | ||
248 | chmod u+x ${SRCDIR}/scripts/*.sh || die | ||
249 | |||
250 | install -d ${SRCDIR}/build || die | ||
251 | cd ${SRCDIR}/build | ||
252 | |||
253 | if [ ! -f /etc/ld.so.conf ] | ||
254 | then | ||
255 | touch /etc/ld.so.conf || die | ||
256 | fi | ||
257 | } | ||
258 | |||
259 | src_compile() | ||
260 | { | ||
261 | local myopts | ||
262 | |||
263 | # generic pathes | ||
264 | myopts="--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info" | ||
265 | # disable profiling | ||
266 | myopts+=" --disable-profile" | ||
267 | # enable addons | ||
268 | myopts+=" --enable-add-ons=nptl,libidn" | ||
269 | # enable tls | ||
270 | myopts+=" --with-tls --with-__thread" | ||
271 | # supported kernel-release | ||
272 | myopts+=" --enable-kernel=${ENABLE_KERNEL}" | ||
273 | # disable cvs and gd support | ||
274 | myopts+=" --without-cvs --without-gd" | ||
275 | # enable bindnow | ||
276 | myopts+=" --enable-bind-now" | ||
277 | |||
278 | # support multilib lib64 dir (x86_64 only) | ||
279 | if [[ ${ARCH} = x86_64 ]] | ||
280 | then | ||
281 | # first build a -m32 version | ||
282 | install -d ${SRCDIR}/build-m32 | ||
283 | cd ${SRCDIR}/build-m32 | ||
284 | |||
285 | CC="gcc -m32" CXX="g++ -m32" \ | ||
286 | CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \ | ||
287 | CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \ | ||
288 | ../configure \ | ||
289 | --build=${CHOST} \ | ||
290 | --host=i686-pc-linux-gnu \ | ||
291 | --libdir=/usr/lib \ | ||
292 | --libexecdir=/usr/lib/glibc \ | ||
293 | ${myopts} \ | ||
294 | || die | ||
295 | |||
296 | make PARALLELMFLAGS="${MAKEOPTS}" || die | ||
297 | fi | ||
298 | |||
299 | cd ${SRCDIR}/build | ||
300 | |||
301 | if [[ ${ARCH} = x86_64 ]]; then | ||
302 | # make sure the -m64 libs goes really to /lib64 | ||
303 | echo "slibdir=/$(mlibdir)" >> ${SRCDIR}/build/configparms || die | ||
304 | fi | ||
305 | |||
306 | # kernel-2.6 with nptl needs this | ||
307 | ../configure \ | ||
308 | --build=${CHOST} \ | ||
309 | --host=${CHOST} \ | ||
310 | --libdir=/usr/$(mlibdir) \ | ||
311 | --libexecdir=/usr/$(mlibdir)/glibc \ | ||
312 | ${myopts} \ | ||
313 | || die | ||
314 | |||
315 | make PARALLELMFLAGS="${MAKEOPTS}" || die | ||
316 | } | ||
317 | |||
318 | niro | 3602 | src_install_glibc() |
319 | niro | 3599 | { |
320 | if [[ ${ARCH} = x86_64 ]] | ||
321 | then | ||
322 | # install -m32 libs | ||
323 | cd ${SRCDIR}/build-m32 | ||
324 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} slibdir=/usr/lib rootsbindir=/usr/sbin install || die | ||
325 | fi | ||
326 | |||
327 | cd ${SRCDIR}/build | ||
328 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} slibdir=/usr/$(mlibdir) rootsbindir=/usr/sbin install || die | ||
329 | |||
330 | niro | 3602 | # cleanup |
331 | niro | 3611 | zapmost ${BINDIR} usr/$(mlibdir)/*.so \ |
332 | usr/$(mlibdir)/*-${PVER}.so.* \ | ||
333 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/*.so usr/lib/*.so.*') \ | ||
334 | niro | 3602 | usr/sbin/ldconfig \ |
335 | usr/bin/iconv \ | ||
336 | usr/bin/locale \ | ||
337 | usr/$(mlibdir)/gconv/IBM850.so \ | ||
338 | usr/$(mlibdir)/gconv/ISO8859-1.so \ | ||
339 | usr/$(mlibdir)/gconv/ISO8859-15.so \ | ||
340 | usr/$(mlibdir)/gconv/UNICODE.so \ | ||
341 | usr/$(mlibdir)/gconv/gconv-modules \ | ||
342 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/IBM850.so') \ | ||
343 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-1.so') \ | ||
344 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-15.so') \ | ||
345 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UNICODE.so') \ | ||
346 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/gconv-modules') \ | ||
347 | || die | ||
348 | niro | 3599 | |
349 | # nsswitch configuration file | ||
350 | minstalletc ${SRCDIR}/nss/nsswitch.conf || die | ||
351 | |||
352 | # base environment | ||
353 | minstallenv glibc.envd-${ENVD_REV} 00glibc || die | ||
354 | if [[ ${ARCH} = x86_64 ]] | ||
355 | then | ||
356 | MCONFIG="/etc/env.d/00glibc" | ||
357 | maddconfig "LDPATH=\"/$(mlibdir)\"" || die | ||
358 | maddconfig "LDPATH=\"/usr/$(mlibdir)\"" || die | ||
359 | maddconfig "LDPATH=\"/usr/local/$(mlibdir)\"" || die | ||
360 | maddconfig "LDPATH=\"/opt/$(mlibdir)\"" || die | ||
361 | fi | ||
362 | |||
363 | # strip all binaries | ||
364 | find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die | ||
365 | |||
366 | # strip all libraries | ||
367 | # want to be safe here; --strip-unneeded seems to cause pthread problems | ||
368 | # strip all but libpthread | ||
369 | install -d ${BUILDDIR}/thread-backup || die | ||
370 | mv ${BINDIR}/usr/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die | ||
371 | |||
372 | # now strip | ||
373 | find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die | ||
374 | mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/usr/$(mlibdir)/ || die | ||
375 | # remove stale directory | ||
376 | rm -rf ${BUILDDIR}/thread-backup || die | ||
377 | |||
378 | # prepare glibc for installation; slackware method | ||
379 | minstalldir /incoming || die | ||
380 | niro | 3610 | mv ${BINDIR}/usr/$(mlibdir)/*.so ${BINDIR}/incoming || die |
381 | niro | 3599 | mv ${BINDIR}/usr/$(mlibdir)/*.so.* ${BINDIR}/incoming || die |
382 | mv ${BINDIR}/incoming ${BINDIR}/usr/$(mlibdir)/incoming || die | ||
383 | mv ${BINDIR}/usr/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/usr/$(mlibdir) || die | ||
384 | } | ||
385 | |||
386 | niro | 3602 | src_install_glibc-dev() |
387 | { | ||
388 | if [[ ${ARCH} = x86_64 ]] | ||
389 | then | ||
390 | # install -m32 libs | ||
391 | cd ${SRCDIR}/build-m32 | ||
392 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} slibdir=/usr/lib rootsbindir=/usr/sbin install || die | ||
393 | fi | ||
394 | |||
395 | cd ${SRCDIR}/build | ||
396 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} slibdir=/usr/$(mlibdir) rootsbindir=/usr/sbin install || die | ||
397 | |||
398 | # cleanup -> in glibc | ||
399 | niro | 3611 | rm -r ${BINDIR}usr/$(mlibdir)/*.so || die |
400 | niro | 3602 | rm ${BINDIR}/usr/$(mlibdir)/*.so.* || die |
401 | rm ${BINDIR}/usr/$(mlibdir)/gconv/IBM850.so || die | ||
402 | rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-1.so || die | ||
403 | rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-15.so || die | ||
404 | rm ${BINDIR}/usr/$(mlibdir)/gconv/UNICODE.so || die | ||
405 | rm ${BINDIR}/usr/$(mlibdir)/gconv/gconv-modules || die | ||
406 | if [[ ${ARCH} = x86_64 ]] | ||
407 | then | ||
408 | niro | 3611 | rm -r ${BINDIR}/usr/lib/*.so || die |
409 | niro | 3602 | rm ${BINDIR}/usr/lib/*.so.* || die |
410 | rm ${BINDIR}/usr/lib/gconv/IBM850.so || die | ||
411 | rm ${BINDIR}/usr/lib/gconv/ISO8859-1.so || die | ||
412 | rm ${BINDIR}/usr/lib/gconv/ISO8859-15.so || die | ||
413 | rm ${BINDIR}/usr/lib/gconv/UNICODE.so || die | ||
414 | rm ${BINDIR}/usr/lib/gconv/gconv-modules || die | ||
415 | fi | ||
416 | rm ${BINDIR}/sbin/ldconfig || die | ||
417 | rm ${BINDIR}/usr/bin/iconv || die | ||
418 | rm ${BINDIR}/usr/bin/locale || die | ||
419 | |||
420 | # do not generate the locales here, let it the user do with the locale-gen tool | ||
421 | # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die | ||
422 | |||
423 | # install locales list and generate tools | ||
424 | # generate locale.gen file from localedata/SUPPORTED file | ||
425 | minstalletc locale.gen-header locale.gen || die | ||
426 | sed \ | ||
427 | -e 's:/: :g' \ | ||
428 | -e 's:\\: :g' \ | ||
429 | -e 's:SUPPORTED-LOCALES=::' \ | ||
430 | -e 's:\ \ $::g' \ | ||
431 | -e '/^#/d' \ | ||
432 | -e 's:^:#:g' \ | ||
433 | ${SRCDIR}/localedata/SUPPORTED \ | ||
434 | >> ${BINDIR}/etc/locale.gen || die | ||
435 | minstalldir /usr/sbin || die | ||
436 | minstallexec -s locale-gen /usr/sbin || die | ||
437 | |||
438 | # nscd configuration file | ||
439 | minstalletc ${SRCDIR}/nscd/nscd.conf || die | ||
440 | |||
441 | # gai configuration file | ||
442 | minstalletc ${SRCDIR}/posix/gai.conf || die | ||
443 | |||
444 | # busybox compat | ||
445 | local args | ||
446 | if [[ $(readlink /bin/cp) = */busybox ]] | ||
447 | then | ||
448 | args="-f" | ||
449 | else | ||
450 | args="--remove-destination" | ||
451 | fi | ||
452 | |||
453 | # we use Berlin as default | ||
454 | cp ${args} ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die | ||
455 | [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; } | ||
456 | [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; } | ||
457 | |||
458 | # strip all binaries | ||
459 | find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die | ||
460 | |||
461 | # strip all libraries | ||
462 | find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die | ||
463 | } | ||
464 | |||
465 | niro | 3599 | fix_db_files() |
466 | { | ||
467 | local i | ||
468 | local DB_ENTRY="${BUILDDIR}/${PKGNAME}" | ||
469 | |||
470 | for i in .files .symlinks .dirs | ||
471 | do | ||
472 | [ ! -f ${DB_ENTRY}/${i} ] && continue | ||
473 | [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue | ||
474 | |||
475 | echo " fixing /$(mlibdir)/incoming from db-entry '${i}' ..." | ||
476 | |||
477 | # /lib/incoming -> empty line; sed2 removes all empty lines | ||
478 | #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i} | ||
479 | # do not simply emtpy the line, but change it the the correct path, | ||
480 | # so no stale libs are around if the package gets updated! | ||
481 | sed -i \ | ||
482 | -e "s:/$(mlibdir)/incoming:/$(mlibdir):g" \ | ||
483 | -e "s:/$(mlibdir)/incoming.*::g" \ | ||
484 | -e '/^$/d' ${DB_ENTRY}/${i} | ||
485 | done | ||
486 | } | ||
487 | |||
488 | niro | 3602 | preinstall_glibc() |
489 | niro | 3599 | { |
490 | niro | 3602 | add_conf_prot_mask /etc/env.d /etc/nsswitch.conf |
491 | } | ||
492 | |||
493 | postinstall_glibc() | ||
494 | { | ||
495 | niro | 3599 | # first save the old libpthread.so.0; |
496 | # it will later used to determinate that there are no stale | ||
497 | # libpthreads that breaks ldconfig | ||
498 | local OLD_PTHREAD | ||
499 | OLD_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" | ||
500 | |||
501 | # slackware install method | ||
502 | |||
503 | # we cannot easily install the glibc libs, | ||
504 | # because our tools for cp etc needs them to run | ||
505 | |||
506 | local file | ||
507 | |||
508 | echo " Switching to new glibc ..." | ||
509 | # swap libraries on the fly: | ||
510 | if [ -x /sbin/ldconfig -a -d /usr/$(mlibdir)/incoming ] && [[ -z ${MROOT} ]] | ||
511 | then | ||
512 | # first create copies of the incoming libraries: | ||
513 | cd /usr/$(mlibdir)/incoming | ||
514 | for file in $(find /usr/$(mlibdir)/incoming -type f) | ||
515 | do | ||
516 | if [ ! -r "../$(basename ${file}).incoming" ] | ||
517 | then | ||
518 | cp -a ${file} ../$(basename ${file}).incoming | ||
519 | fi | ||
520 | done | ||
521 | |||
522 | # then switch to them all at once: | ||
523 | /sbin/ldconfig -l /usr/$(mlibdir)/*.incoming 2> /dev/null | ||
524 | |||
525 | # finally, rename them and clean up: | ||
526 | cd /usr/$(mlibdir) | ||
527 | for file in *.incoming | ||
528 | do | ||
529 | rm -f $(basename ${file} .incoming) | ||
530 | cp -a ${file} $(basename ${file} .incoming) | ||
531 | /sbin/ldconfig -l $(basename ${file} .incoming) | ||
532 | rm -f ${file} | ||
533 | done | ||
534 | |||
535 | # no ldconfig? | ||
536 | # good, it's safe to just jam it on home (and make links below): | ||
537 | else | ||
538 | ( | ||
539 | cd ${MROOT}/usr/$(mlibdir)/incoming | ||
540 | for file in * | ||
541 | do | ||
542 | cp -a ${file} .. | ||
543 | done | ||
544 | |||
545 | local my_sym | ||
546 | local my_dest | ||
547 | |||
548 | # rebuild symlinks | ||
549 | echo " Recreating Symlinks:" | ||
550 | for i in $(find ${MROOT}/usr/$(mlibdir)/incoming -type l) | ||
551 | do | ||
552 | my_sym="$(readlink ${i})" | ||
553 | my_dest="$(basename ${i})" | ||
554 | |||
555 | echo " ${my_dest} -> ${my_dest}" | ||
556 | |||
557 | # assure to remove the old ones; | ||
558 | [ -L ${MROOT}/usr/$(mlibdir)/"${my_dest}" ] && \ | ||
559 | rm ${MROOT}/usr/$(mlibdir)/"${my_dest}" | ||
560 | |||
561 | ln -snf "${my_sym}" ${MROOT}/usr/$(mlibdir)/"${my_dest}" | ||
562 | done | ||
563 | ) | ||
564 | fi | ||
565 | |||
566 | # now, get rid of the temporary directory: | ||
567 | rm -rf ${MROOT}/usr/$(mlibdir)/incoming | ||
568 | |||
569 | # remove stale nptl libpthread-2.?.?.so, | ||
570 | # fix only needed for glibc with linuxthreads; | ||
571 | # prevent reloc errors such as: | ||
572 | # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory | ||
573 | |||
574 | # get our new libpthread.so.0 | ||
575 | local NEW_PTHREAD | ||
576 | NEW_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" | ||
577 | |||
578 | if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ] | ||
579 | then | ||
580 | echo " Removing stale libpthread libraries ..." | ||
581 | for file in ${MROOT}/usr/$(mlibdir)/libpthread-* | ||
582 | do | ||
583 | if [ "$(basename ${file})" != "${NEW_PTHREAD}" ] | ||
584 | then | ||
585 | rm -f ${file} | ||
586 | fi | ||
587 | done | ||
588 | |||
589 | #rm -f /lib/${OLD_PTHREAD} | ||
590 | |||
591 | ln -snf ${NEW_PTHREAD} ${MROOT}/usr/$(mlibdir)/libpthread.so.0 | ||
592 | fi | ||
593 | |||
594 | niro | 3602 | # now we must fix the mage db files |
595 | # to stop the annoying errors messages | ||
596 | fix_db_files | ||
597 | } | ||
598 | |||
599 | postinstall_glibc-dev() | ||
600 | { | ||
601 | niro | 3599 | if [ -x /usr/sbin/iconvconfig ] |
602 | then | ||
603 | # generate fastloading iconv module configuration file. | ||
604 | echo " Generate iconv module config ..." | ||
605 | /usr/sbin/iconvconfig --prefix=${MROOT}/ | ||
606 | fi | ||
607 | |||
608 | niro | 3602 | # not working with busybox |
609 | if [[ $(basename $(readlink /sbin/init)) != busybox ]] | ||
610 | then | ||
611 | # reloading init | ||
612 | echo " Reloading init ..." | ||
613 | [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null | ||
614 | fi | ||
615 | niro | 3599 | |
616 | # generating user def locales | ||
617 | echo " Generating user defined locales ..." | ||
618 | [[ -z ${MROOT} ]] && /usr/sbin/locale-gen | ||
619 | } |