]>
Commit | Line | Data |
---|---|---|
a3cad48c ER |
1 | # TODO |
2 | # - separate subpackages for C extension and FFI extension? | |
3 | # - package bench as subpackage? | |
895d5e01 ER |
4 | # |
5 | # Conditional build: | |
6 | %bcond_with tests # build without tests | |
7 | ||
8 | %define pkgname ffi-yajl | |
9 | Summary: Ruby FFI wrapper around YAJL 2.x | |
10 | Name: ruby-%{pkgname} | |
183978c8 ER |
11 | Version: 1.3.0 |
12 | Release: 1 | |
895d5e01 ER |
13 | License: Apache v2.0 |
14 | Group: Development/Languages | |
15 | Source0: http://rubygems.org/downloads/%{pkgname}-%{version}.gem | |
183978c8 | 16 | # Source0-md5: fc49fe091cd622b75924c8dfa23fe806 |
8df45b88 | 17 | Patch0: system-yajl.patch |
895d5e01 ER |
18 | URL: http://github.com/opscode/ffi-yajl |
19 | BuildRequires: rpm-rubyprov | |
20 | BuildRequires: rpmbuild(macros) >= 1.656 | |
21 | BuildRequires: ruby-devel | |
22 | BuildRequires: sed >= 4.0 | |
23 | %if %{with tests} | |
24 | BuildRequires: ruby-mime-types < 2 | |
25 | BuildRequires: ruby-mime-types >= 1.16 | |
26 | BuildRequires: ruby-pry < 1 | |
27 | BuildRequires: ruby-pry >= 0.9 | |
28 | BuildRequires: ruby-rake < 11 | |
29 | BuildRequires: ruby-rake >= 10.1 | |
30 | BuildRequires: ruby-rake-compiler < 0.9 | |
31 | BuildRequires: ruby-rake-compiler >= 0.8.3 | |
32 | BuildRequires: ruby-rspec < 3 | |
33 | BuildRequires: ruby-rspec >= 2.99 | |
34 | %endif | |
35 | Requires: ruby-ffi < 2 | |
36 | Requires: ruby-ffi >= 1.5 | |
8df45b88 ER |
37 | # libyajl.so.2 opened by FFI |
38 | Requires: yajl >= 2.0 | |
895d5e01 ER |
39 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
40 | ||
41 | %description | |
42 | Ruby FFI wrapper around YAJL 2.x | |
43 | ||
44 | %prep | |
45 | %setup -q -n %{pkgname}-%{version} | |
8df45b88 | 46 | %patch0 -p1 |
895d5e01 ER |
47 | %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* |
48 | ||
a3cad48c | 49 | %build |
35720359 ER |
50 | # write .gemspec |
51 | %__gem_helper spec | |
52 | ||
fd409597 ER |
53 | # provided by rpm deps |
54 | %{__sed} -i -e '/libyajl2/d' %{pkgname}-%{version}.gemspec | |
55 | ||
a3cad48c ER |
56 | cd ext/ffi_yajl/ext/encoder |
57 | %{__ruby} extconf.rb | |
58 | %{__make} V=1 \ | |
59 | CC="%{__cc}" \ | |
60 | LDFLAGS="%{rpmldflags}" \ | |
61 | CFLAGS="%{rpmcflags} -fPIC" | |
62 | ||
63 | cd ../parser | |
64 | %{__ruby} extconf.rb | |
65 | %{__make} V=1 \ | |
66 | CC="%{__cc}" \ | |
67 | LDFLAGS="%{rpmldflags}" \ | |
68 | CFLAGS="%{rpmcflags} -fPIC" | |
69 | ||
895d5e01 ER |
70 | %install |
71 | rm -rf $RPM_BUILD_ROOT | |
35720359 | 72 | install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir},%{_bindir}} |
895d5e01 ER |
73 | cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir} |
74 | cp -a bin/* $RPM_BUILD_ROOT%{_bindir} | |
35720359 | 75 | cp -p %{pkgname}-%{version}.gemspec $RPM_BUILD_ROOT%{ruby_specdir} |
895d5e01 | 76 | |
a3cad48c ER |
77 | install -d $RPM_BUILD_ROOT%{ruby_vendorarchdir}/ffi_yajl/ext/{encoder,parser} |
78 | install -p ext/ffi_yajl/ext/parser/parser.so $RPM_BUILD_ROOT%{ruby_vendorarchdir}/ffi_yajl/ext/parser | |
79 | install -p ext/ffi_yajl/ext/encoder/encoder.so $RPM_BUILD_ROOT%{ruby_vendorarchdir}/ffi_yajl/ext/encoder | |
80 | ||
895d5e01 ER |
81 | %{__rm} $RPM_BUILD_ROOT%{ruby_vendorlibdir}/ffi_yajl/benchmark.rb |
82 | %{__rm} -r $RPM_BUILD_ROOT%{ruby_vendorlibdir}/ffi_yajl/benchmark | |
83 | %{__rm} $RPM_BUILD_ROOT%{_bindir}/ffi-yajl-bench | |
84 | %{__rm} $RPM_BUILD_ROOT%{ruby_vendorlibdir}/ffi_yajl/ext/.keep | |
85 | ||
86 | %clean | |
87 | rm -rf $RPM_BUILD_ROOT | |
88 | ||
89 | %files | |
90 | %defattr(644,root,root,755) | |
91 | %{ruby_vendorlibdir}/ffi_yajl.rb | |
92 | %dir %{ruby_vendorlibdir}/ffi_yajl | |
93 | %{ruby_vendorlibdir}/ffi_yajl/encoder.rb | |
94 | %{ruby_vendorlibdir}/ffi_yajl/ext.rb | |
95 | %{ruby_vendorlibdir}/ffi_yajl/ffi.rb | |
96 | %{ruby_vendorlibdir}/ffi_yajl/json_gem.rb | |
97 | %{ruby_vendorlibdir}/ffi_yajl/parser.rb | |
98 | %{ruby_vendorlibdir}/ffi_yajl/version.rb | |
895d5e01 ER |
99 | %dir %{ruby_vendorlibdir}/ffi_yajl/ffi |
100 | %{ruby_vendorlibdir}/ffi_yajl/ffi/encoder.rb | |
101 | %{ruby_vendorlibdir}/ffi_yajl/ffi/parser.rb | |
35720359 | 102 | %{ruby_specdir}/%{pkgname}-%{version}.gemspec |
a3cad48c ER |
103 | |
104 | # ext | |
105 | %dir %{ruby_vendorarchdir}/ffi_yajl | |
106 | %dir %{ruby_vendorarchdir}/ffi_yajl/ext | |
107 | %dir %{ruby_vendorarchdir}/ffi_yajl/ext/encoder | |
108 | %dir %{ruby_vendorarchdir}/ffi_yajl/ext/parser | |
109 | %attr(755,root,root) %{ruby_vendorarchdir}/ffi_yajl/ext/parser/parser.so | |
110 | %attr(755,root,root) %{ruby_vendorarchdir}/ffi_yajl/ext/encoder/encoder.so |