description="HTTP and reverse proxy, mail proxy, and a generic TCP/UDP proxy server"
url="http://nginx.org/en/"

packager="tnut <tnut@nutyx.org>"
maintainer="http://hg.nginx.org/nginx"

makedepends=(openssl pcre)

name=nginx
version=1.16.1
nutyx_version=11.3

source=(https://downloads.tuxfamily.org/nutyx/files/nutyx-${nutyx_version}.tar.xz
        https://nginx.org/download/nginx-$version.tar.gz)

build() {
cd $name-$version
./configure \
--with-openssl=/usr/include/openssl \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--prefix=/usr \
--modules-path=/usr/lib/nginx/modules \
--http-scgi-temp-path=/usr/lib/nginx/scgi \
--http-uwsgi-temp-path=/usr/lib/nginx/uwsgi \
--http-proxy-temp-path=/usr/lib/nginx/proxy \
--http-client-body-temp-path=/usr/lib/nginx/client-body \
--user=www --group=www
make
make DESTDIR=$PKG install
install -d $PKG{/srv/www,/usr/{lib/nginx,share/man/man8}}

# Configuration file
sed -e '44s|html|/srv/www|' \
    -e '54s|html|/srv/www|' \
    -i $PKG/etc/nginx/nginx.conf.default
rm  $PKG/etc/nginx/nginx.conf
cp -a html $PKG/etc/nginx

# Man pages
install -m644 objs/nginx.8 $PKG/usr/share/man/man8/nginx.8

# Service
cd $SRC/nutyx-${nutyx_version}
make DESTDIR=$PKG install-nginx

}
