Changes between Initial Version and Version 1 of MakingRPM/Tips


Ignore:
Timestamp:
2009/05/24 10:40:26 (15 years ago)
Author:
daisuke
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MakingRPM/Tips

    v1 v1  
     1= SPEC の書き方 Tips = 
     2 
     3== with/without を使った条件分岐 == 
     4 
     5bcond_with または bcond_without を使うことで、条件ビルドの spec への記述が書きやすくなり、 
     6rpmbuild への --with/--without スイッチで機能の追加削除の選択ができるようになります。 
     7 
     8 * {{{%bcond_with foo}}} は rpmbuild で --with-foo が指定されていた場合に with_foo が定義される。 
     9 * {{{%bcond_without foo}}} は rpmbuild で --without-foo が指定されて'''いない'''限り with_foo が定義される。 
     10 
     11例:[[BR]] 
     12以下の例ではデフォルトでビルドした場合は bar のみが定義されます。 
     13{{{ 
     14%bcond_with foo 
     15%bcond_without bar 
     16 
     17%if %{with foo} 
     18BuildRequires: foo-devel 
     19%endif 
     20%if %{with bar} 
     21BuildRequires: bar-devel 
     22%endif 
     23 
     24%configure .... \ 
     25%{?with_foo:--with-foo} \ 
     26%{?with_bar:--with-bar} 
     27 
     28}}} 
     29