# Maintainer: PktSurf <smlinux@pktsurf.in>
app=cgit
version=1.2.3
gitv=2.28.1
build=1sml
homepage="https://git.zx2c4.com/cgit/about/"
download="https://git.zx2c4.com/cgit/snapshot/cgit-$version.tar.xz"
desc="CGI web frontend for git repositories written in C"
requires="zlib git"

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

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

  [ -d git ] && rm -rf git
  tar -xf "$srcdir/git-$gitv.tar.lz" && mv git-$gitv git
}

build() {
  export NO_LUA=1
  export NO_REGEX=NeedsStartEnd

  make
  make install prefix="/" DESTDIR="$pkg"

  cp COPYING $pkgdocs/
  install -Dm 644 $srcdir/cgitrc $pkg/etc/cgitrc.new

  mkdir -p $pkg/var/cache/cgit
  chmod 755 $pkg/var/cache/cgit

  mkfinalpkg
}

sha512sums="
5b11fee74514e52b40f534b38b9ebe271ac707b1e560a7221b0f6b3fc422b339024ac955e3bba566bf20d70be0c7a99924db95b68483c3b0b6884ef89dbbec95  cgit-1.2.3.tar.lz
529a132f96cb9f7956bd68e2589a5f9722289d79e45171221595ea39c147028c53b1208f2fb1aed81741867718367c447dce2efb112d73d170c5dba93918dec4  git-2.28.1.tar.lz
"