angie/nginx.spec

185 lines
5.8 KiB
RPMSpec
Raw Normal View History

2020-04-17 12:58:53 +00:00
%global _disable_ld_no_undefined 1
2012-02-01 14:31:26 +04:00
%define nginx_user nginx
%define nginx_group %{nginx_user}
%define nginx_home /var/lib/nginx
%define nginx_home_tmp %{nginx_home}/tmp
%define nginx_logdir /var/log/nginx
%define nginx_confdir %{_sysconfdir}/nginx
%define nginx_datadir %{_datadir}/nginx
%define nginx_webroot %{nginx_datadir}/html
2020-04-17 12:58:53 +00:00
%global optflags %{optflags} -Ofast
%global ldflags %{ldflags} -Wl,-E
2017-12-14 16:35:35 +03:00
%define rtmp_version 1.2.1
2015-04-23 01:33:37 +10:00
2012-04-27 05:02:27 +04:00
Summary: Robust, small and high performance HTTP and reverse proxy server
2012-02-01 14:31:26 +04:00
Name: nginx
2020-10-31 08:37:14 +00:00
Version: 1.19.4
2019-08-14 11:18:28 +03:00
Release: 1
2012-02-01 14:31:26 +04:00
# BSD License (two clause)
# http://www.freebsd.org/copyright/freebsd-license.html
License: BSD
2015-01-12 22:11:56 +10:00
Group: System/Servers
2015-01-12 22:07:00 +10:00
Url: http://nginx.net/
2012-02-01 14:31:26 +04:00
Source0: http://nginx.org/download/nginx-%{version}.tar.gz
2012-03-31 04:54:18 +04:00
Source2: nginx.service
Source3: nginx.logrotate
2012-02-01 14:31:26 +04:00
Source4: virtual.conf
Source5: ssl.conf
2016-08-06 19:42:56 +03:00
Source10: https://github.com/arut/nginx-rtmp-module/archive/v%{rtmp_version}.tar.gz?/nginx-rtmp-module-%{rtmp_version}.tar.gz
2012-02-01 14:31:26 +04:00
Source100: index.html
Source102: nginx-logo.png
Source103: 50x.html
Source104: 404.html
2015-01-12 22:11:56 +10:00
BuildRequires: systemd-units
2012-03-31 04:54:18 +04:00
BuildRequires: gd-devel
2012-02-01 14:31:26 +04:00
BuildRequires: perl-devel
BuildRequires: perl(ExtUtils::Embed)
2015-01-12 22:07:00 +10:00
BuildRequires: pkgconfig(geoip)
BuildRequires: pkgconfig(libpcre)
BuildRequires: pkgconfig(libxslt)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)
Requires(pre,postun): rpm-helper
2012-02-01 14:31:26 +04:00
Requires: pcre
2012-03-31 04:54:18 +04:00
Requires: geoip
2012-02-01 14:31:26 +04:00
Requires: openssl
Provides: webserver
%description
Nginx [engine x] is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3
proxy server written by Igor Sysoev.
2015-01-12 22:11:56 +10:00
%files
%doc LICENSE CHANGES README
%{nginx_datadir}/
%{_sbindir}/%{name}
%{_mandir}/man3/%{name}.3pm*
%{_mandir}/man8/*
%{_unitdir}/nginx.service
%dir %{nginx_confdir}
%dir %{nginx_confdir}/conf.d
%config(noreplace) %{nginx_confdir}/conf.d/*.conf
%config(noreplace) %{nginx_confdir}/win-utf
%config(noreplace) %{nginx_confdir}/%{name}.conf.default
%config(noreplace) %{nginx_confdir}/scgi_params
%config(noreplace) %{nginx_confdir}/scgi_params.default
%config(noreplace) %{nginx_confdir}/fastcgi.conf
%config(noreplace) %{nginx_confdir}/fastcgi.conf.default
%config(noreplace) %{nginx_confdir}/mime.types.default
%config(noreplace) %{nginx_confdir}/fastcgi_params
%config(noreplace) %{nginx_confdir}/fastcgi_params.default
%config(noreplace) %{nginx_confdir}/koi-win
%config(noreplace) %{nginx_confdir}/koi-utf
%config(noreplace) %{nginx_confdir}/%{name}.conf
%config(noreplace) %{nginx_confdir}/mime.types
%config(noreplace) %{nginx_confdir}/uwsgi_params
%config(noreplace) %{nginx_confdir}/uwsgi_params.default
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %{perl_vendorarch}/auto/%{name}
%{perl_vendorarch}/%{name}.pm
%{perl_vendorarch}/auto/%{name}/%{name}.so
%attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home}
%attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home_tmp}
%attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_logdir}
%pre
%_pre_useradd %{nginx_user} %{nginx_home} /bin/false
%post
%_post_service %{name}
%preun
%_preun_service %{name}
%postun
%_postun_userdel %{nginx_user}
#----------------------------------------------------------------------------
2012-02-01 14:31:26 +04:00
%prep
%setup -q
2015-04-23 01:33:37 +10:00
tar -xf %{SOURCE10}
2012-02-01 14:31:26 +04:00
%build
2019-12-18 15:09:57 +03:00
%global optflags %{optflags} -fno-strict-aliasing
2020-01-13 16:14:53 +03:00
%setup_compile_flags
2012-02-01 14:31:26 +04:00
./configure \
2015-01-12 22:07:00 +10:00
--user=%{nginx_user} \
--group=%{nginx_group} \
--prefix=%{nginx_datadir} \
--sbin-path=%{_sbindir}/%{name} \
--conf-path=%{nginx_confdir}/%{name}.conf \
--error-log-path=%{nginx_logdir}/error.log \
--http-log-path=%{nginx_logdir}/access.log \
--http-client-body-temp-path=%{nginx_home_tmp}/client_body \
--http-proxy-temp-path=%{nginx_home_tmp}/proxy \
--http-fastcgi-temp-path=%{nginx_home_tmp}/fastcgi \
2015-01-14 02:56:56 +10:00
--pid-path=/var/run/%{name}.pid \
2015-01-12 22:07:00 +10:00
--lock-path=/var/lock/subsys/%{name} \
2015-04-23 01:33:37 +10:00
--add-module=nginx-rtmp-module-%{rtmp_version} \
2015-01-12 22:07:00 +10:00
--with-file-aio \
--with-ipv6 \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_geoip_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-http_perl_module \
--with-mail \
--with-mail_ssl_module \
--with-pcre \
2019-12-18 15:09:57 +03:00
--with-stream \
2015-01-12 22:11:56 +10:00
--with-ld-opt="$RPM_LD_FLAGS -Wl,-E" # so the perl module finds its symbols
2015-01-12 22:07:00 +10:00
# this is only passed to perl module being built and only overrides the
# default '-O' flag which anyways lowers optimizations (which we don't
# want)
2020-04-17 12:58:53 +00:00
%make_build OPTIMIZE="-fno-PIE"
2012-02-01 14:31:26 +04:00
%install
2020-04-17 12:58:53 +00:00
%make_install INSTALLDIRS=vendor
2012-02-01 14:31:26 +04:00
find %{buildroot} -type f -name .packlist -exec rm -f {} \;
find %{buildroot} -type f -name perllocal.pod -exec rm -f {} \;
find %{buildroot} -type f -empty -exec rm -f {} \;
find %{buildroot} -type f -exec chmod 0644 {} \;
find %{buildroot} -type f -name '*.so' -exec chmod 0755 {} \;
chmod 0755 %{buildroot}%{_sbindir}/nginx
2019-12-18 15:09:57 +03:00
install -p -D -m 0755 %{SOURCE2} %{buildroot}%{_unitdir}/nginx.service
2015-01-12 22:07:00 +10:00
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -p -d -m 0755 %{buildroot}%{nginx_confdir}/conf.d
install -p -m 0644 %{SOURCE4} %{SOURCE5} %{buildroot}%{nginx_confdir}/conf.d
install -p -d -m 0755 %{buildroot}%{nginx_home_tmp}
install -p -d -m 0755 %{buildroot}%{nginx_logdir}
install -p -d -m 0755 %{buildroot}%{nginx_webroot}
2012-02-01 14:31:26 +04:00
2015-01-14 02:59:51 +10:00
install -p -m 0644 %{SOURCE100} %{SOURCE102} %{SOURCE103} %{SOURCE104} %{buildroot}%{nginx_webroot}
2012-02-01 14:31:26 +04:00
# add current version
perl -pi -e "s|_VERSION_|%{version}|g" %{buildroot}%{nginx_webroot}/index.html
# convert to UTF-8 all files that give warnings.
for textfile in CHANGES; do
2017-04-09 13:35:29 +03:00
mv $textfile $textfile.old
iconv --from-code ISO8859-1 --to-code UTF-8 --output $textfile $textfile.old
rm -f $textfile.old
2012-02-01 14:31:26 +04:00
done
install -d %{buildroot}%{_mandir}/man8
install -m0644 man/*.8 %{buildroot}%{_mandir}/man8/