remove obsolete hicolor-icon-theme BuildRequires
[platform/upstream/libzypp.git] / libzypp.spec.cmake
1 #
2 # spec file for package libzypp
3 #
4 # Copyright (c) 2005-2011 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 # norootforbuild
19 %define force_gcc_46 0
20
21
22 Name:           @PACKAGE@
23 License:        GPL-2.0+
24 Group:          System/Packages
25 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
26 Summary:        Package, Patch, Pattern, and Product Management
27 Version:        @VERSION@
28 Release:        1
29 Source:         %{name}-%{version}.tar.bz2
30 Source1:        %{name}-rpmlintrc
31 Provides:       yast2-packagemanager
32 Obsoletes:      yast2-packagemanager
33
34 # Features we provide (update doc/autoinclude/FeatureTest.doc):
35 Provides:       libzypp(plugin) = 0
36 Provides:       libzypp(plugin:commit) = 0
37 Provides:       libzypp(plugin:services) = 0
38 Provides:       libzypp(plugin:system) = 0
39 Provides:       libzypp(plugin:urlresolver) = 0
40
41 %if 0%{?suse_version}
42 Recommends:     logrotate
43 # lsof is used for 'zypper ps':
44 Recommends:     lsof
45 %endif
46 BuildRequires:  cmake
47 BuildRequires:  openssl-devel
48 %if 0%{?suse_version} >= 1130 || 0%{?fedora_version} >= 16
49 BuildRequires:  libudev-devel
50 %else
51 BuildRequires:  hal-devel
52 %endif
53 BuildRequires:  boost-devel
54 BuildRequires:  dejagnu
55 BuildRequires:  doxygen
56 %if 0%{?force_gcc_46}
57 BuildRequires:  gcc46
58 BuildRequires:  gcc46-c++
59 %else
60 BuildRequires:  gcc-c++ >= 4.6
61 %endif
62 BuildRequires:  gettext-devel
63 BuildRequires:  graphviz
64 BuildRequires:  libxml2-devel
65 %if 0%{?suse_version} != 1110
66 # No libproxy on SLES
67 BuildRequires:  libproxy-devel
68 %endif
69
70 %if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
71 BuildRequires:  pkgconfig
72 %else
73 BuildRequires:  pkg-config
74 %endif
75
76 BuildRequires:  libsolv-devel
77 %if 0%{?suse_version} >= 1100
78 %requires_eq    libsolv-tools
79 %else
80 Requires:       libsolv-tools
81 %endif
82
83 # required for testsuite, webrick
84 BuildRequires:  ruby
85
86 %if 0%{?suse_version}
87 BuildRequires:  libexpat-devel
88 %else
89 BuildRequires:  expat-devel
90 %endif
91
92 Requires:       rpm
93
94 %if 0%{?suse_version}
95 BuildRequires:  rpm-devel
96 Requires:       /usr/bin/uuidgen
97 %endif
98
99 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
100 BuildRequires:  glib2-devel
101 BuildRequires:  popt-devel
102 BuildRequires:  rpm-devel
103 %endif
104
105 %if 0%{?mandriva_version}
106 BuildRequires:  glib2-devel
107 BuildRequires:  librpm-devel
108 # uuidgen
109 Requires:       e2fsprogs
110 %endif
111
112 %if 0%{?suse_version}
113 Requires:       gpg2
114 %else
115 Requires:       gnupg2
116 %endif
117
118 %define min_curl_version 7.19.4
119 %if 0%{?suse_version}
120 %if 0%{?suse_version} >= 1100
121 # Code11+
122 BuildRequires:  libcurl-devel >= %{min_curl_version}
123 Requires:       libcurl4   >= %{min_curl_version}
124 %else
125 # Code10
126 BuildRequires:  curl-devel
127 %endif
128 %else
129 # Other distros (Fedora)
130 BuildRequires:  libcurl-devel >= %{min_curl_version}
131 Requires:       libcurl   >= %{min_curl_version}
132 %endif
133
134 %description
135 Package, Patch, Pattern, and Product Management
136
137 Authors:
138 --------
139     Michael Andres <ma@suse.de>
140     Jiri Srain <jsrain@suse.cz>
141     Stefan Schubert <schubi@suse.de>
142     Duncan Mac-Vicar <dmacvicar@suse.de>
143     Klaus Kaempf <kkaempf@suse.de>
144     Marius Tomaschewski <mt@suse.de>
145     Stanislav Visnovsky <visnov@suse.cz>
146     Ladislav Slezak <lslezak@suse.cz>
147
148 %package devel
149 License:        GPL-2.0+
150 Requires:       libzypp = %{version}
151 Requires:       libxml2-devel
152 Requires:       openssl-devel
153 Requires:       rpm-devel
154 Requires:       glibc-devel
155 Requires:       zlib-devel
156 Requires:       bzip2
157 Requires:       popt-devel
158 Requires:       boost-devel
159 Requires:       libstdc++-devel
160 %if 0%{?suse_version} >= 1130 || 0%{?fedora_version} >= 16
161 Requires:       libudev-devel
162 %else
163 Requires:       hal-devel
164 %endif
165 Requires:       cmake
166 %if 0%{?suse_version}
167 %if 0%{?suse_version} >= 1100
168 # Code11+
169 Requires:       libcurl-devel >= %{min_curl_version}
170 %else
171 # Code10
172 Requires:       curl-devel
173 %endif
174 %else
175 # Other distros (Fedora)
176 Requires:       libcurl-devel >= %{min_curl_version}
177 %endif
178 %if 0%{?suse_version} >= 1100
179 %requires_ge    libsolv-devel
180 %else
181 Requires:       libsolv-devel
182 %endif
183 Summary:        Package, Patch, Pattern, and Product Management - developers files
184 Group:          System/Packages
185 Provides:       yast2-packagemanager-devel
186 Obsoletes:      yast2-packagemanager-devel
187
188 %description -n libzypp-devel
189 Package, Patch, Pattern, and Product Management - developers files
190
191 Authors:
192 --------
193     Michael Andres <ma@suse.de>
194     Jiri Srain <jsrain@suse.cz>
195     Stefan Schubert <schubi@suse.de>
196     Duncan Mac-Vicar <dmacvicar@suse.de>
197     Klaus Kaempf <kkaempf@suse.de>
198     Marius Tomaschewski <mt@suse.de>
199     Stanislav Visnovsky <visnov@suse.cz>
200     Ladislav Slezak <lslezak@suse.cz>
201
202 %prep
203 %setup -q
204
205 %build
206 mkdir build
207 cd build
208 %if 0%{?force_gcc_46}
209 export CC=gcc-4.6
210 export CXX=g++-4.6
211 %endif
212 export CFLAGS="$RPM_OPT_FLAGS"
213 export CXXFLAGS="$RPM_OPT_FLAGS"
214 unset TRANSLATION_SET
215 unset EXTRA_CMAKE_OPTIONS
216 # SLE11-* might want its own translation set:
217 %if 0%{?suse_version} == 1110
218 if [ -f ../po/sle-zypp-po.tar.bz ]; then
219   export TRANSLATION_SET=sle-zypp
220   export EXTRA_CMAKE_OPTIONS="-DDISABLE_LIBPROXY=ON"
221 fi
222 %endif
223 cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
224       -DDOC_INSTALL_DIR=%{_docdir} \
225       -DLIB=%{_lib} \
226       -DCMAKE_BUILD_TYPE=Release \
227       -DCMAKE_SKIP_RPATH=1 \
228       -DUSE_TRANSLATION_SET=${TRANSLATION_SET:-zypp} \
229       ${EXTRA_CMAKE_OPTIONS} \
230       ..
231 make %{?_smp_mflags} VERBOSE=1
232 make -C doc/autodoc %{?_smp_mflags}
233 make -C po %{?_smp_mflags} translations
234
235 %if 0%{?run_testsuite}
236   make -C tests %{?_smp_mflags}
237   pushd tests
238   LD_LIBRARY_PATH=$PWD/../zypp:$LD_LIBRARY_PATH ctest .
239   popd
240 %endif
241
242 #make check
243
244 %install
245 rm -rf "$RPM_BUILD_ROOT"
246 cd build
247 make install DESTDIR=$RPM_BUILD_ROOT
248 make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
249 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
250 ln -s %{_sysconfdir}/yum.repos.d $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
251 %else
252 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
253 %endif
254 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/services.d
255 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/vendors.d
256 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/multiversion.d
257 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp
258 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins
259 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/commit
260 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/services
261 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/system
262 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/urlresolver
263 mkdir -p $RPM_BUILD_ROOT%{_var}/lib/zypp
264 mkdir -p $RPM_BUILD_ROOT%{_var}/log/zypp
265 mkdir -p $RPM_BUILD_ROOT%{_var}/cache/zypp
266
267 make -C po install DESTDIR=$RPM_BUILD_ROOT
268 # Create filelist with translations
269 cd ..
270 %{find_lang} zypp
271
272 %post
273 /sbin/ldconfig
274 if [ -f /var/cache/zypp/zypp.db ]; then rm /var/cache/zypp/zypp.db; fi
275
276 # convert old lock file to new
277 # TODO make this a separate file?
278 # TODO run the sript only when updating form pre-11.0 libzypp versions
279 LOCKSFILE=%{_sysconfdir}/zypp/locks
280 OLDLOCKSFILE=%{_sysconfdir}/zypp/locks.old
281
282 is_old(){
283   # if no such file, exit with false (1 in bash)
284   test -f ${LOCKSFILE} || return 1
285   TEMP_FILE=`mktemp`
286   cat ${LOCKSFILE} | sed '/^\#.*/ d;/.*:.*/d;/^[^[a-zA-Z\*?.0-9]*$/d' > ${TEMP_FILE}
287   if [ -s ${TEMP_FILE} ]
288   then
289     RES=0
290   else
291     RES=1
292   fi
293   rm -f ${TEMP_FILE}
294   return ${RES}
295 }
296
297 append_new_lock(){
298   case "$#" in
299     1 )
300   echo "
301 solvable_name: $1
302 match_type: glob
303 " >> ${LOCKSFILE}
304 ;;
305     2 ) #TODO version
306   echo "
307 solvable_name: $1
308 match_type: glob
309 version: $2
310 " >> ${LOCKSFILE}
311 ;;
312     3 ) #TODO version
313   echo "
314 solvable_name: $1
315 match_type: glob
316 version: $2 $3
317 " >> ${LOCKSFILE}
318   ;;
319 esac
320 }
321
322 die() {
323   echo $1
324   exit 1
325 }
326
327 if is_old ${LOCKSFILE}
328   then
329   mv -f ${LOCKSFILE} ${OLDLOCKSFILE} || die "cannot backup old locks"
330   cat ${OLDLOCKSFILE}| sed "/^\#.*/d"| while read line
331   do
332     append_new_lock $line
333   done
334 fi
335
336 %postun -p /sbin/ldconfig
337
338 %clean
339 rm -rf "$RPM_BUILD_ROOT"
340
341 %files -f zypp.lang
342 %defattr(-,root,root)
343 %dir               %{_sysconfdir}/zypp
344 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
345 %{_sysconfdir}/zypp/repos.d
346 %else
347 %dir               %{_sysconfdir}/zypp/repos.d
348 %endif
349 %dir               %{_sysconfdir}/zypp/services.d
350 %dir               %{_sysconfdir}/zypp/vendors.d
351 %dir               %{_sysconfdir}/zypp/multiversion.d
352 %config(noreplace) %{_sysconfdir}/zypp/zypp.conf
353 %config(noreplace) %{_sysconfdir}/zypp/systemCheck
354 %config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
355 %dir               %{_var}/lib/zypp
356 %dir               %{_var}/log/zypp
357 %dir               %{_var}/cache/zypp
358 %{_prefix}/lib/zypp
359 %{_datadir}/zypp
360 %{_bindir}/*
361 %{_libdir}/libzypp*so.*
362 %doc %{_mandir}/man5/locks.5.*
363
364 %files devel
365 %defattr(-,root,root)
366 %{_libdir}/libzypp.so
367 %{_docdir}/%{name}
368 %{_includedir}/zypp
369 %{_datadir}/cmake/Modules/*
370 %{_libdir}/pkgconfig/libzypp.pc
371
372 %changelog