# Description: An HTTP and reverse proxy server (mainline version)
# URL: http://nginx.org/
# Maintainer: Matt Housh, jaeger at crux dot ninja
# Depends on: libpcre2 zlib openssl

name=nginx
version=1.31.2
release=1
source=(http://nginx.org/download/$name-$version.tar.gz \
    $name.conf $name.rc)

build() {
    cd $name-$version
    ./configure --prefix=/etc/$name \
        --sbin-path=/usr/sbin/$name \
        --conf-path=/etc/$name/$name.conf \
        --error-log-path=/var/log/$name/error.log \
        --http-log-path=/var/log/$name/access.log \
        --pid-path=/run/$name.pid \
        --lock-path=/var/lock/$name.pid \
        --with-http_ssl_module \
        --with-http_v2_module \
        --with-threads \
        --with-http_gzip_static_module \
        --user=$name \
        --group=$name
    make
    make DESTDIR=$PKG install

    install -d -m 0755 $PKG/var/log/$name
    install -D -m 0644 -o root -g root $SRC/$name.conf \
        $PKG/etc/$name/$name.conf

    install -D -m 0755 -o root -g root $SRC/$name.rc \
        $PKG/etc/rc.d/$name

    find $PKG/etc/$name -name "*.default" -delete

    chown $name:$name $PKG/var/log/$name
}
