fix package provides/obsoletes
[platform/upstream/libsolv.git] / package / libsolv.spec.in
1 #
2 # spec file for package libsolv
3 #
4 # Copyright (c) 2011 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:        1
21 License:        BSD 3-Clause
22 Url:            git://gitorious.org/opensuse/libsolv.git
23 Source:         libsolv-%{version}.tar.bz2
24 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
25 Group:          Development/Libraries/C and C++
26
27 %bcond_without enable_static
28 %bcond_without disable_shared
29 %bcond_without perl_binding
30 %bcond_without python_binding
31 %bcond_without ruby_binding
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:  db4-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 rpm-devel gcc-c++
56 BuildRequires:  zlib-devel
57
58 %if %{with perl_binding}
59 BuildRequires: perl
60 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
61 BuildRequires: perl-devel
62 %endif
63 BuildRequires: swig
64 %endif
65 %if %{with ruby_binding}
66 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
67 %global ruby_vendorarch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"]')
68 %else
69 %global ruby_vendorarch %(ruby -rrbconfig -e 'puts Config::CONFIG["vendorarchdir"]')
70 %endif
71 BuildRequires: ruby ruby-devel
72 BuildRequires: swig
73 %endif
74 %if %{with python_binding}
75 %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True);")
76 BuildRequires: python-devel
77 BuildRequires: swig
78 %endif
79
80 Summary:        A new approach to package dependency solving
81
82
83 %description
84 A new approach to package dependency solving
85
86 %if !%{with disable_shared}
87 %package -n libsolv@LIBSOLV_SOVERSION@
88 Summary:        A new approach to package dependency solving
89 Group:          Development/Libraries/C and C++
90
91 %description -n libsolv@LIBSOLV_SOVERSION@
92 A new approach to package dependency solving
93
94 %endif
95 %package devel
96 Summary:        A new approach to package dependency solving
97 Group:          Development/Libraries/C and C++
98 Requires:       libsolv-tools = %version
99 %if !%{with disable_shared}
100 Requires:       libsolv@LIBSOLV_SOVERSION@ = %version
101 %endif
102 Requires:       rpm-devel
103
104 %description devel
105 Development files for libsolv, a new approach to package dependency solving
106
107 %package tools
108 Summary:        A new approach to package dependency solving
109 Group:          Development/Libraries/C and C++
110 Obsoletes:      satsolver-tools < 0.18
111 Provides:       satsolver-tools = 0.18
112 Requires:       gzip bzip2 coreutils
113
114 %description tools
115 A new approach to package dependency solving.
116
117 %package demo
118 Summary:        Applications demoing the libsolv library
119 Group:          System/Management
120 Requires:       curl
121 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
122 Requires:       gnupg2
123 %endif
124 %if 0%{?suse_version}
125 Requires:       gpg2
126 %endif
127
128 %description demo
129 Applications demoing the libsolv library.
130
131 %package -n ruby-solv
132 Summary:        Ruby bindings for the libsolv library
133 Group:          Development/Languages/Ruby
134
135 %description -n ruby-solv
136 Ruby bindings for sat solver.
137
138 %package -n python-solv
139 %if 0%{?py_requires:1}
140 %py_requires
141 %endif
142 Summary:        Python bindings for the libsolv library
143 Group:          Development/Languages/Python
144
145 %description -n python-solv
146 Python bindings for sat solver.
147
148 %package -n perl-solv
149 Requires:       perl = %{perl_version}
150 Summary:        Perl bindings for the libsolv library
151 Group:          Development/Languages/Perl
152
153 %description -n perl-solv
154 Perl bindings for sat solver.
155
156 %prep
157 %setup -n libsolv-%{version}
158
159 %build
160 export CFLAGS="$RPM_OPT_FLAGS"
161 export CXXFLAGS="$CFLAGS"
162
163 CMAKE_FLAGS=
164 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
165 CMAKE_FLAGS="-DFEDORA=1"
166 %endif
167
168 cmake   $CMAKE_FLAGS \
169         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
170         -DLIB=%{_lib} \
171         -DCMAKE_VERBOSE_MAKEFILE=TRUE \
172         -DCMAKE_BUILD_TYPE=Release \
173         %{?with_enable_static:-DENABLE_STATIC=1} \
174         %{?with_disable_shared:-DDISABLE_SHARED=1} \
175         %{?with_perl_binding:-DENABLE_PERL=1} \
176         %{?with_python_binding:-DENABLE_PYTHON=1} \
177         %{?with_ruby_binding:-DENABLE_RUBY=1} \
178         -DUSE_VENDORDIRS=1 \
179         -DCMAKE_SKIP_RPATH=1
180 make %{?jobs:-j %jobs}
181
182 %install
183 make DESTDIR=$RPM_BUILD_ROOT install
184 %if %{with python_binding}
185 %if 0%{?suse_version}
186 pushd $RPM_BUILD_ROOT/%{python_sitearch}
187 python %py_libdir/py_compile.py *.py
188 python -O %py_libdir/py_compile.py *.py
189 popd
190 %endif
191 %endif
192 # we want to leave the .a file untouched
193 export NO_BRP_STRIP_DEBUG=true
194
195 %clean
196 rm -rf "$RPM_BUILD_ROOT"
197
198 %if !%{with disable_shared}
199 %post -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
200
201 %postun -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
202
203 %files -n libsolv@LIBSOLV_SOVERSION@
204 %defattr(-,root,root)
205 %doc LICENSE*
206 %{_libdir}/libsolv.so.*
207 %{_libdir}/libsolvext.so.*
208 %endif
209
210 %files tools
211 %defattr(-,root,root)
212 %exclude %{_bindir}/helix2solv
213 %exclude %{_bindir}/solv
214 %{_bindir}/*
215
216 %files devel
217 %defattr(-,root,root)
218 %if %{with enable_static}
219 %{_libdir}/libsolv.a
220 %{_libdir}/libsolvext.a
221 %endif
222 %if !%{with disable_shared}
223 %{_libdir}/libsolv.so
224 %{_libdir}/libsolvext.so
225 %endif
226 %{_includedir}/solv
227 %{_bindir}/helix2solv
228 %{_datadir}/cmake/Modules/*
229
230 %files demo
231 %defattr(-,root,root)
232 %{_bindir}/solv
233
234 %if %{with perl_binding}
235 %files -n perl-solv
236 %defattr(-,root,root)
237 %{perl_vendorarch}/*
238 %endif
239
240 %if %{with ruby_binding}
241 %files -n ruby-solv
242 %defattr(-,root,root)
243 %{ruby_vendorarch}/*
244 %endif
245
246 %if %{with python_binding}
247 %files -n python-solv
248 %defattr(-,root,root)
249 %{python_sitearch}/*
250 %endif
251
252 %changelog