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