4.5.5. C 程序示例的 spec 文件示例
您可以对使用 C 编程语言编写的 cello 程序使用以下示例 spec 文件作为参考。
使用 C 编写的 cello 程序的 spec 文件示例
Name: cello
Version: 1.0
Release: 1%{?dist}
Summary: Hello World example implemented in C
License: GPLv3+
URL: https://www.example.com/%{name}
Source0: https://www.example.com/%{name}/releases/%{name}-%{version}.tar.gz
Patch0: cello-output-first-patch.patch
BuildRequires: gcc
BuildRequires: make
%description
The long-tail description for our Hello World Example implemented in
C.
%prep
%setup -q
%patch0
%build
make %{?_smp_mflags}
%install
%make_install
%files
%license LICENSE
%{_bindir}/%{name}
%changelog
* Tue May 31 2016 Adam Miller <maxamillion@fedoraproject.org> - 1.0-1
- First cello package
BuildRequires指令,其指定软件包的 build-time 依赖项,包括以下执行编译构建过程所需的软件包:-
gcc -
make
-
-
本例中省略了该软件包的运行时依赖项
Requires指令。所有运行时要求都由rpmbuild进行处理,而cello程序不需要核心 C 标准库之外的任何内容。 -
%build部分反映了这样一个事实,即此示例中,为 cello 程序编写了Makefile文件。因此,您可以使用 GNU make 命令。但是,您必须删除对%configure的调用,因为您没有提供配置脚本。
您可以使用 %make_install 宏安装 cello 程序。这是可能是因为 cello 程序的 Makefile 文件可用。