# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=usbmuxd
pkgver=1.1.1
pkgrel=4
pkgdesc="USB Multiplex Daemon"
url="https://marcansoft.com/blog/iphonelinux/usbmuxd/"
arch=('x86_64')
license=('GPL2' 'GPL3')
depends=('libimobiledevice' 'libusb' 'libplist')
makedepends=('git' 'systemd')
_commit=79c8b38d1488a6b07e1e68f39d8caec3f1a45622  # tags/1.1.1
source=(
  "git+https://github.com/libimobiledevice/usbmuxd#commit=$_commit"
  usbmuxd.sysusers
  libplist-2.3.0.diff
)
b2sums=('SKIP'
        '67a843cd95e750555d1c43c4d01cc90e325ae1b69a5b24bb0e72480b903064f81baeaaa9e1dd95758b456b1444ed869b099be903d6533bb7f5dfe88a87ca1d4e'
        '483559477f83f59933d95a8279b21abf92a9d5ad6fe29802ff8966b4a94a79ac80d11f7fc0648846a189484b9f3a7ffa3bd8337940aa255a13ae78b61bb556f4')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname

  # Compatibility with libplist 2.3.0
  git apply -3 ../libplist-2.3.0.diff

  NOCONFIGURE=1 ./autogen.sh
}

check() {
  cd $pkgname
  make check
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --sbindir=/usr/bin
  make
}

package() {
  cd $pkgname
  make DESTDIR="${pkgdir}" install

  install -Dm644 "$srcdir"/usbmuxd.sysusers "$pkgdir"/usr/lib/sysusers.d/usbmuxd.conf
}
