#!/bin/sh -ue
NAME=limine
VERSION=8.4.1
RELEASE=1
SOURCE="https://github.com/limine-bootloader/limine/releases/download/v${VERSION}/limine-${VERSION}.tar.gz"

build() {
    cd "$SRC/${NAME}-${VERSION}" || die "cannot enter source directory"

    msg "configuring limine..."
    ./configure \
        --prefix="$PREFIX" \
        --enable-bios --enable-bios-cd \
        --enable-uefi-x86-64 --enable-uefi-cd \
        CC="${CC:-cc}" \
        CFLAGS="${CFLAGS:--O2}" \
        LDFLAGS="${LDFLAGS:-}" || die "configure failed"

    msg "building limine..."
    gmake -j"$NPROC" || die "gmake failed"

    msg "installing limine..."
    gmake DESTDIR="$PKG" install || die "gmake install failed"
}

. ${0%/*}/../../libsh/libdmake.sh
