2022-04-27 22:21:24 +00:00
|
|
|
# Maintainer: psykose <alice@ayaya.dev>
|
|
|
|
pkgname=nginx-current
|
2022-08-04 21:32:59 +00:00
|
|
|
pkgver=1.23.1
|
|
|
|
pkgrel=0
|
2022-04-27 22:21:24 +00:00
|
|
|
pkgdesc="HTTP and reverse proxy server (current version)"
|
|
|
|
url="https://www.nginx.org/"
|
|
|
|
arch="all"
|
|
|
|
license="BSD-2-Clause"
|
|
|
|
depends="!nginx"
|
|
|
|
makedepends="
|
|
|
|
brotli-dev
|
2022-06-24 01:54:10 +00:00
|
|
|
clang
|
2022-05-15 04:20:18 +00:00
|
|
|
file-dev
|
2022-04-27 22:21:24 +00:00
|
|
|
gd-dev
|
|
|
|
libxml2-dev
|
|
|
|
libxslt-dev
|
2022-06-24 01:54:10 +00:00
|
|
|
lld
|
2022-04-27 22:21:24 +00:00
|
|
|
linux-headers
|
2022-08-04 21:32:59 +00:00
|
|
|
openssl-dev>3
|
2022-04-27 22:21:24 +00:00
|
|
|
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!
|
|
|
|
|
2022-06-24 01:54:10 +00:00
|
|
|
export CC=clang
|
|
|
|
export CFLAGS="$CFLAGS -flto"
|
|
|
|
# passed below
|
2022-08-04 21:32:59 +00:00
|
|
|
export LDFLAGS="$LDFLAGS -flto -fuse-ld=lld -Wl,--icf=all,--gc-sections"
|
2022-06-24 01:54:10 +00:00
|
|
|
|
2022-04-28 02:55:52 +00:00
|
|
|
_modules_dir="usr/lib/nginx/modules"
|
2022-04-27 22:21:24 +00:00
|
|
|
|
|
|
|
# Built-in dynamic modules
|
|
|
|
for _mod in \
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2022-05-15 04:20:18 +00:00
|
|
|
_add_module "http-mime-magic" "v0.1.0" "https://github.com/Yureien/nginx-mime-magic-module"
|
|
|
|
|
2022-04-27 22:21:24 +00:00
|
|
|
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 \
|
2022-06-24 01:54:10 +00:00
|
|
|
--with-ld-opt="-lmagic $LDFLAGS" \
|
2022-04-27 22:21:24 +00:00
|
|
|
\
|
|
|
|
--with-http_ssl_module \
|
|
|
|
--with-http_v2_module \
|
|
|
|
--with-http_realip_module \
|
|
|
|
--with-http_addition_module \
|
|
|
|
--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-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
|
|
|
|
|
2022-06-24 01:35:47 +00:00
|
|
|
# local name; for name in ngx_devel_kit nginx-rtmp-module; do
|
|
|
|
# cp -r "$srcdir"/$name-*/doc* "$pkgdir"/usr/share/doc/$pkgname/$name
|
|
|
|
# done
|
2022-04-27 22:21:24 +00:00
|
|
|
cd "$pkgdir"
|
|
|
|
|
|
|
|
install -Dm644 "$srcdir"/nginx.conf ./etc/nginx/nginx.conf
|
2022-04-28 02:55:52 +00:00
|
|
|
install -dm755 ./etc/nginx/http.d ./etc/nginx/modules
|
2022-04-27 22:21:24 +00:00
|
|
|
|
|
|
|
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="
|
2022-08-04 21:32:59 +00:00
|
|
|
62d6b3d5282f4e4cc23adf23b3dc26e06fc4574cae3c18381c406d0cf0f8c68e7dfa86af0c3c1c1485214c548f3b45015eb219e62bfe04e0aaa5edaad82e6706 nginx-1.23.1.tar.gz
|
2022-04-27 22:21:24 +00:00
|
|
|
9c5ee975dffa15b76688ef798371635f38f1e6773b143c738add26297878dddfc20ebf276e3871a60f28b197e8a70496ca17d4816c2136171978c157bb8e591f nginx.conf
|
|
|
|
0907f69dc2d3dc1bad3a04fb6673f741f1a8be964e22b306ef9ae2f8e736e1f5733a8884bfe54f3553fff5132a0e5336716250f54272c3fec2177d6ba16986f3 default.conf
|
|
|
|
f3321a45736697009817db335ad36d3f1d05f60d98ac90a943220cdd4c00c52632f018db6a6076d5431a483525aacc5725b87b765b590e2f63b3ef98c5b16bd8 stream.conf
|
|
|
|
09b110693e3f4377349ccea3c43cb8199c8579ee351eae34283299be99fdf764b0c1bddd552e13e4d671b194501618b29c822e1ad53b34101a73a63954363dbb nginx.logrotate
|
|
|
|
ee10a5687740dde0c3d18d8b3555f49fcdc6abfc0a3bc2de1de3be0e99951a346fe8027d916aab73071ecd4e2c50871e7c867aca3a7a0fd16e3374c5caed1c57 nginx.initd
|
|
|
|
0b9b9ed01ac077e334c034faa2679f6e26740fb3362eebf8cef82d22b2af2a3faaa53bae3c9e14af51cbf64720a7c66431905ca5cc43f978366456cc4e3b7f4a nginx.confd
|
2022-05-15 04:20:18 +00:00
|
|
|
68e5507c65abff2a199929db0a45a46a736bd903adebb411bcf32ec22c83cfd24ccd047635e1901ff50abdd1de22a7a1d0bb4f4f4205c6a710e238e8ef3199ee nginx-mime-magic-module-0.1.0.tar.gz
|
2022-04-27 22:21:24 +00:00
|
|
|
"
|