2012-04-20 06:16:24 +08:00
# maintainer: Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
2010-09-09 03:53:22 +08:00
2014-05-23 21:33:36 +08:00
2010-03-13 23:25:19 +08:00
pkgname = glibc
2014-09-16 19:53:45 +08:00
pkgver = 2.20
2015-06-27 22:41:16 +08:00
pkgrel = 6
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' )
2014-09-16 19:53:45 +08:00
depends = ( 'linux-api-headers>=3.16.2' 'tzdata' 'filesystem>=2014.07' )
makedepends = ( 'gcc>=4.9' )
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)
2014-05-23 21:32:30 +08:00
options = ( '!strip' 'staticlibs' )
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}
2014-09-16 19:53:45 +08:00
glibc-2.20-getifaddrs_internal-segfault.patch
glibc-2.20-linux-3.16-additions.patch
glibc-2.20-do_ftell_wide-memleak.patch
2015-06-26 16:48:26 +08:00
glibc-2.20-disable-tsx.patch
2010-03-13 23:25:19 +08:00
locale.gen.txt
2014-05-23 21:33:36 +08:00
locale-gen)
2014-09-16 19:53:45 +08:00
md5sums = ( '948a6e06419a01bd51e97206861595b0'
2014-05-23 21:33:36 +08:00
'SKIP'
2014-09-16 19:53:45 +08:00
'1c5d5c2017445c75dbc5c6d0c1e45ddb'
'8f1059f431b842e54b12bde689620df8'
'b50feeab78fa6ce0a8cfb41ee8dc1fd8'
2015-06-26 16:48:26 +08:00
'd7fd951fd0b7d891eefb6b14e5dd2d28'
2014-05-23 21:33:36 +08:00
'07ac979b6ab5eeb778d55f041529d623'
'476e9113489f93b348b21e144b6a8fcf' )
2013-09-25 19:52:10 +08:00
prepare( ) {
2013-04-25 06:22:36 +08:00
cd ${ srcdir } /${ pkgname } -${ pkgver }
2012-04-20 06:16:24 +08:00
2014-09-16 19:53:45 +08:00
# fix segfault in getifaddrs_internal
# https://sourceware.org/ml/libc-alpha/2014-09/msg00312.html
patch -p1 -i $srcdir /glibc-2.20-getifaddrs_internal-segfault.patch
# linux 3.16 additions - commit 0bd72468
patch -p1 -i $srcdir /glibc-2.20-linux-3.16-additions.patch
# plug memory leak - commit 984c0ea9
patch -p1 -i $srcdir /glibc-2.20-do_ftell_wide-memleak.patch
2013-09-25 19:52:10 +08:00
2015-06-26 16:48:26 +08:00
# disable tsx to avoid crashes on fw update (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762195#20, https://bbs.archlinux.org/viewtopic.php?id=188879)
patch -p1 -i $srcdir /glibc-2.20-disable-tsx.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
2014-09-16 19:53:45 +08:00
echo "slibdir=/usr/lib" >> configparms
echo "rtlddir=/usr/lib" >> configparms
2014-09-27 12:12:32 +08:00
echo "sbindir=/usr/sbin" >> configparms
echo "rootsbindir=/usr/sbin" >> configparms
2014-05-23 21:33:36 +08:00
2013-04-25 06:22:36 +08:00
# remove hardening options for building libraries
2014-05-23 21:33:36 +08:00
CFLAGS = ${ CFLAGS /-fstack-protector-strong/ }
2013-04-25 06:22:36 +08:00
CPPFLAGS = ${ CPPFLAGS /-D_FORTIFY_SOURCE=2/ }
2014-05-23 21:33:36 +08:00
${ srcdir } /${ pkgname } -${ pkgver } /configure --prefix= /usr \
2011-04-12 02:22:13 +08:00
--libdir= /usr/lib --libexecdir= /usr/lib \
--with-headers= /usr/include \
2014-05-23 21:33:36 +08:00
--with-bugurl= https://chakraos.org/bugtracker \
2014-09-16 19:53:45 +08:00
--enable-add-ons \
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
2015-06-27 22:41:16 +08:00
# --enable-lock-elision \
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
2014-05-23 21:33:36 +08:00
2013-04-25 06:22:36 +08:00
# re-enable hardening for programs
sed -i "/build-programs=/s#no#yes#" configparms
2014-05-23 21:33:36 +08:00
echo "CC += -fstack-protector-strong -D_FORTIFY_SOURCE=2" >> configparms
echo "CXX += -fstack-protector-strong -D_FORTIFY_SOURCE=2" >> configparms
2010-09-06 06:54:18 +08:00
make
2013-04-25 06:22:36 +08:00
# remove harding in preparation to run test-suite
2014-09-16 19:53:45 +08:00
sed -i '5,7d' configparms
2011-10-08 08:02:42 +08:00
}
check( ) {
2014-05-23 21:33:36 +08:00
# the linker commands need to be reordered - fixed in 2.19
2013-04-27 02:24:28 +08:00
LDFLAGS = ${ LDFLAGS /--as-needed,/ }
cd ${ srcdir } /glibc-build
2014-05-23 21:33:36 +08:00
2014-09-16 19:53:45 +08:00
make check || true
2010-05-16 23:08:55 +08:00
}
package( ) {
2011-04-12 02:22:13 +08:00
cd ${ srcdir } /glibc-build
2012-11-11 03:09:39 +08:00
install -dm755 ${ pkgdir } /etc
touch ${ pkgdir } /etc/ld.so.conf
2010-09-06 06:54:18 +08:00
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
2014-05-23 21:33:36 +08:00
install -dm755 ${ pkgdir } /usr/lib/{ locale,systemd/system,tmpfiles.d}
install -m644 ${ srcdir } /${ pkgname } -${ pkgver } /nscd/nscd.conf ${ pkgdir } /etc/nscd.conf
install -m644 ${ srcdir } /${ pkgname } -${ pkgver } /nscd/nscd.service ${ pkgdir } /usr/lib/systemd/system
install -m644 ${ srcdir } /${ pkgname } -${ pkgver } /nscd/nscd.tmpfiles ${ pkgdir } /usr/lib/tmpfiles.d/nscd.conf
2012-11-11 03:09:39 +08:00
2014-05-23 21:33:36 +08:00
install -m644 ${ srcdir } /${ pkgname } -${ pkgver } /posix/gai.conf ${ pkgdir } /etc/gai.conf
2012-11-11 03:09:39 +08:00
2014-05-23 21:33:36 +08:00
install -m755 ${ srcdir } /locale-gen ${ pkgdir } /usr/bin
2010-03-13 23:25:19 +08:00
2014-09-30 12:19:57 +08:00
# temporary symlink
ln -s ../sbin/ldconfig ${ pkgdir } /usr/bin/ldconfig
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
2014-05-23 21:33:36 +08:00
# remove the static libraries that have a shared counterpart
# libc, libdl, libm and libpthread are required for toolchain testsuites
# in addition libcrypt appears widely required
rm $pkgdir /usr/lib/lib{ anl,BrokenLocale,nsl,resolv,rt,util} .a
2012-11-14 05:58:35 +08:00
2014-05-23 21:33:36 +08:00
# Do not strip the following files for improved debugging support
# ("improved" as in not breaking gdb and valgrind...):
# ld-${pkgver}.so
# libc-${pkgver}.so
# libpthread-${pkgver}.so
# libthread_db-1.0.so
2010-09-10 21:00:23 +08:00
2014-05-23 21:33:36 +08:00
cd $pkgdir
strip $STRIP_BINARIES usr/bin/{ gencat,getconf,getent,iconv,makedb,locale,localedef} \
usr/sbin/{ iconvconfig,nscd} \
2014-09-27 12:12:32 +08:00
usr/sbin/{ ldconfig,sln} \
2014-05-23 21:33:36 +08:00
usr/bin/{ pcprofiledump,pldd,rpcgen,sprof} \
usr/lib/getconf/*
strip $STRIP_STATIC usr/lib/*.a
2010-09-10 21:00:23 +08:00
2014-09-16 19:53:45 +08:00
strip $STRIP_SHARED usr/lib/{ libanl,libBrokenLocale,libcidn,libcrypt} -*.so \
usr/lib/libnss_{ compat,db,dns,files,hesiod,nis,nisplus} -*.so \
usr/lib/{ libdl,libm,libnsl,libresolv,librt,libutil} -*.so \
usr/lib/{ libmemusage,libpcprofile,libSegFault} .so \
2013-09-25 19:52:10 +08:00
usr/lib/{ audit,gconv} /*.so
2014-09-16 19:53:45 +08:00
#
# add lib symlinks
#
ln -s usr/lib ${ pkgdir } /lib
ln -s usr/lib ${ pkgdir } /lib64
ln -s lib ${ pkgdir } /usr/lib64
2011-10-08 08:02:42 +08:00
}