#!/bin/bash ulimit -s unlimited shopt -s extglob # Copyright 2006-2026 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # Modified by Stuart Winter for Slackware ARM, 2006-2026 # # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: slackset_var_cwds # Load any plugins: # To use these plugins, prior to building glibc: # $ export BUILD_PLUGINS="rk3399 rpi other" # The functions contained within those plugin directories will be called at # pre-defined stages of the build of this package: fnexists_loadplugins "${BUILD_PLUGINS}" $PORTCWD/buildplugins # Determine the CFLAGS for the known architectures: # libdir is set within slackkit's '/usr/share/slackkit/buildkit.sh' case $SLKPORTARCH in arm|aarch64) SLKCFLAGS="${SLKCFLAGS/-O2/-O3} -pipe -fPIC -fno-strict-aliasing" SLKCONFARGS="--disable-werror" ;; esac # Unset to avoid confusing glibc: unset ARCH # Detect whether we're building for /patches: This function sets the variable 'SLACKPATCHING' slack_findpkgstore_is_stablerelease echo "Building for /patches? $SLACKPATCHING" # Use system gcc for a bit rather than our bootstrap version: #export PATH=$( echo $PATH | sed 's?/gcc-5/usr/bin:??g' ) #unset LD_LIBRARY_PATH # Unneeded. Commented out for aarch64. # # Version of the Linux Kernel headers that we'll be compiling with: # These headers are not found in /usr/src/linux but are explicitley extraced # from the d/kernel-headers package and glibc is configured to compile against # them. This was because in days of old, glibc would often not compile against # the headers of the newest Kernel we were running and required a previous release. # This isn't usually the case in 2012, but it's still far easier to build against an # older set of Kernel headers - especially when just rebuilding glibc rather than # upgrading (usually an upgrade works with a newer set of Kernel headers). # In Slackware ARM, the Kernel headers package version is aligned with the Kernel # itself, so we use the version number from the Kernel package. # #if [ "$SLACKPATCHING" = "yes" ]; then # eval $( sed 's?VERSION?KERNELHEADERS?g' $PORTCWD/../kernel/kernel-pkgs/arm/build | grep -E '^export KERNELHEADERS' ) # else # # Within -current: # eval $( sed 's?VERSION?KERNELHEADERS?g' ../../k/arm/build | grep -E '^export KERNELHEADERS' ) #fi #if [ -z "$KERNELHEADERS" ]; then # echo "ERROR: Unable to determine the version of Linux Kernel headers." # exit 1 #fi #echo "Found Kernel headers: $KERNELHEADERS" # This function fixes a doinst.sh file for x86_64. # With thanks to Fred Emmott. fix_doinst() { # ARM and AArch64 use a different major version to x86: sed -i 's?ld-linux.so.[0-9]?'"$ARMLDLINUXVER"'?g' install/doinst.sh if [ "x$LIBDIRSUFFIX" = "x" ]; then return; fi; # Fix "( cd usr/lib${LIBDIRSUFFIX} ;" occurrences sed -i "s#lib ;#lib${LIBDIRSUFFIX} ;#" install/doinst.sh # Fix "lib/" occurrences sed -i "s#lib/#lib${LIBDIRSUFFIX}/#g" install/doinst.sh # Fix "( cd lib" occurrences sed -i "s#( cd lib\$#( cd lib${LIBDIRSUFFIX}#" install/doinst.sh } # Extract the source: function extractglibcsource () { cd $TMPBUILD rm -rf glibc* # Unpack the main from the Slackware source tree: echo "Unpacking main glibc source..." tar xvvf $CWD/$PKGNAM-$VERSION.tar.!(*sign|*asc|*sig) cd glibc-$VERSION*/ || failextract # Clean up leftover CVS directories: find . -type d -name CVS -exec rm -r {} \; 2> /dev/null # Apply Slackware-specific patches (taken from glibc.SlackBuild): # # # Use old-style locale directories rather than a single (and strangely # formatted) /usr/lib/locale/locale-archive file: zcat $CWD/glibc.locale.no-archive.diff.gz | patch -p1 --verbose || exit 1 # Support ru_RU.CP1251 locale: zcat $CWD/glibc.ru_RU.CP1251.diff.gz | patch -p1 --verbose || exit 1 # Don't use AM/PM format for date(1). That's just plain crazy. zcat $CWD/glibc-2.32.en_US.no.am.pm.date.format.diff.gz | patch -p1 --verbose || exit 1 # Other regression fixes from git: for git_patch in $CWD/patches/*.patch.gz ; do zcat $git_patch | patch -p1 --verbose || exit 1 done ############################################################################################### # Slackware ARM patches # This is a mixture of patches taken from Debian/Ubuntu and Gentoo. # For different builds of glibc, we often have to take some patches from a few distributions # in order to get a working build (although usually only if we're using a different version of # glibc than the other distributions), so we leave the code commented out as we'll need to use # it sooner or later! ############################################################################################### # Apply Debian/Ubuntu's ARM patches: - no longer. #tar xvvf $PORTCWD/sources/glibc*debian*xz || exit 1 # Apply: # # NSS issue that appears in the Slackware ARM installer. # https://archlinuxarm.org/packages/arm/glibc/files/bz27343.patch # for pf in \ # \ # nss-bz27343.patch.xz \ # \ # ; do # auto_apply_patch $PORTCWD/sources/$pf || failpatch ## #auto_apply_patch debian/patches/$pf || exit 1 # done # Apply any patches defined within by the build plugins: fnexists_multicall "$BUILD_PLUGINS" srcpatch # Determine version of ld-linux.so: case $SLKPORTARCH in arm) export ARMLDLINUXVER="$( grep -A1 "hard-float ABI" sysdeps/unix/sysv/linux/arm/shlib-versions | grep -E "^ld=" | awk -F= '{print $2}' )" ;; aarch64) export ARMLDLINUXVER="$( grep -E "^ld=" sysdeps/unix/sysv/linux/aarch64/shlib-versions | grep -v "be" | awk -F= '{print $2}' )" ;; esac if [ -z "$ARMLDLINUXVER" ]; then echo "Unable to determine version of ld-linux.so required for the package doinst.sh on platform $SLKPORTARCH" exit 1 else echo "** Found version of ld-linux: $ARMLDLINUXVER for platform arch $SLKPORTARCH**" fi # Clean up CVS mess: find . -type d -name CVS -print0 | xargs -0 rm -rf # Ensure permissions & ownerships: slackhousekeeping # Create a separate build directory: mkdir -vpm755 build_dir cd build_dir } # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM # This is the initial $DESTDIR: export PKG=$TMP/package-glibc-incoming-tree mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Then we'll compile the following packages from it: PGLIBC=$TMP/package-glibc PSOLIBS=$TMP/package-aaa_glibc-solibs PI18N=$TMP/package-glibc-i18n PPROFILE=$TMP/package-glibc-profile PDEBUG=$TMP/package-glibc-debug # Empty & create these locations first: for dir in $PKG $PGLIBC $PSOLIBS $PZONE $PI18N $PPROFILE $PDEBUG ; do rm -rf $dir mkdir -vpm755 $dir done # Create an incoming directory structure for glibc to be built into: mkdir -vpm755 $PKG/{var/{run/nscd,db/nscd},lib${LIBDIRSUFFIX},sbin,usr/{bin,lib${LIBDIRSUFFIX},sbin,include,doc,man,share}} # This was 'back in the day' and isn't required (although works fine). # Cleaned up for aarch64. # # Extract our pre-made Linux Kernel include files. # All I did for these was extract the source, copy the config file in place and # run make oldconfig, then tar up the include dir. # #mkdir -vpm755 $TMPBUILD/kernelheaders/ #echo "Extracting Linux Kernel headers into $TMPBUILD" ## We keep these in the d/ series. ## For patches it's -- but check that the PKGARCH matches the file name: #if [ "$SLACKPATCHING" = "yes" ]; then # tar xf $PORTCWD/../kernel/kernel-headers/sources/${PKGARCH}*-kernel-headers-${KERNELHEADERS}.tar.xz -C $TMPBUILD/kernelheaders/ || exit 1 # else # tar xf $PORTCWD/../../d/kernel-headers/sources/${PKGARCH}*-kernel-headers-${KERNELHEADERS}.tar.xz -C $TMPBUILD/kernelheaders/ || exit 1 #fi ################# Build glibc ############################# echo "[**] Building NPTL version of glibc [**]" # Extract, patch the source & cd into the build dir: extractglibcsource || exit 1 # Configure: # Note: the --enable-kernel option tells glibc which obsolete options to # compile *INTO* glibc, not what to compile out!! # See http://www.mail-archive.com/lfs-dev@linuxfromscratch.org/msg11060.html # To see what'd be compiled in for the older versions, look at: # glibc-2.9/sysdeps/unix/sysv/linux/kernel-features.h # Slackware uses this, but Slackware ARM still keeps a copy of the headers # in the source tree which we extract whenever we build glibc. # --with-headers=/usr/include \ #AUTOCONF=false \ # --with-headers=$TMPBUILD/kernelheaders/include \ # # We are setting the variable below so that x86 ISA level is not included # in shared libraries. Without this, glibc compiled with -march= may not # run on some CPUs that it should be able to support. Needed for glibc-2.33. # FIXME: revisit this with future glibc releases! # # Note re libc_cv_rtlddir, libc_cv_slibdir: this is required for AArch64 # to set the linker to the final location. By default glibc picks /lib and # will create a symlink: # /lib/ld-linux-aarch64.so.1 -> ../lib64/ld-linux-aarch64.so.1 # However, running it like this has caused # glibc to fail once during upgradepkg. Upon investigation I found the symlink # was missing. This mitigates that risk. # Note however that we include a symlink instead for compatability with 3rd party # apps that target an OS where the linker lives in /lib. libc_cv_include_x86_isa_level=no \ libc_cv_rtlddir=/lib${LIBDIRSUFFIX} \ libc_cv_slibdir=/lib${LIBDIRSUFFIX} \ CFLAGS="$SLKCFLAGS" \ ../configure \ \ $SLKCONFARGS \ \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --enable-kernel=5.4 \ --with-headers=/usr/include \ --enable-add-ons \ --enable-profile \ $DISABLE_NSCD \ --infodir=/usr/info \ --mandir=/usr/man \ --with-tls \ --with-__thread \ --without-cvs \ \ --build=${SLK_ARCH_BUILD} \ --host=${SLK_ARCH_HOST} || failconfig # Build: make $NUMJOBS || make || failmake # Install into local package: #make install install_root=$PKG || failinstall make -j$( nproc ) install install_root=$PKG || failinstall # Don't use this, as it makes the i18n package WAY bigger: #make localedata/install-locale-files DESTDIR=$PKG || exit 1 #make localedata/install-locales install_root=$PKG DESTDIR=$PKG || exit 1 make -j$( nproc ) localedata/install-locales install_root=$PKG DESTDIR=$PKG || failmake # Build and install libxcrypt: # Patch the build script - this should be upstreamed eventually to enable overrides # as we do with mesa. install -vpm755 $CWD/libxcrypt.build $TMPBUILD/ sed -i '/^cd $(dirname $0).*/d' $TMPBUILD/libxcrypt.build # otherwise the dirs are wrong sed -i '/^PKG=.*/d' $TMPBUILD/libxcrypt.build sed -i '/^TMP=.*/d' $TMPBUILD/libxcrypt.build sed -i 's?$TMP?$TMPBUILD?g' $TMPBUILD/libxcrypt.build sed -i 's?$ARCH-slackware-linux?${SLK_ARCH_BUILD}?g' $TMPBUILD/libxcrypt.build pushd $CWD # In this ARM build script we omit the CFLAGS since they're already # exported by slackkit. export -n VERSION # otherwise libxcrypt.build takes glibc's version. pushd $CWD ARCH=$SLKPORTARCH $TMPBUILD/libxcrypt.build || failmake popd export VERSION # re-export to the environment # We've always had an sln symlink in /bin, so let's make sure it # remains there so as not to break any scripts that might need it: mkdir -vpm755 $PKG/bin ( cd $PKG/bin ; ln -vsf ../sbin/sln . ) # This bit was mostly copped from Fedora Rawhide's .spec file. I'm not # entirely sure how important it is, since I'm not aware of anything # we ship trying to link libpthread as static. What it does is make sure # that anything linking libpthread static includes all of the functions # so that the resulting binary doesn't rely on parts of the library that # were not linked in. Optimizing actually working over binary size, so # to speak. ( cd $PKG/usr/lib${LIBDIRSUFFIX} gcc -r -nostdlib -o libpthread.o -Wl,--whole-archive ./libpthread.a rm libpthread.a ar rcs libpthread.a libpthread.o rm libpthread.o ) # The prevailing standard seems to be putting unstripped libraries in # /usr/lib/debug/ and stripping the debugging symbols from all the other # libraries. mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/debug cp -a $PKG/lib${LIBDIRSUFFIX}/l*.so* $PKG/usr/lib${LIBDIRSUFFIX}/debug cp -a $PKG/usr/lib${LIBDIRSUFFIX}/*.a $PKG/usr/lib${LIBDIRSUFFIX}/debug # Don't need debug+profile: ( cd $PKG/usr/lib${LIBDIRSUFFIX}/debug ; rm -f *_p.* ) # NOTE: Is there really a reason for the glibc-debug package? # If you're debugging glibc, you can also compile it, right? ## COMMENTED OUT: There's no reason for profile libs to include -g information. ## Put back unstripped profiling libraries: #mv $PKG/usr/lib${LIBDIRSUFFIX}/debug/*_p.a $PKG/usr/lib${LIBDIRSUFFIX} # It might be best to put the unstripped and profiling libraries in glibc-debug and glibc-profile. # I don't think "strip -g" causes the pthread problems. It's --strip-unneeded that does. strip -g $PKG/lib${LIBDIRSUFFIX}/l*.so* strip -g $PKG/usr/lib${LIBDIRSUFFIX}/l*.so* strip -g $PKG/usr/lib${LIBDIRSUFFIX}/lib*.a # Remove the rquota.x and rquota.h include files, as they are provided by # the quota package: rm -fv $PKG/usr/include/rpcsvc/rquota.{h,x} # Back to the sources dir to add some files/docs: cd $TMPBUILD/*glibc-* # We'll automatically install the config file for the Name Server Cache Daemon. # Perhaps this should also have some commented-out startup code in rc.inet2... mkdir -vpm755 $PKG/etc cat nscd/nscd.conf > $PKG/etc/nscd.conf.new # Install docs: ( mkdir -vpm755 $PKG/usr/doc/glibc-$VERSION cp -favv \ CONTRIBUTED-BY* COPYING* INSTALL* LICENSES* MAINTAINERS* NEWS* README* SECURITY* SHARED-FILES* \ $PKG/usr/doc/glibc-$VERSION ) # Trim the NEWS file to omit ancient history: if [ -r NEWS ]; then DOCSDIR=$(echo $PKG/usr/doc/glibc-$VERSION) cat NEWS | head -n 1000 > $DOCSDIR/NEWS touch -r NEWS $DOCSDIR/NEWS fi # Slackware policy: ( cd $PKG # root:root slackchown # 644 docs: slack644docs # Strip most binaries: find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-debug 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip -g 2> /dev/null # gzip man & info pages: slackgzpages -i # This is junk rm -f etc/ld.so.cache find . -name "*.orig" -exec rm -f {} \; # These contain scratchbox paths when built inside sbox: sed -i '1s/.*/#!\/bin\/bash/' usr/bin/xtrace usr/bin/tzselect ) ################################## # OK, time to make some packages # ################################## # Create the package holding directories in case we're working in /patches. # For this, we set PKGSTORE to /tmp/patches within the 'arm/build' script. mkdir -vpm755 $PKGSTORE/{a,l} # Delete old package versions? if [ "${DELETEOLDPKGS}" = "Yes" ]; then rm -fv $PKGSTORE/a/aaa_glibc-solibs* rm -fv $PKGSTORE/l/glibc-* rm -fv $PKGSTORE/l/glibc-{debug,profile}* # rm -f $PKGSTORE/../extra/glibc-extra-packages/glibc-{debug,profile}* fi #################################################################################### # glibc-profile: #################################################################################### mkdir -vpm755 $PPROFILE/usr/lib${LIBDIRSUFFIX} cd $PPROFILE # Might as well just grab these with 'mv' to simplify things later: mv -fv $PKG/usr/lib${LIBDIRSUFFIX}/lib*_p.a usr/lib${LIBDIRSUFFIX}/ # Profile libs should be stripped. Use the debug libs to debug... ( cd usr/lib${LIBDIRSUFFIX} ; strip -g *.a ) mkdir -vpm755 install install -vpm644 -oroot -groot $CWD/slack-desc.glibc-profile install/slack-desc #makepkg -l y -c n $PKGSTORE/../extra/glibc-extra-packages/glibc-profile-$VERSION-$PKGARCH-$BUILD.txz makepkg -l y -c n $PKGSTORE/l/glibc-profile-$VERSION-$PKGARCH-$BUILD.txz # THIS IS NO LONGER PACKAGED (or is it? might be better to let it be made, and then ship it or not...) #################################################################################### # glibc-debug: #################################################################################### cd $PDEBUG mkdir -vpm755 usr/lib${LIBDIRSUFFIX} # Might as well just grab these with 'mv' to simplify things later: mv -fv $PKG/usr/lib${LIBDIRSUFFIX}/debug usr/lib${LIBDIRSUFFIX} mkdir -vpm755 install install -m644 -oroot -groot $CWD/slack-desc.glibc-debug install/slack-desc makepkg -l y -c n $TMPBUILD/glibc-debug-$VERSION-$PKGARCH-$BUILD.txz ## INSTEAD, NUKE THESE LIBS #rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/debug #makepkg -l y -c n $PKGSTORE/../extra/glibc-extra-packages/glibc-debug-$VERSION-$PKGARCH-$BUILD.txz #################################################################################### # glibc-i18n: #################################################################################### cd $PI18N mkdir -p usr/lib${LIBDIRSUFFIX}/locale mv $PKG/usr/lib${LIBDIRSUFFIX}/locale/* usr/lib${LIBDIRSUFFIX}/locale mkdir -p usr/share/{i18n,locale} mv $PKG/usr/share/i18n/* usr/share/i18n mv $PKG/usr/share/locale/* usr/share/locale # Leave copies of the C, POSIX, and en_US locales in the main glibc package: cp -a usr/lib${LIBDIRSUFFIX}/locale/{C,en_US}* $PKG/usr/lib${LIBDIRSUFFIX}/locale mkdir -p $PKG/usr/share/i18n/locales cp -a usr/share/i18n/locales/{C,POSIX,en_US} $PKG/usr/share/i18n/locales mkdir -vpm755 install install -m644 -oroot -groot $CWD/slack-desc.glibc-i18n install/slack-desc makepkg -l y -c n $PKGSTORE/l/glibc-i18n-$VERSION-$PKGARCH-$BUILD.txz #################################################################################### # aaa_glibc-solibs: #################################################################################### cd $PSOLIBS mkdir -vpm755 etc/profile.d cp -a $CWD/profile.d/* etc/profile.d chown -R root:root etc chmod 755 etc/profile.d/* mkdir -vpm755 lib${LIBDIRSUFFIX} cp -a $PKG/lib${LIBDIRSUFFIX}/* lib${LIBDIRSUFFIX} ( cd lib${LIBDIRSUFFIX} mkdir -vpm755 incoming mv -fv *so* incoming/ # Beginning with glibc-2.34, shared objects are using their ABI sonames # directly, which is frankly, a terrible idea. It might help other package # managers, but doesn't do us any favors where we already had a system for # dealing with upgrades (and downgrades!). We'll change these libraries to # use the versioned naming system of glibc-2.33 and earlier so that we don't # have to handle these files differently and so that it's easy to see what # version of glibc is in use at a glance. cd incoming # First do the new libxcrypt links (a little bit differently): for cryptlib in libcrypt.so.* ; do CRYPTSO=$(echo $cryptlib | cut -f 3 -d .) mv -fv $cryptlib libcrypt${CRYPTSO}-${VERSION}.so done for library in *.so.* ; do mv -fv $library $(echo $library | cut -f 1 -d .)-${VERSION}.so done # This one is a special case. We don't want an $ARCH embedded in the # filename. It prevents using the same install scripts on all $ARCH # and does no good since we'll never have multiple $ARCH libraries # installed in the same directory anyway. So give it the previous name # format: mv -fv ld-linux*-${VERSION}.so ld-${VERSION}.so ) mkdir -vpm755 usr cp -a $PKG/usr/bin usr mv usr/bin/ldd . rm usr/bin/* mv ldd usr/bin mkdir -vpm755 usr/lib${LIBDIRSUFFIX} # The gconv directory has a lot of stuff, but including it here will save some problems. # Seems standard elsewhere. cp -a $PKG/usr/lib${LIBDIRSUFFIX}/gconv usr/lib${LIBDIRSUFFIX} mkdir -vpm755 usr/libexec cp -a $PKG/usr/libexec/pt_chown usr/libexec cp -a $PKG/sbin . mv -fv sbin/ldconfig . rm sbin/* mv -fv ldconfig sbin mkdir -vpm755 install install -vpm644 -oroot -groot $CWD/slack-desc.aaa_glibc-solibs install/slack-desc install -vpm644 -oroot -groot $CWD/doinst.sh-aaa_glibc-solibs install/doinst.sh # Fix specific versioning for the symlink creation script. This part of the # script would only be used in the case where there is no ldconfig on the # running system that's used to install the package. That should never be the # case, but we'll leave the code in place anyway just in case. sed -i "s/@@VERSION@@/$VERSION/g" install/doinst.sh # Call the function to fix doinst.sh where $LIBDIRSUFFIX is needed: fix_doinst # Only scrub the links in /lib{,64} that will be created by ldconfig: find lib${LIBDIRSUFFIX} -type l -exec rm {} \; # Add a compatability symlink for 3rd party packages # Where they have the linker in /lib as opposed to /lib64: [ "${SLKPORTARCH}" = "aarch64" ] && { mkdir -vpm755 lib pushd lib # Refer to the symlink to avoid any version number issues during upgrades # (should the /lib/ld-linux-aarch64.so.1 be taken in preference to /lib64 for # any reason): ln -vfs ../lib64/$ARMLDLINUXVER . popd ;} # Build the package: echo "*** Building a/aaa_glibc-solibs" set -x makepkg -l y -c n $PKGSTORE/a/aaa_glibc-solibs-$VERSION-$PKGARCH-$BUILD.txz set +x #################################################################################### # l/glibc #################################################################################### # And finally, the complete "all-in-one" glibc package is created # from whatever was leftover: cd $PGLIBC mv $PKG/* . mkdir -vpm755 etc/profile.d cp -a $CWD/profile.d/* etc/profile.d chown -R root:root etc chmod 755 etc/profile.d/* # Only scrub the links in /lib{,64} that will be created by ldconfig: find lib${LIBDIRSUFFIX} -type l -exec rm {} \; mkdir -vpm755 install install -vpm644 -oroot -groot $CWD/slack-desc.glibc install/slack-desc install -vpm644 -oroot -groot $CWD/doinst.sh-glibc install/doinst.sh # Fix specific versioning for the symlink creation script. This part of the # script would only be used in the case where there is no ldconfig on the # running system that's used to install the package. That should never be the # case, but we'll leave the code in place anyway just in case. sed -i "s/@@VERSION@@/$VERSION/g" install/doinst.sh # Call the function to fix doinst.sh where $LIBDIRSUFFIX is needed: fix_doinst ( cd lib${LIBDIRSUFFIX} mkdir -vpm755 incoming mv -fv *so* incoming/ mv -fv incoming/libmemusage.so . # Beginning with glibc-2.34, shared objects are using their ABI sonames # directly, which is frankly, a terrible idea. It might help other package # managers, but doesn't do us any favors where we already had a system for # dealing with upgrades (and downgrades!). We'll change these libraries to # use the versioned naming system of glibc-2.33 and earlier so that we don't # have to handle these files differently and so that it's easy to see what # version of glibc is in use at a glance. cd incoming # First do the new libxcrypt links (a little bit differently): for cryptlib in libcrypt.so.* ; do CRYPTSO=$(echo $cryptlib | cut -f 3 -d .) mv -fv $cryptlib libcrypt${CRYPTSO}-${VERSION}.so done for library in *.so.* ; do mv -fv $library $(echo $library | cut -f 1 -d .)-${VERSION}.so done # This one is a special case. We don't want an $ARCH embedded in the # filename. It prevents using the same install scripts on all $ARCH # and does no good since we'll never have multiple $ARCH libraries # installed in the same directory anyway. So give it the previous name # format: mv -fv ld-linux*-${VERSION}.so ld-${VERSION}.so ) # Add a compatability symlink for 3rd party packages # Where they have the linker in /lib as opposed to /lib64: [ "${SLKPORTARCH}" = "aarch64" ] && { mkdir -vpm755 lib pushd lib # Refer to the symlink to avoid any version number issues during upgrades # (should the /lib/ld-linux-aarch64.so.1 be taken in preference to /lib64 for # any reason): ln -vfs ../lib64/$ARMLDLINUXVER . popd ;} # Build the package: makepkg -l y -c n $PKGSTORE/l/glibc-$VERSION-$PKGARCH-$BUILD.txz # Done!