7.2. RubyGems spec 文件约定
RubyGems spec 文件必须满足以下约定:
-
文件包含
%{gem_name}的定义,后者是 gem 规范中的名称。 - 软件包的源必须是发布的 gem 归档的完整 URL。
- 软件包的版本必须是 gem 的版本。
文件包含以下
BuildRequires:指令:BuildRequires: rubygems-develrubygems-devel软件包包含构建所需的宏。-
文件不包含任何其他
rubygem (foo)Requires或Provides指令,因为这些指令是从 gem 元数据自动生成的。
7.2.1. RubyGems spec 文件示例 复制链接链接已复制到粘贴板!
以下是用于构建 gems 的示例 spec 文件的特定于 RubyGems 的部分。spec 文件的其余部分遵循通用准则。
示例 spec 文件的特定于 RubyGems 的部分
%prep
%setup -q -n %{gem_name}-%{version}
# Modify the gemspec if necessary
# Also apply patches to code if necessary
%patch 0 -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}/
7.2.2. RubyGems spec 文件指令 复制链接链接已复制到粘贴板!
以下是 spec 文件的特定于 RubyGems 部分中的特定项的具体信息。
| 指令 | RubyGems 具体信息 |
|---|---|
|
|
RPM 可以直接解包 gem 归档。
|
|
|
本节包含将软件构建成机器码的命令。 |
|
|
安装将在 |