blob: 8221ca1e319504034a442207c30faaa42f4564cf (
plain)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# Maintainer: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Earnestly <zibeon@googlemail.com>
# All my PKGBUILDs are managed at https://github.com/eli-schwartz/pkgbuilds
pkgname=glibc-git
pkgver=2.32.r35.gcd71f47acc
pkgrel=1
pkgdesc='GNU C Library'
arch=('i686' 'x86_64')
url='https://www.gnu.org/software/libc/'
license=('GPL' 'LGPL')
groups=('base')
depends=('linux-api-headers' 'tzdata' 'filesystem')
optdepends=('gd: graph image generation with memusage')
makedepends=('git' 'python')
# XXX Arch Linux's valgrind package requires an exact version
provides=("glibc=${pkgver%%.r*}")
conflicts=('glibc')
backup=('etc/gai.conf' 'etc/nscd.conf')
options=('staticlibs')
install='glibc-git.install'
source=('git+https://sourceware.org/git/glibc.git'
'locale-gen'
'0001-Revert-elf-Correct-absolute-SHN_ABS-symbol-run-time-.patch')
sha256sums=('SKIP'
'05fbb88877cdddc99ef25e48304d6e5ac236660c20925d461cb4e90ebcb3b7de'
'6a3de26cec7b5b3e05090e85e970705454d9d749dcd4a2e1d35bee11d4e3637b')
# remove default hardening for building libraries
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
pkgver() {
cd glibc
# wtf is tag "glibc-2.26.9000"
git describe --exclude '*.*.9000' | sed 's/^glibc-//; s/-/.r/; s/-/./'
}
prepare() {
cd glibc
# revert commit breaking proprietary electron apps for now; this is lld's fault
# but it's too serious a regression to break software in the wild until users
# have a solution. See https://bugs.archlinux.org/task/59550 and
# https://github.com/electron/electron/issues/13972#issuecomment-411532741
patch -p1 -i ../0001-Revert-elf-Correct-absolute-SHN_ABS-symbol-run-time-.patch
}
build() {
mkdir -p build
cd build
if [[ ${CARCH} = "i686" ]]; then
# Hack to fix NPTL issues with Xen, only required on 32bit platforms
export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs"
fi
{ printf 'slibdir=/usr/lib\n'
printf 'rtlddir=/usr/lib\n'
printf 'sbindir=/usr/bin\n'
printf 'rootsbindir=/usr/bin\n'
} >> configparms
"$srcdir"/glibc/configure \
--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--with-headers=/usr/include \
--with-bugurl=https://bugs.archlinux.org/ \
--enable-add-ons \
--enable-bind-now \
--enable-cet \
--enable-lock-elision \
--enable-multi-arch \
--enable-stack-protector=strong \
--enable-stackguard-randomization \
--disable-profile \
--disable-werror
printf 'build-programs=no\n' >> configparms
make
# Re-enable hardening for programs.
sed -i '/build-programs=/s/no/yes/' configparms
{ printf 'CC += -D_FORTIFY_SOURCE=2\n'
printf 'CXX += -D_FORTIFY_SOURCE=2\n'
} >> configparms
make
}
check() {
cd build
# Remove harding in preparation to run test-suite.
sed -i '/FORTIFY/d' configparms
make check || true
}
package() {
make -C build install_root="$pkgdir" install
install -dm0755 "$pkgdir"/usr/lib/locale
install -dm0755 "$pkgdir"/etc/locales
install -Dm0755 locale-gen "$pkgdir"/usr/bin/locale-gen
install -Dm0644 glibc/posix/gai.conf "$pkgdir"/etc/gai.conf
install -Dm0644 glibc/nscd/nscd.conf "$pkgdir"/etc/nscd.conf
install -Dm0644 glibc/nscd/nscd.tmpfiles "$pkgdir"/usr/lib/tmpfiles.d/nscd.conf
install -Dm0644 glibc/nscd/nscd.service "$pkgdir"/usr/lib/systemd/system/nscd.service
# Only support UTF-8 charmaps.
find "$pkgdir"/usr/share/i18n/charmaps ! -name UTF-8.gz -type f -delete
# We generate these in the post-install with ldconfig -r .
rm "$pkgdir"/etc/ld.so.cache
# Shipped in tzdata
rm -f "$pkgdir"/usr/bin/{tzselect,zdump,zic}
# Provided by libxcrypt; keep the old shared library for backwards compatibility
rm -f "$pkgdir"/usr/include/crypt.h "$pkgdir"/usr/lib/libcrypt.a
# handle selectively stripping unless debug packages are requested
if check_option 'debug' n; then
options+=('!strip')
# I use 2> /dev/null for all of these due to many false-positives as it
# attempts to strip scripts or other unstrippable files.
find "$pkgdir"/usr/bin -type f -executable -exec strip $STRIP_BINARIES {} + 2> /dev/null || true
find "$pkgdir"/usr/lib -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true
# Do not strip these for gdb and valgrind functionality.
find "$pkgdir"/usr/lib \
-not -name 'ld-*.so' \
-not -name 'libc-*.so' \
-not -name 'libpthread-*.so' \
-not -name 'libthread_db-*.so' \
-name '*-*.so' -type f -exec strip $STRIP_SHARED {} + 2> /dev/null || true
fi
}
|