概述
spec文件是制作rpm包的脚本文件,详细定义rpm包的信息、包含内容和安装位置,如软件包的名字、版本、类别、说明摘要、创建时要执行什么指令、安装时要执行什么操作、以及软件包所要包含的文件列表等等。
spec文件有多个段组成,分别定义rpm编译、打包、安装等阶段的工作内容。
示例如下:
Name: myprogram
Version: 1.0
Release: 1
Vendor: Jaun
Summary: My program
License: GPL
URL: http://myprogram.com
Source0: myprogram-1.0.tar.gz
Group: Development/Tools
BuildRequires: gcc
%description
My program is a simple example program.
%prep
%setup -q
%build
./configure
make
%install
make install DESTDIR=%{buildroot}
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
/sbin/myprogram
%post
/sbin/ldconfig /sbin/myprogram
%preun
/sbin/ldconfig /sbin/myprog