Menu Close
3.12. 使用 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
的事实,因此可以使用 rpmdev-newspec
程序提供的 GNU make 命令。但是,您需要删除对 %configure
的调用,因为您没有提供配置脚本。
可使用 rpmdev-newspec
命令提供的 %make_install
宏来完成 cello 程序安装。这是因为 cello 程序的 Makefile
可用。
其他资源