9.2. RubyGems spec file conventions
A RubyGems spec file must meet the following conventions:
-
The file contains a definition of
%{gem_name}, which is the name from the gem’s specification. - The source of the package must be the full URL to the released gem archive.
- The version of the package must be the gem’s version.
The file contains the following
BuildRequires:directive:BuildRequires: rubygems-develThe
rubygems-develpackage contains macros needed for a build.-
The file does not contain any additional
rubygem(foo)RequiresorProvidesdirectives because these directives are autogenerated from the gem metadata.
9.2.1. RubyGems spec file example 링크 복사링크가 클립보드에 복사되었습니다!
The following is the RubyGems-specific part of an example spec file for building gems. The remaining part of the spec file follows the generic guidelines.
A RubyGems-specific part of an example spec file
%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}/
9.2.2. RubyGems spec file directives 링크 복사링크가 클립보드에 복사되었습니다!
The following are the specifics of particular items in the RubyGems-specific part of the spec file.
| Directive | RubyGems specifics |
|---|---|
|
|
RPM can directly unpack gem archives. The
|
|
|
This section includes commands for building the software into machine code. The |
|
|
The installation is performed into the |