diff --git a/glibc/PKGBUILD b/glibc/PKGBUILD new file mode 100644 index 0000000..8d46a57 --- /dev/null +++ b/glibc/PKGBUILD @@ -0,0 +1,131 @@ +# This is an example PKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Maintainer: Future Linux Team +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') +options=('staticlibs' '!lto') +source=(https://ftp.gnu.org/gnu/${pkgbase}/${pkgbase}-${pkgver}.tar.xz + ${pkgbase}-${pkgver}-fhs-1.patch + nsswitch.conf + ld.so.conf) +sha256sums=(19a890175e9263d748f627993de6f4b1af9cd21e03f080e4bfb3a1fac10205a2 + 643552db030e2f2d7ffde4f558e0f5f83d3fabf34a2e0e56ebdb49750ac27b0d + f86fc39cffef8960af4006d478f2e33d1aba708c019e0337cceed8b2c4853b58 + 71315fb19572420138b2974acd8a2d836ef1f1889599775cf0361d73d9e86d6a) + +prepare() { + cd ${pkgbase}-${pkgver} + + patch -Np1 -i ${srcdir}/${pkgbase}-${pkgver}-fhs-1.patch + + install -vd ${pkgbase}-build ${pkgbase}-32bit-build +} + +build() { + cd ${srcdir}/${pkgbase}-${pkgver}/${pkgbase}-build + + CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=3/} + + echo "slibdir=/usr/lib64" >> configparms + echo "rtlddir=/usr/lib64" >> configparms + echo "sbindir=/usr/bin" >> configparms + echo "rootsbindir=/usr/sbin" >> configparms + echo "complocaledir=/usr/lib/locale" >> configparms + + ${BUILD_CONFIGURE} \ + --disable-werror \ + --enable-kernel=4.19 \ + --with-headers=/usr/include \ + --enable-stack-protector=strong \ + --disable-nscd \ + --disable-timezone-tools \ + --enable-cet + + make + + cd ${srcdir}/${pkgbase}-${pkgver}/${pkgbase}-32bit-build + + CFLAGS=${CFLAGS/-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer/} + + echo "slibdir=/usr/lib32" >> configparms + echo "rtlddir=/usr/lib32" >> configparms + echo "sbindir=/usr/bin" >> configparms + echo "rootsbindir=/usr/sbin" >> configparms + echo "complocaledir=/usr/lib/locale" >> configparms + + CC="${CHOST}-gcc -m32 -mstackrealign" \ + CXX="${CHOST}-g++ -m32 -mstackrealign" \ + ${BUILD_CONFIGURE} \ + --host=${CHOST32} \ + --build=$(../scripts/config.guess) \ + --enable-kernel=4.19 \ + --disable-nscd \ + --libdir=/usr/lib32 \ + --libexecdir=/usr/lib32 \ + --disable-timezone-tools + + make +} + +package_glibc() { + pkgdesc="GNU C Library" + groups=('base') + depends=('linux-api-headers' 'tzdata') + backup=(etc/nsswitch.conf + etc/ld.so.conf) + + cd ${srcdir}/${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 + if LOCALE=`grep "zh_CN.UTF-8/" ../localedata/SUPPORTED`; then + CHARMAP=`echo $LOCALE | sed 's,[^/]*/\([^ ]*\) [\],\1,'` + INPUT=`echo $LOCALE | sed 's,[/.].*,,'` + LOCALE=`echo $LOCALE | sed 's,/.*,,'` + ${pkgdir}/usr/bin/localedef --prefix=${pkgdir} -i $INPUT -f $CHARMAP $LOCALE + fi + + 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}") + backup=(etc/ld.so.conf.d/glibc-32bit.conf) + options+=('!emptydirs') + + cd ${srcdir}/${pkgbase}-${pkgver}/${pkgbase}-32bit-build + + make DESTDIR=$PWD/DESTDIR install + + install -vdm755 ${pkgdir}/usr/{lib32,include/gnu} + + ln -sv /usr/lib32 ${pkgdir}/lib32 + + cp -a DESTDIR/usr/lib32/* ${pkgdir}/usr/lib32/ + install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \ + ${pkgdir}/usr/include/gnu/ + + install -vdm755 ${pkgdir}/usr/lib64 + ln -s ../lib32/ld-linux.so.2 ${pkgdir}/usr/lib64/ + + install -vdm755 ${pkgdir}/etc/ld.so.conf.d + echo "/usr/lib32" > ${pkgdir}/etc/ld.so.conf.d/glibc-32bit.conf +} diff --git a/glibc/glibc-2.40-fhs-1.patch b/glibc/glibc-2.40-fhs-1.patch new file mode 100644 index 0000000..4ac8d10 --- /dev/null +++ b/glibc/glibc-2.40-fhs-1.patch @@ -0,0 +1,72 @@ +Submitted By: Armin K. +Date: 2013-02-11 +Initial Package Version: 2.17 +Upstream Status: Not Applicable +Origin: Self +Description: This patch removes references to /var/db directory which is not part + of FHS and replaces them with more suitable directories in /var + hierarchy - /var/cache/nscd for nscd and /var/lib/nss_db for nss_db. + +--- a/Makeconfig 2012-12-25 04:02:13.000000000 +0100 ++++ b/Makeconfig 2013-02-11 01:32:32.500667439 +0100 +@@ -250,7 +250,7 @@ + + # Directory for the database files and Makefile for nss_db. + ifndef vardbdir +-vardbdir = $(localstatedir)/db ++vardbdir = $(localstatedir)/lib/nss_db + endif + inst_vardbdir = $(install_root)$(vardbdir) + +--- a/nscd/nscd.h 2012-12-25 04:02:13.000000000 +0100 ++++ b/nscd/nscd.h 2013-02-11 01:32:32.500667439 +0100 +@@ -112,11 +112,11 @@ + + + /* Paths of the file for the persistent storage. */ +-#define _PATH_NSCD_PASSWD_DB "/var/db/nscd/passwd" +-#define _PATH_NSCD_GROUP_DB "/var/db/nscd/group" +-#define _PATH_NSCD_HOSTS_DB "/var/db/nscd/hosts" +-#define _PATH_NSCD_SERVICES_DB "/var/db/nscd/services" +-#define _PATH_NSCD_NETGROUP_DB "/var/db/nscd/netgroup" ++#define _PATH_NSCD_PASSWD_DB "/var/cache/nscd/passwd" ++#define _PATH_NSCD_GROUP_DB "/var/cache/nscd/group" ++#define _PATH_NSCD_HOSTS_DB "/var/cache/nscd/hosts" ++#define _PATH_NSCD_SERVICES_DB "/var/cache/nscd/services" ++#define _PATH_NSCD_NETGROUP_DB "/var/cache/nscd/netgroup" + + /* Path used when not using persistent storage. */ + #define _PATH_NSCD_XYZ_DB_TMP "/var/run/nscd/dbXXXXXX" +--- a/nss/db-Makefile 2012-12-25 04:02:13.000000000 +0100 ++++ b/nss/db-Makefile 2013-02-11 01:32:32.500667439 +0100 +@@ -22,7 +22,7 @@ + /etc/rpc /etc/services /etc/shadow /etc/gshadow \ + /etc/netgroup) + +-VAR_DB = /var/db ++VAR_DB = /var/lib/nss_db + + AWK = awk + MAKEDB = makedb --quiet +--- a/sysdeps/generic/paths.h 2012-12-25 04:02:13.000000000 +0100 ++++ b/sysdeps/generic/paths.h 2013-02-11 01:32:32.500667439 +0100 +@@ -68,7 +68,7 @@ + /* Provide trailing slash, since mostly used for building pathnames. */ + #define _PATH_DEV "/dev/" + #define _PATH_TMP "/tmp/" +-#define _PATH_VARDB "/var/db/" ++#define _PATH_VARDB "/var/lib/nss_db/" + #define _PATH_VARRUN "/var/run/" + #define _PATH_VARTMP "/var/tmp/" + +--- a/sysdeps/unix/sysv/linux/paths.h 2012-12-25 04:02:13.000000000 +0100 ++++ b/sysdeps/unix/sysv/linux/paths.h 2013-02-11 01:32:32.504000831 +0100 +@@ -68,7 +68,7 @@ + /* Provide trailing slash, since mostly used for building pathnames. */ + #define _PATH_DEV "/dev/" + #define _PATH_TMP "/tmp/" +-#define _PATH_VARDB "/var/db/" ++#define _PATH_VARDB "/var/lib/nss_db/" + #define _PATH_VARRUN "/var/run/" + #define _PATH_VARTMP "/var/tmp/" + diff --git a/glibc/ld.so.conf b/glibc/ld.so.conf new file mode 100644 index 0000000..aaee9cc --- /dev/null +++ b/glibc/ld.so.conf @@ -0,0 +1,3 @@ +# Add an include directory + +include /etc/ld.so.conf.d/*.conf diff --git a/glibc/nsswitch.conf b/glibc/nsswitch.conf new file mode 100644 index 0000000..20b2db3 --- /dev/null +++ b/glibc/nsswitch.conf @@ -0,0 +1,15 @@ +# Begin /etc/nsswitch.conf + +passwd: files systemd +group: files systemd +shadow: files systemd + +hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns +networks: files + +protocols: files +services: files +ethers: files +rpc: files + +# End /etc/nsswitch.conf