Add ENABLE_COMPLEX_DEPS flag
[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 sysconfig import get_path; print(get_path('platlib'))")
94 BuildRequires:  python-devel
95 BuildRequires:  swig
96 %endif
97
98 %if %{with python3}
99 %global python3_sitearch %(python3 -c "from sysconfig import get_path; print(get_path('platlib'))")
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 Requires:       findutils
157
158 %description tools
159 libsolv is a library for solving packages and reading repositories.
160
161 This subpackage contains utilities to create and work with the .solv
162 files used by libsolv.
163
164 %package demo
165 Summary:        Applications demoing the libsolv library
166 Group:          System/Management
167 Requires:       curl
168 Conflicts:      libsatsolver-demo
169 %if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
170 Requires:       gnupg2
171 %endif
172 %if 0%{?suse_version}
173 Requires:       gpg2
174 %endif
175
176 %description demo
177 Applications demoing the libsolv library.
178
179 %package -n ruby-solv
180 Summary:        Ruby bindings for the libsolv library
181 Group:          Development/Languages/Ruby
182
183 %description -n ruby-solv
184 Ruby bindings for libsolv.
185
186 %package -n python-solv
187 %if 0%{?py_requires:1} && %{with python}
188 %py_requires
189 %endif
190 Summary:        Python bindings for the libsolv library
191 Group:          Development/Languages/Python
192
193 %description -n python-solv
194 Python bindings for libsolv.
195
196 %package -n python3-solv
197 Summary:        Python3 bindings for the libsolv library
198 Group:          Development/Languages/Python
199
200 %description -n python3-solv
201 Python3 bindings for libsolv.
202
203 %package -n perl-solv
204 Summary:        Perl bindings for the libsolv library
205 Group:          Development/Languages/Perl
206 Requires:       perl = %{perl_version}
207
208 %description -n perl-solv
209 Perl bindings for libsolv.
210
211 %prep
212 %setup -q
213
214 %build
215 %global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
216 export CFLAGS="%{optflags}"
217 export CXXFLAGS="$CFLAGS"
218
219 CMAKE_FLAGS=
220 %if 0%{?fedora} || 0%{?rhel} >= 6
221 CMAKE_FLAGS="-DFEDORA=1"
222 %endif
223 %if 0%{?mageia}
224 CMAKE_FLAGS="-DMAGEIA=1"
225 %endif
226 %if 0%{?suse_version}
227 CMAKE_FLAGS="-DSUSE=1"
228 %endif
229
230 cmake . $CMAKE_FLAGS \
231         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
232         -DLIB=%{_lib} \
233         -DCMAKE_VERBOSE_MAKEFILE=TRUE \
234         -DCMAKE_BUILD_TYPE=RelWithDebInfo \
235         -DWITH_LIBXML2=1 \
236         -DENABLE_APPDATA=1 \
237         -DENABLE_COMPS=1 \
238         %{?with_static:-DENABLE_STATIC=1} \
239         %{!?with_shared:-DDISABLE_SHARED=1} \
240         %{?with_perl:-DENABLE_PERL=1} \
241         %{?with_python:-DENABLE_PYTHON=1} \
242         %{?with_python3:-DENABLE_PYTHON3=1} \
243         %{?with_ruby:-DENABLE_RUBY=1} \
244         %{?with_bz2:-DENABLE_BZIP2_COMPRESSION=1} \
245         %{?with_xz:-DENABLE_LZMA_COMPRESSION=1} \
246         %{?with_zstd:-DENABLE_ZSTD_COMPRESSION=1} \
247         %{?with_zstd:-DENABLE_ZCHUNK_COMPRESSION=1} \
248         %{?with_richdeps:-DENABLE_COMPLEX_DEPS=1} \
249         %{?with_zypp:-DENABLE_SUSEREPO=1 -DENABLE_HELIXREPO=1} \
250         -DUSE_VENDORDIRS=1 \
251         -DCMAKE_SKIP_RPATH=1
252 make %{?_smp_mflags}
253
254 %install
255 make DESTDIR=%{buildroot} install
256 ln -s repo2solv %{buildroot}/%{_bindir}/repo2solv.sh
257
258 %if 0%{?suse_version}
259 %if %{with python}
260 %py_compile -O %{buildroot}/%{python_sitearch}
261 %endif
262 %if %{with python3}
263 %py3_compile %{buildroot}/%{python3_sitearch}
264 %endif
265 %endif
266
267 %check
268 make ARGS=--output-on-failure test
269
270 %if %{with shared}
271 %post -n %{libname} -p /sbin/ldconfig
272
273 %postun -n %{libname} -p /sbin/ldconfig
274
275 %files -n %{libname}
276 %defattr(-,root,root)
277 %license LICENSE*
278 %{_libdir}/libsolv.so.*
279 %{_libdir}/libsolvext.so.*
280 %endif
281
282 %files tools
283 %defattr(-,root,root)
284 %if 0%{?suse_version}
285 %exclude %{_bindir}/helix2solv
286 %exclude %{_mandir}/man1/helix2solv*
287 %endif
288 %exclude %{_mandir}/man1/solv.1*
289 %exclude %{_bindir}/solv
290 %{_bindir}/*
291 %{_mandir}/man1/*
292
293 %files devel
294 %defattr(-,root,root)
295 %if %{with static}
296 %{_libdir}/libsolv.a
297 %{_libdir}/libsolvext.a
298 %endif
299 %if %{with shared}
300 %{_libdir}/libsolv.so
301 %{_libdir}/libsolvext.so
302 %endif
303 %{_includedir}/solv
304 %if 0%{?suse_version}
305 %{_bindir}/helix2solv
306 %{_mandir}/man1/helix2solv*
307 %endif
308 %{_datadir}/cmake/Modules/*
309 %{_libdir}/pkgconfig/libsolv*.pc
310 %{_mandir}/man3/*
311
312 %files demo
313 %defattr(-,root,root)
314 %{_bindir}/solv
315 %{_mandir}/man1/solv.1*
316
317 %if %{with perl}
318 %files -n perl-solv
319 %defattr(-,root,root)
320 %{perl_vendorarch}/*
321 %endif
322
323 %if %{with ruby}
324 %files -n ruby-solv
325 %defattr(-,root,root)
326 %{ruby_vendorarch}/*
327 %endif
328
329 %if %{with python}
330 %files -n python-solv
331 %defattr(-,root,root)
332 %{python_sitearch}/*
333 %endif
334
335 %if %{with python3}
336 %files -n python3-solv
337 %defattr(-,root,root)
338 %{python3_sitearch}/*solv*
339 %if 0%{?suse_version}
340 %{python3_sitearch}/*/*solv*
341 %endif
342 %endif
343
344 %changelog