]> git.pld-linux.org Git - SPECS.git/blob - ruby-ffi.spec
SPECS updated Tue 30 Apr 15:06:09 CEST 2024
[SPECS.git] / ruby-ffi.spec
1 #
2 # Conditional build:
3 %bcond_without  tests   # testing
4
5 %define ffi_req 7:3.2
6 %define pkgname ffi
7 Summary:        FFI Extensions for Ruby
8 Summary(pl.UTF-8):      Rozszerzenia FFI dla języka Ruby
9 Name:           ruby-%{pkgname}
10 Version:        1.15.5
11 Release:        1
12 License:        BSD
13 Group:          Development/Languages
14 Source0:        http://rubygems.org/gems/%{pkgname}-%{version}.gem
15 # Source0-md5:  026cce18ef8ffc713be29c2ffc9d335b
16 Patch0:         %{name}-platform.patch
17 Patch1:         ffi-x32.patch
18 URL:            https://wiki.github.com/ffi/ffi
19 BuildRequires:  libffi-devel >= %{ffi_req}
20 BuildRequires:  rpm-rubyprov
21 BuildRequires:  rpmbuild(macros) >= 1.665
22 BuildRequires:  ruby-devel
23 %if %{with tests}
24 BuildRequires:  ruby-rspec
25 BuildRequires:  ruby-rspec-mocks
26 %endif
27 Requires:       libffi >= %{ffi_req}
28 ExclusiveArch:  %{ix86} %{x8664} x32 aarch64 %{arm} ia64 mips mipsel mips64 mips64el powerpc64 powerpc64le ppc s390 s390x riscv64 sparc sparcv9 sparc64
29 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
31 %description
32 Ruby-FFI is a Ruby extension for programmatically loading dynamic
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
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
46 %prep
47 %setup -q -n %{pkgname}-%{version}
48 %patch0 -p1
49 %patch1 -p1
50
51 # be sure to use system ffi
52 %{__rm} -r ext/ffi_c/libffi
53
54 # drop not our targets
55 %{__rm} -r lib/ffi/platform/*-{aix,cygwin,darwin,freebsd12,*bsd,gnu,haiku,msys,solaris,windows}
56 # provide only definitions for package architecture
57 %ifnarch aarch64
58 %{__rm} -r lib/ffi/platform/aarch64-*
59 %endif
60 %ifnarch %{arm}
61 %{__rm} -r lib/ffi/platform/arm-*
62 %endif
63 %ifnarch %{ix86}
64 %{__rm} -r lib/ffi/platform/i386-*
65 %endif
66 %ifnarch ia64
67 %{__rm} -r lib/ffi/platform/ia64-*
68 %endif
69 %ifnarch mips
70 %{__rm} -r lib/ffi/platform/mips-*
71 %{__rm} -r lib/ffi/platform/mipsisa32r6-*
72 %endif
73 %ifnarch mipsel
74 %{__rm} -r lib/ffi/platform/mipsel-*
75 %{__rm} -r lib/ffi/platform/mipsisa32r6el-*
76 %endif
77 %ifnarch mips64
78 %{__rm} -r lib/ffi/platform/mips64-*
79 %{__rm} -r lib/ffi/platform/mipsisa64r6-*
80 %endif
81 %ifnarch mips64el
82 %{__rm} -r lib/ffi/platform/mips64el-*
83 %{__rm} -r lib/ffi/platform/mipsisa64r6el-*
84 %endif
85 %ifnarch powerpc
86 %{__rm} -r lib/ffi/platform/powerpc-*
87 %endif
88 %ifnarch powerpc64
89 %{__rm} -r lib/ffi/platform/powerpc64-*
90 %endif
91 %ifnarch powerpc64le
92 %{__rm} -r lib/ffi/platform/powerpc64le-*
93 %endif
94 %ifnarch s390
95 %{__rm} -r lib/ffi/platform/s390-*
96 %endif
97 %ifnarch s390x
98 %{__rm} -r lib/ffi/platform/s390x-*
99 %endif
100 %ifnarch riscv64
101 %{__rm} -r lib/ffi/platform/riscv64-*
102 %endif
103 %ifnarch sparc sparcv9
104 %{__rm} -r lib/ffi/platform/sparc-*
105 %endif
106 %ifnarch sparc64
107 %{__rm} -r lib/ffi/platform/sparc64-*
108 %endif
109 %ifnarch %{x8664}
110 %{__rm} -r lib/ffi/platform/x86_64-linux
111 %endif
112 %ifnarch x32
113 %{__rm} -r lib/ffi/platform/x86_64-linux-gnux32
114 %endif
115
116 # cleanup backups after patching
117 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
118
119 %{__tar} xf %{SOURCE0} metadata.gz
120
121 %build
122 %__gem_helper spec
123
124 cd ext/ffi_c
125 %{__ruby} extconf.rb
126 %{__make} \
127         CC="%{__cc}" \
128         ldflags="%{rpmldflags}" \
129         optflags="%{rpmcflags} -fPIC"
130 cd -
131
132 %if %{with tests}
133 ruby -Ilib:ext/ffi_c -S \
134         rspec spec
135 %endif
136
137 %install
138 rm -rf $RPM_BUILD_ROOT
139 install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_vendorarchdir}/ffi,%{ruby_specdir}}
140 cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir}
141 install -p ext/ffi_c/ffi_c.so $RPM_BUILD_ROOT%{ruby_vendorarchdir}
142 %{__mv} $RPM_BUILD_ROOT%{ruby_vendorlibdir}/ffi/platform $RPM_BUILD_ROOT%{ruby_vendorarchdir}/ffi
143 cp -p %{pkgname}-%{version}.gemspec $RPM_BUILD_ROOT%{ruby_specdir}
144
145 %clean
146 rm -rf $RPM_BUILD_ROOT
147
148 %files
149 %defattr(644,root,root,755)
150 %doc README.md LICENSE
151 %{ruby_vendorlibdir}/ffi.rb
152 %{ruby_vendorlibdir}/ffi
153 %attr(755,root,root) %{ruby_vendorarchdir}/ffi_c.so
154 %dir %{ruby_vendorarchdir}/ffi
155 %{ruby_vendorarchdir}/ffi/platform
156 %{ruby_specdir}/%{pkgname}-%{version}.gemspec
This page took 0.292789 seconds and 3 git commands to generate.