1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# Maintainer: Márcio Silva <coadde@parabola.nu>
# based of glibc
_pkgname=glibc
pkgname=glibc-static
pkgver=2.22
pkgrel=4
pkgdesc="GNU C Library (static libraries only)"
arch=('i686' 'x86_64' 'armv7h')
url="http://www.gnu.org/software/libc"
license=('GPL' 'LGPL')
depends=('glibc')
makedepends=('gcc>=5.2')
options=('!strip' '!docs' 'staticlibs' '!emptydirs')
source=(http://ftp.gnu.org/gnu/libc/${_pkgname}-${pkgver}.tar.xz{,.sig}
glibc-2.22-roundup.patch)
md5sums=('e51e02bf552a0a1fbbdc948fb2f5e83c'
'SKIP'
'8476d7f2bceaacde30ea2b9d4afb4bd1')
validpgpkeys=('F37CDAB708E65EA183FD1AF625EF0A436C2A4AFF') # Carlos O'Donell
prepare() {
cd ${srcdir}/glibc-${pkgver}
# glibc-2.21..g2b529a8
patch -p1 -i $srcdir/glibc-2.22-roundup.patch
mkdir ${srcdir}/glibc-build
}
build() {
cd ${srcdir}/glibc-build
if [[ ${CARCH} = "i686" ]]; then
# Hack to fix NPTL issues with Xen, only required on 32bit platforms
# TODO: make separate glibc-xen package for i686
export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs"
fi
echo "slibdir=/usr/lib" >> configparms
echo "rtlddir=/usr/lib" >> configparms
# remove hardening options for building libraries
CFLAGS=${CFLAGS/-fstack-protector-strong/}
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
${srcdir}/${_pkgname}-${pkgver}/configure --prefix=/usr \
--libdir=/usr/lib \
--with-headers=/usr/include \
--with-bugurl=https://labs.parabola.no/ \
--enable-add-ons \
--enable-obsolete-rpc \
--enable-kernel=2.6.32 \
--enable-bind-now --disable-profile \
--enable-stackguard-randomization \
--enable-lock-elision \
--enable-multi-arch \
--disable-werror
# 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-strong -D_FORTIFY_SOURCE=2" >> configparms
echo "CXX += -fstack-protector-strong -D_FORTIFY_SOURCE=2" >> configparms
make
# remove harding in preparation to run test-suite
sed -i '5,7d' configparms
}
check() {
cd ${srcdir}/glibc-build
# some failures are "expected"
make check || true
}
package() {
cd ${srcdir}/glibc-build
make install_root=${pkgdir} install
rm -vr ${pkgdir}/{etc,sbin,usr/{bin,lib/{audit,gconv},include,libexec,share,sbin},var}
rm -v ${pkgdir}/usr/lib/*.o
rm -v ${pkgdir}/usr/lib/*.so*
rm -v ${pkgdir}/usr/lib/lib{c{,_nonshared},crypt,dl,g,ieee,m,mcheck,pthread{,_nonshared},rpcsvc}.a
strip $STRIP_STATIC ${pkgdir}/usr/lib/*.a
}
|