app=nginx
version=1.17.3
build=2sml
homepage="http://nginx.org"
download="http://nginx.org/download/nginx-1.17.3.tar.gz"
desc="High-performance HTTP server with support for IMAP3 and POP3 proxies"
requires="zlib pcre openssl"

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

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

  CC="$CC" \
  ./configure \
    --prefix="" \
    --with-http_ssl_module \
    --with-http_v2_module \
    --with-http_stub_status_module \
    --with-http_auth_request_module \
    --with-http_gunzip_module \
    --with-http_realip_module \
    --with-http_secure_link_module \
    --with-http_slice_module \
    --with-threads \
    --with-ipv6 \
    --sbin-path=/bin/nginx \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --lock-path=/var/lock/nginx.lock \
    --http-log-path=/var/log/nginx/access.log \
    --http-client-body-temp-path=/var/spool/nginx\body \
    --http-fastcgi-temp-path=/var/spool/nginx/fastcgi \
    --http-proxy-temp-path=/var/spool/nginx/proxy \
    --http-scgi-temp-path=/var/spool/nginx/scgi \
    --http-uwsgi-temp-path=/var/spool/nginx/uwsgi

  make
  make install DESTDIR=$pkg

  mkdir -p $pkg/var/spool/nginx
  install -Dm 644 $srcdir/nginx.conf.sample $pkg/etc/nginx/nginx.conf.sample

  cp LICENSE $pkgdocs/

  preprunitservice nginx down

  mkfinalpkg
}

sha512sums="
b81e75c4c8c03ca2f0b40b9c2a1812cf168cb2319d7246b9b0cce838ef7dba81f3cd57a213ec8d58e457a0fa6b912adff2e5597e5ada7258cfe27f55b05205e2  nginx-1.17.3.tar.gz
"
