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