Created
February 17, 2014 07:47
-
-
Save itxx00/9046443 to your computer and use it in GitHub Desktop.
tengine.spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
%define tengine_home %{_localstatedir}/cache/tengine | |
%define tengine_user tengine | |
%define tengine_group tengine | |
Summary: Web server originated by Taobao | |
Name: tengine | |
Version: 2.0.0 | |
Release: 0%{?dist} | |
Vendor: taobao inc. | |
URL: http://tengine.taobao.org/ | |
Source0: http://tengine.taobao.org/download/%{name}-%{version}.tar.gz | |
Source1: tengine.logrotate | |
Source2: tengine.init | |
Source3: tengine.sysconf | |
Source4: tengine.conf | |
Source5: default.conf | |
License: 2-clause BSD-like license | |
Group: System Environment/Daemons | |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | |
BuildRequires: zlib-devel | |
BuildRequires: pcre-devel | |
BuildRequires: perl | |
BuildRequires: openssl-devel | |
BuildRequires: jemalloc-devel | |
Requires: initscripts >= 8.36 | |
Requires: jemalloc | |
Requires(pre): shadow-utils | |
Requires(post): chkconfig | |
Provides: webserver | |
%description | |
Tengine is a web server and a reverse proxy server for HTTP, SMTP, POP3 and | |
IMAP protocols, with a strong focus on high concurrency, performance and low | |
memory usage. | |
%package devel | |
Summary: Development interfaces for the tengine server | |
Group: Development/Libraries | |
Requires: tengine = %{version}-%{release} | |
%description devel | |
This package contains files that you need to build Dynamic Shared Objects | |
(DSOs) for the tengine Server. | |
%prep | |
%setup -q | |
%build | |
./configure \ | |
--prefix=%{_sysconfdir}/tengine \ | |
--sbin-path=%{_sbindir}/tengine \ | |
--dso-tool-path=%{_sbindir}/dso_tool \ | |
--includedir=%{_includedir}/tengine \ | |
--conf-path=%{_sysconfdir}/tengine/tengine.conf \ | |
--error-log-path=%{_localstatedir}/log/tengine/error.log \ | |
--http-log-path=%{_localstatedir}/log/tengine/access.log \ | |
--pid-path=%{_localstatedir}/run/tengine.pid \ | |
--lock-path=%{_localstatedir}/run/tengine.lock \ | |
--http-client-body-temp-path=%{_localstatedir}/cache/tengine/client_temp \ | |
--http-proxy-temp-path=%{_localstatedir}/cache/tengine/proxy_temp \ | |
--http-fastcgi-temp-path=%{_localstatedir}/cache/tengine/fastcgi_temp \ | |
--http-uwsgi-temp-path=%{_localstatedir}/cache/tengine/uwsgi_temp \ | |
--http-scgi-temp-path=%{_localstatedir}/cache/tengine/scgi_temp \ | |
--user=%{tengine_user} \ | |
--group=%{tengine_group} \ | |
--with-http_spdy_module \ | |
--with-http_ssl_module \ | |
--with-http_realip_module \ | |
--with-http_addition_module \ | |
--with-http_sub_module \ | |
--with-http_gunzip_module \ | |
--with-http_gzip_static_module \ | |
--with-http_stub_status_module \ | |
--with-http_sysguard_module \ | |
--with-file-aio \ | |
--with-jemalloc \ | |
--with-cc-opt="%{optflags} $(pcre-config --cflags)" | |
make %{?_smp_mflags} | |
%install | |
%{__rm} -rf $RPM_BUILD_ROOT | |
%{__make} DESTDIR=$RPM_BUILD_ROOT install | |
%{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/tengine | |
%{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/tengine/html $RPM_BUILD_ROOT%{_datadir}/tengine/ | |
%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/tengine/*.default | |
%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/tengine/fastcgi.conf | |
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/log/tengine | |
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/run/tengine | |
%{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/cache/tengine | |
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/tengine/conf.d | |
%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/tengine/tengine.conf | |
%{__install} -m 644 -p %{SOURCE4} \ | |
$RPM_BUILD_ROOT%{_sysconfdir}/tengine/tengine.conf | |
%{__install} -m 644 -p %{SOURCE5} \ | |
$RPM_BUILD_ROOT%{_sysconfdir}/tengine/conf.d/default.conf | |
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig | |
%{__install} -m 644 -p %{SOURCE3} \ | |
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/tengine | |
# install SYSV init stuff | |
%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir} | |
%{__install} -m755 %{SOURCE2} \ | |
$RPM_BUILD_ROOT%{_initrddir}/tengine | |
# install log rotation stuff | |
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d | |
%{__install} -m 644 -p %{SOURCE1} \ | |
$RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/tengine | |
%clean | |
%{__rm} -rf $RPM_BUILD_ROOT | |
%files | |
%defattr(-,root,root) | |
%{_sbindir}/tengine | |
%dir %{_sysconfdir}/tengine | |
%dir %{_sysconfdir}/tengine/conf.d | |
%config(noreplace) %{_sysconfdir}/tengine/browsers | |
%config(noreplace) %{_sysconfdir}/tengine/module_stubs | |
%config(noreplace) %{_sysconfdir}/tengine/tengine.conf | |
%config(noreplace) %{_sysconfdir}/tengine/conf.d/default.conf | |
%config(noreplace) %{_sysconfdir}/tengine/mime.types | |
%config(noreplace) %{_sysconfdir}/tengine/fastcgi_params | |
%config(noreplace) %{_sysconfdir}/tengine/scgi_params | |
%config(noreplace) %{_sysconfdir}/tengine/uwsgi_params | |
%config(noreplace) %{_sysconfdir}/tengine/koi-utf | |
%config(noreplace) %{_sysconfdir}/tengine/koi-win | |
%config(noreplace) %{_sysconfdir}/tengine/win-utf | |
%config(noreplace) %{_sysconfdir}/logrotate.d/tengine | |
%config(noreplace) %{_sysconfdir}/sysconfig/tengine | |
%{_initrddir}/tengine | |
%dir %{_datadir}/tengine | |
%dir %{_datadir}/tengine/html | |
%{_datadir}/tengine/html/* | |
%attr(0755,root,root) %dir %{_localstatedir}/cache/tengine | |
%attr(0755,root,root) %dir %{_localstatedir}/log/tengine | |
%files devel | |
%defattr(-,root,root) | |
%{_sbindir}/dso_tool | |
%{_includedir}/tengine | |
%pre | |
# Add the "tengine" user | |
getent group %{tengine_group} >/dev/null || groupadd -r %{tengine_group} | |
getent passwd %{tengine_user} >/dev/null || \ | |
useradd -r -g %{tengine_group} -s /sbin/nologin \ | |
-d %{tengine_home} -c "tengine user" %{tengine_user} | |
exit 0 | |
%post | |
# Register the tengine service | |
if [ $1 -eq 1 ]; then | |
/sbin/chkconfig --add tengine | |
# print site info | |
cat <<BANNER | |
---------------------------------------------------------------------- | |
Thanks for using tengine! | |
Please find the official documentation for tengine here: | |
* http://tengine.taobao.org/documentation.html | |
---------------------------------------------------------------------- | |
BANNER | |
# Touch and set permisions on default log files on installation | |
if [ -d %{_localstatedir}/log/tengine ]; then | |
if [ ! -e %{_localstatedir}/log/tengine/access.log ]; then | |
touch %{_localstatedir}/log/tengine/access.log | |
%{__chmod} 640 %{_localstatedir}/log/tengine/access.log | |
%{__chown} tengine:adm %{_localstatedir}/log/tengine/access.log | |
fi | |
if [ ! -e %{_localstatedir}/log/tengine/error.log ]; then | |
touch %{_localstatedir}/log/tengine/error.log | |
%{__chmod} 640 %{_localstatedir}/log/tengine/error.log | |
%{__chown} tengine:adm %{_localstatedir}/log/tengine/error.log | |
fi | |
fi | |
fi | |
%preun | |
if [ $1 -eq 0 ]; then | |
/sbin/service tengine stop > /dev/null 2>&1 | |
/sbin/chkconfig --del tengine | |
fi | |
%postun | |
if [ $1 -ge 1 ]; then | |
/sbin/service tengine upgrade &>/dev/null || : | |
fi | |
%changelog | |
* Mon Feb 17 2014 itxx00 <[email protected]> - 2.0.0-0 | |
- Initial release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment