# Maintainer: Erich Eckner <arch at eckner dot net>

pkgname=vchanger
pkgver=1.0.3
pkgrel=9
pkgdesc='disk-based virtual autochanger device for use with Bacula(TM) and bareos'
arch=('i486' 'i686' 'pentium4' 'x86_64')
url='https://sourceforge.net/projects/vchanger/'
license=('GPL')
source=("${pkgname}-${pkgver}.tar.gz::https://sourceforge.net/projects/$pkgname/files/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('866367a30d578bd49c502918b0cd6b7fc5b3d79fdd9985c4e5684decfac635cbc99b90b0ff4fef1fa5380a476714fe595c82f92710bbfc48a697470c0d25c8b0')
_pinned_dependencies=(
  'gcc-libs=12.1.1'
  'glibc>=2.31'
  'libudev.so=1'
)
depends=("${_pinned_dependencies[@]}")

build() {
  cd "$srcdir/$pkgname"
  ./configure \
    --prefix=/usr \
    --libexecdir=/usr/bin

  find "$srcdir/$pkgname" -name Makefile \
    -exec sed -i '
      s#\(= \$(libexecdir)\)/vchanger$#\1#
    ' {} \;

  make
}

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