build.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. set -e
  3. build_dir=$1
  4. source_dir=$(pwd)
  5. # Create build directory in the specified location
  6. mkdir -p "${build_dir}"
  7. # Change to the glibc source directory
  8. cd sources/glibc-2.42
  9. # Apply the FHS patch to make programs store runtime data in FHS-compliant locations
  10. echo "Applying FHS patch..."
  11. patch -Np1 -i ../../sources/glibc-2.42-fhs-1.patch
  12. # Create a dedicated build directory as recommended by Glibc documentation
  13. echo "Creating build directory..."
  14. mkdir -v "${build_dir}/build"
  15. # Ensure that ldconfig and sln utilities will be installed into /usr/sbin
  16. echo "rootsbindir=/usr/sbin" > "${build_dir}/build/configparms"
  17. # Change to the build directory
  18. cd "${build_dir}/build"
  19. # Prepare Glibc for compilation
  20. echo "Configuring glibc..."
  21. ${source_dir}/sources/glibc-2.42/configure --prefix=/usr \
  22. --disable-werror \
  23. --enable-kernel=4.19 \
  24. --enable-stack-protector=strong \
  25. --disable-nscd \
  26. libc_cv_slibdir=/usr/lib
  27. # Compile the package
  28. echo "Building glibc..."
  29. make
  30. echo "Build complete."