1.4. tmp glibc-2.36

STRIP=true to avoid stripping.
strip from pass1-binutils choked on unknown section in .so files of glibc.

#!/bin/sh
# Copyright © 1999-2022 Gerard Beekmans
# Copyright © 2017-2022 Random Crew
# Distributed under the terms of MIT License.



STRIP=$(which true)

Configuration

src_config()
{
    mkdir build
    cd build

    echo "rootsbindir=/usr/sbin" > configparms
    ../configure                         \
      --prefix=${PREFIX}                 \
      --host=${LFS_TGT}                  \
      --build=$(../scripts/config.guess) \
      --enable-kernel=3.2                \
      --with-headers=${LFS}${PREFIX}/include   \
      libc_cv_slibdir=${PREFIX}/lib

}

Compilation

src_compile()
{
    make ${MAKEOPTS}
}

Unit testing

src_check()
{
    make check || nonfail
}

Installation

Time zone data are installed in separate package tzdata.

Additional compatibility links:

ld-lsb*.so.3 link is created for LSB compatibility.
/lib/ld-linux* is created, pointing to actual $PREFIX/lib/ld-linux*.
That is done in glibc package instead of manual editing filesystem in original LFS.

src_install()
{
    make install ${MAKEOPTS} DESTDIR=${D}

    # real and expected loader location
    mkdir -p ${D}/lib
    ln -sf ../usr/lib/ld-linux-x86-64.so.2 ${D}/lib/ld-linux-x86-64.so.2

    case $(uname -m) in
        i?86)
            ln -sf ld-linux.so.2 ${D}/lib/ld-lsb.so.3
        ;;
        x86_64) 
            mkdir -p ${D}/lib64
            ln -sf ../lib/ld-linux-x86-64.so.2 ${D}/lib64
            ln -sf ../lib/ld-linux-x86-64.so.2 ${D}/lib64/ld-lsb-x86-64.so.3
        ;;
    esac

    sed '/RTLDLIST=/s@/usr@@g' -i ${D}${PREFIX}/bin/ldd

    # this belongs to gcc, installed to filesystem before
    ${LFS}${PASS1PREFIX}/libexec/gcc/${LFS_TGT}/12.2.0/install-tools/mkheaders
}

Links

url.lfs: https://linuxfromscratch.org/lfs/view/11.2/chapter08/glibc.html
url.lfs.stage1: https://linuxfromscratch.org/lfs/view/11.2/chapter05/glibc.html