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

pkgbase=libudev-zero
pkgname=libudev-zero

pkgdesc="Daemonless replacement for libudev"
_pkgver=1.0.0
pkgver=215
pkgrel=03
so_ver=1.6.3
url="https://github.com/illiliti/libudev-zero"
source=("${url}/archive/refs/tags/${_pkgver}.tar.gz"
        arch-nosystemd-install.patch)
arch=('x86_64')
makedepends=('glibc' 'make')
provides=('libudev-zero' 'libeudev' 'libudev' "libudev.so=$libudev_ver")

prepare() {
	cd ${pkgname}-${_pkgver}
	patch -p0 -i ../arch-nosystemd-install.patch
}

build() {
	cd ${pkgname}-${_pkgver}

	LIBUDEV_VER="${so_ver}" make

	msg "Compiling helper"
	cd contrib
	gcc $CFLAGS -o libudev-helper helper.c
}

package() {
	cd ${pkgname}-${_pkgver}

	LIBUDEV_VER="${so_ver}" make DESTDIR="${pkgdir}" PREFIX="/usr" install

	install -Dm755 contrib/libudev-helper "${pkgdir}"/usr/bin/libudev-helper
}

depends=()

groups=(no-udev)

provides=('libudev-zero' 'libeudev' 'libudev' 'libudev.so=1-64')

conflicts=('libudev' 'libeudev' 'libudev-zero-git')

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

license=('GPL')

sha256sums=(68c20aefd7aa89abe446cf5ec76f5846315ded719f0665eabed9261cc3c7f47a # 1.0.0.tar.gz
	1f8a6dc821c616b4c57c3e58b9cf6e5b5e6bd319872e20eea11e9f48b696a700) # arch-nosystemd-install.patch
