core/glibc/PKGBUILD

168 lines
5.8 KiB
Bash
Raw Normal View History

2012-04-20 06:16:24 +08:00
# maintainer: Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
2010-03-13 23:25:19 +08:00
pkgname=glibc
2013-09-25 19:52:10 +08:00
pkgver=2.18
pkgrel=3
2010-03-13 23:25:19 +08:00
pkgdesc="GNU C Library"
2013-04-27 02:24:28 +08:00
arch=('x86_64')
2010-03-13 23:25:19 +08:00
url="http://www.gnu.org/software/libc"
license=('GPL' 'LGPL')
groups=('base')
2013-09-25 19:52:10 +08:00
depends=('linux-api-headers>=3.10' 'tzdata')
makedepends=('gcc>=4.8')
2011-10-08 08:02:42 +08:00
backup=(etc/gai.conf
etc/locale.gen
2013-04-27 02:24:28 +08:00
etc/nscd.conf)
2011-10-08 08:02:42 +08:00
options=('!strip')
2010-03-13 23:25:19 +08:00
install=glibc.install
2013-04-25 06:22:36 +08:00
source=(http://ftp.gnu.org/gnu/libc/${pkgname}-${pkgver}.tar.xz{,.sig}
2013-09-25 19:52:10 +08:00
glibc-2.18-readdir_r-CVE-2013-4237.patch
glibc-2.18-malloc-corrupt-CVE-2013-4332.patch
glibc-2.18-strcoll-CVE-2012-4412+4424.patch
glibc-2.18-ptr-mangle-CVE-2013-4788.patch
glibc-2.18-strstr-hackfix.patch
2012-11-11 03:09:39 +08:00
nscd.service
nscd.tmpfiles
2010-03-13 23:25:19 +08:00
locale.gen.txt
2013-09-25 19:52:10 +08:00
locale-gen # parallel version, see https://bugs.archlinux.org/task/36955
locale.patch
2013-04-27 02:24:28 +08:00
glibc.conf)
2013-09-25 19:52:10 +08:00
sha1sums=('1f0e4e7ba5fe1f45ffd0548b6c36caef0bc7e51f'
'SKIP'
'7ecd9abb03495a620f0e4a2d45a6046310649fde'
'd3dd647f2f292c44f31311ea3cf9e39db7ba798e'
'04f38fe8508e2541c9d946a9d788c60f160c1cc0'
'f0117b071f5f24c2522231aa9452342bea0d0c3f'
'f928cedf0fb3d2bf046975680c637d6b09ad93cf'
'18406ad58e562a85a13b3cebe938841cf5d624ff'
'1a9eb962463409159792a1a2d768524f37ce2e7b'
'61f72da0b1f44af013c8a6873a298c2b6efb3f3d'
'b8a9e83a5c0d22066a7923f07d02c88484d438ba'
'46afb75ca2197d84d6e8cc426389a1e7d8aca479'
'b335a2526d631aaed53d3a88cc3904a51fccd1a4')
prepare() {
2013-04-25 06:22:36 +08:00
cd ${srcdir}/${pkgname}-${pkgver}
2013-09-25 19:52:10 +08:00
# upstream commit 91ce4085
patch -p1 -i $srcdir/glibc-2.18-readdir_r-CVE-2013-4237.patch
# upstream commits 1159a193, 55e17aad and b73ed247
patch -p1 -i $srcdir/glibc-2.18-malloc-corrupt-CVE-2013-4332.patch
2012-04-20 06:16:24 +08:00
2013-09-25 19:52:10 +08:00
# upstream commits 1326ba1a, 141f3a77 and 303e567a
# https://sourceware.org/ml/libc-alpha/2013-08/msg00394.html
# https://sourceware.org/ml/libc-alpha/2013-08/msg00462.html
patch -p1 -i $srcdir/glibc-2.18-strcoll-CVE-2012-4412+4424.patch
2012-04-20 06:16:24 +08:00
2013-09-25 19:52:10 +08:00
# upstream commits c61b4d41 and 0b1f8e35
patch -p1 -i $srcdir/glibc-2.18-ptr-mangle-CVE-2013-4788.patch
2012-04-20 06:16:24 +08:00
2013-09-25 19:52:10 +08:00
# hack fix for strstr issues on x86
patch -p1 -i $srcdir/glibc-2.18-strstr-hackfix.patch
# patch regarding locale generation, severly affects ISO creation
# origin: http://comments.gmane.org/gmane.comp.lib.glibc.alpha/31543
patch -p1 -u -i ${srcdir}/locale.patch
2013-09-25 19:52:10 +08:00
mkdir ${srcdir}/glibc-build
}
build() {
cd ${srcdir}/glibc-build
2010-03-13 23:25:19 +08:00
echo "slibdir=/lib" >> configparms
2013-04-27 02:24:28 +08:00
2013-04-25 06:22:36 +08:00
# remove hardening options for building libraries
CFLAGS=${CFLAGS/-fstack-protector/}
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
2013-04-27 02:24:28 +08:00
${srcdir}/glibc-${pkgver}/configure --prefix=/usr \
--libdir=/usr/lib --libexecdir=/usr/lib \
--with-headers=/usr/include \
--enable-add-ons=nptl,libidn \
2012-12-16 09:07:23 +08:00
--enable-obsolete-rpc \
2012-11-14 05:58:35 +08:00
--enable-kernel=2.6.32 \
2013-04-25 06:22:36 +08:00
--enable-bind-now --disable-profile \
--enable-stackguard-randomization \
2013-09-25 19:52:10 +08:00
--enable-lock-elision \
2011-10-26 17:30:58 +08:00
--enable-multi-arch
2011-10-08 08:02:42 +08:00
2013-04-25 06:22:36 +08:00
# build libraries with hardening disabled
echo "build-programs=no" >> configparms
make
# re-enable hardening for programs
sed -i "/build-programs=/s#no#yes#" configparms
echo "CC += -fstack-protector -D_FORTIFY_SOURCE=2" >> configparms
echo "CXX += -fstack-protector -D_FORTIFY_SOURCE=2" >> configparms
make
2013-04-25 06:22:36 +08:00
# remove harding in preparation to run test-suite
sed -i '2,4d' configparms
2011-10-08 08:02:42 +08:00
}
check() {
2013-04-27 02:24:28 +08:00
# bug to file - the linker commands need to be reordered
LDFLAGS=${LDFLAGS/--as-needed,/}
cd ${srcdir}/glibc-build
# from LFS:
# The nptl/tst-clock2, nptl/tst-attr3, tst/tst-cputimer1, and rt/tst-cpuclock2 tests have been known to fail.
# The reason is not completely understood, but indications are that minor timing issues can trigger these failures.
# -k is an ugly workaround
make -k check 2>&1 | tee glibc-check-log
2010-05-16 23:08:55 +08:00
}
package() {
cd ${srcdir}/glibc-build
2012-11-11 03:09:39 +08:00
install -dm755 ${pkgdir}/etc
touch ${pkgdir}/etc/ld.so.conf
make install_root=${pkgdir} install
2010-03-13 23:25:19 +08:00
2011-10-08 08:02:42 +08:00
rm -f ${pkgdir}/etc/ld.so.{cache,conf}
2010-03-13 23:25:19 +08:00
2012-11-14 05:58:35 +08:00
install -dm755 ${pkgdir}/{,usr/{sbin,lib/{,locale,systemd/system,tmpfiles.d}}}
2012-11-11 03:09:39 +08:00
2013-04-27 02:24:28 +08:00
install -m644 ${srcdir}/glibc-${pkgver}/nscd/nscd.conf ${pkgdir}/etc/nscd.conf
sed -i -e 's/^\tserver-user/#\tserver-user/' ${pkgdir}/etc/nscd.conf
2012-11-11 03:09:39 +08:00
install -m644 ${srcdir}/nscd.service ${pkgdir}/usr/lib/systemd/system
install -m644 ${srcdir}/nscd.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/nscd.conf
2013-04-27 02:24:28 +08:00
install -m755 ${srcdir}/locale-gen ${pkgdir}/usr/sbin
install -m644 ${srcdir}/glibc-${pkgver}/posix/gai.conf ${pkgdir}/etc/gai.conf
2010-03-13 23:25:19 +08:00
# create /etc/locale.gen
install -m644 ${srcdir}/locale.gen.txt ${pkgdir}/etc/locale.gen
2013-04-25 06:22:36 +08:00
sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' \
${srcdir}/glibc-${pkgver}/localedata/SUPPORTED >> ${pkgdir}/etc/locale.gen
2010-03-13 23:25:19 +08:00
2013-04-27 02:24:28 +08:00
# fix for the linker
sed -i '/RTLDLIST/s%lib64%lib%' ${pkgdir}/usr/bin/ldd
# Comply with multilib binaries, they look for the linker in /lib64
mkdir ${pkgdir}/lib64
cd ${pkgdir}/lib64
ln -v -s ../lib/ld* .
2012-11-14 05:58:35 +08:00
2012-11-14 04:20:22 +08:00
cd ${pkgdir}
strip $STRIP_BINARIES sbin/{ldconfig,sln} \
usr/bin/{gencat,getconf,getent,iconv,locale} \
usr/bin/{localedef,pcprofiledump,rpcgen,sprof} \
usr/lib/getconf/* \
2011-10-08 08:02:42 +08:00
usr/sbin/{iconvconfig,nscd}
2013-02-21 02:48:17 +08:00
strip $STRIP_STATIC usr/lib/*.a
2013-02-21 02:48:17 +08:00
strip $STRIP_SHARED lib/{libanl,libBrokenLocale,libcidn,libcrypt}-${pkgver}.so \
lib/libnss_{compat,dns,files,hesiod,nis,nisplus}-${pkgver}.so \
lib/{libdl,libm,libnsl,libresolv,librt,libutil}-${pkgver}.so \
lib/{libmemusage,libpcprofile,libSegFault}.so \
2013-09-25 19:52:10 +08:00
usr/lib/{audit,gconv}/*.so
2012-11-14 07:52:44 +08:00
2013-04-27 02:24:28 +08:00
# Add /usr/lib32 to the default library search path
2012-11-16 04:21:00 +08:00
install -Dm644 "$srcdir/glibc.conf" "$pkgdir/etc/ld.so.conf.d/glibc.conf"
2011-10-08 08:02:42 +08:00
}