1.9. tmp coreutils-8.32

Package automake and aclocal at the host system are prerequisites for building this package.

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

Configuration

src_config()
{
    ./configure \
            --prefix=${PREFIX}                \
            --host=${LFS_TGT}                 \
            --build=$(build-aux/config.guess) \
            --enable-install-program=hostname \
            --enable-no-install-program=kill,uptime
}

Compilation

src_compile()
{
    make ${MAKEOPTS}
}

Installation

The string with rootprefix means that block after check with ause method will be executed, if project has word rootprefix in it. In that case several essential packages are installed to root directory / along with /usr. When the system is merged to /usr, this block of code is not performed.

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

    if ause 'rootprefix' ; then
        mkdir -p ${D}/bin/
        for command in \
            cat chgrp chmod chown cp date dd df 'echo' false ln ls mkdir mknod mv pwd rm \
            rmdir stty sync true uname head sleep nice touch test [ \
            ; do
            mv ${D}${PREFIX}/bin/${command} ${D}/bin/
        done
    fi

    mkdir -p ${D}${PREFIX}/sbin/
    mv ${D}${PREFIX}/bin/chroot ${D}${PREFIX}/sbin/
    mkdir -p ${D}${PREFIX}/share/man/man8/
    mv ${D}${PREFIX}/share/man/man1/chroot.1 ${D}${PREFIX}/share/man/man8/chroot.8
    sed -i s/\"1\"/\"8\"/1 ${D}${PREFIX}/share/man/man8/chroot.8
}

Unit testing

Unit testing is not used during this stage.

src_check()
{
    su root -s /bin/bash \
    -c "PATH=$PATH make NON_ROOT_USERNAME=$(id -un) check-root"

    make RUN_EXPENSIVE_TESTS=yes check
}

Links

url.lfs: https://linuxfromscratch.org/lfs/view/10.1/chapter08/coreutils.html
url.lfs.stage1: https://linuxfromscratch.org/lfs/view/10.1/chapter06/coreutils.html