40d266a89c371cdcceeaef0b5cde3c948df8dc90
[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 export CFLAGS="%{optflags}"
211 export CXXFLAGS="$CFLAGS"
212
213 CMAKE_FLAGS=
214 %if 0%{?fedora} || 0%{?rhel} >= 6
215 CMAKE_FLAGS="-DFEDORA=1"
216 %endif
217 %if 0%{?mageia}
218 CMAKE_FLAGS="-DMAGEIA=1"
219 %endif
220 %if 0%{?suse_version}
221 CMAKE_FLAGS="-DSUSE=1"
222 %endif
223
224 cmake . $CMAKE_FLAGS \
225         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
226         -DLIB=%{_lib} \
227         -DCMAKE_VERBOSE_MAKEFILE=TRUE \
228         -DCMAKE_BUILD_TYPE=RelWithDebInfo \
229         -DWITH_LIBXML2=1 \
230         -DENABLE_APPDATA=1 \
231         -DENABLE_COMPS=1 \
232         %{?with_static:-DENABLE_STATIC=1} \
233         %{!?with_shared:-DDISABLE_SHARED=1} \
234         %{?with_perl:-DENABLE_PERL=1} \
235         %{?with_python:-DENABLE_PYTHON=1} \
236         %{?with_python3:-DENABLE_PYTHON3=1} \
237         %{?with_ruby:-DENABLE_RUBY=1} \
238         %{?with_bz2:-DENABLE_BZIP2_COMPRESSION=1} \
239         %{?with_xz:-DENABLE_LZMA_COMPRESSION=1} \
240         %{?with_zstd:-DENABLE_ZSTD_COMPRESSION=1} \
241         %{?with_zstd:-DENABLE_ZCHUNK_COMPRESSION=1} \
242         %{?with_richdeps:-DENABLE_COMPLEX_DEPS=1} \
243         %{?with_zypp:-DENABLE_SUSEREPO=1 -DENABLE_HELIXREPO=1} \
244         -DUSE_VENDORDIRS=1 \
245         -DCMAKE_SKIP_RPATH=1
246 make %{?_smp_mflags}
247
248 %install
249 make DESTDIR=%{buildroot} install
250 ln -s repo2solv %{buildroot}/%{_bindir}/repo2solv.sh
251
252 %if 0%{?suse_version}
253 %if %{with python}
254 %py_compile -O %{buildroot}/%{python_sitearch}
255 %endif
256 %if %{with python3}
257 %py3_compile %{buildroot}/%{python3_sitearch}
258 %endif
259 %endif
260 %if %{with static}
261 # we want to leave the .a file untouched
262 export NO_BRP_STRIP_DEBUG=true
263 %endif
264
265 %check
266 make ARGS=--output-on-failure test
267
268 %if %{with shared}
269 %post -n %{libname} -p /sbin/ldconfig
270
271 %postun -n %{libname} -p /sbin/ldconfig
272
273 %files -n %{libname}
274 %defattr(-,root,root)
275 %license LICENSE*
276 %{_libdir}/libsolv.so.*
277 %{_libdir}/libsolvext.so.*
278 %endif
279
280 %files tools
281 %defattr(-,root,root)
282 %if 0%{?suse_version}
283 %exclude %{_bindir}/helix2solv
284 %exclude %{_mandir}/man1/helix2solv*
285 %endif
286 %exclude %{_mandir}/man1/solv.1*
287 %exclude %{_bindir}/solv
288 %{_bindir}/*
289 %{_mandir}/man1/*
290
291 %files devel
292 %defattr(-,root,root)
293 %if %{with static}
294 %{_libdir}/libsolv.a
295 %{_libdir}/libsolvext.a
296 %endif
297 %if %{with shared}
298 %{_libdir}/libsolv.so
299 %{_libdir}/libsolvext.so
300 %endif
301 %{_includedir}/solv
302 %if 0%{?suse_version}
303 %{_bindir}/helix2solv
304 %{_mandir}/man1/helix2solv*
305 %endif
306 %{_datadir}/cmake/Modules/*
307 %{_libdir}/pkgconfig/libsolv*.pc
308 %{_mandir}/man3/*
309
310 %files demo
311 %defattr(-,root,root)
312 %{_bindir}/solv
313 %{_mandir}/man1/solv.1*
314
315 %if %{with perl}
316 %files -n perl-solv
317 %defattr(-,root,root)
318 %{perl_vendorarch}/*
319 %endif
320
321 %if %{with ruby}
322 %files -n ruby-solv
323 %defattr(-,root,root)
324 %{ruby_vendorarch}/*
325 %endif
326
327 %if %{with python}
328 %files -n python-solv
329 %defattr(-,root,root)
330 %{python_sitearch}/*
331 %endif
332
333 %if %{with python3}
334 %files -n python3-solv
335 %defattr(-,root,root)
336 %{python3_sitearch}/*solv*
337 %if 0%{?suse_version}
338 %{python3_sitearch}/*/*solv*
339 %endif
340 %endif
341
342 %changelog