6.7.3.3. RubyGems spec ファイルの例
サンプル 仕様 ファイルとその主要セクションを使用して、Ruby gem をビルドおよびパッケージ化したり、独自の 仕様 ファイルを作成したりできます。
RubyGems spec ファイルの例
%prep
%setup -q -n %{gem_name}-%{version}
# Modify the gemspec if necessary
# Also apply patches to code if necessary
%patch0 -p1
%build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/
# If there were programs installed:
mkdir -p %{buildroot}%{_bindir}
cp -a ./%{_bindir}/* %{buildroot}%{_bindir}
# If there are C extensions, copy them to the extdir.
mkdir -p %{buildroot}%{gem_extdir_mri}
cp -a .%{gem_extdir_mri}/{gem.build_complete,*.so} %{buildroot}%{gem_extdir_mri}/
次の表は、RubyGems spec ファイルに含まれる特定の項目の詳細を説明しています。
| ディレクティブ | RubyGems の詳細 |
|---|---|
| %prep |
RPM は gem アーカイブを直接展開できるため、 |
| %build |
このディレクティブには、ソフトウェアをマシンコードに構築するためのコマンドまたは一連のコマンドが含まれます。
|
| %install |
インストールは、 |