Blob Blame History Raw
%{!?ruby_sitelib: %global ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")}
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%global gemname xmlparser
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}

%global rubyabi 1.8

Summary: Ruby bindings to the Expat XML parsing library
Name: rubygem-%{gemname}
Version: 0.6.81
Release: 9%{?dist}
Group: Development/Languages
# src/lib/xml/xpath.rb is GPLv2+
# src/ext/encoding.h and the functions of encoding map are GPLv2+ or Artistic
# All other files are Ruby or GPLv2+ or MIT
# For a breakdown of the licensing, see also README
License: GPLv2+ and ( Ruby or GPLv2+ or MIT ) and ( GPLv2+ or Artistic ) 
URL: http://rubygems.org/gems/xmlparser
Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: ruby
Requires: ruby(rubygems)
Requires: ruby(abi) = %{rubyabi}
BuildRequires: ruby
BuildRequires: ruby(rubygems)
BuildRequires: ruby(abi) = %{rubyabi}
BuildRequires: ruby-devel
BuildRequires: rubygem(rake)
BuildRequires: rubygem(mkrf)
BuildRequires: expat-devel
Provides: rubygem(%{gemname}) = %{version}

%description
Ruby bindings to the Expat XML parsing library. 


%prep
%setup -q -c -T 
cp %{SOURCE0} %{gemname}-%{version}.gem

%build
mkdir -p .%{gemdir}
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
gem install -V --local --install-dir $(pwd)/%{gemdir} --no-rdoc --no-ri --force %{gemname}-%{version}.gem

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{gemdir}
cp -rp .%{gemdir}/* %{buildroot}%{gemdir}

# only needed for building 
rm -rf %{buildroot}%{gemdir}/gems/xmlparser-0.6.81/ext

# Arch dependent files go here
mkdir -p %{buildroot}%{ruby_sitearch}

# for this package the .so file need to be in the ruby_sitearch directory (rather than %{ruby_sitearch}/lib) else the library is not found
mv %{buildroot}%{geminstdir}/lib/xmlparser.so %{buildroot}%{ruby_sitearch}

%clean
rm -rf %{buildroot}


%files
%defattr(-, root, root, -)
%{ruby_sitearch}/xmlparser.so
%dir %{gemdir}/gems/%{gemname}-%{version}/
%doc %{gemdir}/gems/%{gemname}-%{version}/[A-Z]*
%{gemdir}/gems/%{gemname}-%{version}/lib
%{gemdir}/cache/%{gemname}-%{version}.gem
%{gemdir}/specifications/%{gemname}-%{version}.gemspec

%changelog
* Tue Mar 06 2012 Ulrich Schwickerath <ulrich.schwickerath@web.de> - 0.6.81-9
- replace build requirement for ruby-libs by ruby 

* Wed Dec 07 2011 Ulrich Schwickerath <ulrich.schwickerath@web.de> - 0.6.81-8
- remove the link to xmlparser.so and move it to  %{ruby_sitearch}

* Wed Dec 07 2011 Ulrich Schwickerath <ulrich.schwickerath@web.de> - 0.6.81-7
- fix for /usr/lib/ruby/gems/1.8/gems/xmlparser-0.6.81 should be owned by the package
- fix installation path for .so files
- add dependency on ruby-libs which owns the %{ruby_sitearch} directory

* Wed Jul 12 2011 Ulrich Schwickerath <ulrich.schwickerath@web.de> - 0.6.81-6
- add more details about licensing

* Wed Jul 12 2011 Ulrich Schwickerath <ulrich.schwickerath@web.de> - 0.6.81-5
- specify
- fix format of changelog
- remove ruby-sitelib

* Tue Jul 11 2011 Ulrich Schwickerath <ulrich.schwickerath@web.de> - 0.6.81-4
- cleaner way to treat SOURCE
- remove explicit dependency on expat
- make globals conditional

* Mon Jul 10 2011 Ulrich Schwickerath <ulrich.schwickerath@web.de> - 0.6.81-3
- fix build problems 

* Sat Jul 08 2011 Ulrich Schwickerath <ulrich.schwickerath@web.de> - 0.6.81-2
- add dependencies

* Wed Jul 06 2011 Ulrich Schwickerath <ulrich.schwickerath@web.de> - 0.6.81-1
- Initial package from gem2rpm