1.4. tmp glibc-2.31

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

Configuration

src_config()
{
    mkdir build
    cd build

    ../configure                         \
      --prefix=${PREFIX}                 \
      --host=${LFS_TGT}                  \
      --build=$(../scripts/config.guess) \
      --enable-kernel=3.2                \
      --with-headers=${PREFIX}/include   \

#      libc_cv_forced_unwind=yes          \
#      libc_cv_c_cleanup=yes
}

Compilation

src_compile()
{
    make ${MAKEOPTS}
}

Unit testing

src_check()
{
    make check || nonfail
}

Installation

Additional large piece is added.

That is done in glibc package instead of manual editing filesystem in original LFS.

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

    # gcc sickness:
    # modify and install additional specs to add search path for libs and includes
    path=$( ${LFS_TGT}-gcc -print-libgcc-file-name )
    path=$(dirname ${path})
    mkdir -p ${D}/${path}/
    ${LFS_TGT}-gcc -dumpspecs > ${T}/specs
    sed -e "s#crt1.o#${PREFIX}/lib/crt1.o#g" \
        -e "s#crti.o#${PREFIX}/lib/crti.o#g" \
        -e "s#crtn.o#${PREFIX}/lib/crtn.o#g" \
        -e "\#%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}#s#\$# -I${PREFIX}/include#" \
         ${T}/specs > ${D}/${path}/specs

    mkdir -p ${D}/${PREFIX}/${LFS_TGT}/include
    for i in $(ls ${D}/${PREFIX}/include/) ; do
        ln -s ../../include/$i ${D}/${PREFIX}/${LFS_TGT}/include/$i
    done
}

Links

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