Imported Upstream version 0.6.8
[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:            https://github.com/openSUSE/libsolv
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 %bcond_with zypp
31
32 %if 0%{?mandriva_version}
33 # force this version on mandriva
34 BuildRequires:  libneon0.26-devel
35 %endif
36 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
37 BuildRequires:  db4-devel
38 %endif
39 %if 0%{?suse_version}
40 %if 0%{?suse_version} < 1030
41 BuildRequires:  expat
42 %else
43 BuildRequires:  libexpat-devel
44 %endif
45 %if 0%{?suse_version} < 1100
46 BuildRequires:  graphviz
47 %endif
48 %if 0%{?suse_version} > 1020
49 BuildRequires:  fdupes
50 %endif
51 %else
52 BuildRequires:  expat-devel
53 %endif
54 BuildRequires:  cmake
55 BuildRequires:  gcc-c++
56 BuildRequires:  rpm-devel
57 BuildRequires:  zlib-devel
58
59 %if %{with perl_binding}
60 BuildRequires:  perl
61 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
62 BuildRequires:  perl-devel
63 %endif
64 BuildRequires:  swig
65 %endif
66 %if %{with ruby_binding}
67 %global ruby_vendorarch %(ruby  -r rbconfig -e "puts Config::CONFIG['vendorarchdir'].nil? ? Config::CONFIG['sitearchdir'] : Config::CONFIG['vendorarchdir']")
68 BuildRequires:  ruby
69 BuildRequires:  ruby-devel
70 BuildRequires:  swig
71 %endif
72 %if %{with python_binding}
73 %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True);")
74 BuildRequires:  python-devel
75 BuildRequires:  swig
76 %endif
77
78 Summary:        A new approach to package dependency solving
79 License:        BSD-3-Clause
80 Group:          Development/Libraries/C and C++
81
82 %description
83 A new approach to package dependency solving
84
85 %if !%{with disable_shared}
86 %package -n libsolv@LIBSOLV_SOVERSION@
87 Summary:        A new approach to package dependency solving
88 Group:          Development/Libraries/C and C++
89
90 %description -n libsolv@LIBSOLV_SOVERSION@
91 A new approach to package dependency solving
92
93 %endif
94 %package devel
95 Summary:        A new approach to package dependency solving
96 Group:          Development/Libraries/C and C++
97 %if !%{with disable_shared}
98 Requires:       libsolv@LIBSOLV_SOVERSION@ = %version
99 %endif
100 Requires:       rpm-devel
101 Conflicts:      libsatsolver-devel
102
103 %description devel
104 Development files for libsolv, a new approach to package dependency solving
105
106 %package tools
107 Summary:        A new approach to package dependency solving
108 Group:          Development/Libraries/C and C++
109 Obsoletes:      satsolver-tools < 0.18
110 Provides:       satsolver-tools = 0.18
111 Conflicts:      satsolver-tools-obsolete
112 Requires:       gzip bzip2 coreutils findutils
113
114 %description tools
115 A new approach to package dependency solving.
116
117 %package demo
118 Summary:        Applications demoing the libsolv library
119 Group:          System/Management
120 Requires:       curl
121 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
122 Requires:       gnupg2
123 %endif
124 %if 0%{?suse_version}
125 Requires:       gpg2
126 %endif
127 Conflicts:      libsatsolver-demo
128
129 %description demo
130 Applications demoing the libsolv library.
131
132 %package -n ruby-solv
133 Summary:        Ruby bindings for the libsolv library
134 Group:          Development/Languages/Ruby
135
136 %description -n ruby-solv
137 Ruby bindings for sat solver.
138
139 %package -n python-solv
140 %if 0%{?py_requires:1} && %{with python_binding}
141 %py_requires
142 %endif
143 Summary:        Python bindings for the libsolv library
144 Group:          Development/Languages/Python
145
146 %description -n python-solv
147 Python bindings for sat solver.
148
149 %package -n perl-solv
150 Requires:       perl = %{perl_version}
151 Summary:        Perl bindings for the libsolv library
152 Group:          Development/Languages/Perl
153
154 %description -n perl-solv
155 Perl bindings for sat solver.
156
157 %prep
158 %setup -n libsolv-%{version}
159
160 %build
161 export CFLAGS="$RPM_OPT_FLAGS"
162 export CXXFLAGS="$CFLAGS"
163
164 CMAKE_FLAGS=
165 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
166 CMAKE_FLAGS="-DFEDORA=1"
167 %endif
168 %if 0%{?suse_version}
169 CMAKE_FLAGS="-DSUSE=1 -DENABLE_APPDATA=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=RelWithDebInfo \
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         %{?with_zypp:-DENABLE_SUSEREPO=1 -DENABLE_HELIXREPO=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 %if %{with disable_shared}
198 # we want to leave the .a file untouched
199 export NO_BRP_STRIP_DEBUG=true
200 %endif
201
202 %clean
203 rm -rf "$RPM_BUILD_ROOT"
204
205 %if !%{with disable_shared}
206 %post -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
207
208 %postun -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
209
210 %files -n libsolv@LIBSOLV_SOVERSION@
211 %defattr(-,root,root)
212 %doc LICENSE*
213 %{_libdir}/libsolv.so.*
214 %{_libdir}/libsolvext.so.*
215 %endif
216
217 %files tools
218 %defattr(-,root,root)
219 %if 0%{?suse_version}
220 %exclude %{_bindir}/helix2solv
221 %exclude %{_mandir}/man1/helix2solv*
222 %endif
223 %exclude %{_bindir}/solv
224 %{_bindir}/*
225 %{_mandir}/man1/*
226
227 %files devel
228 %defattr(-,root,root)
229 %if %{with enable_static}
230 %{_libdir}/libsolv.a
231 %{_libdir}/libsolvext.a
232 %endif
233 %if !%{with disable_shared}
234 %{_libdir}/libsolv.so
235 %{_libdir}/libsolvext.so
236 %endif
237 %{_includedir}/solv
238 %if 0%{?suse_version}
239 %{_bindir}/helix2solv
240 %{_mandir}/man1/helix2solv*
241 %endif
242 %{_datadir}/cmake/Modules/*
243 %{_mandir}/man3/*
244
245 %files demo
246 %defattr(-,root,root)
247 %{_bindir}/solv
248
249 %if %{with perl_binding}
250 %files -n perl-solv
251 %defattr(-,root,root)
252 %{perl_vendorarch}/*
253 %endif
254
255 %if %{with ruby_binding}
256 %files -n ruby-solv
257 %defattr(-,root,root)
258 %{ruby_vendorarch}/*
259 %endif
260
261 %if %{with python_binding}
262 %files -n python-solv
263 %defattr(-,root,root)
264 %{python_sitearch}/*
265 %endif
266
267 %changelog