6.4.5. サンプル C プログラムの spec ファイルの例
C プログラミング言語 (cello) で書かれたサンプルプログラムのアノテーション付きサンプル 仕様 ファイルを確認してください。
cello プログラムは、%make_install マクロを使用してインストールできます。これが可能なのは、cello プログラムの Makefile を利用できるためです。
例6.5 チェロプログラムの仕様ファイルの例
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ディレクティブには、コンパイルビルドプロセスを実行するために必要な次のパッケージが含まれています。-
gcc -
make
-
-
この例では、パッケージにランタイム依存関係を指定する
Requiresディレクティブは省略されています。すべてのランタイム要件はrpmbuildにより処理されます。celloプログラムはコア C 標準ライブラリー以外のものは必要としません。 -
%buildセクションは、この例で cello プログラム用のMakefileファイルを作成したことを反映しています。したがって、GNU make コマンドを使用できます。ただし、設定スクリプトを指定していないため、%configureへの呼び出しを削除する必要があります。