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