9.2. RubyGems 사양 파일 규칙


이러한 사양 파일을 생성할 때 따라야 하는 RubyGems 사양 파일 구조 예제를 검토합니다.

RubyGems 사양 파일은 다음 규칙을 충족해야 합니다.

  • 파일에는 gem의 사양의 이름인 %{gem_name} 의 정의가 포함되어 있습니다.
  • 패키지의 소스는 릴리스된 gem 아카이브의 전체 URL이어야 합니다.
  • 패키지 버전은 gem의 버전이어야 합니다.
  • 파일에는 다음 BuildRequires 지시문이 포함되어 있습니다.

    BuildRequires: rubygems-devel

    rubygems-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}/
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동