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

name=nginx
version=1.25.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=/var/run/$name.pid \
        --lock-path=/var/lock/$name.pid \
        --with-http_ssl_module \
        --with-pcre \
        --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
}
