#!/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 |---------------------------------------

pkgname=lsb-release
pkgver=2.0.r48.3cf5103
_commit=3cf51039933d03ef15388b75d30baa5d5e09a1a0
pkgrel=01
pkgdesc="LSB version query program"
arch=('any')
url="https://refspecs.linuxfoundation.org/lsb.shtml"
depends=('sh')
makedepends=('git')
source=("git+https://github.com/LinuxStandardBase/lsb-samples.git#commit=$_commit"
        'lsb-release'
        'lsb_release_description.patch'
        'lsb_release_make_man_page_reproducible.patch')

pkgver() {
	cd lsb-samples/lsb_release/src
	printf "%s.r%s.%s" "$(grep -Po 'SCRIPTVERSION="\K[^"]*' lsb_release)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd lsb-samples/lsb_release/src
	patch -Np0 -i "$srcdir/lsb_release_description.patch"
	patch -Np1 -i "$srcdir/lsb_release_make_man_page_reproducible.patch"
}

build() {
	cd lsb-samples/lsb_release/src
	make
}

package() {
	cd lsb-samples/lsb_release/src
	install -Dm644 lsb_release.1.gz -t "$pkgdir/usr/share/man/man1"
	install -Dm755 lsb_release -t "$pkgdir/usr/bin"
	install -Dm644 "$srcdir/lsb-release" -t "$pkgdir/etc"
}

#---- license gpg-key sha256sums ----

license=('GPL')

sha256sums=(b68bca433bb6b36e7d285daf52a8b93f9a284ecede61aded2e25ec6f78b134af # lsb-release
	79f7f4d47052eea37c602d42c8d75d391b87effd867f20003f179e8f74663e93 # lsb_release_description.patch
	da9fdceedd09f336652147d4482edc6f0e8834cc24ed64ecda79b3c1efeac7a6) # lsb_release_make_man_page_reproducible.patch
