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