# %define nginx_home %{_localstatedir}/cache/nginx %define nginx_user nginx %define nginx_group nginx %define nginx_loggroup adm %define debug_package %{nil} %if 0%{?rhel} == 7 BuildRequires: redhat-lsb-core %define _group System Environment/Daemons %define epoch 1 Epoch: %{epoch} Requires(pre): shadow-utils Requires: systemd Requires: gperftools-devel BuildRequires: gperftools-devel Requires: luajit BuildRequires: luajit-devel BuildRequires: systemd Requires: openssl BuildRequires: openssl-devel BuildRequires: devtoolset-4-gcc %define dist .el7_4 %endif # end of distribution specific definitions %define main_version 1.13.6 %define main_release 1%{?dist}.ngx %define module_sticky_shaid 08a395c66e42 %define lua_nginx_shaid 0.10.10 %define nginx_devel_shaid 0.3.0 %define bdir %{_builddir}/%{name}-%{main_version} %define WITH_CC_OPT $(echo %{optflags} $(pcre-config --cflags)) -fPIC -ggdb %define WITH_LD_OPT "-fPIC" %define BASE_CONFIGURE_ARGS $(echo "--prefix=%{_sysconfdir}/nginx --sbin-path=%{_sbindir}/nginx --modules-path=%{_libdir}/nginx/modules --conf-path=%{_sysconfdir}/nginx/nginx.conf --error-log-path=%{_localstatedir}/log/nginx/error.log --http-log-path=%{_localstatedir}/log/nginx/access.log --pid-path=%{_localstatedir}/run/nginx.pid --lock-path=%{_localstatedir}/run/nginx.lock --http-client-body-temp-path=%{_localstatedir}/cache/nginx/client_temp --http-proxy-temp-path=%{_localstatedir}/cache/nginx/proxy_temp --http-fastcgi-temp-path=%{_localstatedir}/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=%{_localstatedir}/cache/nginx/uwsgi_temp --http-scgi-temp-path=%{_localstatedir}/cache/nginx/scgi_temp --user=%{nginx_user} --group=%{nginx_group} --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --add-module=%{_builddir}/%{name}-%{version}/ngx_devel_kit-%{nginx_devel_shaid} --add-module=nginx-goodies-nginx-sticky-module-ng-%{module_sticky_shaid} --add-module=%{_builddir}/%{name}-%{version}/lua-nginx-module-%{lua_nginx_shaid} --with-google_perftools_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module") Summary: High performance web server Name: nginx Version: %{main_version} Release: %{main_release} Vendor: Nginx, Inc. URL: http://nginx.org/ Group: %{_group} Source0: http://nginx.org/download/%{name}-%{version}.tar.gz Source1: logrotate Source2: nginx.init.in Source3: nginx.sysconf Source4: nginx.conf Source5: nginx.vh.default.conf Source7: nginx-debug.sysconf Source8: nginx.service Source9: nginx.upgrade.sh Source11: nginx-debug.service Source12: COPYRIGHT Source13: nginx.check-reload.sh Source14: ngx_devel_kit-%{nginx_devel_shaid}.tar.gz Source15: nginx-goodies-nginx-sticky-module-ng-%{module_sticky_shaid}.zip Source16: lua-nginx-module-%{lua_nginx_shaid}.tar.gz License: 2-clause BSD-like license BuildRoot: %{_tmppath}/%{name}-%{main_version}-%{main_release}-root BuildRequires: zlib-devel BuildRequires: pcre-devel Provides: webserver %description nginx [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server. %prep %setup -q %{__tar} zxvf %{SOURCE14} %setup -T -D -a 14 unzip %SOURCE15 %{__tar} zxvf %{SOURCE16} %setup -T -D -a 16 cp %{SOURCE2} . sed -e 's|%%DEFAULTSTART%%|2 3 4 5|g' -e 's|%%DEFAULTSTOP%%|0 1 6|g' \ -e 's|%%PROVIDES%%|nginx|g' < %{SOURCE2} > nginx.init sed -e 's|%%DEFAULTSTART%%||g' -e 's|%%DEFAULTSTOP%%|0 1 2 3 4 5 6|g' \ -e 's|%%PROVIDES%%|nginx-debug|g' < %{SOURCE2} > nginx-debug.init %build export CC=/opt/rh/devtoolset-4/root/usr/bin/gcc ./configure %{BASE_CONFIGURE_ARGS} \ --with-cc-opt="%{WITH_CC_OPT}" \ --with-ld-opt="%{WITH_LD_OPT}" \ --with-debug make %{?_smp_mflags} %{__mv} %{bdir}/objs/nginx \ %{bdir}/objs/nginx-debug ./configure %{BASE_CONFIGURE_ARGS} \ --with-cc-opt="%{WITH_CC_OPT}" \ --with-ld-opt="%{WITH_LD_OPT}" make %{?_smp_mflags} %install %{__rm} -rf $RPM_BUILD_ROOT %{__make} DESTDIR=$RPM_BUILD_ROOT INSTALLDIRS=vendor install %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/nginx %{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/html $RPM_BUILD_ROOT%{_datadir}/nginx/ %{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/nginx/*.default %{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/nginx/fastcgi.conf %{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/log/nginx %{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/run/nginx %{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/cache/nginx %{__mkdir} -p $RPM_BUILD_ROOT%{_libdir}/nginx/modules cd $RPM_BUILD_ROOT%{_sysconfdir}/nginx && \ %{__ln_s} ../..%{_libdir}/nginx/modules modules && cd - %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{main_version} %{__install} -m 644 -p %{SOURCE12} \ $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{main_version}/ %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/nginx.conf %{__install} -m 644 -p %{SOURCE4} \ $RPM_BUILD_ROOT%{_sysconfdir}/nginx/nginx.conf %{__install} -m 644 -p %{SOURCE5} \ $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/default.conf %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig %{__install} -m 644 -p %{SOURCE3} \ $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx %{__install} -m 644 -p %{SOURCE7} \ $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx-debug %{__install} -p -D -m 0644 %{bdir}/objs/nginx.8 \ $RPM_BUILD_ROOT%{_mandir}/man8/nginx.8 %{__mkdir} -p $RPM_BUILD_ROOT%{_unitdir} %{__install} -m644 %SOURCE8 \ $RPM_BUILD_ROOT%{_unitdir}/nginx.service %{__install} -m644 %SOURCE11 \ $RPM_BUILD_ROOT%{_unitdir}/nginx-debug.service %{__mkdir} -p $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx %{__install} -m755 %SOURCE9 \ $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx/upgrade %{__install} -m755 %SOURCE13 \ $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx/check-reload # install log rotation stuff %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d %{__install} -m 644 -p %{SOURCE1} \ $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/nginx %{__install} -m755 %{bdir}/objs/nginx-debug \ $RPM_BUILD_ROOT%{_sbindir}/nginx-debug %clean %{__rm} -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{_sbindir}/nginx %{_sbindir}/nginx-debug %dir %{_sysconfdir}/nginx %dir %{_sysconfdir}/nginx/conf.d %{_sysconfdir}/nginx/modules %config(noreplace) %{_sysconfdir}/nginx/nginx.conf %config(noreplace) %{_sysconfdir}/nginx/conf.d/default.conf %config(noreplace) %{_sysconfdir}/nginx/mime.types %config(noreplace) %{_sysconfdir}/nginx/fastcgi_params %config(noreplace) %{_sysconfdir}/nginx/scgi_params %config(noreplace) %{_sysconfdir}/nginx/uwsgi_params %config(noreplace) %{_sysconfdir}/nginx/koi-utf %config(noreplace) %{_sysconfdir}/nginx/koi-win %config(noreplace) %{_sysconfdir}/nginx/win-utf %config(noreplace) %{_sysconfdir}/logrotate.d/nginx %config(noreplace) %{_sysconfdir}/sysconfig/nginx %config(noreplace) %{_sysconfdir}/sysconfig/nginx-debug %{_unitdir}/nginx.service %{_unitdir}/nginx-debug.service %dir %{_libexecdir}/initscripts/legacy-actions/nginx %{_libexecdir}/initscripts/legacy-actions/nginx/* %attr(0755,root,root) %dir %{_libdir}/nginx %attr(0755,root,root) %dir %{_libdir}/nginx/modules %dir %{_datadir}/nginx %dir %{_datadir}/nginx/html %{_datadir}/nginx/html/* %attr(0755,root,root) %dir %{_localstatedir}/cache/nginx %attr(0755,root,root) %dir %{_localstatedir}/log/nginx %dir %{_datadir}/doc/%{name}-%{main_version} %doc %{_datadir}/doc/%{name}-%{main_version}/COPYRIGHT %{_mandir}/man8/nginx.8* %pre # Add the "nginx" user getent group %{nginx_group} >/dev/null || groupadd -r %{nginx_group} getent passwd %{nginx_user} >/dev/null || \ useradd -r -g %{nginx_group} -s /sbin/nologin \ -d %{nginx_home} -c "nginx user" %{nginx_user} exit 0 %post # Register the nginx service if [ $1 -eq 1 ]; then /usr/bin/systemctl preset nginx.service >/dev/null 2>&1 ||: /usr/bin/systemctl preset nginx-debug.service >/dev/null 2>&1 ||: # print site info cat </dev/null 2>&1 ||: /usr/bin/systemctl stop nginx.service >/dev/null 2>&1 ||: fi %postun /usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||: if [ $1 -ge 1 ]; then /sbin/service nginx status >/dev/null 2>&1 || exit 0 /sbin/service nginx upgrade >/dev/null 2>&1 || echo \ "Binary upgrade failed, please check nginx's error.log" fi %changelog * Tue Oct 10 2017 Konstantin Pavlov - 1.13.6