This repository has been archived on 2023-01-08. You can view files and clone it, but cannot push or open issues or pull requests.
ptrcports/nginx-current/APKBUILD

311 lines
13 KiB
Plaintext

# Maintainer: psykose <alice@ayaya.dev>
pkgname=nginx-current
pkgver=1.21.6
pkgrel=1
pkgdesc="HTTP and reverse proxy server (current version)"
url="https://www.nginx.org/"
arch="all"
license="BSD-2-Clause"
depends="!nginx"
makedepends="
brotli-dev
gd-dev
libxml2-dev
libxslt-dev
linux-headers
openssl3-dev
pcre2-dev
perl-dev
zeromq-dev
zlib-dev
"
pkgusers="nginx"
_grp_ngx="nginx"
_grp_www="www-data"
pkggroups="$_grp_ngx $_grp_www"
install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-upgrade $pkgname.post-upgrade"
subpackages="$pkgname-doc $pkgname-openrc $pkgname-vim::noarch"
source="https://nginx.org/download/nginx-$pkgver.tar.gz
nginx.conf
default.conf
stream.conf
nginx.logrotate
nginx.initd
nginx.confd
"
builddir="$srcdir/nginx-$pkgver"
options="!check" # no time!
_modules_dir="usr/lib/nginx/modules"
# Built-in dynamic modules
for _mod in \
http-image-filter \
http-perl \
http-xslt-filter \
mail \
stream
do
subpackages="$subpackages $pkgname-mod-$_mod:_module"
done
# Third-party dynamic modules
# For simplicity we assume that module is hosted on GitHub.
_add_module() {
local name="$1" ver="$2" url="$3" subdir="$4" enabled="${5:-true}"
local dirname=${url##*/}-${ver#v}
local varprefix="_${name//-/_}"
eval "${varprefix}_ver='$ver'; ${varprefix}_url='$url'"
# Don't add new flag and source if it's already there, i.e. two or more
# modules share the same source (e.g. geoip2 that provides http-geoip2
# and stream-geoip2).
if ! printf '%s\n' $_extra_flags | grep -qFw "$srcdir/$dirname"; then
source="$source $dirname.tar.gz::$url/archive/$ver.tar.gz"
# $source must be always in-sync with $sha512sums, so we have to
# add there source of a module that is disabled on the current arch.
[ "$enabled" = false ] && return
_extra_flags="$_extra_flags --add-dynamic-module=$srcdir/$dirname/$subdir"
fi
subpackages="$subpackages $pkgname-mod-$name:_module"
}
_add_module "devel-kit" "v0.3.1" "https://github.com/vision5/ngx_devel_kit"
_devel_kit_so="ndk_http_module.so"
_add_module "http-accounting" "v2.0" "https://github.com/Lax/traffic-accounting-nginx-module"
_add_module "http-array-var" "v0.05" "https://github.com/openresty/array-var-nginx-module"
_http_array_var_depends="$pkgname-mod-devel-kit"
_add_module "http-brotli" "v1.0.0rc" "https://github.com/google/ngx_brotli"
_http_brotli_so="ngx_http_brotli_filter_module.so ngx_http_brotli_static_module.so"
_add_module "http-cache-purge" "2.5.1" "https://github.com/nginx-modules/ngx_cache_purge"
_add_module "http-cookie-flag" "v1.1.0" "https://github.com/AirisX/nginx_cookie_flag_module"
_http_cookie_flag_so="ngx_http_cookie_flag_filter_module.so"
_add_module "http-echo" "v0.62" "https://github.com/openresty/echo-nginx-module"
_add_module "http-encrypted-session" "v0.08" "https://github.com/openresty/encrypted-session-nginx-module"
_http_encrypted_session_depends="$pkgname-mod-devel-kit"
_add_module "http-fancyindex" "v0.5.1" "https://github.com/aperezdc/ngx-fancyindex"
_add_module "http-headers-more" "v0.33" "https://github.com/openresty/headers-more-nginx-module"
_http_headers_more_so="ngx_http_headers_more_filter_module.so"
_add_module "http-log-zmq" "v1.0.0" "https://github.com/danifbento/nginx-log-zmq"
_add_module "http-nchan" "v1.2.8" "https://github.com/slact/nchan"
_http_nchan_so="ngx_nchan_module.so"
_add_module "http-redis2" "v0.15" "https://github.com/openresty/redis2-nginx-module"
_add_module "http-set-misc" "v0.32" "https://github.com/openresty/set-misc-nginx-module"
_http_set_misc_depends="$pkgname-mod-devel-kit"
_add_module "http-shibboleth" "v2.0.1" "https://github.com/nginx-shib/nginx-http-shibboleth"
_add_module "http-untar" "v1.0" "https://github.com/ajax16384/ngx_http_untar_module"
_add_module "http-upload-progress" "v0.9.2" "https://github.com/masterzen/nginx-upload-progress-module"
_http_upload_progress_so="ngx_http_uploadprogress_module.so"
_add_module "http-upstream-fair" "0.1.3" "https://github.com/itoffshore/nginx-upstream-fair"
_add_module "http-upstream-jdomain" "1.1.5" "https://github.com/nicholaschiasson/ngx_upstream_jdomain"
_add_module "http-vod" "1.28" "https://github.com/kaltura/nginx-vod-module"
_add_module "http-zip" "1.2.0" "https://github.com/evanmiller/mod_zip"
_add_module "rtmp" "v1.2.2" "https://github.com/arut/nginx-rtmp-module"
_rtmp_provides="nginx-rtmp" # for backward compatibility
build() {
./configure \
--prefix=/var/lib/nginx \
--sbin-path=/usr/sbin/nginx \
--modules-path=/$_modules_dir \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/run/nginx/nginx.pid \
--lock-path=/run/nginx/nginx.lock \
--http-client-body-temp-path=/var/lib/nginx/tmp/client_body \
--http-proxy-temp-path=/var/lib/nginx/tmp/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi \
--http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi \
--http-scgi-temp-path=/var/lib/nginx/tmp/scgi \
--with-perl_modules_path=/usr/lib/perl5/vendor_perl \
\
--user=$pkgusers \
--group=$_grp_ngx \
--with-threads \
--with-file-aio \
\
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module=dynamic \
--with-http_image_filter_module=dynamic \
--with-http_sub_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_perl_module=dynamic \
--with-mail=dynamic \
--with-mail_ssl_module \
--with-openssl-opt=enable-ktls \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_ssl_preread_module \
\
$_extra_flags
make
}
package() {
make DESTDIR="$pkgdir" install
chown root:root "$pkgdir"/usr/sbin/nginx
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
install -Dm644 README "$pkgdir"/usr/share/doc/$pkgname/README
install -Dm644 objs/nginx.8 "$pkgdir"/usr/share/man/man8/nginx.8
local name; for name in ngx_devel_kit nginx-rtmp-module; do
cp -r "$srcdir"/$name-*/doc* "$pkgdir"/usr/share/doc/$pkgname/$name
done
cd "$pkgdir"
install -Dm644 "$srcdir"/nginx.conf ./etc/nginx/nginx.conf
install -dm755 ./etc/nginx/http.d ./etc/nginx/modules
install -Dm755 "$srcdir"/nginx.initd ./etc/init.d/nginx
install -Dm644 "$srcdir"/nginx.confd ./etc/conf.d/nginx
install -Dm644 "$srcdir"/nginx.logrotate ./etc/logrotate.d/nginx
install -dm750 -o $pkgusers -g $_grp_ngx ./var/lib/nginx
install -dm700 -o $pkgusers -g $_grp_ngx ./var/lib/nginx/tmp
install -dm755 -g $_grp_www ./var/www/localhost/htdocs
install -Dm644 "$srcdir"/default.conf ./usr/share/nginx/http-default_server.conf
install -dm755 ./var/log
mv ./var/lib/nginx/logs ./var/log/nginx
chown $pkgusers:$_grp_ngx var/log/nginx
ln -sf /$_modules_dir ./var/lib/nginx/modules
ln -sf /var/log/nginx ./var/lib/nginx/logs
ln -sf /run/nginx ./var/lib/nginx/run
# Remove archaic charset maps.
rm ./etc/nginx/koi-* ./etc/nginx/win-utf
rm -rf ./run ./etc/nginx/*.default
}
vim() {
pkgdesc="$pkgdesc (vim syntax)"
install_if="vim $pkgname=$pkgver-r$pkgrel"
depends=
mkdir -p "$subpkgdir"/usr/share/vim
cp -r "$builddir"/contrib/vim "$subpkgdir"/usr/share/vim/vimfiles
}
_module() {
local name="${subpkgname#$pkgname-mod-}"; name="${name//-/_}"
local ver=$(getvar _${name}_ver)
pkgdesc="Nginx module ${name//_/-}"
[ "$ver" ] && pkgdesc="Nginx third-party module ${name//_/-} (version $ver)"
url=$(getvar "_${name}_url" "$url")
sonames=$(getvar "_${name}_so" "ngx_${name}_module.so")
depends="$pkgname $(getvar "_${name}_depends")"
provides=$(getvar "_${name}_provides")
# Numeric prefix for the module config to ensure that modules with
# dependencies on other modules will be loaded after their dependencies.
# For simplicity, we don't actually resolve dependency tree. Instead,
# we just prefix the module name with a number that reflects number of
# the module's dependencies times ten (e.g. 10, 20, 30, ...).
local conf_prefix="$(echo "$depends" | wc -w)0_"
mkdir -p "$subpkgdir"/$_modules_dir
mkdir -p "$subpkgdir"/etc/nginx/modules
cd "$subpkgdir"
local soname; for soname in $sonames; do
mv "$pkgdir"/$_modules_dir/$soname ./$_modules_dir/$soname
echo "load_module \"modules/$soname\";" >> ./etc/nginx/modules/${conf_prefix}$name.conf
done
case "$name" in
http_perl)
mv "$pkgdir"/usr/lib/perl5 "$subpkgdir"/usr/lib/
;;
http_naxsi)
install -m644 -D "$srcdir"/naxsi-*/naxsi_config/naxsi_core.rules \
./etc/nginx/naxsi_core.rules
;;
stream)
mkdir -p ./etc/nginx/stream.d
install -m644 "$srcdir"/stream.conf ./etc/nginx/stream.conf
;;
esac
}
# Print value of the specified variable, or the default if empty or not defined.
getvar() {
eval "printf '%s\n' \"\${$1:-$2}\""
}
sha512sums="
10b0cdd13b26687104bf11e6b850fd851e9d8881bdf67f72c062d956e661da4d70482e6ec3123405b324ad7ed821a8bcc67b742dce9f59e972407fa437ddcad4 nginx-1.21.6.tar.gz
9c5ee975dffa15b76688ef798371635f38f1e6773b143c738add26297878dddfc20ebf276e3871a60f28b197e8a70496ca17d4816c2136171978c157bb8e591f nginx.conf
0907f69dc2d3dc1bad3a04fb6673f741f1a8be964e22b306ef9ae2f8e736e1f5733a8884bfe54f3553fff5132a0e5336716250f54272c3fec2177d6ba16986f3 default.conf
f3321a45736697009817db335ad36d3f1d05f60d98ac90a943220cdd4c00c52632f018db6a6076d5431a483525aacc5725b87b765b590e2f63b3ef98c5b16bd8 stream.conf
09b110693e3f4377349ccea3c43cb8199c8579ee351eae34283299be99fdf764b0c1bddd552e13e4d671b194501618b29c822e1ad53b34101a73a63954363dbb nginx.logrotate
ee10a5687740dde0c3d18d8b3555f49fcdc6abfc0a3bc2de1de3be0e99951a346fe8027d916aab73071ecd4e2c50871e7c867aca3a7a0fd16e3374c5caed1c57 nginx.initd
0b9b9ed01ac077e334c034faa2679f6e26740fb3362eebf8cef82d22b2af2a3faaa53bae3c9e14af51cbf64720a7c66431905ca5cc43f978366456cc4e3b7f4a nginx.confd
de1e3349d8dd08e5982279b2219dc8a8006739f0409b8e0f5c50d93434beff1fbafba43e9c5ac85a5fab90afc5c0a7244a340610339c36f82f2cba7233e72de9 ngx_devel_kit-0.3.1.tar.gz
0df34c3765e18dc5cc5a053d3a17dbee17a686a1f6e76ad057c262741c4e4465c66bcef86e627a19258f836cad5f14745bf046fd396b00960ad79ed20c2a07bb traffic-accounting-nginx-module-2.0.tar.gz
7c9fa9b76bc7cd2473ceae6d5ffb8de26993be9293ea967908d6c4550e086affa7016df4c936fb0b79f1142dc0aa1a5f2058d417e6433b5a3497a45d7e866e84 array-var-nginx-module-0.05.tar.gz
05a880d5e48ac83be84498ed41fb4750211b827a9d7541acfd6ef494e5205a6e853d5594bfec3ab4ae668ea3f803e4f4b0ba550c76811971c8e266e42663c56d ngx_brotli-1.0.0rc.tar.gz
3ad37b4a251fb85a9a384f87fea5ca640166e3d7173c6ed9a857b191ae5f2e93819483b5d423fcafe8a10239b571677b342cc2d2d5d62315816f1316d7d5bb76 ngx_cache_purge-2.5.1.tar.gz
352cc3d033cc67ee34209f958dac13ada2147de429f4dd3da301c865d52970d80c8aa3c193f7fb28cf4854b88baff07b6efc3bae1fb813fe53d5956a87dfc81a nginx_cookie_flag_module-1.1.0.tar.gz
240896b1c559a71ca6ca87136d8535edd25b1d65ebb80d46080ad41c09ed1cec9737828f9efe260782294d660cea66cf402f4e75bba3fed26f3a94de0ae2f89b echo-nginx-module-0.62.tar.gz
80651951edd69d202e991a66f531bbe0398b4f062e822bb7748411f5f597eb1d5827102ba477bb6cd2793274adf6f6d60dd89fde7645174b091143251197af69 encrypted-session-nginx-module-0.08.tar.gz
5c9252713286056cb493b734c8aabef51538c4c3c3204404eecc6c09dffcd06f733ed4f134af8f5d38558db75ac0a6161a1fa29ae98284b68b30309d9a5e6b31 ngx-fancyindex-0.5.1.tar.gz
13165b1b8d4be281b8bd2404fa48d456013d560bace094c81da08a35dc6a4f025a809a3ae3a42be6bbf67abbcbe41e0730aba06f905220f3baeb01e1192a7d37 headers-more-nginx-module-0.33.tar.gz
015a358d987476bb61302fbbe1cb105f5314edc1a8b7ee6310aae697f755c79fcb1834ff561fced054c8cd5624f5387fcc1de729731ccd70662f2eb72bcdc174 nginx-log-zmq-1.0.0.tar.gz
bea5ce8669f43f752a42f5988125ac1beb7c7904e780605f7706bbb03e9ab4f30a2bcbcddac5bc1c67cff4d92f798023ec320e8d9a2db47953f9f7b08b5ad882 nchan-1.2.8.tar.gz
d6ca250db8de93edbd7875afca35e73cecdaf82132d1a7ee933cf94c6b8afa8e629e9e647a9321f2bc1fbb92137ec0d32dcd89b82ac5fae31e342537fb7e0431 redis2-nginx-module-0.15.tar.gz
5590526f60c99630f99a49bfa9e3455baee6d58cd2a1419eab1367a838dafb87a50f5e2607aa8ac557b90dbf633dcf61069c997b3526cddc8f2fc45820a7bc3b set-misc-nginx-module-0.32.tar.gz
1730845ea2e52be8c2f6cfceb2894304c5a07959a96940bb1617ee0e7cf81d22283304f411d9a219ddb71e4d9a66012bba0f6f5574d101aeb3c406f26c5d6a4e nginx-http-shibboleth-2.0.1.tar.gz
5b0800ffb98ae69d3505d9046bc7f660defa14d21b74a4e425a4b07db917e39fd9a324851be8c424f5b4b4ef83997e09d9053eb8aa9e9f1889513dd742b5abba ngx_http_untar_module-1.0.tar.gz
c31c46344d49704389722325a041b9cd170fa290acefe92cfc572c07f711cd3039de78f28df48ca7dcb79b2e4bbe442580aaaf4d92883fd3a14bf41d66dd9d8c nginx-upload-progress-module-0.9.2.tar.gz
8adb7453c27748f4e685e3352e9b318b408da818754dc5b6244e908423941a8ba337561104f6e481f2553cbc0e334dcea73b57f8e810a9d6e974bb69ff8859e5 nginx-upstream-fair-0.1.3.tar.gz
54a0aae25a80f285e76344e6d0759e9a1b707be4bc0755abf4b7e48918c8e37092b7b259d052215d875be447d79717c0626797ea449677c492aa1e473cc448fd ngx_upstream_jdomain-1.1.5.tar.gz
389137124a3d046b99faabb977b5dbcf7c84541e039da27dfcca6b863d6d7f99e4b42916be1d7202bad017a88973c2f931985c2c58243f5134b7d9d199cdff0c nginx-vod-module-1.28.tar.gz
92e1e5aa570b68a19bb718817f864c4347f6dc89f90d828071ab3d06c784cc2786674d9d64fffef8c23749d0a653f2eb996b412ab10015eea1ed895d81268ce1 mod_zip-1.2.0.tar.gz
3f8c803221854c4b1a06aadc6313fbfec74bd7179c0ee51d4365b26ffa8875881a6e1e48f777a9c9efbb9170ab7478a82920d5448a2c2df485503d37bb03ab81 nginx-rtmp-module-1.2.2.tar.gz
"