3.6. bzip2-1.0.8

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

Configuration

src_config()
{
    sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
    sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
}

Compilation

src_compile()
{
    make ${MAKEOPTS} -f Makefile-libbz2_so
    make clean
    make ${MAKEOPTS}
}

Installation

Dataword rootprefix means that the project uses root directory / along with /usr and several essential packages are installed to root directory. When the system is merged to /usr, this word is absent in configuration.

The string with ause command chooses the first block in case of presence of rootprefix.

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

    if ause 'rootprefix' ; then
        mkdir -p ${D}/bin/
        mkdir -p ${D}/lib/
        cp bzip2-shared ${D}/bin/bzip2
        cp -pR libbz2.so* ${D}/lib/
        ln -s ../../lib/libbz2.so.1.0 ${D}${PREFIX}/lib/libbz2.so
        rm \
            ${D}${PREFIX}/bin/bunzip2 \
            ${D}${PREFIX}/bin/bzcat \
            ${D}${PREFIX}/bin/bzip2
        ln -s bzip2 ${D}/bin/bunzip2
        ln -s bzip2 ${D}/bin/bzcat
    else
        cp -a libbz2.so.* ${D}${PREFIX}/lib
        ln -s libbz2.so.1.0.8 ${D}${PREFIX}/lib/libbz2.so

        cp bzip2-shared ${D}${PREFIX}/bin/bzip2
        for i in bzcat bunzip2; do
            ln -sf bzip2 ${D}${PREFIX}/bin/$i
        done
    fi
}

Patches

bzip2-1.0.8-install_docs-1.patch

Build code

bzip2.build
pass1.sh

Other files

meta.txt
text

Links

url.lfs: https://linuxfromscratch.org/lfs/view/11.2/chapter08/bzip2.html
url.lfs.stage1: https://linuxfromscratch.org/lfs/view/9.1/chapter05/bzip2.html