pkgname=(glibc glibc-32bit) pkgbase=glibc pkgver=2.40 pkgrel=1 arch=('x86_64') url="https://www.gnu.org/software/libc/" license=('GPL-2.0-or-later' 'LGPL-2.1-or-later') makedepends=('linux-api-headers' 'tzdata' 'filesystem') options=('!lto') source=(https://ftp.gnu.org/gnu/${pkgbase}/${pkgbase}-${pkgver}.tar.xz https://www.linuxfromscratch.org/patches/downloads/${pkgbase}/${pkgbase}-${pkgver}-fhs-1.patch ld.so.conf nsswitch.conf) sha256sums=(19a890175e9263d748f627993de6f4b1af9cd21e03f080e4bfb3a1fac10205a2 643552db030e2f2d7ffde4f558e0f5f83d3fabf34a2e0e56ebdb49750ac27b0d 71315fb19572420138b2974acd8a2d836ef1f1889599775cf0361d73d9e86d6a e472b2ab7376bd38064a1a0549063b5fda4b71a0adac6baa881adb7416b84cb4) prepare() { cd ${pkgbase}-${pkgver} patch -Np1 -i ${srcdir}/${pkgbase}-${pkgver}-fhs-1.patch install -vdm755 ${pkgbase}-build ${pkgbase}-build-32bit } build() { cd ${pkgbase}-${pkgver} ( cd ${pkgbase}-build CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=3/} echo "rootsbindir=/usr/sbin" >> configparms echo "complocaledir=/usr/lib/locale" >> configparms ../configure \ --disable-werror \ --enable-kernel=5.4 \ --enable-stack-protector=strong \ --disable-nscd \ libc_cv_slibdir=/usr/lib64 \ --enable-cet \ ${configure_options} make ) ( cd ${pkgbase}-build-32bit CFLAGS=${CFLAGS/-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer/} echo "rootsbindir=/usr/sbin" >> configparms echo "complocaledir=/usr/lib/locale" >> configparms CC="${CHOST}-gcc -m32" \ CXX="${CHOST}-g++ -m32" \ ../configure \ --prefix=/usr \ --host=i686-flarebird-linux-gnu \ --build=${CHOST} \ --enable-kernel=5.4 \ --disable-nscd \ --libdir=/usr/lib32 \ --libexecdir=/usr/lib32 \ libc_cv_slibdir=/usr/lib32 make ) } package_glibc() { pkgdesc="GNU C Library" depends=('linux-api-headers' 'tzdata' 'filesystem') backup=(etc/nsswitch.conf etc/ld.so.conf) cd ${pkgbase}-${pkgver}/${pkgbase}-build make DESTDIR=${pkgdir} install install -vdm755 ${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') cd ${pkgbase}-${pkgver}/${pkgbase}-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 }