rpmbuild安装
yum install -y rpmdevtools rpm-build
创建一个RPM构建根目录结构(默认将再当前用户主目录下),如果需要改变次默认位置,可以修改配置文件:~/.rpmmacros中变量_topdir对应
rpmdev-setuptree
查看所有的宏
rpmbuild –showrc
目录结构
rpmbuild命令的用法:
1 从spec文档建立有以下选项:
|
|
2 从tarball包建立,与spec类似
|
|
3 从源码包建立
|
|
软件包所属类别,具体类别有:
less /usr/share/doc/rpm-4.8.0/GROUPS
|
|
其他
make %{?_smp_mflags}
它就自动将软件安装时的路径自动设置成如下约定:
可执行程序/usr/bin
依赖的动态库/usr/lib或者/usr/lib64视操作系统版本而定。
二次开发的头文件/usr/include
文档及手册/usr/share/man
%setup 不加任何选项,仅将软件包打开。
%setup -n newdir 将软件包解压在newdir目录。
%setup -c 解压缩之前先产生目录。
%setup -b num 将第num个source文件解压缩。
%setup -T 不使用default的解压缩操作。
%setup -T -b 0 将第0个源代码文件解压缩。
%setup -c -n newdir 指定目录名称newdir,并在此目录产生rpm套件。
%patch 最简单的补丁方式,自动指定patch level。
%patch 0 使用第0个补丁文件,相当于%patch ?p 0。
%patch -s 不显示打补丁时的信息。
%patch -T 将所有打补丁时产生的输出文件删除。
/sbin/install-info –delete %{_infodir}/%{name}.info %{_infodir}/dir 2> /dev/null || :
These two scriptlets tell install-info to add entries for the info pages to the main index file on installation and remove them at erase time. The “|| :” in this case prevents failures that would typically affect systems that have been configured not to install any %doc files, or have read-only mounted, %_netsharedpath /usr/share.
Nginx rpm
vim ~/rpmbuild/SPECS/httpd.spec
|
|