1.22. pass2-gcc-11.2.0

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


MY_P="${P#pass2-}"
MY_PD="${MY_P}"

Additional source handling

src_postfetch()
{
    tar xf ${ANYSRCDIR}/mpfr-4.1.0.tar.xz
    mv mpfr-4.1.0 mpfr
    tar xf ${ANYSRCDIR}/gmp-6.2.1.tar.xz
    mv gmp-6.2.1 gmp
    tar xf ${ANYSRCDIR}/mpc-1.2.1.tar.gz
    mv mpc-1.2.1 mpc
}

Configuration

src_config()
{
    case $(uname -m) in
        x86_64)
            sed -e '/m64=/s/lib64/lib/' \
                -i.orig gcc/config/i386/t-linux64
        ;;
    esac

    mkdir build
    cd build
    mkdir -p ${LFS_TGT}/libgcc
    ln -s ../../../libgcc/gthr-posix.h ${LFS_TGT}/libgcc/gthr-default.h

    ../configure                                       \
        --build=$(../config.guess)                     \
        --host=${LFS_TGT}                              \
        --prefix=${PREFIX}                             \
        CC_FOR_TARGET=${LFS_TGT}-gcc                   \
        --with-build-sysroot=${LFS}                    \
        --enable-initfini-array                        \
        --disable-nls                                  \
        --disable-multilib                             \
        --disable-decimal-float                        \
        --disable-libatomic                            \
        --disable-libgomp                              \
        --disable-libquadmath                          \
        --disable-libssp                               \
        --disable-libvtv                               \
        --disable-libstdcxx                            \
        --enable-languages=c,c++
}

Compilation

src_compile()
{
    make ${MAKEOPTS}
}

Installation

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

    ln -s gcc ${D}/usr/bin/cc
}

Links

url.lfs:
url.lfs.stage1: https://linuxfromscratch.org/lfs/view/11.1/chapter06/gcc-pass2.html