angie/nginx.spec

182 lines
6 KiB
RPMSpec
Raw Normal View History

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
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
2012-10-26 21:09:54 +04:00
Version: 1.2.4
2013-06-18 18:20:58 +04:00
Release: 2
2012-02-01 14:31:26 +04:00
Group: System/Servers
# BSD License (two clause)
# http://www.freebsd.org/copyright/freebsd-license.html
License: BSD
URL: http://nginx.net/
Source0: http://nginx.org/download/nginx-%{version}.tar.gz
Source1: http://nginx.org/download/nginx-%{version}.tar.gz.asc
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
Source100: index.html
Source101: poweredby.png
Source102: nginx-logo.png
Source103: 50x.html
Source104: 404.html
Requires(pre): rpm-helper
Requires(postun): rpm-helper
2012-03-31 04:54:18 +04:00
BuildRequires: gd-devel
2013-06-18 18:20:58 +04:00
BuildRequires: pkgconfig(geoip)
2012-03-31 04:54:18 +04:00
BuildRequires: libxslt-devel
2012-02-01 14:31:26 +04:00
BuildRequires: openssl-devel
2012-03-31 04:54:18 +04:00
BuildRequires: pcre-devel
2012-02-01 14:31:26 +04:00
BuildRequires: perl-devel
BuildRequires: perl(ExtUtils::Embed)
2012-03-31 04:54:18 +04:00
BuildRequires: zlib-devel
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.
%prep
%setup -q
%build
%serverbuild
./configure \
--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 \
--pid-path=/var/run/%{name}/%{name}.pid \
--lock-path=/var/lock/subsys/%{name} \
2012-03-31 04:54:18 +04:00
--with-file-aio \
--with-ipv6 \
2012-02-01 14:31:26 +04:00
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
2012-03-31 04:54:18 +04:00
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_geoip_module \
2012-02-01 14:31:26 +04:00
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
2012-03-31 04:54:18 +04:00
--with-http_mp4_module \
2012-02-01 14:31:26 +04:00
--with-http_gzip_static_module \
2012-03-31 04:54:18 +04:00
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
2012-02-01 14:31:26 +04:00
--with-http_stub_status_module \
--with-http_perl_module \
--with-mail \
--with-mail_ssl_module \
--with-cc-opt="$CFLAGS $(pcre-config --cflags)"
2012-02-01 17:53:43 +04: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)
%make OPTIMIZE="-fno-PIE"
2012-02-01 14:31:26 +04:00
%install
%makeinstall_std INSTALLDIRS=vendor
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
2012-03-31 04:54:18 +04:00
%{__install} -p -D -m 0755 %{SOURCE2} %{buildroot}/lib/systemd/system/nginx.service
2012-02-01 14:31:26 +04: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}
%{__install} -p -m 0644 %{SOURCE100} %{SOURCE101} %{SOURCE102} %{SOURCE103} %{SOURCE104} %{buildroot}%{nginx_webroot}
# 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
mv $textfile $textfile.old
iconv --from-code ISO8859-1 --to-code UTF-8 --output $textfile $textfile.old
rm -f $textfile.old
done
install -d %{buildroot}%{_mandir}/man8
install -m0644 man/*.8 %{buildroot}%{_mandir}/man8/
%pre
%_pre_useradd %{nginx_user} %{nginx_home} /bin/false
%post
2012-03-31 04:54:18 +04:00
if [ $1 -eq 1 ]; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
2012-02-01 14:31:26 +04:00
fi
%preun
2012-03-31 04:54:18 +04:00
if [ $1 -eq 0 ]; then
/bin/systemctl --no-reload disable nginx.service >/dev/null 2>&1 || :
/bin/systemctl stop nginx.service >/dev/null 2>&1 || :
fi
2012-02-01 14:31:26 +04:00
%postun
2012-03-31 04:54:18 +04:00
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -gt 1 ]; then
/bin/systemctl try-restart nginx.service >/dev/null 2>&1 || :
fi
2012-02-01 14:31:26 +04:00
%_postun_userdel %{nginx_user}
%files
%defattr(-,root,root,-)
%doc LICENSE CHANGES README
%{nginx_datadir}/
%{_sbindir}/%{name}
%{_mandir}/man3/%{name}.3pm*
%{_mandir}/man8/*
2012-03-31 04:54:18 +04:00
/lib/systemd/system/nginx.service
2012-02-01 14:31:26 +04:00
%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}
%attr(-,%{nginx_user},%{nginx_group}) %dir /var/run/%{name}