设为首页 收藏本站
查看: 853|回复: 0

[经验分享] 【编译打包】nginx 1.4.0 SRPM

[复制链接]

尚未签到

发表于 2018-11-14 11:28:21 | 显示全部楼层 |阅读模式
#  
%define nginx_home %{_localstatedir}/cache/nginx
  
%define nginx_user nginx
  
%define nginx_group nginx
  
Summary: nginx is a high performance web server
  
Name: nginx
  
Version: 1.4.4
  
Release: 2%{?dist}.pagespeed
  
Vendor: nginx inc.
  
URL: http://nginx.org/
  
Source0: http://nginx.org/download/%{name}-%{version}.tar.gz
  
Source1: logrotate
  
Source2: nginx.init
  
Source3: nginx.sysconf
  
Source4: nginx.conf
  
Source5: nginx.vh.default.conf
  
Source6: nginx.vh.example_ssl.conf
  
Source7: nginx.suse.init
  
Source8: fastcgi_params
  
Source50: ngx_pagespeed-1.7.30.1-beta.tar.gz
  
Source51: pagespeed.conf
  
License: 2-clause BSD-like license
  
%if 0%{?suse_version}
  
Group: Productivity/Networking/Web/Servers
  
%else
  
Group: System Environment/Daemons
  
%endif
  
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
  
BuildRequires: zlib-devel
  
BuildRequires: pcre-devel
  
BuildRequires: perl
  
BuildRequires: gperftools-devel
  
BuildRequires: gcc-c++
  
%if 0%{?suse_version}
  
BuildRequires: libopenssl-devel
  
Requires(pre): pwdutils
  
%else
  
BuildRequires: openssl-devel
  
Requires: initscripts >= 8.36
  
Requires(pre): shadow-utils
  
Requires(post): chkconfig
  
%endif
  
Provides: webserver
  
%description
  
nginx [engine x] is an HTTP and reverse proxy server, as well as
  
a mail proxy server
  
%package debug
  
Summary: debug version of nginx
  
Group: System Environment/Daemons
  
Requires: nginx
  
%description debug
  
not stripped version of nginx build with the debugging log support
  
%prep
  
%setup -q
  
%{__tar} zxvf %{SOURCE50}
  
%build
  
./configure \
  --prefix=%{_sysconfdir}/nginx \
  --sbin-path=%{_sbindir}/nginx \
  --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-http_ssl_module \
  --with-http_realip_module \
  --with-http_gzip_static_module \
  --with-http_stub_status_module \
  --with-google_perftools_module \
  --add-module=ngx_pagespeed-1.7.30.1-beta  \
  --with-file-aio \
  --with-debug \
  --with-cc-opt="%{optflags} $(pcre-config --cflags)" \
  $*
  
make %{?_smp_mflags}
  
%{__mv} %{_builddir}/%{name}-%{version}/objs/nginx \
  %{_builddir}/%{name}-%{version}/objs/nginx.debug
  
./configure \
  --prefix=%{_sysconfdir}/nginx \
  --sbin-path=%{_sbindir}/nginx \
  --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-http_ssl_module \
  --with-http_realip_module \
  --with-http_gzip_static_module \
  --with-http_stub_status_module \
  --with-file-aio \
  --with-google_perftools_module \
  --add-module=ngx_pagespeed-1.7.30.1-beta  \
  --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}/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%{_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
  
%{__install} -m 644 -p %{SOURCE6} \
  $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/example_ssl.conf
  
%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
  
%{__install} -m 644 -p %{SOURCE3} \
  $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx
  
%{__install} -m 644 -p %{SOURCE8} \
  $RPM_BUILD_ROOT%{_sysconfdir}/nginx/fastcgi_params
  
%{__install} -m 644 -p %{SOURCE51} \
  $RPM_BUILD_ROOT%{_sysconfdir}/nginx/pagespeed.conf
  
# install SYSV init stuff
  
%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir}
  
%if 0%{?suse_version}
  
%{__install} -m755 %{SOURCE7} \
  $RPM_BUILD_ROOT%{_initrddir}/nginx
  
%else
  
%{__install} -m755 %{SOURCE2} \
  $RPM_BUILD_ROOT%{_initrddir}/nginx
  
%endif
  
# 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} -m644 %{_builddir}/%{name}-%{version}/objs/nginx.debug \
  $RPM_BUILD_ROOT%{_sbindir}/nginx.debug
  
%clean
  
%{__rm} -rf $RPM_BUILD_ROOT
  
%files
  
%defattr(-,root,root)
  
%{_sbindir}/nginx
  
%dir %{_sysconfdir}/nginx
  
%dir %{_sysconfdir}/nginx/conf.d
  
%config(noreplace) %{_sysconfdir}/nginx/nginx.conf
  
%config(noreplace) %{_sysconfdir}/nginx/conf.d/default.conf
  
%config(noreplace) %{_sysconfdir}/nginx/conf.d/example_ssl.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}/nginx/pagespeed.conf
  
%config(noreplace) %{_sysconfdir}/logrotate.d/nginx
  
%config(noreplace) %{_sysconfdir}/sysconfig/nginx
  
%{_initrddir}/nginx
  
%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
  
%files debug
  
%attr(0755,root,root) %{_sbindir}/nginx.debug
  
%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
  /sbin/chkconfig --add nginx
  # print site info
  cat &1
  /sbin/chkconfig --del nginx
  
fi
  
%postun
  
if [ $1 -ge 1 ]; then
  /sbin/service nginx upgrade &>/dev/null || :
  
fi
  
%changelog
  
* Sat Nov 23 2013 Purple Grape
  
- update to 1.4.4
  
- google_perftools_module add
  
- ngx_pagespeed module add



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-634954-1-1.html 上篇帖子: nginx1.4+resin4.0整合 下篇帖子: nginx 配置资料 整理(一)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表