cd56c6744594e7dc108e39db3d04580d0087fba2
[platform/upstream/libsolv.git] / package / libsolv.spec.in
1 #
2 # spec file for package libsolv
3 #
4 # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
5 #
6 # All modifications and additions to the file contributed by third parties
7 # remain the property of their copyright owners, unless otherwise agreed
8 # upon. The license for this file, and modifications and additions to the
9 # file, is the same license as for the pristine package itself (unless the
10 # license for the pristine package is not an Open Source License, in which
11 # case the license is the MIT License). An "Open Source License" is a
12 # license that conforms to the Open Source Definition (Version 1.9)
13 # published by the Open Source Initiative.
14
15 # Please submit bugfixes or comments via http://bugs.opensuse.org/
16 #
17
18 %define libname libsolv@LIBSOLV_SOVERSION@
19
20 %if 0%{?sle_version} >= 120300 || 0%{?suse_version} >= 1330 || !0%{?suse_version}
21 %bcond_without bz2
22 %bcond_without xz
23 %else
24 %bcond_with bz2
25 %bcond_with xz
26 %endif
27 %if 0%{?is_opensuse} && (0%{?sle_version} >= 150000 || 0%{?suse_version} >= 1500)
28 %bcond_without zstd
29 %else
30 %bcond_with zstd
31 %endif
32 %if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?mageia} >= 6 || 0%{?suse_version} >= 1330
33 %bcond_without richdeps
34 %else
35 %bcond_with richdeps
36 %endif
37 # we need at least swig 1.3.40 for the bindings ($typemap support)
38 %if 0%{?suse_version} != 1110
39 %bcond_without python3
40 %bcond_without python
41 %bcond_without ruby
42 %bcond_without perl
43 %else
44 %bcond_with python3
45 %bcond_with python
46 %bcond_with ruby
47 %bcond_with perl
48 %endif
49 %bcond_without static
50 %bcond_with shared
51 %bcond_with zypp
52
53 Name:           libsolv
54 Version:        @VERSION@
55 Release:        0
56 Summary:        Package dependency solver using a satisfiability algorithm
57 License:        BSD-3-Clause
58 Group:          Development/Libraries/C and C++
59 Url:            https://github.com/openSUSE/libsolv
60 Source:         libsolv-%{version}.tar.bz2
61 BuildRequires:  cmake
62 BuildRequires:  gcc-c++
63 BuildRequires:  libxml2-devel
64 BuildRequires:  rpm-devel
65 BuildRequires:  zlib-devel
66 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
67
68 %if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
69 BuildRequires:  db-devel
70 %endif
71
72 %if %{with perl}
73 BuildRequires:  perl
74 %if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
75 BuildRequires:  perl-devel
76 %endif
77 BuildRequires:  swig
78 %endif
79
80 %if %{with ruby}
81 %global ruby_vendorarch %(ruby  -r rbconfig -e "puts RbConfig::CONFIG['vendorarchdir'].nil? ? RbConfig::CONFIG['sitearchdir'] : RbConfig::CONFIG['vendorarchdir']")
82 BuildRequires:  ruby
83 BuildRequires:  ruby-devel
84 BuildRequires:  swig
85 %endif
86
87 %if %{with python}
88 %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
89 BuildRequires:  python-devel
90 BuildRequires:  swig
91 %endif
92
93 %if %{with python3}
94 %global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
95 BuildRequires:  python3-devel
96 BuildRequires:  swig
97 %endif
98
99 %if %{with bz2}
100 %if 0%{?suse_version}
101 BuildRequires:  libbz2-devel
102 %else
103 BuildRequires:  bzip2-devel
104 %endif
105 %endif
106
107 %if %{with xz}
108 BuildRequires:  xz-devel
109 %endif
110
111 %if %{with zstd}
112 BuildRequires:  libzstd-devel
113 %endif
114
115
116 %description
117 libsolv is a library for solving packages and reading repositories.
118 The solver uses a satisfiability algorithm.
119
120 %if %{with shared}
121 %package -n %{libname}
122 Summary:        Package dependency solver using a satisfiability algorithm
123 Group:          System/Libraries
124
125 %description -n %{libname}
126 libsolv is a library for solving packages and reading repositories.
127 It consists of two central blocks: Using a dictionary approach to
128 store and retrieve package and dependency information, and, using a
129 so-called satisfiability algorithm for resolving package
130 dependencies.
131
132 %endif
133 %package devel
134 Summary:        Development files for libsolv, a package solver
135 Group:          Development/Libraries/C and C++
136 %if %{with shared}
137 Requires:       %{libname} = %version
138 %endif
139 Requires:       rpm-devel
140 Conflicts:      libsatsolver-devel
141
142 %description devel
143 Development files for libsolv, a library for solving packages and
144 reading repositories.
145
146 %package tools
147 Summary:        Utilities to work with .solv files
148 Group:          System/Management
149 Conflicts:      satsolver-tools-obsolete
150 Obsoletes:      satsolver-tools < 0.18
151 Provides:       satsolver-tools = 0.18
152
153 %description tools
154 libsolv is a library for solving packages and reading repositories.
155
156 This subpackage contains utilities to create and work with the .solv
157 files used by libsolv.
158
159 %package demo
160 Summary:        Applications demoing the libsolv library
161 Group:          System/Management
162 Requires:       curl
163 Conflicts:      libsatsolver-demo
164 %if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
165 Requires:       gnupg2
166 %endif
167 %if 0%{?suse_version}
168 Requires:       gpg2
169 %endif
170
171 %description demo
172 Applications demoing the libsolv library.
173
174 %package -n ruby-solv
175 Summary:        Ruby bindings for the libsolv library
176 Group:          Development/Languages/Ruby
177
178 %description -n ruby-solv
179 Ruby bindings for libsolv.
180
181 %package -n python-solv
182 %if 0%{?py_requires:1} && %{with python}
183 %py_requires
184 %endif
185 Summary:        Python bindings for the libsolv library
186 Group:          Development/Languages/Python
187
188 %description -n python-solv
189 Python bindings for libsolv.
190
191 %package -n python3-solv
192 Summary:        Python3 bindings for the libsolv library
193 Group:          Development/Languages/Python
194
195 %description -n python3-solv
196 Python3 bindings for libsolv.
197
198 %package -n perl-solv
199 Summary:        Perl bindings for the libsolv library
200 Group:          Development/Languages/Perl
201 Requires:       perl = %{perl_version}
202
203 %description -n perl-solv
204 Perl bindings for libsolv.
205
206 %prep
207 %setup -q
208
209 %build
210 %global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
211 export CFLAGS="%{optflags}"
212 export CXXFLAGS="$CFLAGS"
213
214 CMAKE_FLAGS=
215 %if 0%{?fedora} || 0%{?rhel} >= 6
216 CMAKE_FLAGS="-DFEDORA=1"
217 %endif
218 %if 0%{?mageia}
219 CMAKE_FLAGS="-DMAGEIA=1"
220 %endif
221 %if 0%{?suse_version}
222 CMAKE_FLAGS="-DSUSE=1"
223 %endif
224
225 cmake . $CMAKE_FLAGS \
226         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
227         -DLIB=%{_lib} \
228         -DCMAKE_VERBOSE_MAKEFILE=TRUE \
229         -DCMAKE_BUILD_TYPE=RelWithDebInfo \
230         -DWITH_LIBXML2=1 \
231         -DENABLE_APPDATA=1 \
232         -DENABLE_COMPS=1 \
233         %{?with_static:-DENABLE_STATIC=1} \
234         %{!?with_shared:-DDISABLE_SHARED=1} \
235         %{?with_perl:-DENABLE_PERL=1} \
236         %{?with_python:-DENABLE_PYTHON=1} \
237         %{?with_python3:-DENABLE_PYTHON3=1} \
238         %{?with_ruby:-DENABLE_RUBY=1} \
239         %{?with_bz2:-DENABLE_BZIP2_COMPRESSION=1} \
240         %{?with_xz:-DENABLE_LZMA_COMPRESSION=1} \
241         %{?with_zstd:-DENABLE_ZSTD_COMPRESSION=1} \
242         %{?with_zstd:-DENABLE_ZCHUNK_COMPRESSION=1} \
243         %{?with_richdeps:-DENABLE_COMPLEX_DEPS=1} \
244         %{?with_zypp:-DENABLE_SUSEREPO=1 -DENABLE_HELIXREPO=1} \
245         -DUSE_VENDORDIRS=1 \
246         -DCMAKE_SKIP_RPATH=1
247 make %{?_smp_mflags}
248
249 %install
250 make DESTDIR=%{buildroot} install
251 ln -s repo2solv %{buildroot}/%{_bindir}/repo2solv.sh
252
253 %if 0%{?suse_version}
254 %if %{with python}
255 %py_compile -O %{buildroot}/%{python_sitearch}
256 %endif
257 %if %{with python3}
258 %py3_compile %{buildroot}/%{python3_sitearch}
259 %endif
260 %endif
261
262 %check
263 make ARGS=--output-on-failure test
264
265 %if %{with shared}
266 %post -n %{libname} -p /sbin/ldconfig
267
268 %postun -n %{libname} -p /sbin/ldconfig
269
270 %files -n %{libname}
271 %defattr(-,root,root)
272 %license LICENSE*
273 %{_libdir}/libsolv.so.*
274 %{_libdir}/libsolvext.so.*
275 %endif
276
277 %files tools
278 %defattr(-,root,root)
279 %if 0%{?suse_version}
280 %exclude %{_bindir}/helix2solv
281 %exclude %{_mandir}/man1/helix2solv*
282 %endif
283 %exclude %{_mandir}/man1/solv.1*
284 %exclude %{_bindir}/solv
285 %{_bindir}/*
286 %{_mandir}/man1/*
287
288 %files devel
289 %defattr(-,root,root)
290 %if %{with static}
291 %{_libdir}/libsolv.a
292 %{_libdir}/libsolvext.a
293 %endif
294 %if %{with shared}
295 %{_libdir}/libsolv.so
296 %{_libdir}/libsolvext.so
297 %endif
298 %{_includedir}/solv
299 %if 0%{?suse_version}
300 %{_bindir}/helix2solv
301 %{_mandir}/man1/helix2solv*
302 %endif
303 %{_datadir}/cmake/Modules/*
304 %{_libdir}/pkgconfig/libsolv*.pc
305 %{_mandir}/man3/*
306
307 %files demo
308 %defattr(-,root,root)
309 %{_bindir}/solv
310 %{_mandir}/man1/solv.1*
311
312 %if %{with perl}
313 %files -n perl-solv
314 %defattr(-,root,root)
315 %{perl_vendorarch}/*
316 %endif
317
318 %if %{with ruby}
319 %files -n ruby-solv
320 %defattr(-,root,root)
321 %{ruby_vendorarch}/*
322 %endif
323
324 %if %{with python}
325 %files -n python-solv
326 %defattr(-,root,root)
327 %{python_sitearch}/*
328 %endif
329
330 %if %{with python3}
331 %files -n python3-solv
332 %defattr(-,root,root)
333 %{python3_sitearch}/*solv*
334 %if 0%{?suse_version}
335 %{python3_sitearch}/*/*solv*
336 %endif
337 %endif
338
339 %changelog