3 %bcond_without tests # build without tests
5 %define gem_name bson_ext
6 Summary: C extensions for Ruby BSON
11 Group: Development/Languages
12 Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
13 # Source0-md5: 5360798f3d7d94d65be6c19aeacfc91f
14 # git clone http://github.com/mongodb/mongo-ruby-driver.git && cd mongo-ruby-driver/
16 # tar czvf bson_ext-1.6.4-tests.tgz test/bson/ test/support/
17 Source1: %{gem_name}-%{version}-tests.tgz
18 URL: http://www.mongodb.org/display/DOCS/BSON
19 BuildRequires: rpm-rubyprov
20 BuildRequires: rpmbuild(macros) >= 1.656
21 BuildRequires: ruby-devel
22 BuildRequires: setup.rb
24 BuildRequires: ruby-bson >= 1.4.0
25 BuildRequires: ruby-json
26 BuildRequires: ruby-minitest
28 Requires: ruby-bson >= 1.4.0
29 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
32 C extensions to accelerate the Ruby BSON serialization. For more
33 information about BSON, see <http://bsonspec.org>. For information
34 about MongoDB, see <http://www.mongodb.org>.
37 Summary: Documentation for %{name}
39 Requires: %{name} = %{version}-%{release}
42 Documentation for %{name}
45 %setup -q -n %{gem_name}-%{version} -a1
46 cp -p %{_datadir}/setup.rb .
49 %{__ruby} setup.rb config
50 %{__make} V=1 -C ext/cbson \
54 # Run the test suite with minitest.
55 # https://jira.mongodb.org/browse/RUBY-465
56 sed -i "/gem 'test-unit'/ d" test/bson/test_helper.rb
58 # Remove the inclusion of bson (absolute path that doesn't exist) and rather require it while running ruby
59 sed -i "/require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'bson')/d" test/bson/test_helper.rb
61 # Test suite fails on i386 :/
62 # https://jira.mongodb.org/browse/RUBY-466
63 ruby -Iext -e "require 'bson'; Dir.glob('./test/bson/*_test.rb').each {|t| require t}" || :
67 rm -rf $RPM_BUILD_ROOT
68 install -d $RPM_BUILD_ROOT%{ruby_vendorarchdir}
69 install -p ext/cbson/cbson.so $RPM_BUILD_ROOT%{ruby_vendorarchdir}
72 rm -rf $RPM_BUILD_ROOT
75 %defattr(644,root,root,755)
76 %attr(755,root,root) %{ruby_vendorarchdir}/cbson.so