#!/bin/bash set -e build_dir=$1 source_dir=$(pwd) # Create build directory in the specified location mkdir -p "${build_dir}" # Change to the glibc source directory cd sources/glibc-2.42 # Apply the FHS patch to make programs store runtime data in FHS-compliant locations echo "Applying FHS patch..." patch -Np1 -i ../../sources/glibc-2.42-fhs-1.patch # Create a dedicated build directory as recommended by Glibc documentation echo "Creating build directory..." mkdir -v "${build_dir}/build" # Ensure that ldconfig and sln utilities will be installed into /usr/sbin echo "rootsbindir=/usr/sbin" > "${build_dir}/build/configparms" # Change to the build directory cd "${build_dir}/build" # Prepare Glibc for compilation echo "Configuring glibc..." ${source_dir}/sources/glibc-2.42/configure --prefix=/usr \ --disable-werror \ --enable-kernel=4.19 \ --enable-stack-protector=strong \ --disable-nscd \ libc_cv_slibdir=/usr/lib # Compile the package echo "Building glibc..." make echo "Build complete."