9.2. RubyGems 사양 파일 규칙
이러한 사양 파일을 생성할 때 따라야 하는 RubyGems 사양 파일 구조 예제를 검토합니다.
RubyGems 사양 파일은 다음 규칙을 충족해야 합니다.
-
파일에는 gem의 사양의 이름인
%{gem_name}의 정의가 포함되어 있습니다. - 패키지의 소스는 릴리스된 gem 아카이브의 전체 URL이어야 합니다.
- 패키지 버전은 gem의 버전이어야 합니다.
파일에는 다음
BuildRequires지시문이 포함되어 있습니다.BuildRequires: rubygems-develrubygems-devel패키지에는 빌드에 필요한 매크로가 포함되어 있습니다.-
이러한 지시문은 gem 메타데이터에서 자동으로 생성되므로 파일에 추가
rubygem(foo)Requires또는Provides지시문이 포함되어 있지 않습니다.
9.2.1. RubyGems 사양 파일 예 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
gem을 빌드하기 위해 예제 사양 파일의 다음 RubyGems 관련 부분의 세부 정보를 검토합니다. 파일의 나머지 부분은 일반 사양 파일 지침을 따릅니다.
spec
예 9.1. 예제 사양 파일의 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}/