pkgname=(glibc glibc-32bit) pkgbase=glibc pkgver=2.40+r16+gaa533d58ff12 pkgrel=1 arch=('x86_64') url="https://www.gnu.org/software/libc" license=('GPL-2.0-or-later' 'LGPL-2.1-or-later') makedepends=('git' 'gcc-libs-32bit' 'python') options=('!staticlibs' '!lto') source=(git+https://mirrors.tuna.tsinghua.edu.cn/git/glibc.git#commit=aa533d58ff12e27771d9c960a727d74992a3f2a3 https://www.linuxfromscratch.org/patches/downloads/${pkgbase}/${pkgbase}-2.40-fhs-1.patch ld.so.conf nsswitch.conf) sha256sums=(SKIP 643552db030e2f2d7ffde4f558e0f5f83d3fabf34a2e0e56ebdb49750ac27b0d 71315fb19572420138b2974acd8a2d836ef1f1889599775cf0361d73d9e86d6a e472b2ab7376bd38064a1a0549063b5fda4b71a0adac6baa881adb7416b84cb4) pkgver() { cd glibc git describe --abbrev=12 --tags | sed 's/[^-]*-//;s/[^-]*-/&r/;s/-/+/g' } prepare() { cd glibc mkdir -p ${srcdir}/glibc-build ${srcdir}/glibc-build-32bit patch -Np1 -i ${srcdir}/${pkgbase}-2.40-fhs-1.patch } build() { local _configure_flags=( --prefix=/usr --with-headers=/usr/include --enable-bind-now --enable-fortify-source --enable-kernel=5.4 --enable-multi-arch --enable-stack-protector=strong --disable-nscd --disable-profile --disable-werror ) # _FORTIFY_SOURCE=3 causes testsuite build failure and is unnecessary during # actual builds (support is built-in via --enable-fortify-source). CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=3/} ( cd glibc-build echo "rootsbindir=/usr/sbin" >> configparms echo "complocaledir=/usr/lib/locale" >> configparms ${srcdir}/glibc/configure \ --libdir=/usr/lib64 \ --enable-cet \ libc_cv_slibdir=/usr/lib64 \ "${_configure_flags[@]}" make -O # build info pages manually for reproducibility make info ) ( cd glibc-build-32bit export CC="gcc -m32 -mstackrealign" export CXX="g++ -m32 -mstackrealign" # remove frame pointer flags due to crashes of nvidia driver on steam starts # See https://gitlab.archlinux.org/archlinux/packaging/packages/glibc/-/issues/10 CFLAGS=${CFLAGS/-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer/} echo "rootsbindir=/usr/sbin" >> configparms echo "complocaledir=/usr/lib/locale" >> configparms ${srcdir}/glibc/configure \ --host=i686-pc-linux-gnu \ --libdir=/usr/lib32 \ --libexecdir=/usr/lib32 \ libc_cv_slibdir=/usr/lib32 \ "${_configure_flags[@]}" make -O ) } package_glibc() { pkgdesc='GNU C Library' depends=('linux-api-headers' 'tzdata' 'filesystem') install=glibc.install backup=(etc/nsswitch.conf etc/ld.so.conf) cd glibc-build make DESTDIR=${pkgdir} install install -dm755 ${pkgdir}/usr/lib/locale ${pkgdir}/usr/bin/localedef --prefix=${pkgdir} -i C -f UTF-8 C.UTF-8 ${pkgdir}/usr/bin/localedef --prefix=${pkgdir} -i en_US -f ISO-8859-1 en_US ${pkgdir}/usr/bin/localedef --prefix=${pkgdir} -i en_US -f UTF-8 en_US.UTF-8 ${pkgdir}/usr/bin/localedef --prefix=${pkgdir} -i zh_CN -f GB18030 zh_CN.GB18030 ${pkgdir}/usr/bin/localedef --prefix=${pkgdir} -i zh_CN -f GBK zh_CN.GBK ${pkgdir}/usr/bin/localedef --prefix=${pkgdir} -i zh_CN -f UTF-8 zh_CN.UTF-8 ${pkgdir}/usr/bin/localedef --prefix=${pkgdir} -i zh_CN -f GB2312 zh_CN.GB2312 install -vm644 ${srcdir}/nsswitch.conf ${pkgdir}/etc/ install -vm644 ${srcdir}/ld.so.conf ${pkgdir}/etc/ install -vdm755 ${pkgdir}/etc/ld.so.conf.d } package_glibc-32bit() { pkgdesc="GNU C Library (32-bit)" depends=("glibc=${pkgver}") options+=('!emptydirs') install=glibc-32bit.install cd glibc-build-32bit make DESTDIR=$PWD/DESTDIR install install -vdm755 ${pkgdir}/usr/lib{32,64} ln -sv usr/lib32 ${pkgdir}/lib32 cp -a DESTDIR/usr/lib32/* ${pkgdir}/usr/lib32/ install -vDm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h -t ${pkgdir}/usr/include/gnu/ install -vdm755 ${pkgdir}/etc/ld.so.conf.d echo "/usr/lib32" >> ${pkgdir}/etc/ld.so.conf.d/glibc-32bit.conf ln -svf ../lib32/ld-linux.so.2 ${pkgdir}/usr/lib64/ld-linux.so.2 }