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