Build static per default.
[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 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 Authors:
108 --------
109     Michael Schroeder <mls@suse.de>
110     Klaus Kaempf <kkaempf@suse.de>
111     Stephan Kulow <coolo@suse.de>
112     Michael Matz <matz@suse.de>
113     Duncan Mac-Vicar P. <dmacvicar@suse.de>
114
115 %package tools
116 Summary:        A new approach to package dependency solving
117 Group:          Development/Libraries/C and C++
118 Obsoletes:      libsatsolver <= 0.0.15
119 Provides:       libsatsolver = %{version}-%{release}
120 Requires:       gzip bzip2 coreutils
121
122 %description tools
123 A new approach to package dependency solving.
124
125 %package demo
126 Summary:        Applications demoing the libsolv library
127 Group:          System/Management
128 Requires:       curl
129 %if 0%{?fedora_version}
130 Requires:       gnupg2
131 %endif
132 %if 0%{?suse_version}
133 Requires:       gpg2
134 %endif
135
136 %description demo
137 Applications demoing the libsolv library.
138
139 %package -n ruby-solv
140 Summary:        Ruby bindings for the libsolv library
141 Group:          Development/Languages/Ruby
142
143 %description -n ruby-solv
144 Ruby bindings for sat solver.
145
146 %package -n python-solv
147 %if 0%{?py_requires:1}
148 %py_requires
149 %endif
150 Summary:        Python bindings for the libsolv library
151 Group:          Development/Languages/Python
152
153 %description -n python-solv
154 Python bindings for sat solver.
155
156 %package -n perl-solv
157 Requires:       perl = %{perl_version}
158 Summary:        Perl bindings for the libsolv library
159 Group:          Development/Languages/Perl
160
161 %description -n perl-solv
162 Perl bindings for sat solver.
163
164 %prep
165 %setup -n libsolv-%{version}
166
167 %build
168 export CFLAGS="$RPM_OPT_FLAGS"
169 export CXXFLAGS="$CFLAGS"
170
171 CMAKE_FLAGS=
172 %if 0%{?fedora_version}
173 CMAKE_FLAGS="-DFEDORA=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=Release \
181         %{?with_enable_static:-DENABLE_STATIC=1} \
182         %{?with_disable_shared:-DDISABLE_SHARED=1} \
183         %{?with_perl_binding:-DENABLE_PERL=1} \
184         %{?with_python_binding:-DENABLE_PYTHON=1} \
185         %{?with_ruby_binding:-DENABLE_RUBY=1} \
186         -DUSE_VENDORDIRS=1 \
187         -DCMAKE_SKIP_RPATH=1
188 make %{?jobs:-j %jobs}
189
190 %install
191 make DESTDIR=$RPM_BUILD_ROOT install
192 %if %{with python_binding}
193 %if 0%{?suse_version}
194 pushd $RPM_BUILD_ROOT/%{python_sitearch}
195 python %py_libdir/py_compile.py *.py
196 python -O %py_libdir/py_compile.py *.py
197 popd
198 %endif
199 %endif
200 # we want to leave the .a file untouched
201 export NO_BRP_STRIP_DEBUG=true
202
203 %clean
204 rm -rf "$RPM_BUILD_ROOT"
205
206 %if !%{with disable_shared}
207 %post -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
208
209 %postun -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
210
211 %files -n libsolv@LIBSOLV_SOVERSION@
212 %defattr(-,root,root)
213 %doc LICENSE*
214 %{_libdir}/libsolv.so.*
215 %{_libdir}/libsolvext.so.*
216 %endif
217
218 %files tools
219 %defattr(-,root,root)
220 %exclude %{_bindir}/helix2solv
221 %exclude %{_bindir}/solv
222 %{_bindir}/*
223
224 %files devel
225 %defattr(-,root,root)
226 %{_libdir}/libsolv.so
227 %{_libdir}/libsolvext.so
228 %{_includedir}/solv
229 %{_bindir}/helix2solv
230 %{_datadir}/cmake/Modules/*
231
232 %files demo
233 %defattr(-,root,root)
234 %{_bindir}/solv
235
236 %if %{with perl_binding}
237 %files -n perl-solv
238 %defattr(-,root,root)
239 %{perl_vendorarch}/*
240 %endif
241
242 %if %{with ruby_binding}
243 %files -n ruby-solv
244 %defattr(-,root,root)
245 %{ruby_vendorarch}/*
246 %endif
247
248 %if %{with python_binding}
249 %files -n python-solv
250 %defattr(-,root,root)
251 %{python_sitearch}/*
252 %endif
253
254 %changelog