#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
# reference to the implementation done by mobinmob in abyss 
# https://github.com/mobinmob/void-mklive/tree/abyss
# https://github.com/void-linux/void-mklive/issues/313

pkgname=limine
## previous=4.20230325.0
pkgver=4.20230408.0
pkgrel=02
pkgdesc="An advanced, portable, multiprotocol bootloader"
url="https://limine-bootloader.org/"
depends=('glibc')
makedepends=('nasm' 'mtools' 'llvm' 'lld' 'clang')
source=("https://github.com/limine-bootloader/limine/releases/download/v${pkgver}/limine-${pkgver}.tar.xz"
	limine.boot.protocol
	limine.barebones.wiki
	limine.cfg::https://github.com/limine-bootloader/limine/raw/trunk/test/limine.cfg
	bg.jpg::https://raw.githubusercontent.com/limine-bootloader/limine/trunk/test/bg.jpg
	CONFIG.md::https://github.com/limine-bootloader/limine/raw/trunk/CONFIG.md)

build() {
  cd "$pkgname-$pkgver"
  ./configure \
	--prefix=/usr \
	--bindir=/usr/bin \
	--sbindir=/usr/bin \
	--libdir=/usr/lib \
	--mandir=/usr/share/man \
	--docdir=/usr/share/doc \
	--enable-bios-cd \
	--enable-bios-pxe \
	--enable-bios \
	--disable-uefi-ia32 \
	--enable-uefi-x86-64 \
	--disable-uefi-aarch64 \
	--enable-uefi-cd \
	TOOLCHAIN_FOR_TARGET=llvm
  make
}

package() {
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  mkdir -p -m755 "$pkgdir/boot/limine"
  install -Dm644 $srcdir/$pkgname-$pkgver/bin/limine.sys "$pkgdir/boot/limine/"
  install -Dm644 $srcdir/bg.jpg "$pkgdir/boot/limine/"
  install -Dm644 $srcdir/limine.cfg "$pkgdir/boot/limine/"
  install -Dm644 $srcdir/CONFIG.md "$pkgdir/boot/limine/"
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('BSD')

b2sums=('c4a5d0a93082b4f9569b2af6d8b345ca7b0e00aeff42af112e2f07541b091f54451af7be969fad3d28c6108cf2106ce7d5d463f0237090bfd5b3548e50ca935f'
	SKIP
	SKIP
	SKIP
	SKIP
	SKIP)

sha256sums=(e0f41a5242436a98638d3931ec65ae4aa07c838060ddb833b11783c25cc7e10e  # limine-4.20230408.0.tar.xz
	8964016f9aaaf246d92433f6849c2e228483c7b9716d04afef234d9bb556ca8a  # limine.boot.protocol
	aba179176961f3fece88672413f98d0ef93e9671f9d25846335aa1ae8e806ebb  # limine.barebones.wiki
	bfbd4b5e8d318cb6cb91c1e1311525f65046943edb642aa411bea94a522f3d32  # limine.cfg
	15df8e06872a6cb89dfad3f99ad2b255dd1a54576e4343c954975e2ea48f28ab  # bg.jpg
	929fdf6d57dd490ab4bf18ad0415318eeeafe35dae0095c3b477ad32c3f32919) #  CONFIG.md

##  6f114f7a8b7c8de6a399aaee7a53444497a7cf9932677071febfec1bdd524e7c  limine-4.20230408.0-02-x86_64.pkg.tar.lz
