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