Imported Upstream version 0.6.24
[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%{?mandriva_version}
34 # force this version on mandriva
35 BuildRequires:  libneon0.26-devel
36 %endif
37 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
38 BuildRequires:  db-devel
39 %endif
40 %if 0%{?suse_version}
41 %if 0%{?suse_version} < 1030
42 BuildRequires:  expat
43 %else
44 BuildRequires:  libexpat-devel
45 %endif
46 %if 0%{?suse_version} < 1100
47 BuildRequires:  graphviz
48 %endif
49 %if 0%{?suse_version} > 1020
50 BuildRequires:  fdupes
51 %endif
52 %else
53 BuildRequires:  expat-devel
54 %endif
55 BuildRequires:  cmake
56 BuildRequires:  gcc-c++
57 BuildRequires:  rpm-devel
58 BuildRequires:  zlib-devel
59
60 %if %{with perl_binding}
61 BuildRequires:  perl
62 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
63 BuildRequires:  perl-devel
64 %endif
65 BuildRequires:  swig
66 %endif
67 %if %{with ruby_binding}
68 %global ruby_vendorarch %(ruby  -r rbconfig -e "puts RbConfig::CONFIG['vendorarchdir'].nil? ? RbConfig::CONFIG['sitearchdir'] : RbConfig::CONFIG['vendorarchdir']")
69 BuildRequires:  ruby
70 BuildRequires:  ruby-devel
71 BuildRequires:  swig
72 %endif
73 %if %{with python_binding}
74 %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
75 BuildRequires:  python-devel
76 BuildRequires:  swig
77 %endif
78 %if %{with python3_binding}
79 %global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
80 BuildRequires:  python3-devel
81 %endif
82
83 Summary:        A new approach to package dependency solving
84 License:        BSD-3-Clause
85 Group:          Development/Libraries/C and C++
86
87 %description
88 A new approach to package dependency solving
89
90 %if !%{with disable_shared}
91 %package -n libsolv@LIBSOLV_SOVERSION@
92 Summary:        A new approach to package dependency solving
93 Group:          Development/Libraries/C and C++
94
95 %description -n libsolv@LIBSOLV_SOVERSION@
96 A new approach to package dependency solving
97
98 %endif
99 %package devel
100 Summary:        A new approach to package dependency solving
101 Group:          Development/Libraries/C and C++
102 %if !%{with disable_shared}
103 Requires:       libsolv@LIBSOLV_SOVERSION@ = %version
104 %endif
105 Requires:       rpm-devel
106 Conflicts:      libsatsolver-devel
107
108 %description devel
109 Development files for libsolv, a new approach to package dependency solving
110
111 %package tools
112 Summary:        A new approach to package dependency solving
113 Group:          Development/Libraries/C and C++
114 Obsoletes:      satsolver-tools < 0.18
115 Provides:       satsolver-tools = 0.18
116 Conflicts:      satsolver-tools-obsolete
117 Requires:       gzip bzip2 coreutils findutils
118
119 %description tools
120 A new approach to package dependency solving.
121
122 %package demo
123 Summary:        Applications demoing the libsolv library
124 Group:          System/Management
125 Requires:       curl
126 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
127 Requires:       gnupg2
128 %endif
129 %if 0%{?suse_version}
130 Requires:       gpg2
131 %endif
132 Conflicts:      libsatsolver-demo
133
134 %description demo
135 Applications demoing the libsolv library.
136
137 %package -n ruby-solv
138 Summary:        Ruby bindings for the libsolv library
139 Group:          Development/Languages/Ruby
140
141 %description -n ruby-solv
142 Ruby bindings for sat solver.
143
144 %package -n python-solv
145 %if 0%{?py_requires:1} && %{with python_binding}
146 %py_requires
147 %endif
148 Summary:        Python bindings for the libsolv library
149 Group:          Development/Languages/Python
150
151 %description -n python-solv
152 Python bindings for sat solver.
153
154 %package -n python3-solv
155 Summary:        Python3 bindings for the libsolv library
156 Group:          Development/Languages/Python
157
158 %description -n python3-solv
159 Python3 bindings for sat solver.
160
161 %package -n perl-solv
162 Requires:       perl = %{perl_version}
163 Summary:        Perl bindings for the libsolv library
164 Group:          Development/Languages/Perl
165
166 %description -n perl-solv
167 Perl bindings for sat solver.
168
169 %prep
170 %setup -n libsolv-%{version}
171
172 %build
173 export CFLAGS="$RPM_OPT_FLAGS"
174 export CXXFLAGS="$CFLAGS"
175
176 CMAKE_FLAGS=
177 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
178 CMAKE_FLAGS="-DFEDORA=1"
179 %endif
180 %if 0%{?suse_version}
181 CMAKE_FLAGS="-DSUSE=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1"
182 %endif
183
184 cmake   $CMAKE_FLAGS \
185         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
186         -DLIB=%{_lib} \
187         -DCMAKE_VERBOSE_MAKEFILE=TRUE \
188         -DCMAKE_BUILD_TYPE=RelWithDebInfo \
189         %{?with_enable_static:-DENABLE_STATIC=1} \
190         %{?with_disable_shared:-DDISABLE_SHARED=1} \
191         %{?with_perl_binding:-DENABLE_PERL=1} \
192         %{?with_python_binding:-DENABLE_PYTHON=1} \
193         %{?with_python3_binding:-DENABLE_PYTHON3=1} \
194         %{?with_ruby_binding:-DENABLE_RUBY=1} \
195         %{?with_zypp:-DENABLE_SUSEREPO=1 -DENABLE_HELIXREPO=1} \
196         -DUSE_VENDORDIRS=1 \
197         -DCMAKE_SKIP_RPATH=1
198 make %{?jobs:-j %jobs}
199
200 %install
201 make DESTDIR=$RPM_BUILD_ROOT install
202 %if 0%{?suse_version}
203 %if %{with python_binding}
204 pushd $RPM_BUILD_ROOT/%{python_sitearch}
205 python %py_libdir/py_compile.py *.py
206 python -O %py_libdir/py_compile.py *.py
207 popd
208 %endif
209 %if %{with python3_binding}
210 %py3_compile $RPM_BUILD_ROOT/%{python3_sitearch}
211 %endif
212 %endif
213 %if %{with disable_shared}
214 # we want to leave the .a file untouched
215 export NO_BRP_STRIP_DEBUG=true
216 %endif
217
218 %clean
219 rm -rf "$RPM_BUILD_ROOT"
220
221 %if !%{with disable_shared}
222 %post -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
223
224 %postun -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
225
226 %files -n libsolv@LIBSOLV_SOVERSION@
227 %defattr(-,root,root)
228 %doc LICENSE*
229 %{_libdir}/libsolv.so.*
230 %{_libdir}/libsolvext.so.*
231 %endif
232
233 %files tools
234 %defattr(-,root,root)
235 %if 0%{?suse_version}
236 %exclude %{_bindir}/helix2solv
237 %exclude %{_mandir}/man1/helix2solv*
238 %endif
239 %exclude %{_bindir}/solv
240 %{_bindir}/*
241 %{_mandir}/man1/*
242
243 %files devel
244 %defattr(-,root,root)
245 %if %{with enable_static}
246 %{_libdir}/libsolv.a
247 %{_libdir}/libsolvext.a
248 %endif
249 %if !%{with disable_shared}
250 %{_libdir}/libsolv.so
251 %{_libdir}/libsolvext.so
252 %endif
253 %{_includedir}/solv
254 %if 0%{?suse_version}
255 %{_bindir}/helix2solv
256 %{_mandir}/man1/helix2solv*
257 %endif
258 %{_datadir}/cmake/Modules/*
259 %{_libdir}/pkgconfig/libsolv.pc
260 %{_mandir}/man3/*
261
262 %files demo
263 %defattr(-,root,root)
264 %{_bindir}/solv
265
266 %if %{with perl_binding}
267 %files -n perl-solv
268 %defattr(-,root,root)
269 %{perl_vendorarch}/*
270 %endif
271
272 %if %{with ruby_binding}
273 %files -n ruby-solv
274 %defattr(-,root,root)
275 %{ruby_vendorarch}/*
276 %endif
277
278 %if %{with python_binding}
279 %files -n python-solv
280 %defattr(-,root,root)
281 %{python_sitearch}/*
282 %endif
283
284 %if %{with python3_binding}
285 %files -n python3-solv
286 %defattr(-,root,root)
287 %{python3_sitearch}/*solv*
288 %if 0%{?suse_version}
289 %{python3_sitearch}/*/*solv*
290 %endif
291 %endif
292
293 %changelog