Nginx RPM包SPEC文件

...

%define realname nginx
%define realver  1.4.2
%define srcext   tar.gz

%define page_speed_commit cd80e92
%define psolver           1.6.29.3

%if 0%{?suse_version}
%define USER   wwwrun
%define GROUP  www
%define PREFIX /srv/www
%define WEB_USER_HOME /var/lib/lighttpd
%else
%define USER   apache
%define GROUP  apache
%define PREFIX /var/www
%define WEB_USER_HOME /var/www
%endif

%define CONF_FILE %{_sysconfdir}/%{name}/%{name}.conf

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       16.1
License:       BSD-2-Clause
Group:         Productivity/Networking/Web/Servers
URL:           http://nginx.org/
Summary:       HTTP and reverse proxy server, as well as a mail proxy server

# Install-time parameters
Provides:      httpd http_daemon webserver %{?suse_version:suse_help_viewer}
Requires:      logrotate

# Build-time parameters
BuildRequires: gcc-c++ libstdc++-devel
BuildRequires: dos2unix
BuildRequires: zlib-devel openssl-devel pcre-devel
BuildRequires: libxml2-devel libxslt-devel gd-devel libGeoIP-devel
%if 0%{?suse_version} || 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} >= 600
BuildRequires: libaio-devel
%endif
BuildRoot:     %{_tmppath}/%{name}-root
Source0:       http://nginx.org/download/%{realname}-%{realver}%{?extraver}.%{srcext}
Source1:       nginx.logrotate
Source2:       nginx.init
Source3:       nginx.sysconfig
Source91:      https://github.com/pagespeed/ngx_pagespeed/tarball/%{page_speed_commit}/pagespeed-ngx_pagespeed-%{page_speed_commit}.tar.gz
Source92:      https://dl.google.com/dl/page-speed/psol/%{psolver}.tar.gz
Patch:         nginx-memset_zero.patch

#!BuildIgnore: freetype2

%description
nginx [engine x] is a HTTP and reverse proxy server, as well as a mail proxy server

This nginx package built with Google PageSpeed

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver} -a91
%{__tar} -zxf %{S:92} -C pagespeed-ngx_pagespeed-%{page_speed_commit}
%patch -p1

%build
./configure  --prefix=%{PREFIX}  --sbin-path=%{_sbindir}/%{name}  --conf-path=%{CONF_FILE}  --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}/lock/%{name}.lock  --user=%{USER}  --group=%{GROUP}   --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_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 %if 0%{?suse_version} || 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} >= 600
 --with-file-aio %endif
 --with-ipv6   --with-http_ssl_module  --with-http_spdy_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-mail  --with-mail_ssl_module   --with-cc-opt="%{optflags}"  --with-ld-opt="-Wl,--as-needed -Wl,--strip-all"   --with-pcre  --with-pcre-jit  --add-module=%{_builddir}/%{realname}-%{realver}%{?extraver}/pagespeed-ngx_pagespeed-%{page_speed_commit}
%__make %{?_smp_mflags}

%install
%__make install DESTDIR=%{buildroot}
iconv -f koi8-r CHANGES.ru > c && %__mv -f c CHANGES.ru
%__install -D -m644 man/nginx.8 %{buildroot}%{_mandir}/man8/nginx.8
%__install -D -m644 %{S:1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%__install -d -m755 %{buildroot}%{_initrddir}
sed -r ‘s|##PREFIX##|%{PREFIX}|; s|##CONF_FILE##|%{CONF_FILE}|‘ %{S:2} > %{buildroot}%{_initrddir}/%{name}
%__rm -f %{buildroot}%{PREFIX}/html/index.html
%if %{expand:%_vendor == "suse"}
%__mv %{buildroot}%{PREFIX}/html %{buildroot}%{PREFIX}/htdocs
%__install -d -m755 %{buildroot}/var/adm/fillup-templates
sed -r ‘s|##PREFIX##|%{PREFIX}|; s|##CONF_FILE##|%{CONF_FILE}|‘ %{S:3} > %{buildroot}/var/adm/fillup-templates/sysconfig.%{name}
%__ln_s -f %{_initrddir}/%{name} %{buildroot}%{_sbindir}/rc%{name}
dos2unix contrib/geo2nginx.pl
%__install -D -m755 contrib/geo2nginx.pl %{buildroot}%{_bindir}/geo2nginx.pl
%else
%__install -d -m755 %{buildroot}/%{_sysconfdir}/sysconfig
sed -r ‘s|##PREFIX##|%{PREFIX}|; s|##CONF_FILE##|%{CONF_FILE}|‘ %{S:3} > %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
%endif
%__install -d -m755 %{buildroot}%{_localstatedir}/cache/%{name}

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc CHANGES CHANGES.ru LICENSE README
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/*
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_sbindir}/nginx
%attr(0755,root,root) %{_initrddir}/%{name}
%dir %attr(0755,%{USER},%{GROUP}) %{_localstatedir}/log/%{name}
%if %{expand:%_vendor == "suse"}
%{_bindir}/geo2nginx.pl
%{_sbindir}/rcnginx
%{PREFIX}/htdocs/*
/var/adm/fillup-templates/sysconfig.%{name}
%else
%{PREFIX}/html/*
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%endif
%doc %{_mandir}/man8/*
%dir %attr(0755,%{USER},%{GROUP}) %{_localstatedir}/cache/%{name}

%pre
/usr/sbin/groupadd -r %{GROUP} &>/dev/null ||:
/usr/sbin/useradd  -g %{GROUP} -s /bin/false -r -c "Web-server" -d %{WEB_USER_HOME} %{USER} &>/dev/null ||:

%if 0%{?suse_version}

%post
%{fillup_and_insserv %{name}}

%preun
%{stop_on_removal %{name}}
rm -rf %{_localstatedir}/cache/%{name}/*

%postun
%{restart_on_update %{name}}
%{insserv_cleanup}

%else

%preun
rm -rf %{_localstatedir}/cache/%{name}/*

%endif

%changelog
时间: 2024-08-26 11:01:01

Nginx RPM包SPEC文件的相关文章

Fpm 之 Nginx rpm 包制作

Fpm 之 Nginx rpm 包制作 一.下载nginx编译安包机器上 wget http://nginx.org/download/nginx-1.12.2.tar.gz 二.安装nginx的编译所需的依赖包 yum -y install pure lib gcc-c++ openssl openssl-devel 三.编译安装nginx tar -zxvf nginx-1.12.2.tar.gz cd nginx-1.12.2 ./configure --prefix=/app/nginx

Linux /centos 下nginx rpm包安装及配置

Centos下安装nginx rpm包                                                                                                                            www.169it.com 1 在nginx官方网站下载一个rpm包,下载地址是:http://nginx.org/en/download.html wget http://nginx.org/packages/c

linux 已安装包校验、rpm包中文件提取

已安装包校验 rpm -V 已安装的包名-V 校验指定rpm包中的文件 rpm -V pth没有任何提示,说明自安装后没有做过任何修改 rpm包中文件提取 比如对一个系统配置文件误操作,可以根据这个文件找到它所属的rpm包,然后再从rpm包中提取这个文件再覆盖被误操作文件 rpm2cpio 包全名 | cpio -idv .rpm包中文件绝对路径-i copy-in模式,还原-d 还原时自动新建目录-v 显示还原过程 rpm2cpio将rpm包转换为cpio格式的文件 cpio是一个标准工具,它

使用fpm制作nginx rpm包

在使用saltstack部署的时候,我们依赖公司自己的rpm包,编译的参数,启动的脚本都是自己定制的,然后打成rpm包 放入公司自己的yum仓库里.制作rpm包的方式很多 checkinstall spec文件,fpm使用很简单,主要介绍下 1.安装fpm yum -y install ruby rubygems ruby-devel rpm-build gem sources -a http://ruby.taobao.org/ gem sources --remove http://ruby

openssl-1.0.1j 制作RPM的spec文件

因为需要测试Nginx的spdy,需要升级openssl.可能会涉及后续的大规模升级计划,所以将openssl制作成rpm包, 其中包括了对hifn so的管理.. hifn so的管理就是: 将so copy到/usr/lib,在/usr/lib创建最新的so链接文件. 然后在通过/usr/lib的链接文件,引入到openssl的目录内. 以后so升级,就拷贝到/usr/lib,然后更新so链接文件就可以了.. OpenSSL的spec文件内容. #sinaopenssl-1.0.1j.spe

fpm定制化RPM包之nginx rpm包的制作

1.安装ruby模块 # yum -y install ruby rubygems ruby-devel 2.添加阿里云的Rubygems仓库,国外资源会影响下载速度 gem sources -a http://mirrors.aliyun.com/rubygems/ http://mirrors.aliyun.com/rubygems/ added to sources 移除原生的ruby仓库 gem sources --remove http://rubygems.org/ 3.安装fpm

FPM制作nginx rpm包

fpm介绍: FPM功能简单说就是将一种类型的包转换成另一种类型. FPM的github:https://github.com/jordansissel/fpm fpm常用参数: -s          指定源类型 -t          指定目标类型,即想要制作为什么包 -n          指定包的名字 -v          指定包的版本号 -C          指定打包的相对路径  Change directory to here before searching forfiles

Centos下安装nginx rpm包

1 在nginx官方网站下载一个rpm包,下载地址是:http://nginx.org/en/download.html wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm 2 安装这个rpm包 rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm 安装过程中会出现错误提示: warning: nginx-

RPM包的制作

RPM包的制作 前言 按照其软件包的格式来划分,常见的Linux发行版主要可以分为两类,类ReadHat系列和类Debian系列,这两类系统分别提供了自己的软件包管理系统和相应的工具. 类RedHat系统中软件包的后缀是rpm,提供了同名的rpm命令来安装.卸载.升级rpm软件包: 类Debian系统中软件包的后缀是deb,同样提供了dpkg命令来对后缀是deb rpm的全称是Redhat Package Manager,常见的使用rpm软件包的系统主要有Fedora.CentOS.openSU