You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
446 lines
16 KiB
446 lines
16 KiB
## |
|
## nginx.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2022 OpenPKG Project <http://openpkg.org/> |
|
## |
|
## Permission to use, copy, modify, and distribute this software for |
|
## any purpose with or without fee is hereby granted, provided that |
|
## the above copyright notice and this permission notice appear in all |
|
## copies. |
|
## |
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
## SUCH DAMAGE. |
|
## |
|
|
|
# package version |
|
%define V_nginx 1.21.5 |
|
%define V_nginx_headmore 0.33 |
|
%define V_nginx_ajp 0.3.0 |
|
%define V_nginx_lua 0.10.20rc1 |
|
%define V_nginx_lua_stream 0.0.10rc2 |
|
%define V_nginx_lua_upstream 0.07 |
|
%define V_nginx_redis 0.15rc1 |
|
%define V_nginx_echo 0.62rc1 |
|
%define V_nginx_davext 3.0.0 |
|
%define V_nginx_digest 20180103 |
|
%define V_nginx_fancyindex 0.5.2 |
|
%define V_nginx_geoip2 3.3 |
|
%define V_nginx_njs 239f3511397b |
|
%define V_nginx_brotli 20190810 |
|
%define V_nginx_rtmp 1.2.2 |
|
%define V_nginx_ts 0.1.1 |
|
%define V_nginx_ldap 20190810 |
|
|
|
# package information |
|
Name: nginx |
|
Summary: Reverse Proxy Server |
|
URL: http://nginx.org/ |
|
Vendor: Igor Sysoev |
|
Packager: OpenPKG Project |
|
Distribution: OpenPKG Community |
|
Class: PLUS |
|
Group: Web |
|
License: MIT-style |
|
Version: %{V_nginx} |
|
Release: 20211229 |
|
|
|
# package options |
|
%option with_ajp no |
|
%option with_perl no |
|
%option with_lua no |
|
%option with_redis no |
|
%option with_echo no |
|
%option with_davext no |
|
%option with_digest no |
|
%option with_fancyindex no |
|
%option with_geoip2 no |
|
%option with_njs no |
|
%option with_stream no |
|
%option with_brotli no |
|
%option with_rtmp no |
|
%option with_ts no |
|
%option with_ldap no |
|
|
|
# list of sources |
|
Source0: http://nginx.org/download/nginx-%{V_nginx}.tar.gz |
|
Source1: https://github.com/openresty/headers-more-nginx-module/archive/v%{V_nginx_headmore}.tar.gz |
|
Source2: https://github.com/yaoweibin/nginx_ajp_module/archive/v%{V_nginx_ajp}.tar.gz |
|
Source3: https://github.com/openresty/lua-nginx-module/archive/v%{V_nginx_lua}.tar.gz |
|
Source4: https://github.com/openresty/redis2-nginx-module/archive/v%{V_nginx_redis}.tar.gz |
|
Source5: https://github.com/openresty/echo-nginx-module/archive/v%{V_nginx_echo}.tar.gz |
|
Source6: https://github.com/arut/nginx-dav-ext-module/archive/v%{V_nginx_davext}.tar.gz |
|
Source7: http://download.openpkg.org/components/versioned/nginx/nginx-http-auth-digest-%{V_nginx_digest}.tar.gz |
|
Source8: https://github.com/aperezdc/ngx-fancyindex/archive/v%{V_nginx_fancyindex}.tar.gz |
|
Source9: https://github.com/leev/ngx_http_geoip2_module/archive/%{V_nginx_geoip2}.tar.gz |
|
Source10: http://hg.nginx.org/njs/archive/%{V_nginx_njs}.tar.gz |
|
Source11: http://download.openpkg.org/components/versioned/nginx/ngx_brotli-%{V_nginx_brotli}.tar.xz |
|
Source12: https://github.com/arut/nginx-rtmp-module/archive/v%{V_nginx_rtmp}.tar.gz |
|
Source13: https://github.com/arut/nginx-ts-module/archive/v%{V_nginx_ts}.tar.gz |
|
Source14: http://download.openpkg.org/components/versioned/nginx/nginx-auth-ldap-%{V_nginx_ldap}.tar.xz |
|
Source15: https://github.com/openresty/stream-lua-nginx-module/archive/v%{V_nginx_lua_stream}.tar.gz |
|
Source16: https://github.com/openresty/lua-upstream-nginx-module/archive/v%{V_nginx_lua_upstream}.tar.gz |
|
Source17: nginx.conf |
|
Source18: rc.nginx |
|
Patch0: nginx.patch |
|
|
|
# build information |
|
BuildPreReq: OpenPKG, openpkg >= 20160101 |
|
PreReq: OpenPKG, openpkg >= 20160101, x509 |
|
BuildPreReq: zlib, pcre, openssl, geoip |
|
PreReq: zlib, pcre, openssl, geoip |
|
%if "%{with_perl}" == "yes" |
|
BuildPreReq: perl |
|
PreReq: perl |
|
%endif |
|
%if "%{with_davext}" == "yes" |
|
BuildPreReq: libxml, libxslt |
|
PreReq: libxml, libxslt |
|
%endif |
|
%if "%{with_geoip2}" == "yes" |
|
BuildPreReq: geoip2 |
|
PreReq: geoip2 |
|
%endif |
|
%if "%{with_lua}" == "yes" |
|
BuildPreReq: luajit |
|
PreReq: luajit |
|
%endif |
|
%if "%{with_ldap}" == "yes" |
|
BuildPreReq: openldap |
|
PreReq: openldap |
|
%endif |
|
|
|
%description |
|
Nginx (pronounced "engine X" is a lightweight, event-driven |
|
high-performance Web server/reverse proxy and e-mail (IMAP/POP3) |
|
proxy. It provides the following HTTP features: Handling of static |
|
files, index files, and auto-indexing; Reverse proxy with caching; |
|
Load balancing; Fault tolerance; SSL support; FastCGI support with |
|
caching; Name- and IP-based virtual servers; FLV streaming; MP4 |
|
streaming; Web page access authentication; gzip compression; and |
|
ability to handle more than 10.000 simultaneous connections. |
|
|
|
%track |
|
prog nginx:nginx = { |
|
version = %{V_nginx} |
|
url = http://nginx.org/en/download.html |
|
regex = nginx-(1\.\d+\.\d+)\.tar\.gz |
|
} |
|
prog nginx:nginx-headmore = { |
|
version = %{V_nginx_headmore} |
|
url = https://github.com/openresty/headers-more-nginx-module/releases |
|
regex = v(\d+\.\d\d)\.tar\.gz |
|
} |
|
prog nginx:nginx-ajp = { |
|
version = %{V_nginx_ajp} |
|
url = https://github.com/yaoweibin/nginx_ajp_module/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-lua = { |
|
version = %{V_nginx_lua} |
|
url = https://github.com/openresty/lua-nginx-module/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-lua-stream = { |
|
version = %{V_nginx_lua_stream} |
|
url = https://github.com/openresty/stream-lua-nginx-module/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-lua-upstream = { |
|
version = %{V_nginx_lua_upstream} |
|
url = https://github.com/openresty/lua-upstream-nginx-module/releases |
|
regex = v(\d+\.\d+)\.tar\.gz |
|
} |
|
prog nginx:nginx-redis = { |
|
version = %{V_nginx_redis} |
|
url = https://github.com/openresty/redis2-nginx-module/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-echo = { |
|
version = %{V_nginx_echo} |
|
url = https://github.com/openresty/echo-nginx-module/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-davext = { |
|
version = %{V_nginx_davext} |
|
url = https://github.com/arut/nginx-dav-ext-module/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-digest = { |
|
version = %{V_nginx_digest} |
|
url = http://download.openpkg.org/components/versioned/nginx/ |
|
regex = nginx-http-auth-digest-(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-fancyindex = { |
|
version = %{V_nginx_fancyindex} |
|
url = https://github.com/aperezdc/ngx-fancyindex/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-geoip2 = { |
|
version = %{V_nginx_geoip2} |
|
url = https://github.com/leev/ngx_http_geoip2_module/releases |
|
regex = (__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-njs = { |
|
version = %{V_nginx_njs} |
|
url = http://hg.nginx.org/njs/ |
|
regex = rev/([\da-f]+) |
|
} |
|
prog nginx:nginx-brotli = { |
|
version = %{V_nginx_brotli} |
|
url = http://download.openpkg.org/components/versioned/nginx/ |
|
regex = ngx_brotli-(__VER__)\.tar\.xz |
|
} |
|
prog nginx:nginx-rtmp = { |
|
version = %{V_nginx_rtmp} |
|
url = https://github.com/arut/nginx-rtmp-module/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-ts = { |
|
version = %{V_nginx_ts} |
|
url = https://github.com/arut/nginx-ts-module/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
prog nginx:nginx-ldap = { |
|
version = %{V_nginx_ldap} |
|
url = http://download.openpkg.org/components/versioned/nginx/ |
|
regex = nginx-auth-ldap-(__VER__)\.tar\.xz |
|
} |
|
|
|
%prep |
|
%setup -q |
|
%patch -p0 |
|
%setup -q -T -D -a 1 |
|
mv headers-more-nginx-module-* nginx_headers_more_module |
|
%if "%{with_ajp}" == "yes" |
|
%setup -q -T -D -a 2 |
|
mv nginx_ajp_module-* nginx_ajp_module |
|
%endif |
|
%if "%{with_lua}" == "yes" |
|
%setup -q -T -D -a 3 |
|
%setup -q -T -D -a 16 |
|
mv lua-nginx-module-* nginx_lua_module |
|
mv lua-upstream-nginx-module-* nginx_lua_upstream_module |
|
%{l_shtool} subst \ |
|
-e 's;\(include \)<\(lua[^>]*\.h\)>;\1"\2";g' \ |
|
nginx_lua_module/src/ngx_http_lua_common.h |
|
%endif |
|
%if "%{with_redis}" == "yes" |
|
%setup -q -T -D -a 4 |
|
mv redis2-nginx-module-* nginx_redis_module |
|
%endif |
|
%if "%{with_echo}" == "yes" |
|
%setup -q -T -D -a 5 |
|
mv echo-nginx-module-* nginx_echo_module |
|
%endif |
|
%if "%{with_davext}" == "yes" |
|
%setup -q -T -D -a 6 |
|
mv nginx-dav-ext-module-* nginx_davext_module |
|
%endif |
|
%if "%{with_digest}" == "yes" |
|
%setup -q -T -D -a 7 |
|
mv nginx-http-auth-digest nginx_http_auth_digest_module |
|
%endif |
|
%if "%{with_fancyindex}" == "yes" |
|
%setup -q -T -D -a 8 |
|
mv ngx-fancyindex-* nginx_fancyindex_module |
|
%endif |
|
%if "%{with_geoip2}" == "yes" |
|
%setup -q -T -D -a 9 |
|
mv ngx_http_geoip2_module-* ngx_http_geoip2_module |
|
%endif |
|
%if "%{with_njs}" == "yes" |
|
%setup -q -T -D -a 10 |
|
mv njs-* ngx_njs_module |
|
%endif |
|
%if "%{with_brotli}" == "yes" |
|
%setup -q -T -D -a 11 |
|
mv ngx_brotli nginx_brotli_module |
|
%endif |
|
%if "%{with_rtmp}" == "yes" |
|
%setup -q -T -D -a 12 |
|
mv nginx-rtmp-module-* nginx_rtmp_module |
|
%endif |
|
%if "%{with_ts}" == "yes" |
|
%setup -q -T -D -a 13 |
|
mv nginx-ts-module-* nginx_ts_module |
|
%endif |
|
%if "%{with_ldap}" == "yes" |
|
%setup -q -T -D -a 14 |
|
mv nginx-auth-ldap nginx_auth_ldap_module |
|
%endif |
|
%if "%{with_lua}" == "yes" && "%{with_stream}" == "yes" |
|
%setup -q -T -D -a 15 |
|
mv stream-lua-nginx-module-* nginx_stream_lua_module |
|
%endif |
|
|
|
%build |
|
# configure program |
|
%{l_shtool} subst \ |
|
-e 's;/usr/local;%{l_prefix};g' \ |
|
auto/lib/*/conf |
|
CC="%{l_cc}" |
|
export CC |
|
CFLAGS="%{l_cflags -O} %{l_cppflags openssl .}" |
|
export CFLAGS |
|
LDFLAGS="%{l_ldflags}" |
|
export LDFLAGS |
|
LIBS="" |
|
export LIBS |
|
%if "%{with_davext}" == "yes" |
|
LIBS="$LIBS `pkg-config libxslt --libs`" |
|
%endif |
|
%if "%{with_njs}" == "yes" |
|
LIBS="$LIBS `pkg-config readline --libs`" |
|
%endif |
|
%if "%{with_lua}" == "yes" |
|
LUAJIT_INC=%{l_prefix}/include/luajit |
|
export LUAJIT_INC |
|
LUAJIT_LIB=%{l_prefix}/lib |
|
export LUAJIT_LIB |
|
%endif |
|
./configure \ |
|
--prefix=%{l_prefix} \ |
|
--conf-path=%{l_prefix}/etc/nginx/nginx.conf \ |
|
--error-log-path=%{l_prefix}/var/nginx/log/nginx.log \ |
|
--pid-path=%{l_prefix}/var/nginx/var/nginx.pid \ |
|
--lock-path=%{l_prefix}/var/nginx/var/nginx.lck \ |
|
--http-log-path=%{l_prefix}/var/nginx/log/nginx.access.log \ |
|
--http-client-body-temp-path=%{l_prefix}/var/nginx/tmp/cbody \ |
|
--http-proxy-temp-path=%{l_prefix}/var/nginx/tmp/proxy \ |
|
--http-fastcgi-temp-path=%{l_prefix}/var/nginx/tmp/fastcgi \ |
|
--http-uwsgi-temp-path=%{l_prefix}/var/nginx/tmp/uwsgi \ |
|
--http-scgi-temp-path=%{l_prefix}/var/nginx/tmp/scgi \ |
|
--with-cc="$CC" \ |
|
--with-cc-opt="$CFLAGS" \ |
|
--with-ld-opt="$LDFLAGS $LIBS" \ |
|
--user=%{l_nusr} \ |
|
--group=%{l_ngrp} \ |
|
--add-module=`pwd`/nginx_headers_more_module \ |
|
%if "%{with_ajp}" == "yes" |
|
--add-module=`pwd`/nginx_ajp_module \ |
|
%endif |
|
%if "%{with_perl}" == "yes" |
|
--with-http_perl_module \ |
|
--with-perl=%{l_prefix}/bin/perl \ |
|
%endif |
|
%if "%{with_lua}" == "yes" |
|
--add-module=`pwd`/nginx_lua_module \ |
|
--add-module=`pwd`/nginx_lua_upstream_module \ |
|
%endif |
|
%if "%{with_redis}" == "yes" |
|
--add-module=`pwd`/nginx_redis_module \ |
|
%endif |
|
%if "%{with_echo}" == "yes" |
|
--add-module=`pwd`/nginx_echo_module \ |
|
%endif |
|
%if "%{with_davext}" == "yes" |
|
--add-module=`pwd`/nginx_davext_module \ |
|
%endif |
|
%if "%{with_digest}" == "yes" |
|
--add-module=`pwd`/nginx_http_auth_digest_module \ |
|
%endif |
|
%if "%{with_fancyindex}" == "yes" |
|
--add-module=`pwd`/nginx_fancyindex_module \ |
|
%endif |
|
%if "%{with_geoip2}" == "yes" |
|
--add-module=`pwd`/ngx_http_geoip2_module \ |
|
%endif |
|
%if "%{with_njs}" == "yes" |
|
--add-module=`pwd`/ngx_njs_module/nginx \ |
|
%endif |
|
%if "%{with_brotli}" == "yes" |
|
--add-module=`pwd`/nginx_brotli_module \ |
|
%endif |
|
%if "%{with_rtmp}" == "yes" |
|
--add-module=`pwd`/nginx_rtmp_module \ |
|
%endif |
|
%if "%{with_ts}" == "yes" |
|
--add-module=`pwd`/nginx_ts_module \ |
|
%endif |
|
%if "%{with_ldap}" == "yes" |
|
--add-module=`pwd`/nginx_auth_ldap_module \ |
|
%endif |
|
%if "%{with_stream}" == "yes" |
|
--with-stream \ |
|
--with-stream_ssl_module \ |
|
--with-stream_realip_module \ |
|
--with-stream_geoip_module \ |
|
--with-stream_ssl_preread_module \ |
|
%if "%{with_lua}" == "yes" |
|
--add-module=`pwd`/nginx_stream_lua_module \ |
|
%endif |
|
%endif |
|
--with-http_realip_module \ |
|
--with-http_addition_module \ |
|
--with-http_auth_request_module \ |
|
--with-http_dav_module \ |
|
--with-http_degradation_module \ |
|
--with-http_flv_module \ |
|
--with-http_geoip_module \ |
|
--with-http_gunzip_module \ |
|
--with-http_gzip_static_module \ |
|
--with-http_random_index_module \ |
|
--with-http_realip_module \ |
|
--with-http_secure_link_module \ |
|
--with-http_ssl_module \ |
|
--with-http_v2_module \ |
|
--with-http_stub_status_module \ |
|
--with-http_slice_module \ |
|
--with-http_sub_module |
|
|
|
# build program |
|
%{l_make} %{l_mflags -O} |
|
|
|
%install |
|
# install program |
|
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
|
|
|
# strip down installation |
|
strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true |
|
|
|
# install default configuration |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/* |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/nginx \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/nginx/nginx.d |
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
%{SOURCE nginx.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/ |
|
%{l_shtool} install -c -m 644 \ |
|
conf/mime.types $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/ |
|
|
|
# install run-command script |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
|
%{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
%{SOURCE rc.nginx} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
|
|
# create run-time directories |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/cbody \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/proxy \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/fastcgi \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/uwsgi \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/scgi \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/nginx/log \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/nginx/run |
|
|
|
# determine installation files |
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
%{l_files_std} \ |
|
'%config %{l_prefix}/etc/nginx/*' \ |
|
'%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/nginx/*' \ |
|
'%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/nginx/*/*' |
|
|
|
%files -f files |
|
|
|
%clean |
|
|
|
|