3.52. coreutils-8.32

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

Configuration

Tests are disabled only for context in lfs-11.* versions.

src_config()
{
    case ${LFS_VERSION} in
        11.*)
        ;;
        *)
            sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk
        ;;
    esac

    autoreconf -fiv
    FORCE_UNSAFE_CONFIGURE=1 \
    ./configure \
        --prefix=${PREFIX} \
        --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

The actions for tests differs from original LFS. As we are building from our own user, which is autocreated inside chroot, we do not need to switch to that user manually. On the opposite, we need to switch to root user.

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

    make RUN_EXPENSIVE_TESTS=yes check
}

Patches

coreutils-8.32-i18n-1.patch

Build code

coreutils.build
pass1.sh

Other files

meta.txt
text

Links

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