# Maintainer: PktSurf <smlinux@pktsurf.in>
app=minidlna
version=1.2.1
build=1sml
homepage="https://sourceforge.net/projects/minidlna/"
download="https://sourceforge.net/projects/minidlna/files/minidlna/$version/minidlna-$version.tar.gz"
desc="DLNA and UPnP server"
requires="flac libexif libid3tag libjpeg-turbo libvorbis sqlite ffmpeg"

prepbuilddir() {
  mkandenterbuilddir
  rm -rf $app-$version

  tar xf $srcdir/$app-$version.tar.?z*
  cd $app-$version
  fixbuilddirpermissions

  applypatch $srcdir/10-minidlna-nfo.patch
}

build() {
  ./configure \
    --prefix="" \
    --sbindir=/bin \
    --with-os-name="SMLinux" \
    --with-db-path=/var/lib/minidlna \
    --with-log-path=/var/log/minidlna

  make
  make install DESTDIR=$pkg

  install -Dm 644 minidlnad.8 $pkg/share/man/man8/minidlnad.8 
  install -Dm 644 minidlna.conf.5 $pkg/share/man/man8/minidla.conf.5
  install -Dm 644 minidlna.conf $pkg/etc/minidlna.conf.new

  install -Dm 755 $srcdir/rc.minidlna $pkg/etc/rc.d/rc.minidlna

  cp LICENCE.miniupnpd COPYING $pkgdocs/

  mkfinalpkg
}

sha512sums="
6a6613d7d92b13a5aa73fe19f218c73b4552ff062d9868efbd2d16b83d02b4a2f9dd8dea0d4ed4d6d9045845b63c1a6ddf2808e61586d53a1affb51fcb2077cb  minidlna-1.2.1.tar.lz
59a97ef0a36d3ae44dd2e182a0b106f84ce5c17e7dc14ee0459b17430b57ddc59a74e8e67fc0a90326fa451a505b97a0b719b438475efac144028dd012b44af1  10-minidlna-nfo.patch
"
