simplify and fix ruby vendordir check in spec file
[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 %global ruby_vendorarch %(ruby  -r rbconfig -e "puts Config::CONFIG['vendorarchdir'].nil? ? Config::CONFIG['sitearchdir'] : Config::CONFIG['vendorarchdir']")
67 BuildRequires:  ruby
68 BuildRequires:  ruby-devel
69 BuildRequires:  swig
70 %endif
71 %if %{with python_binding}
72 %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True);")
73 BuildRequires:  python-devel
74 BuildRequires:  swig
75 %endif
76
77 Summary:        A new approach to package dependency solving
78 License:        BSD-3-Clause
79 Group:          Development/Libraries/C and C++
80
81 %description
82 A new approach to package dependency solving
83
84 %if !%{with disable_shared}
85 %package -n libsolv@LIBSOLV_SOVERSION@
86 Summary:        A new approach to package dependency solving
87 Group:          Development/Libraries/C and C++
88
89 %description -n libsolv@LIBSOLV_SOVERSION@
90 A new approach to package dependency solving
91
92 %endif
93 %package devel
94 Summary:        A new approach to package dependency solving
95 Group:          Development/Libraries/C and C++
96 Requires:       libsolv-tools = %version
97 %if !%{with disable_shared}
98 Requires:       libsolv@LIBSOLV_SOVERSION@ = %version
99 %endif
100 Requires:       rpm-devel
101
102 %description devel
103 Development files for libsolv, a new approach to package dependency solving
104
105 %package tools
106 Summary:        A new approach to package dependency solving
107 Group:          Development/Libraries/C and C++
108 Obsoletes:      satsolver-tools < 0.18
109 Provides:       satsolver-tools = 0.18
110 Requires:       gzip bzip2 coreutils findutils
111
112 %description tools
113 A new approach to package dependency solving.
114
115 %package demo
116 Summary:        Applications demoing the libsolv library
117 Group:          System/Management
118 Requires:       curl
119 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
120 Requires:       gnupg2
121 %endif
122 %if 0%{?suse_version}
123 Requires:       gpg2
124 %endif
125
126 %description demo
127 Applications demoing the libsolv library.
128
129 %package -n ruby-solv
130 Summary:        Ruby bindings for the libsolv library
131 Group:          Development/Languages/Ruby
132
133 %description -n ruby-solv
134 Ruby bindings for sat solver.
135
136 %package -n python-solv
137 %if 0%{?py_requires:1}
138 %py_requires
139 %endif
140 Summary:        Python bindings for the libsolv library
141 Group:          Development/Languages/Python
142
143 %description -n python-solv
144 Python bindings for sat solver.
145
146 %package -n perl-solv
147 Requires:       perl = %{perl_version}
148 Summary:        Perl bindings for the libsolv library
149 Group:          Development/Languages/Perl
150
151 %description -n perl-solv
152 Perl bindings for sat solver.
153
154 %prep
155 %setup -n libsolv-%{version}
156
157 %build
158 export CFLAGS="$RPM_OPT_FLAGS"
159 export CXXFLAGS="$CFLAGS"
160
161 CMAKE_FLAGS=
162 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
163 CMAKE_FLAGS="-DFEDORA=1"
164 %endif
165 %if 0%{?suse_version}
166 CMAKE_FLAGS="-DSUSE=1"
167 %endif
168
169 cmake   $CMAKE_FLAGS \
170         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
171         -DLIB=%{_lib} \
172         -DCMAKE_VERBOSE_MAKEFILE=TRUE \
173         -DCMAKE_BUILD_TYPE=RelWithDebInfo \
174         %{?with_enable_static:-DENABLE_STATIC=1} \
175         %{?with_disable_shared:-DDISABLE_SHARED=1} \
176         %{?with_perl_binding:-DENABLE_PERL=1} \
177         %{?with_python_binding:-DENABLE_PYTHON=1} \
178         %{?with_ruby_binding:-DENABLE_RUBY=1} \
179         -DUSE_VENDORDIRS=1 \
180         -DCMAKE_SKIP_RPATH=1
181 make %{?jobs:-j %jobs}
182
183 %install
184 make DESTDIR=$RPM_BUILD_ROOT install
185 %if %{with python_binding}
186 %if 0%{?suse_version}
187 pushd $RPM_BUILD_ROOT/%{python_sitearch}
188 python %py_libdir/py_compile.py *.py
189 python -O %py_libdir/py_compile.py *.py
190 popd
191 %endif
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 %if 0%{?suse_version}
214 %exclude %{_bindir}/helix2solv
215 %endif
216 %exclude %{_bindir}/solv
217 %{_bindir}/*
218
219 %files devel
220 %defattr(-,root,root)
221 %if %{with enable_static}
222 %{_libdir}/libsolv.a
223 %{_libdir}/libsolvext.a
224 %endif
225 %if !%{with disable_shared}
226 %{_libdir}/libsolv.so
227 %{_libdir}/libsolvext.so
228 %endif
229 %{_includedir}/solv
230 %if 0%{?suse_version}
231 %{_bindir}/helix2solv
232 %endif
233 %{_datadir}/cmake/Modules/*
234
235 %files demo
236 %defattr(-,root,root)
237 %{_bindir}/solv
238
239 %if %{with perl_binding}
240 %files -n perl-solv
241 %defattr(-,root,root)
242 %{perl_vendorarch}/*
243 %endif
244
245 %if %{with ruby_binding}
246 %files -n ruby-solv
247 %defattr(-,root,root)
248 %{ruby_vendorarch}/*
249 %endif
250
251 %if %{with python_binding}
252 %files -n python-solv
253 %defattr(-,root,root)
254 %{python_sitearch}/*
255 %endif
256
257 %changelog