Imported Upstream version 0.6.28
[platform/upstream/libsolv.git] / package / libsolv.spec.in
1 #
2 # spec file for package libsolv
3 #
4 # Copyright (c) 2012 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:        A new approach to package dependency solving
106 License:        BSD-3-Clause
107 Group:          Development/Libraries/C and C++
108
109 %description
110 A new approach to package dependency solving
111
112 %if !%{with disable_shared}
113 %package -n libsolv@LIBSOLV_SOVERSION@
114 Summary:        A new approach to package dependency solving
115 Group:          Development/Libraries/C and C++
116
117 %description -n libsolv@LIBSOLV_SOVERSION@
118 A new approach to package dependency solving
119
120 %endif
121 %package devel
122 Summary:        A new approach to package dependency solving
123 Group:          Development/Libraries/C and C++
124 %if !%{with disable_shared}
125 Requires:       libsolv@LIBSOLV_SOVERSION@ = %version
126 %endif
127 Requires:       rpm-devel
128 Conflicts:      libsatsolver-devel
129
130 %description devel
131 Development files for libsolv, a new approach to package dependency solving
132
133 %package tools
134 Summary:        A new approach to package dependency solving
135 Group:          Development/Libraries/C and C++
136 Obsoletes:      satsolver-tools < 0.18
137 Provides:       satsolver-tools = 0.18
138 Conflicts:      satsolver-tools-obsolete
139 Requires:       gzip bzip2 coreutils findutils
140
141 %description tools
142 A new approach to package dependency solving.
143
144 %package demo
145 Summary:        Applications demoing the libsolv library
146 Group:          System/Management
147 Requires:       curl
148 %if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
149 Requires:       gnupg2
150 %endif
151 %if 0%{?suse_version}
152 Requires:       gpg2
153 %endif
154 Conflicts:      libsatsolver-demo
155
156 %description demo
157 Applications demoing the libsolv library.
158
159 %package -n ruby-solv
160 Summary:        Ruby bindings for the libsolv library
161 Group:          Development/Languages/Ruby
162
163 %description -n ruby-solv
164 Ruby bindings for sat solver.
165
166 %package -n python-solv
167 %if 0%{?py_requires:1} && %{with python_binding}
168 %py_requires
169 %endif
170 Summary:        Python bindings for the libsolv library
171 Group:          Development/Languages/Python
172
173 %description -n python-solv
174 Python bindings for sat solver.
175
176 %package -n python3-solv
177 Summary:        Python3 bindings for the libsolv library
178 Group:          Development/Languages/Python
179
180 %description -n python3-solv
181 Python3 bindings for sat solver.
182
183 %package -n perl-solv
184 Requires:       perl = %{perl_version}
185 Summary:        Perl bindings for the libsolv library
186 Group:          Development/Languages/Perl
187
188 %description -n perl-solv
189 Perl bindings for sat solver.
190
191 %prep
192 %setup -n libsolv-%{version}
193
194 %build
195 export CFLAGS="$RPM_OPT_FLAGS"
196 export CXXFLAGS="$CFLAGS"
197
198 CMAKE_FLAGS=
199 %if 0%{?fedora} || 0%{?rhel} >= 6
200 CMAKE_FLAGS="-DFEDORA=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1"
201 %endif
202 %if 0%{?mageia}
203 CMAKE_FLAGS="-DMAGEIA=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1"
204 %endif
205 %if 0%{?suse_version}
206 CMAKE_FLAGS="-DSUSE=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1"
207 %endif
208
209 cmake   $CMAKE_FLAGS \
210         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
211         -DLIB=%{_lib} \
212         -DCMAKE_VERBOSE_MAKEFILE=TRUE \
213         -DCMAKE_BUILD_TYPE=RelWithDebInfo \
214         -DWITH_LIBXML2=1 \
215         %{?with_enable_static:-DENABLE_STATIC=1} \
216         %{?with_disable_shared:-DDISABLE_SHARED=1} \
217         %{?with_perl_binding:-DENABLE_PERL=1} \
218         %{?with_python_binding:-DENABLE_PYTHON=1} \
219         %{?with_python3_binding:-DENABLE_PYTHON3=1} \
220         %{?with_ruby_binding:-DENABLE_RUBY=1} \
221         %{?with_bz2:-DENABLE_BZIP2_COMPRESSION=1} \
222         %{?with_xz:-DENABLE_LZMA_COMPRESSION=1} \
223         %{?with_richdeps:-DENABLE_COMPLEX_DEPS=1} \
224         %{?with_zypp:-DENABLE_SUSEREPO=1 -DENABLE_HELIXREPO=1} \
225         -DUSE_VENDORDIRS=1 \
226         -DCMAKE_SKIP_RPATH=1
227 make %{?_smp_mflags}
228
229 %install
230 make DESTDIR=$RPM_BUILD_ROOT install
231 %if 0%{?suse_version}
232 %if %{with python_binding}
233 pushd $RPM_BUILD_ROOT/%{python_sitearch}
234 python %py_libdir/py_compile.py *.py
235 python -O %py_libdir/py_compile.py *.py
236 popd
237 %endif
238 %if %{with python3_binding}
239 %py3_compile $RPM_BUILD_ROOT/%{python3_sitearch}
240 %endif
241 %endif
242 %if %{with disable_shared}
243 # we want to leave the .a file untouched
244 export NO_BRP_STRIP_DEBUG=true
245 %endif
246
247 %clean
248 rm -rf "$RPM_BUILD_ROOT"
249
250 %if !%{with disable_shared}
251 %post -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
252
253 %postun -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
254
255 %files -n libsolv@LIBSOLV_SOVERSION@
256 %defattr(-,root,root)
257 %doc LICENSE*
258 %{_libdir}/libsolv.so.*
259 %{_libdir}/libsolvext.so.*
260 %endif
261
262 %files tools
263 %defattr(-,root,root)
264 %if 0%{?suse_version}
265 %exclude %{_bindir}/helix2solv
266 %exclude %{_mandir}/man1/helix2solv*
267 %endif
268 %exclude %{_bindir}/solv
269 %{_bindir}/*
270 %{_mandir}/man1/*
271
272 %files devel
273 %defattr(-,root,root)
274 %if %{with enable_static}
275 %{_libdir}/libsolv.a
276 %{_libdir}/libsolvext.a
277 %endif
278 %if !%{with disable_shared}
279 %{_libdir}/libsolv.so
280 %{_libdir}/libsolvext.so
281 %endif
282 %{_includedir}/solv
283 %if 0%{?suse_version}
284 %{_bindir}/helix2solv
285 %{_mandir}/man1/helix2solv*
286 %endif
287 %{_datadir}/cmake/Modules/*
288 %{_libdir}/pkgconfig/libsolv*.pc
289 %{_mandir}/man3/*
290
291 %files demo
292 %defattr(-,root,root)
293 %{_bindir}/solv
294
295 %if %{with perl_binding}
296 %files -n perl-solv
297 %defattr(-,root,root)
298 %{perl_vendorarch}/*
299 %endif
300
301 %if %{with ruby_binding}
302 %files -n ruby-solv
303 %defattr(-,root,root)
304 %{ruby_vendorarch}/*
305 %endif
306
307 %if %{with python_binding}
308 %files -n python-solv
309 %defattr(-,root,root)
310 %{python_sitearch}/*
311 %endif
312
313 %if %{with python3_binding}
314 %files -n python3-solv
315 %defattr(-,root,root)
316 %{python3_sitearch}/*solv*
317 %if 0%{?suse_version}
318 %{python3_sitearch}/*/*solv*
319 %endif
320 %endif
321
322 %changelog