core/glibc/PKGBUILD

154 lines
5.1 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-04-25 06:22:36 +08:00
pkgver=2.17
pkgrel=4
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-04-27 02:24:28 +08:00
depends=('linux-api-headers>=3.7' 'tzdata')
2012-11-14 04:20:22 +08:00
makedepends=('gcc>=4.7')
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}
glibc-2.17-sync-with-linux37.patch
glibc-2.17-getaddrinfo-stack-overflow.patch
glibc-2.17-regexp-matcher-overrun.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-04-27 02:24:28 +08:00
locale-gen
locale.patch
2013-04-27 02:24:28 +08:00
glibc.conf)
2013-04-25 06:22:36 +08:00
md5sums=('87bf675c8ee523ebda4803e8e1cec638'
2013-04-27 02:24:28 +08:00
'SKIP'
2013-04-25 06:22:36 +08:00
'fb99380d94598cc76d793deebf630022'
'56d5f2c09503a348281a20ae404b7de3'
'200acc05961b084ee00dde919e64f82d'
'c1e07c0bec0fe89791bfd9d13fc85edf'
2012-11-11 03:09:39 +08:00
'bccbe5619e75cf1d97312ec3681c605c'
2010-03-13 23:25:19 +08:00
'07ac979b6ab5eeb778d55f041529d623'
2013-04-27 02:24:28 +08:00
'476e9113489f93b348b21e144b6a8fcf'
'a9e0575f8cb7892c0a15b088139abf37'
2013-04-27 02:24:28 +08:00
'8b3298de2392a10905a64ceccf56d2c1')
2010-03-13 23:25:19 +08:00
build() {
2013-04-25 06:22:36 +08:00
cd ${srcdir}/${pkgname}-${pkgver}
2012-04-20 06:16:24 +08:00
2013-04-25 06:22:36 +08:00
# combination of upstream commits 318cd0b, b540704 and fc1abbe
patch -p1 -i ${srcdir}/glibc-2.17-sync-with-linux37.patch
2012-04-20 06:16:24 +08:00
2013-04-25 06:22:36 +08:00
# CVE-2013-1914 - upstream commit 1cef1b19
patch -p1 -i ${srcdir}/glibc-2.17-getaddrinfo-stack-overflow.patch
2012-04-20 06:16:24 +08:00
2013-04-25 06:22:36 +08:00
# CVE-2013-0242 - upstream commit a445af0b
patch -p1 -i ${srcdir}/glibc-2.17-regexp-matcher-overrun.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-04-27 02:24:28 +08:00
cd ${srcdir}
mkdir glibc-build
2010-03-13 23:25:19 +08:00
cd glibc-build
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 \
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 \
2011-10-08 08:02:42 +08:00
usr/lib/{pt_chown,{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
}