3.28. sed-4.8

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

Configuration

The replacement of prefix to tools in original lfs-9.* is done in more universal way:

    replace="${PASS1PREFIX##/}"
    sed -i "s/usr/${replace}/"       build-aux/help2man

First string gets the text part of the prefix, i.e. string tools from /tools. The second string does the same change as original LFS does.

The string with rootprefix means that option --bindir=/bin is added to configure, if global project configuration has rootprefix in it and several essential packages are installed to root directory / along with /usr. When the system is merged to /usr, this option is not added.

src_config()
{
    case ${LFS_VERSION} in
        9.*)
            replace="${PASS1PREFIX##/}"
            sed -i "s/usr/${replace}/"       build-aux/help2man
            sed -i 's/panic-tests.sh//' Makefile.in
        ;;
    esac

    ./configure \
        --prefix=${PREFIX} \
        $(ause_enable 'rootprefix' "--bindir=/bin")
}

Compilation

src_compile()
{
    make ${MAKEOPTS}
    make html ${MAKEOPTS}
}

Installation

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

    install -d -m755 ${D}${PREFIX}/share/doc/${P}
    install -m644 doc/sed.html ${D}${PREFIX}/share/doc/${P}
}

Unit testing

src_check()
{
    make check
}

Build code

pass1.sh
sed.build

Other files

meta.txt
text

Links

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