php-7.1.0 rpm包制作

nginx-1.8.0 rpm包制作见上篇文章:http://www.cnblogs.com/xiaoming279/p/6251149.html

spec文件

Name:            php    
Version:         7.1.0    
Release:        1%{?dist}
Summary:         php

Group:            Applications/Server    
License:         GPLv2    
URL:            http://www.51.com
Source0:        %{name}-%{version}.tar.gz    
Source1:        php.ini-production
Source2:        php-fpm.conf

BuildRequires:        gcc,make    
Requires:        zlib libpng-devel libjpeg-turbo-devel libcurl-devel  libjpeg freetype libgpg-error-devel libxslt libxslt-devel libpng gd curl libmcrypt libmcrypt-devel zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel
BuildRoot:        %{_topdir}/BUILDROOT 

%description
It's a php compile by hexm@51.com.

%prep
%setup -q

%build
echo $RPM_BUILD_ROOT

./configure 
 --prefix=%{_prefix} 
 --enable-fpm 
 --with-fpm-user=nobody 
 --with-config-file-path=%{_prefix}/lib 
 --with-fpm-group=nobody 
 --with-mysqli 
 --with-pdo-mysql 
 --with-freetype-dir 
 --with-jpeg-dir 
 --with-png-dir 
 --with-zlib 
 --with-libxml-dir=/usr 
 --enable-xml 
 --disable-rpath 
 --enable-bcmath 
 --enable-shmop 
 --enable-sysvsem 
 --enable-inline-optimization 
 --with-curl 
 --enable-mbregex 
 --enable-mbstring 
 --with-mcrypt 
 --enable-ftp 
 --with-gd 
 --enable-gd-native-ttf 
 --with-openssl 
 --with-mhash 
 --enable-pcntl 
 --enable-sockets 
 --with-xmlrpc 
 --enable-zip 
 --enable-soap 
 --without-pear 
 --disable-phar 
 --with-gettext 
 --disable-fileinfo 
 --enable-maintainer-zts

make %{?_smp_mflags}

%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
make INSTALL_ROOT=$RPM_BUILD_ROOT install
%{__install} -p -D %{SOURCE1} $RPM_BUILD_ROOT/%{_prefix}/lib/php.ini
%{__install} -p -D %{SOURCE2} $RPM_BUILD_ROOT/%{_prefix}/etc/php-fpm.conf

%pre

%post
ln -sv %{_prefix} /usr/local/%{name}  &> /dev/null
[ ! -d /data/logs/%{name} ] && mkdir -p /data/logs/%{name}  &> /dev/null

%preun

%postun
rm -rf /usr/local/%{name}
rm -rf %{_prefix}

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%files
%defattr (-,root,root,0755)
%{_prefix}

%changelog
原文地址:https://www.cnblogs.com/xiaoming279/p/6253063.html