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