%global gem_name ruby-shadow # On EPEL we need to configure various gem paths, add a ruby-shadow package and # setup a symlink in the ruby path. %if 0%{?rhel} %{!?gem_dir: %global gem_dir /usr/share/gems} %{!?gem_instdir: %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}} %{!?gem_cache: %global gem_cache %{gem_dir}/cache/%{gem_name}-%{version}.gem} %{!?gem_libdir: %global gem_libdir %{gem_instdir}/lib} %{!?gem_spec: %global gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec} %{!?gem_docdir: %global gem_docdir %{gem_dir}/doc/%{gem_name}-%{version}} %{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e "puts RbConfig::CONFIG['sitearchdir']")} %endif %global ruby_version %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["ruby_version"]') Name: rubygem-%{gem_name} Version: 2.1.3 Release: 2%{?dist} Summary: Ruby shadow password module Group: Development/Languages License: Public Domain URL: https://github.com/apalmblad/ruby-shadow Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem %if 0%{?rhel} == 5 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %endif BuildRequires: ruby-devel %if 0%{?fedora} BuildRequires: rubygems-devel %endif BuildRequires: ruby(rubygems) BuildRequires: ruby >= 1.8 # Work around the lack of ruby in the default mock buildroot %if "%{ruby_version}" Requires: ruby(abi) = %{ruby_version} %endif Requires: ruby(rubygems) Provides: rubygem(%{gem_name}) = %{version} %if 0%{?fedora} Provides: ruby(shadow) = %{version} Obsoletes: ruby-shadow < 1.4.1-16 Provides: ruby-shadow = %{version}-%{release} %endif %description This module provides access to shadow passwords on Linux and Solaris. %package doc Summary: Documentation for %{name} Group: Documentation Requires: %{name} = %{version}-%{release} %if 0%{?fedora} || 0%{?rhel} >= 6 BuildArch: noarch %endif %description doc Documentation for %{name}. %if 0%{?rhel} %package -n ruby-shadow Summary: Ruby bindings for shadow password access Group: System Environment/Libraries Requires: rubygem-%{gem_name} = %{version}-%{release} Provides: ruby(shadow) = %{version}-%{release} %description -n ruby-shadow %{summary}. %endif %prep %setup -q -c -T mkdir -p .%{gem_dir} export CONFIGURE_ARGS="--with-cflags='%{optflags}'" gem install -V \ --local \ --install-dir .%{gem_dir} \ --bindir .%{_bindir} \ --force \ --rdoc \ %{SOURCE0} %build %install %if 0%{?rhel} == 5 rm -rf %{buildroot} %endif mkdir -p %{buildroot}%{gem_dir} cp -a .%{gem_dir}/* %{buildroot}%{gem_dir}/ %if 0%{?fedora} >= 17 mkdir -p %{buildroot}%{gem_extdir}/lib mv %{buildroot}%{gem_libdir}/shadow.so %{buildroot}%{gem_extdir}/lib/ %endif pushd %{buildroot}%{gem_instdir} # Remove the binary extension sources and build leftovers. rm -rf ext *.c *.log *.o Makefile depend extconf.rb shadow.so # Symlink shadow.so %if 0%{?rhel} || (0%{?fedora} && 0%{?fedora} < 17) ln -sv lib/shadow.so . %endif popd # Setup symlinks for EPEL systems %if 0%{?rhel} mkdir -p %{buildroot}%{ruby_sitearch} ln -sv %{gem_libdir}/shadow.so %{buildroot}%{ruby_sitearch}/shadow.so %endif %files %dir %{gem_instdir} %exclude %{gem_cache} %{gem_instdir}/README* %{gem_instdir}/*gemspec %if 0%{?fedora} >= 17 %{gem_extdir}/lib/*.so %else %{gem_instdir}/*.so %endif %{gem_libdir} %{gem_spec} %files doc %doc %{gem_docdir} %doc %{gem_instdir}/HISTORY %doc %{gem_instdir}/MANIFEST %if 0%{?rhel} %files -n ruby-shadow %{ruby_sitearch}/shadow.so %endif %changelog * Tue Apr 17 2012 Todd Zullinger - 2.1.3-2 - Use %%{gem_extdir} on F-17 and above * Fri Apr 06 2012 Todd Zullinger - 2.1.3-1 - Update to 2.1.3 - Fix license tag * Sun Apr 01 2012 Todd Zullinger - 2.1.2-3 - Revert gem repacking until ruby guidelines are finalized - Only define gem macros for EPEL, all Fedora releases have them - Add BuildRoot and clean it manually for EL-5 * Thu Feb 16 2012 Todd Zullinger - 2.1.2-2 - Minor cleanups for review - Changes for building on EL-6 (EL-5's rubygems is too old) * Mon Jan 16 2012 Michael Stahnke - 2.1.2-1 - Initial package