# Maintainer: PktSurf <smlinux@pktsurf.in>
app=motion
version=4.2.2
build=1sml
homepage="https://motion-project.github.io/"
download="https://github.com/Motion-Project/motion/archive/refs/tags/release-$version.tar.gz"
desc="Software-based camera motion detection utility"
requires="bzip2 zlib gnutls sqlite libidn libtasn1 nettle libmicrohttpd libxext dbus sdl2 libwebp ffmpeg"

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

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

build() {
  # Building with mmal causes link errors with /opt/vc/lib/libvcsm.so, hence we disable it.
  ./configure \
    --prefix="" \
    --sysconfdir=/etc \
    --without-mmal

  make
  make install DESTDIR=$pkg

  cp COPYING $pkgdocs/

  mkfinalpkg
}

sha512sums="
79da14f2e93caf8dd0da6e4eb116c981db3b6b7d2d9c38a0dd1afb0364f694b4d598d8c4cd25b7cb7be37a20a2cc84b16d50bb79801b47bdbdca42a236db0315  motion-release-4.2.2.tar.lz
"
