%define gem_dir %(ruby -rrbconfig -e 'puts File::expand_path(File::join(Config::CONFIG["sitedir"],"..","gems"))')
%define rb_ver %(ruby -rrbconfig -e 'puts Config::CONFIG["ruby_version"]')
%define gem_home %{gem_dir}/%{rb_ver}
%define ruby_sitelib %(ruby -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]')
%define has_ruby_abi 0%{?fedora:%fedora} >= 5 || 0%{?rhel:%rhel} >= 5
%define has_ruby_noarch %has_ruby_abi
# Whether rdoc is in ruby-rdoc or in the main ruby package
%define has_ruby_rdoc %has_ruby_abi
# rdoc on RHEL4 has a bug that makes rdoc generation for rubygems fail
%define suppress_rdoc 0%{?rhel:%rhel} == 4
Summary: The Ruby standard for packaging ruby libraries
Name: rubygems
Version: 0.9.4
Release: 1%{?dist}
Group: Development/Libraries
License: Ruby License/GPL
URL: http://rubyforge.org/projects/rubygems/
Source0: http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz
Patch0: noarch-gemdir.patch
Patch1: no-rdoc.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
%if %has_ruby_abi
Requires: ruby(abi) = 1.8
%endif
BuildRequires: ruby
%if %has_ruby_rdoc
Requires: ruby-rdoc
BuildRequires: ruby-rdoc
%endif
%if %has_ruby_noarch
BuildArch: noarch
%endif
Provides: ruby(rubygems) = %{version}
%description
RubyGems is the Ruby standard for publishing and managing third party
libraries.
%prep
%setup -q
%patch0 -p1
%if %suppress_rdoc
%patch1 -p1
%endif
# Some of the library files start with #! which rpmlint doesn't like
# and doesn't make much sense
for f in `find lib -name \*.rb` ; do
head -1 $f | grep -q '^#!/usr/bin/env ruby' && sed -i -e '1d' $f
done
%build
CFLAGS="$RPM_OPT_FLAGS" \
ruby setup.rb config
ruby setup.rb setup
ruby doc/makedoc.rb
%install
rm -rf $RPM_BUILD_ROOT
GEM_HOME=$RPM_BUILD_ROOT%{gem_home} \
ruby setup.rb install --prefix=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-, root, root, -)
%doc README TODO ChangeLog Releases gemspecs
%doc GPL.txt LICENSE.txt
%{_bindir}/gem
%{_bindir}/gemlock
%{_bindir}/gem_mirror
%{_bindir}/gemri
%{_bindir}/gem_server
%{_bindir}/gemwhich
%{_bindir}/index_gem_repository.rb
%{_bindir}/update_rubygems
%{gem_dir}
%{ruby_sitelib}/gemconfigure.rb
%{ruby_sitelib}/ubygems.rb
%{ruby_sitelib}/rubygems.rb
%{ruby_sitelib}/rubygems
%{ruby_sitelib}/rbconfig/datadir.rb
%changelog
* Fri Jul 27 2007 David Lutterkort <dlutter@redhat.com> - 0.9.4-1
- Conditionalize so it builds on RHEL4
* Tue Feb 27 2007 David Lutterkort <dlutter@redhat.com> - 0.9.2-1
- New version
- Add patch0 to fix multilib sensitivity of Gem::dir (bz 227400)
* Thu Jan 18 2007 David Lutterkort <dlutter@redhat.com> - 0.9.1-1
- New version; include LICENSE.txt and GPL.txt
- avoid '..' in gem_dir to work around a bug in gem installer
- add ruby-rdoc to requirements
* Tue Jan 2 2007 David Lutterkort <dlutter@redhat.com> - 0.9.0-2
- Fix gem_dir to be arch independent
- Mention dual licensing in License field
* Fri Dec 22 2006 David Lutterkort <dlutter@redhat.com> - 0.9.0-1
- Updated to 0.9.0
- Changed to agree with Fedora Extras guidelines
* Mon Jan 9 2006 David Lutterkort <dlutter@redhat.com> - 0.8.11-1
- Updated for 0.8.11
* Sun Oct 10 2004 Omar Kilani <omar@tinysofa.org> 0.8.1-1ts
- First version of the package