]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
5 | %define pkgname ffi | |
6 | Summary: FFI Extensions for Ruby | |
7 | Summary(pl.UTF-8): Rozszerzenia FFI dla języka Ruby | |
8 | Name: ruby-%{pkgname} | |
9 | Version: 1.9.6 | |
10 | Release: 1 | |
11 | License: BSD | |
12 | Group: Development/Languages | |
13 | Source0: http://rubygems.org/gems/%{pkgname}-%{version}.gem | |
14 | # Source0-md5: 8606c263037322ae957e1959245841be | |
15 | Patch0: %{name}-platform.patch | |
16 | URL: http://wiki.github.com/ffi/ffi | |
17 | BuildRequires: libffi-devel | |
18 | BuildRequires: rpm-rubyprov | |
19 | BuildRequires: rpmbuild(macros) >= 1.665 | |
20 | BuildRequires: ruby-devel | |
21 | BuildRequires: setup.rb | |
22 | %if %{with tests} | |
23 | BuildRequires: ruby-rspec | |
24 | BuildRequires: ruby-rspec-mocks | |
25 | %endif | |
26 | ExclusiveArch: %{ix86} %{x8664} arm ia64 mips mipsel ppc s390 s390x sparc sparcv9 | |
27 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
28 | ||
29 | %description | |
30 | Ruby-FFI is a Ruby extension for programmatically loading dynamic | |
31 | libraries, binding functions within them, and calling those functions | |
32 | from Ruby code. Moreover, a Ruby-FFI extension works without changes | |
33 | on Ruby and JRuby. Discover why should you write your next extension | |
34 | using Ruby-FFI here: <http://wiki.github.com/ffi/ffi/why-use-ffi>. | |
35 | ||
36 | %description -l pl.UTF-8 | |
37 | Ruby-FFI to rozszerzenie języka Ruby do programowego ładowania | |
38 | bibliotek dynamicznych, wiązania obecnych w nich funkcji oraz | |
39 | wywoływania tych funkcji z kodu w języku Ruby. Co więcej, rozszerzenie | |
40 | Ruby-FFI działa bez zmian w implementacji Ruby oraz JRuby. Informacje, | |
41 | dlaczego nowe rozszerzenia powinny używać Ruby-FFI, można znaleźć na | |
42 | stronie <http://wiki.github.com/ffi/ffi/why-use-ffi>. | |
43 | ||
44 | %prep | |
45 | %setup -q -n %{pkgname}-%{version} | |
46 | %patch0 -p1 | |
47 | ||
48 | # be sure to use system ffi | |
49 | %{__rm} -r ext/ffi_c/libffi | |
50 | ||
51 | # drop not our targets | |
52 | %{__rm} -r lib/ffi/platform/*-{aix,cygwin,darwin,gnu,*bsd,solaris,windows} | |
53 | # provide only definitions for package architecture | |
54 | %ifnarch arm | |
55 | %{__rm} -r lib/ffi/platform/arm-* | |
56 | %endif | |
57 | %ifnarch %{ix86} | |
58 | %{__rm} -r lib/ffi/platform/i386-* | |
59 | %endif | |
60 | %ifnarch ia64 | |
61 | %{__rm} -r lib/ffi/platform/ia64-* | |
62 | %endif | |
63 | %ifnarch mips | |
64 | %{__rm} -r lib/ffi/platform/mips-* | |
65 | %endif | |
66 | %ifnarch mipsel | |
67 | %{__rm} -r lib/ffi/platform/mipsel-* | |
68 | %endif | |
69 | %ifnarch powerpc | |
70 | %{__rm} -r lib/ffi/platform/powerpc-* | |
71 | %endif | |
72 | %ifnarch s390 | |
73 | %{__rm} -r lib/ffi/platform/s390-* | |
74 | %endif | |
75 | %ifnarch s390x | |
76 | %{__rm} -r lib/ffi/platform/s390x-* | |
77 | %endif | |
78 | %ifnarch sparc | |
79 | %{__rm} -r lib/ffi/platform/sparc-* | |
80 | %endif | |
81 | %ifnarch %{x8664} | |
82 | %{__rm} -r lib/ffi/platform/x86_64-* | |
83 | %endif | |
84 | ||
85 | # ext build | |
86 | cp -p %{_datadir}/setup.rb . | |
87 | ||
88 | %build | |
89 | %__gem_helper spec | |
90 | ||
91 | %{__ruby} setup.rb config \ | |
92 | --rbdir=%{ruby_rubylibdir} \ | |
93 | --sodir=%{ruby_archdir} \ | |
94 | --makeprog=true | |
95 | ||
96 | %{__ruby} setup.rb setup | |
97 | ||
98 | %{__make} -C ext/ffi_c \ | |
99 | CC="%{__cc}" | |
100 | ||
101 | %if %{with tests} | |
102 | %{__make} -f libtest/GNUmakefile \ | |
103 | CCACHE= \ | |
104 | CC="%{__cc}" | |
105 | ruby -Ilib:ext/ffi_c -S \ | |
106 | rspec spec | |
107 | %endif | |
108 | ||
109 | %install | |
110 | rm -rf $RPM_BUILD_ROOT | |
111 | install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_vendorarchdir}/ffi,%{ruby_specdir}} | |
112 | cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir} | |
113 | install -p ext/ffi_c/ffi_c.so $RPM_BUILD_ROOT%{ruby_vendorarchdir} | |
114 | %{__mv} $RPM_BUILD_ROOT%{ruby_vendorlibdir}/ffi/platform $RPM_BUILD_ROOT%{ruby_vendorarchdir}/ffi | |
115 | cp -p %{pkgname}-%{version}.gemspec $RPM_BUILD_ROOT%{ruby_specdir} | |
116 | ||
117 | %clean | |
118 | rm -rf $RPM_BUILD_ROOT | |
119 | ||
120 | %files | |
121 | %defattr(644,root,root,755) | |
122 | %doc README.md LICENSE | |
123 | %{ruby_vendorlibdir}/ffi.rb | |
124 | %{ruby_vendorlibdir}/ffi | |
125 | %attr(755,root,root) %{ruby_vendorarchdir}/ffi_c.so | |
126 | %dir %{ruby_vendorarchdir}/ffi | |
127 | %{ruby_vendorarchdir}/ffi/platform | |
128 | %{ruby_specdir}/%{pkgname}-%{version}.gemspec |