3.13. flex-2.6.4

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

Configuration

Variable HELP2MAN is assigned as parameter to configure in certain versions of LFS. When current version of LFS does not do that, variable is replaced with empty string.

The option --disable-static is added to configure in certain versions of LFS. When current version of LFS does not do that, variable is replaced with empty string.

src_config()
{
    help2man_replace=
    case ${LFS_VERSION} in
        8.*|9.*)
            sed -i "/math.h/a #include <malloc.h>" src/flexdef.h
            help2man_replace="eval HELP2MAN=${PASS1PREFIX}/bin/true"
        ;;
    esac

    disable_static="--disable-static"
    case ${LFS_VERSION} in
        8.*|9.*|10.0)
            disable_static=
        ;;
    esac

    ${help2man_replace} \
    ./configure \
        --prefix=${PREFIX} \
        --docdir=${PREFIX}/share/doc/${P} \
        ${disable_static}
}

Compilation

src_compile()
{
    make ${MAKEOPTS}
}

Installation

src_install()
{
    make install ${MAKEOPTS} DESTDIR=${D}
    ln -s flex ${D}/usr/bin/lex
}

Unit testing

src_check()
{
    make check
}

Build code

flex.build

Other files

meta.txt
text

Links

url.lfs: https://linuxfromscratch.org/lfs/view/11.1/chapter08/flex.html
url.lfs.stage1: