diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..13a27802ba87 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,126 @@ +# 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.26.r1039.g48a8f83281 +pkgrel=1 +pkgdesc='GNU C Library, from git' +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') +# XXX Arch Linux's valgrind package requires an exact version +provides=("glibc=${pkgver%%.r*}") +conflicts=('glibc') +backup=('etc/gai.conf' 'etc/nscd.conf') +options=('!strip' 'staticlibs') +install='glibc-git.install' +source=('git+https://sourceware.org/git/glibc.git' + 'locale-gen') +sha256sums=('SKIP' + '7e4a8d3fd37c67ec57b5e27575155d958628a92729098cf8a01ba9aba7078a80') + +pkgver() { + cd glibc + # wtf is tag "glibc-2.26.9000" + git describe --exclude '*.*.9000' | sed 's/^glibc-//; s/-/.r/; s/-/./' +} + +prepare() { + rm -rf build + mkdir build +} + +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 + + # remove fortify for building libraries + CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} + + "$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-lock-elision \ + --enable-multi-arch \ + --enable-obsolete-nsl \ + --enable-obsolete-rpc \ + --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 + + if check_option 'debug' n; then + # 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 + + # Do not strip these for gdb and valgrind functionality, but strip the + # rest. + find "$pkgdir"/usr/lib ! -name 'ld-*.so' \ + ! -name 'libc-*.so' \ + ! -name 'libpthread-*.so' \ + ! -name 'libthread_db-*.so' \ + -name '*-*.so' -type f -exec strip $STRIP_SHARED {} + 2> /dev/null || true + + # Strip the remaining static libraries. + find "$pkgdir"/usr/lib -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true + fi +} |