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