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