1.20. tmp xz-5.2.5

#!/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) \
        --disable-static                  \
        --docdir=${PREFIX}/share/doc/${P}
}

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 ${D}/lib
        mv \
            ${D}${PREFIX}/bin/lzma \
            ${D}${PREFIX}/bin/unlzma \
            ${D}${PREFIX}/bin/lzcat \
            ${D}${PREFIX}/bin/xz \
            ${D}${PREFIX}/bin/unxz \
            ${D}${PREFIX}/bin/xzcat \
            ${D}/bin
        mv ${D}${PREFIX}/lib/liblzma.so.* ${D}/lib
        ln -sf ../../lib/$(readlink ${D}${PREFIX}/lib/liblzma.so) ${D}${PREFIX}/lib/liblzma.so
    fi
}

Unit testing

src_check()
{
    make check
}

Links

url.lfs: https://linuxfromscratch.org/lfs/view/11.0/chapter08/xz.html
url.lfs.stage1: https://linuxfromscratch.org/lfs/view/11.0/chapter06/xz.html