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