%define tengine_home %{_localstatedir}/cache/tengine %define tengine_user tengine %define tengine_group tengine %define tengine_loggroup adm Name: tengine Version: 2.2.2 Release: 5%{?dist} Summary: Tengine is a web server originated by Taobao, based on the Nginx HTTP server and has many advanced features. License: 2-clause BSD-like license URL: http://tengine.taobao.org #Source0: http://tengine.taobao.org/download/%{name}-%{version}.tar.gz Source0: tengine-master.zip Source1: logrotate Source2: %{name}.service Source3: %{name}.conf Source4: %{name}.vh.default.conf Patch1: 0001-unix-ngx_user-Apply-fix-for-really-old-bug-in-glibc-.patch %if 0%{?fedora} >= 26 BuildRequires: compat-openssl10-devel %else BuildRequires: openssl-devel %endif BuildRequires: pcre-devel BuildRequires: zlib-devel BuildRequires: luajit-devel BuildRequires: redhat-lsb-core unzip systemd libxslt-devel gd-devel lua-devel GeoIP-devel Requires: openssl systemd libxslt gd lua GeoIP %description Tengine is a web server originated by Taobao, the largest e-commerce website in Asia. It is based on the Nginx HTTP server and has many advanced features. Tengine has proven to be very stable and efficient on some of the top 100 websites in the world, including taobao.com and tmall.com. %package devel Summary: Development files for %{name} Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel Header and Library files for doing development with the %{name} %prep %setup -q -n tengine-master %patch1 -p1 %build #./configure --help ./configure --prefix=%{_datadir}/%{name} \ --includedir=%{_includedir}/%{name} \ --sbin-path=%{_sbindir}/%{name} \ --dso-tool-path=%{_sbindir}/%{name}_dso_tool \ --dso-path=%{_libdir}/%{name}/modules \ --conf-path=%{_sysconfdir}/%{name}/%{name}.conf \ --error-log-path=%{_localstatedir}/log/%{name}/error.log \ --http-log-path=%{_localstatedir}/log/%{name}/access.log \ --pid-path=%{_localstatedir}/run/%{name}.pid \ --lock-path=%{_localstatedir}/run/%{name}.lock \ --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_temp \ --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \ --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \ --http-uwsgi-temp-path=%{_localstatedir}/cache/%{name}/uwsgi_temp \ --http-scgi-temp-path=%{_localstatedir}/cache/%{name}/scgi_temp \ --user=%{tengine_user} --group=%{tengine_group} \ --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 \ --enable-mods-shared=all make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT %make_install #mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name} #mv $RPM_BUILD_ROOT/usr/html $RPM_BUILD_ROOT/%{_datadir}/%{name} #INSTALL LOGROTATE CONF FILE mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d %{__install} -m 644 -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name} #INSTALL SERVICE FILE mkdir -p $RPM_BUILD_ROOT%{_unitdir} %{__install} -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service #RENAME sbin files to avoid confilicts with original nginx executables. #mv $RPM_BUILD_ROOT/usr/sbin/nginx $RPM_BUILD_ROOT/usr/sbin/%{name} #mv $RPM_BUILD_ROOT/usr/sbin/dso_tool $RPM_BUILD_ROOT/usr/sbin/%{name}_dso_tool %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/conf.d #%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/nginx.conf %{__install} -m 644 -p %{SOURCE3} \ $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name}.conf %{__install} -m 644 -p %{SOURCE4} \ $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/conf.d/default.conf %{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name} %{__mkdir} -p $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name} %files %doc README CHANGES CHANGES.* LICENSE contrib docs %{_sysconfdir}/%{name} %{_sysconfdir}/logrotate.d/%{name} %{_unitdir}/%{name}.service %{_sbindir}/* %{_datadir}/%{name} %{_libdir}/%{name} %{_localstatedir}/log/%{name} %{_localstatedir}/cache/%{name} %files devel %defattr(-,root,root,-) %{_includedir}/* %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 /usr/bin/systemctl preset %{name}.service >/dev/null 2>&1 ||: # 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_user}:%{tengine_loggroup} %{_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_user}:%{tengine_loggroup} %{_localstatedir}/log/tengine/error.log fi fi fi %preun if [ $1 -eq 0 ]; then /usr/bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 ||: /usr/bin/systemctl stop %{name}.service >/dev/null 2>&1 ||: fi %postun /usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||: %changelog