# $Id$
# Maintainer: Martchus <martchus@gmx.net>

pkgname=nginx-mod-fancyindex
pkgver=0.5.2
pkgrel=2
_dirname="ngx-fancyindex-${pkgver}"
_nginxver=1.20.2

pkgdesc='Fancy indexes module for the Nginx web server'
arch=('x86_64')
depends=("nginx=$_nginxver" "libutil-linux")
makedepends=("nginx-src")
url='https://github.com/aperezdc/ngx-fancyindex'
license=('CUSTOM')

source=("$pkgname-$pkgver::https://github.com/aperezdc/ngx-fancyindex/archive/v${pkgver}.tar.gz")
sha256sums=('c3dd84d8ba0b8daeace3041ef5987e3fb96e9c7c17df30c9ffe2fe3aa2a0ca31')

prepare() {
  cd "$srcdir/$_dirname"
}

build() {
  cp -r /usr/src/nginx .
  cd "$srcdir"/nginx
  ./configure --with-compat --add-dynamic-module="../$_dirname"
  make modules
}

package() {
  install -Dm755 "$srcdir/$_dirname/LICENSE" "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
  cd "$srcdir"/nginx/objs
  for mod in ngx_*.so; do
    install -Dm755 $mod "$pkgdir"/usr/lib/nginx/modules/$mod
  done
}
