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