#!/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=libudev-zero
pkgver=222
pkgrel=01
libudev_ver=1-64
so_ver=1.6.3
pkgdesc="Daemonless replacement for libudev "
arch=('x86_64' 'aarch64')
url="https://github.com/illiliti/libudev-zero"
makedepends=('glibc' 'make' 'git')
provides=('libudev-zero' 'libeudev' 'libudev' "libudev.so=$libudev_ver")
conflicts=('libudev')
source=("git+https://github.com/illiliti/$pkgname"
        arch-nosystemd-install.patch)

pkgver() {
  cd $srcdir/$pkgname
  git rev-list --count HEAD
}

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

build() {
	cd $pkgname

	LIBUDEV_VER="${so_ver}" make

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

package() {
	cd $pkgname

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

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

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

license=('GPL')

sha256sums=(SKIP
	755787ff9111c81fa2978232e512e1fc5f1706786abd7ac6f203c8ef18660b2b) #  arch-nosystemd-install.patch
