Sync common code between configure.ac files
[xapian.git] / xapian-bindings / xapian-bindings.spec.in
bloba52ff992534fca1d07098e4a47a4defee44a09b1
1 # RedHat-style .spec file for Xapian
2 # @configure_input@
4 # If you don't want to try building packages for all the supported bindings,
5 # you can disable particular bindings by passing these options to rpmbuild:
7 # --without csharp Disable C# bindings
8 # --without perl Disable Perl bindings
9 # --without php Disable PHP bindings
10 # --without python Disable Python bindings
11 # --without ruby Disable Ruby bindings
12 # --without tcl8 Disable Tcl8 bindings
14 %if 0%{?!_without_python:1}
15 %define python_ver %(%{__python} -c "import sys; print sys.version[:3]")
16 %endif
18 %if 0%{?!_without_php:1}
19 %define php_extension_dir %(php-config --extension-dir)
20 %endif
22 %if 0%{?!_without_ruby:1}
23 %define ruby_ver %(ruby -e "print RUBY_VERSION")
24 %endif
26 %if 0%{?!_without_tcl8:1}
27 %define tcl_lib %(echo 'foreach d $tcl_pkgPath {if {![regexp {/share(/|$)} $d]} {break}};puts $d'|tclsh)
28 %endif
30 %if 0%{?!_without_perl:1}
31 %define perl_lib %(%{__perl} -MConfig -e 'print $Config{installsitelib}')
32 %define perl_arch %(%{__perl} -MConfig -e 'print $Config{installsitearch}')
33 %endif
35 Summary: Bindings for the Xapian Search Engine Library
36 Name: xapian-bindings
37 Version: @VERSION@
38 Release: 1
39 License: GPL
40 Vendor: xapian.org
41 Group: Development/Libraries
42 URL: https://xapian.org/
43 Requires: xapian-core-libs = %{version}
44 %if 0%{?!_without_python:1}
45 BuildRequires: python-devel >= 2.3
46 %endif
47 %if 0%{?!_without_php:1}
48 BuildRequires: php-devel >= 5.0
49 %endif
50 %if 0%{?!_without_ruby:1}
51 BuildRequires: ruby-devel >= 1.8
52 %endif
53 %if 0%{?!_without_tcl8:1}
54 BuildRequires: tcl-devel >= 8.1
55 %endif
56 %if 0%{?!_without_csharp:1}
57 BuildRequires: mono-devel >= 1.1
58 %endif
59 %if 0%{?!_without_perl:1}
60 # https://fedoraproject.org/wiki/Packaging:Perl
61 # perl-devel doesn't exist on RHEL 5 so use ExtUtils::MakeMaker for perl.h
62 BuildRequires: perl(ExtUtils::MakeMaker)
63 %endif
64 BuildRequires: autoconf automake libtool
65 Source0: https://oligarchy.co.uk/xapian/%{version}/%{name}-%{version}.tar.xz
66 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
68 %description
69 Xapian is a highly adaptable toolkit which allows developers to easily
70 add advanced indexing and search facilities to their own applications.
71 It has built-in support for several families of weighting models and
72 also supports a rich set of boolean query operators.
74 This package provides the files needed for scripts which use Xapian.
76 %if 0%{?!_without_ruby:1}
77 %package ruby
78 Group: Development/Libraries
79 Summary: Files needed for Ruby scripts which use Xapian.
80 Requires: %{name} = %{version}, ruby >= %{ruby_ver}
82 %description ruby
83 Xapian is a highly adaptable toolkit which allows developers to easily
84 add advanced indexing and search facilities to their own applications.
85 It has built-in support for several families of weighting models and
86 also supports a rich set of boolean query operators.
88 This package provides the files needed for developing and running
89 Ruby scripts which use Xapian.
90 %endif
92 %if 0%{?!_without_python:1}
93 %package python
94 Group: Development/Libraries
95 Summary: Files needed for Python scripts which use Xapian.
96 Requires: %{name} = %{version}, python >= %{python_ver}
98 %description python
99 Xapian is a highly adaptable toolkit which allows developers to easily
100 add advanced indexing and search facilities to their own applications.
101 It has built-in support for several families of weighting models and
102 also supports a rich set of boolean query operators.
104 This package provides the files needed for developing and running
105 Python scripts which use Xapian.
106 %endif
108 %if 0%{?!_without_php:1}
109 %package php
110 Group: Development/Libraries
111 Summary: Files needed for PHP scripts which use Xapian.
112 Requires: %{name} = %{version}, php
114 %description php
115 Xapian is a highly adaptable toolkit which allows developers to easily
116 add advanced indexing and search facilities to their own applications.
117 It has built-in support for several families of weighting models and
118 also supports a rich set of boolean query operators.
120 This package provides the files needed for developing and running
121 PHP scripts which use Xapian.
122 %endif
124 %if 0%{?!_without_tcl8:1}
125 %package tcl8
126 Group: Development/Libraries
127 Summary: Files needed for Tcl scripts which use Xapian.
128 Requires: %{name} = %{version}, tcl
130 %description tcl8
131 Xapian is a highly adaptable toolkit which allows developers to easily
132 add advanced indexing and search facilities to their own applications.
133 It has built-in support for several families of weighting models and
134 also supports a rich set of boolean query operators.
136 This package provides the files needed for developing and running
137 Tcl scripts which use Xapian.
138 %endif
140 %if 0%{?!_without_csharp:1}
141 %package csharp
142 Group: Development/Libraries
143 Summary: Files needed for C# applications which use Xapian.
144 Requires: %{name} = %{version}, mono-core
146 %description csharp
147 Xapian is a highly adaptable toolkit which allows developers to easily
148 add advanced indexing and search facilities to their own applications.
149 It has built-in support for several families of weighting models and
150 also supports a rich set of boolean query operators.
152 This package provides the files needed for developing and running
153 C# applications which use Xapian.
154 %endif
156 %if 0%{?!_without_perl:1}
157 %package perl
158 Group: Development/Libraries
159 Summary: Files needed for Perl applications which use Xapian.
160 Requires: %{name} = %{version}
161 Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
162 Requires: perl(Exporter) perl(DynaLoader)
164 %description perl
165 Xapian is a highly adaptable toolkit which allows developers to easily
166 add advanced indexing and search facilities to their own applications.
167 It has built-in support for several families of weighting models and
168 also supports a rich set of boolean query operators.
170 This package provides the files needed for developing and running
171 Perl applications which use Xapian.
172 %endif
174 %prep
175 %setup -q -n %{name}-%{version}
177 %build
178 # As of 1.1.0, Xapian uses libtool 2.2.x which allows us to override libtool's
179 # sometimes conservative take on which directories are in the default dynamic
180 # linker search path, so we no longer incorrectly try to set rpath for
181 # /usr/lib64. Hence there's no longer a need to run "autoreconf --force" here
182 # and it's better not to as it avoids having to cope with incompatibilities
183 # with older versions of the autotools which older distros have.
184 #autoreconf --force
185 # Only build the bindings we want.
186 %configure %{?!_without_python:--with-python} %{?!_without_php:--with-php} %{?!_without_tcl8:--with-tcl} %{?!_without_csharp:--with-csharp} %{?!_without_ruby:--with-ruby} %{?!_without_perl:--with-perl}
187 make
189 %install
190 [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
191 mkdir -p %{buildroot}
192 # Installation of some files does not obey prefix, so use make install with
193 # DESTDIR instead of makeinstall.
194 make install DESTDIR=%{buildroot}
195 # Move the docs to the right places.
196 %{?!_without_python: mv %{buildroot}%{_datadir}/doc/%{name}/python %{buildroot}%{_datadir}/doc/%{name}-python-%{version}}
197 %{?!_without_php: mv %{buildroot}%{_datadir}/doc/%{name}/php %{buildroot}%{_datadir}/doc/%{name}-php-%{version}}
198 %{?!_without_php: [ -d "%{buildroot}%{_datadir}/php5" ] && mv %{buildroot}%{_datadir}/php5 %{buildroot}%{_datadir}/php}
199 %{?!_without_tcl8: mv %{buildroot}%{_datadir}/doc/%{name}/tcl8 %{buildroot}%{_datadir}/doc/%{name}-tcl8-%{version}}
200 %{?!_without_csharp: mv %{buildroot}%{_datadir}/doc/%{name}/csharp %{buildroot}%{_datadir}/doc/%{name}-csharp-%{version}}
202 %clean
203 [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
205 %files
206 %defattr(-, root, root)
207 # There are no common files at the moment
208 %doc AUTHORS ChangeLog COPYING NEWS README
210 %if 0%{?!_without_python:1}
211 %files python
212 %defattr(-, root, root)
213 %{_libdir}/python%{python_ver}/site-packages/xapian/_xapian.so
214 %{_libdir}/python%{python_ver}/site-packages/xapian/__init__.py
215 %{_libdir}/python%{python_ver}/site-packages/xapian/__init__.pyc
216 %ghost %{_libdir}/python%{python_ver}/site-packages/xapian/__init__.pyo
217 %doc %{_datadir}/doc/%{name}-python-%{version}
218 %endif
220 %if 0%{?!_without_php:1}
221 %files php
222 %defattr(-, root, root)
223 %{php_extension_dir}/xapian.so
224 %{_datadir}/php/xapian.php
225 %doc %{_datadir}/doc/%{name}-php-%{version}
226 %endif
228 %if 0%{?!_without_ruby:1}
229 %files ruby
230 %defattr(-, root, root)
231 %{_libdir}/ruby
232 /usr/lib/ruby
233 %defattr(0644, root, root)
234 %{_docdir}/xapian-bindings/ruby/
235 %endif
237 %if 0%{?!_without_tcl8:1}
238 %files tcl8
239 %defattr(-, root, root)
240 %{tcl_lib}/xapian%{version}
241 %doc %{_datadir}/doc/%{name}-tcl8-%{version}
242 %endif
244 %if 0%{?!_without_csharp:1}
245 %files csharp
246 %defattr(-, root, root)
247 %{_libdir}/_XapianSharp.so
248 %{_libdir}/mono/XapianSharp
249 %{_libdir}/mono/gac/XapianSharp
250 %doc %{_datadir}/doc/%{name}-csharp-%{version}
251 %endif
253 %if 0%{?!_without_perl:1}
254 %files perl
255 %defattr(-, root, root)
256 %{perl_arch}/auto/Xapian/Xapian.so
257 %{perl_lib}/Xapian.pm
258 %{perl_lib}/Xapian
259 %doc %{_datadir}/doc/%{name}/perl
260 %endif