rpmbuild打包php
安装php依赖库
mkdir -pv ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
php有一个依赖库,在yum源于epel源中都没有需要自己打包libiconv
编写libiconv spec文件
%define __os_install_post %{nil}
%define debug_package %{nil}
Name: libiconv
Version: 1.15
Release: 1%{?dist}
Summary: liconv
Group: liconv
License: GPL
URL: http://www.test.net
Packager: test
Vendor: test
Source0: libiconv-1.15.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
%description
iconv
%prep
%setup -q
%build
./configure --prefix=/usr/share/libiconv-1.15 \
make
%install
make install DESTDIR=%{buildroot}
%files
%defattr(-,root,root,-)
%attr(0655,root,root) /usr/share/libiconv-1.15/*
%attr(0755,root,root) /usr/share/libiconv-1.15/bin/*
%clean
rm -rf $RPM_BUILD_DIR/%{name}-%{version}
%post
ln -sv /usr/share/libiconv-1.15/ /usr/share/libiconv
%changelog
* Sun Aug 24 2018 LC 1.15-1
- package libiconv-1.15
编写php spec文件
Name: php
Version: 7.1.17
Release: 1%{?dist}
Summary: php
Group: php
License: GPL
URL: http://php.org
Packager: php
Vendor: php
Source0: php-7.1.17.tar.bz2
Source1: php.ini
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Requires: libiconv,zlib-devel,libxml2-devel,libjpeg-devel,libjpeg-turbo-devel,freetype-devel,libpng-devel,gd-devel,curl-devel,libxslt-devel,bzip2-devel,gmp-devel,readline-devel,mcrypt,mhash,libmcrypt-devel
%description
php %prep
id nginx || useradd nginx -s /sbin/nologin -M
%setup -q %build
./configure \
--prefix=/usr/share/php-7.1.17 \
--with-config-file-path=/etc/php/ \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--mandir=/usr/share/man \
--sysconfdir=/etc/php/ \
--with-mysqli=mysqlnd \
--with-iconv-dir=/usr/share/libiconv \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-libxml-dir \
--enable-xml \
--disable-rpath \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx make -j 4 %install
rm -rf %{buildroot}
make INSTALL_ROOT=%{buildroot} install
%{__install} -p -D %{SOURCE1} %{buildroot}/etc/php/php.ini %files
%defattr(-,root,root,-)
/usr/share/php-7.1.17/*
%attr(0744,root,root) /usr/bin/*
%attr(0744,root,root) /usr/sbin/*
/usr/share/man/*
/etc/php/* %pre
id nginx || useradd nginx -s /sbin/nologin -M %post
cp /etc/php/php-fpm.conf.default /etc/php/php-fpm.conf
cp /etc/php/php-fpm.d/www.conf.default /etc/php/php-fpm.d/www.conf %postun
userdel nginx %changelog
* Sun Aug 10 2018 lc lc
- package php-7.1.71
构建PHP RPM包遇到的问题
RPM build errors:
bogus date in %changelog: Sun Aug 10 2018 lc zhoushilong
Explicit %attr() mode not applicaple to symlink: /root/rpmbuild/BUILDROOT/php-7.1.17-1.el7.centos.x86_64/usr/bin/phar
Installed (but unpackaged) file(s) found:
/.channels/.alias/pear.txt
/.channels/.alias/pecl.txt
/.channels/.alias/phpdocs.txt
/.channels/__uri.reg
/.channels/doc.php.net.reg
/.channels/pear.php.net.reg
/.channels/pecl.php.net.reg
/.depdb
/.depdblock
/.filemap
/.lock
解决方法如下:
方法1
生成的rpm包里有前面在%files里添加的这个文件,如下:
/usr/local/php/.channels
方法二,下面是直接删除的解决办法,实践OK(视具体情况是删除还是添加选一个即可):
rm -rf %{buildroot}/{.channels,.depdb,.depdblock,.filemap,.lock}
方法三,/usr/lib/rpm/macros修改宏
# 构建根目录中的未打包文件是否应终止构建?
%_unpackaged_files_terminate_build 1 # 把1改为0只警告 %__check_files %{_rpmconfigdir}/check-files %{buildroot} # 这一行,把这一行注释掉,然后重新编译
rpmbuild打包php的更多相关文章
- 使用rpmbuild打包时不对文件进行strip操作
		使用rpmbuild打包时不对文件进行strip操作 摘自: https://www.ichenfu.com/2017/11/20/rpmbuild-not-strip/ By Chen Fu 发表于 ... 
- rpmbuild打包
		安装: yum install -y rpm-build 目录介绍: 默认目录在 /root/rpmbuild BUILD :你要打包的文件将会在这里编译(编译rpm包的临时目录) BUILDRO ... 
- 利用rpmbuild 打包可执行文件和链接库生成rpm 包
		Background: Background: 遇到一个打包可执行程序和链接库生成rpm 包的需求,查遍了很多网站的资料,现在整理下解决方案. 前期参考的是这篇帖子: https://codeante ... 
- RPM打包原理、示例、详解及备查
		原文地址:https://blog.csdn.net/qq_16542775/article/details/80961213 RPM(Redhat Package Manager)是用于Redhat ... 
- RPM打包原理、示例、详解及备查( 转)
		RPM(Redhat Package Manager)是用于Redhat.CentOS.Fedora等Linux 分发版(distribution)的常见的软件包管理器.因为它允许分发已编译的软件,所 ... 
- linux之使用rpmbuild打rpm包
		linux之使用rpmbuild打rpm包 前言: 已从事linux运维工作数年,感觉自己还是个小菜鸟,没有大神那么的钻研的精神.只是单纯热爱,喜欢对着黑色的屏幕敲击命令,喜欢这种感觉.为什么要做RP ... 
- [实践] ubuntu下编译安装ambari
		ambari是一个Hadoop套件的管理工具,可以方便部署.管理及监控.最初开发时使用的就是RH系的Linux,只支持RHEL.CentOS5/6.OEL.SLES,暂不支持Ubuntu:可我的需求就 ... 
- 在Linux CentOS 6.5 (Final)上安装git-1.9.0
		CentOS 6.5 (Final)默认安装的git版本为1.7.1.3,而我们希望安装1.9.0版本.由于rpm安装库里没有1.9.0版本,因此我们需要找其它方法来安装. 网上有很多文章介绍了如何从 ... 
- 编译wiredtiger rpm包
		1.安装rpm-build 使用rpmbuild打包rpm包前,首先安装rpmbuild: yum install rpm-build -y 2.创建打包文件目录 mkdir -p /root/r ... 
随机推荐
- idea maven +spring mvc
			1.步骤一 2.目录结构 3.maven <!--测试--> <dependency> <groupId>junit</groupId> <art ... 
- Spring 学习笔记(二)
			spring 核心 (xml方式.注解方式) 两种方式实现 ioc :控制反转 aop : 面向切面 
- 【XSY2332】Randomized Binary Search Tree 概率DP FFT
			题目描述 \(\forall 0\leq i<n\),求有多少棵\(n\)个点,权值和优先级完全随机的treap的树高为\(i\). \(n\leq 30000\) 题解 设\(f_{i,j}\ ... 
- MT【266】求$a$的范围
			已知 $a$ 为常数,函数$f(x)=\dfrac{x}{\sqrt{a-x^2}-\sqrt{1-x^2}}$ 的最小值为$-\dfrac{2}{3}$,则 $a$ 的取值范围_____ 解: 考虑 ... 
- redis主从复制和sentinel配置高可用
			一:redis主从配置1.环境准备 master : 192.168.50.10 6179 slave1: 192.168.50.10 6279 slave2: 192.168.50.10 63792 ... 
- [NOI2010]海拔(最小割)
			题目描述 YT市是一个规划良好的城市,城市被东西向和南北向的主干道划分为n×n个区域.简单起见,可以将YT市看作一个 正方形,每一个区域也可看作一个正方形.从而,YT城市中包括(n+1)×(n+1)个 ... 
- hdu 2859 Phalanx (最大对称子矩阵)
			Problem Description Today is army day, but the servicemen are busy with the phalanx for the celebrat ... 
- 使用Spring Cloud连接不同服务
			http://www.infoq.com/cn/articles/spring-cloud-service-wiring 主要结论 Spring Cloud为微服务系统中相互依赖的服务提供了丰富的连接 ... 
- js click 与 onclick   事件绑定,触发与解绑
			click 与 onclick 1.onclick 事件会在对象被点击时发生. <input id="btn1" type="button" onclic ... 
- Linux下VMware在更新完内核无法启动
			该问题尚未解决,我已经换Oracle VM VirtualBox 
