void-packages/srcpkgs/nginx/template

109 lines
3.0 KiB
Bash

# Template file for 'nginx'
pkgname=nginx
version=1.14.2
revision=1
makedepends="libressl-devel pcre-devel $(vopt_if geoip 'geoip-devel')"
short_desc="A high performance web and reverse proxy server"
maintainer="Juan RP <xtraeme@voidlinux.org>"
license="BSD-2-Clause"
homepage="https://nginx.org"
distfiles="https://nginx.org/download/nginx-${version}.tar.gz"
checksum=002d9f6154e331886a2dd4e6065863c9c1cf8291ae97a1255308572c02be9797
if [ "$CROSS_BUILD" ]; then
# fake configure run on host
hostmakedepends=$makedepends
fi
conf_files="/etc/nginx/fastcgi.conf
/etc/nginx/fastcgi_params
/etc/nginx/koi-win
/etc/nginx/koi-utf
/etc/nginx/mime.types
/etc/nginx/nginx.conf
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
/etc/nginx/win-utf"
system_accounts="nginx"
nginx_homedir="/var/tmp/nginx"
make_dirs="/var/log/nginx 0750 root root
/var/tmp 1777 root root
/var/tmp/nginx 0750 nginx root"
if [ "$CROSS_BUILD" ]; then
# fake configure run on host
hostmakedepends+=" $makedepends"
fi
build_options="geoip"
build_options_default="geoip"
do_configure() {
local cfgdir=/etc/nginx
local tmpdir=/var/tmp/nginx
if [ "$CROSS_BUILD" ]; then
# fake configure run on host
unset CC CPP LD CFLAGS CPPFLAGS LDFLAGS
fi
./configure --prefix=${cfgdir} \
--conf-path=${cfgdir}/nginx.conf \
--sbin-path=/usr/bin/nginx \
--pid-path=/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx --group=nginx \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--http-client-body-temp-path=${tmpdir}/client-body \
--http-proxy-temp-path=${tmpdir}/proxy \
--http-fastcgi-temp-path=${tmpdir}/fastcgi \
--http-scgi-temp-path=${tmpdir}/scgi \
--http-uwsgi-temp-path=${tmpdir}/uwsgi \
--with-mail --with-mail_ssl_module \
--with-pcre-jit --with-file-aio \
--with-http_gunzip_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_stub_status_module \
$(vopt_if geoip --with-http_geoip_module)
if [ "$CROSS_BUILD" ]; then
case "$XBPS_TARGET_MACHINE" in
arm*|aarch64*) cp ${FILESDIR}/ngx_auto_config.h.armv6l objs/ngx_auto_config.h;;
esac
fi
sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
}
do_build() {
make ${makejobs} CC="${CC}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
}
do_install() {
make DESTDIR=$DESTDIR install
sed -e 's|\<user\s\+\w\+;|user html;|g' \
-e '44s|html|/usr/share/nginx/html|' \
-e '54s|html|/usr/share/nginx/html|' \
-i $DESTDIR/etc/nginx/nginx.conf
rm $DESTDIR/etc/nginx/*.default
vmkdir usr/share/nginx
mv $DESTDIR/etc/nginx/html/ $DESTDIR/usr/share/nginx
vman man/nginx.8
vlicense LICENSE
vsv nginx
}
# REMARKS:
# The pregnerated header file for ARM must be syncrhonized on update. After the
# configure step, the diff between srcpkgs/nginx/files/ngx_auto_config.h.armv6l
# and masterdir/builddir/nginx-$version/objs/ngx_auto_config.h must be checked
# for changes that must be made.