- fix: _smp_flags macro broken.
[platform/upstream/rpm.git] / rpm.spec
1 %define with_python_subpackage  1 %{nil}
2 %define with_bzip2              1 %{nil}
3 %define with_apidocs            1 %{nil}
4 %define with_internal_db        1 %{nil}
5 %define strip_binaries          1
6
7 # XXX enable at your own risk, CDB access to rpmdb isn't cooked yet.
8 %define enable_cdb              create cdb
9
10 # XXX legacy requires './' payload prefix to be omitted from rpm packages.
11 %define _noPayloadPrefix        1
12
13 %define __prefix        /usr
14 %{expand:%%define __share %(if [ -d %{__prefix}/share/man ]; then echo /share ; else echo %%{nil} ; fi)}
15
16 Summary: The Red Hat package management system.
17 Name: rpm
18 %define version 4.1
19 Version: %{version}
20 Release: 0.1
21 Group: System Environment/Base
22 Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{version}.tar.gz
23 Copyright: GPL
24 Conflicts: patch < 2.5
25 %ifos linux
26 Prereq: gawk fileutils textutils mktemp
27 Requires: popt = 1.6.3
28 %endif
29
30 %if !%{with_internal_db}
31 BuildRequires: db3-devel
32
33 # XXX glibc-2.1.92 has incompatible locale changes that affect statically
34 # XXX linked binaries like /bin/rpm.
35 %ifnarch ia64
36 Requires: glibc >= 2.1.92
37 %endif
38 %endif
39
40 # XXX Red Hat 5.2 has not bzip2 or python
41 %if %{with_bzip2}
42 BuildRequires: bzip2 >= 0.9.0c-2
43 %endif
44 %if %{with_python_subpackage}
45 BuildRequires: python-devel >= 1.5.2
46 %endif
47
48 BuildRoot: %{_tmppath}/%{name}-root
49
50 %description
51 The RPM Package Manager (RPM) is a powerful command line driven
52 package management system capable of installing, uninstalling,
53 verifying, querying, and updating software packages.  Each software
54 package consists of an archive of files along with information about
55 the package like its version, a description, etc.
56
57 %package devel
58 Summary: Development files for applications which will manipulate RPM packages.
59 Group: Development/Libraries
60 Requires: rpm = %{version}, popt = 1.6.3
61
62 %description devel
63 This package contains the RPM C library and header files.  These
64 development files will simplify the process of writing programs which
65 manipulate RPM packages and databases. These files are intended to
66 simplify the process of creating graphical package managers or any
67 other tools that need an intimate knowledge of RPM packages in order
68 to function.
69
70 This package should be installed if you want to develop programs that
71 will manipulate RPM packages and databases.
72
73 %package build
74 Summary: Scripts and executable programs used to build packages.
75 Group: Development/Tools
76 Requires: rpm = %{version}
77
78 %description build
79 This package contains scripts and executable programs that are used to
80 build packages using RPM.
81
82 %if %{with_python_subpackage}
83 %package python
84 Summary: Python bindings for apps which will manipulate RPM packages.
85 Group: Development/Libraries
86 Requires: rpm = %{version}
87 Requires: python >= 1.5.2
88
89 %description python
90 The rpm-python package contains a module which permits applications
91 written in the Python programming language to use the interface
92 supplied by RPM (RPM Package Manager) libraries.
93
94 This package should be installed if you want to develop Python
95 programs that will manipulate RPM packages and databases.
96 %endif
97
98 %package -n popt
99 Summary: A C library for parsing command line parameters.
100 Group: Development/Libraries
101 Version: 1.7
102
103 %description -n popt
104 Popt is a C library for parsing command line parameters.  Popt was
105 heavily influenced by the getopt() and getopt_long() functions, but it
106 improves on them by allowing more powerful argument expansion.  Popt
107 can parse arbitrary argv[] style arrays and automatically set
108 variables based on command line arguments.  Popt allows command line
109 arguments to be aliased via configuration files and includes utility
110 functions for parsing arbitrary strings into argv[] arrays using
111 shell-like rules.
112
113 Install popt if you're a C programmer and you'd like to use its
114 capabilities.
115
116 %prep
117 %setup -q
118
119 %build
120
121 #
122 # XXX work around a (possible) compiler problem on ia64
123 %ifarch ia64
124 RPM_OPT_FLAGS="-O0"
125 %endif
126
127 %ifos linux
128 CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{__prefix} --sysconfdir=/etc --localstatedir=/var --infodir='${prefix}%{__share}/info' --mandir='${prefix}%{__share}/man'
129 %else
130 CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{__prefix}
131 %endif
132
133 make
134
135 %install
136 rm -rf $RPM_BUILD_ROOT
137
138 make DESTDIR="$RPM_BUILD_ROOT" install
139
140 %ifos linux
141
142 # Save list of packages through cron
143 mkdir -p ${RPM_BUILD_ROOT}/etc/cron.daily
144 install -m 755 scripts/rpm.daily ${RPM_BUILD_ROOT}/etc/cron.daily/rpm
145
146 mkdir -p ${RPM_BUILD_ROOT}/etc/logrotate.d
147 install -m 755 scripts/rpm.log ${RPM_BUILD_ROOT}/etc/logrotate.d/rpm
148
149 mkdir -p $RPM_BUILD_ROOT/etc/rpm
150 cat << E_O_F > $RPM_BUILD_ROOT/etc/rpm/macros.db1
151 %%_dbapi                1
152 E_O_F
153 cat << E_O_F > $RPM_BUILD_ROOT/etc/rpm/macros.cdb
154 %{?enable_cdb:#%%__dbi_cdb      %{enable_cdb}}
155 E_O_F
156
157 mkdir -p $RPM_BUILD_ROOT/var/lib/rpm
158 for dbi in \
159         Basenames Conflictname Dirnames Group Installtid Name Providename \
160         Provideversion Removetid Requirename Requireversion Triggername \
161         Packages __db.001 __db.002 __db.003 __db.004 __db.005 __db.006 __db.007 \
162         __db.008 __db.009
163 do
164     touch $RPM_BUILD_ROOT/var/lib/rpm/$dbi
165 done
166
167 %endif
168
169 %if %{with_apidocs}
170 gzip -9n apidocs/man/man*/* || :
171 %endif
172
173 %if %{strip_binaries}
174 { cd $RPM_BUILD_ROOT
175   strip ./bin/rpm
176   strip .%{__prefix}/bin/rpm2cpio
177 }
178 %endif
179
180 %clean
181 rm -rf $RPM_BUILD_ROOT
182
183 %pre
184 %ifos linux
185 if [ -f /var/lib/rpm/Packages -a -f /var/lib/rpm/packages.rpm ]; then
186     echo "
187 You have both
188         /var/lib/rpm/packages.rpm       db1 format installed package headers
189         /var/lib/rpm/Packages           db3 format installed package headers
190 Please remove (or at least rename) one of those files, and re-install.
191 "
192     exit 1
193 fi
194 /usr/sbin/groupadd -g 37 rpm                            > /dev/null 2>&1
195 /usr/sbin/useradd  -r -d /var/lib/rpm -u 37 -g 37 rpm   > /dev/null 2>&1
196 %endif
197 exit 0
198
199 %post
200 %ifos linux
201 /sbin/ldconfig
202 if [ -f /var/lib/rpm/packages.rpm ]; then
203     /bin/chown rpm.rpm /var/lib/rpm/*.rpm
204 elif [ -f /var/lib/rpm/Packages ]; then
205     # undo db1 configuration
206     rm -f /etc/rpm/macros.db1
207     /bin/chown rpm.rpm /var/lib/rpm/[A-Z]*
208 else
209     # initialize db3 database
210     rm -f /etc/rpm/macros.db1
211     /bin/rpm --initdb
212 fi
213 %endif
214 exit 0
215
216 %ifos linux
217 %postun
218 /sbin/ldconfig
219 if [ $1 == 0 ]; then
220     /usr/sbin/userdel rpm
221     /usr/sbin/groupdel rpm
222 fi
223
224
225 %post devel -p /sbin/ldconfig
226 %postun devel -p /sbin/ldconfig
227
228 %post -n popt -p /sbin/ldconfig
229 %postun -n popt -p /sbin/ldconfig
230 %endif
231
232 %if %{with_python_subpackage}
233 %post python -p /sbin/ldconfig
234 %postun python -p /sbin/ldconfig
235 %endif
236
237 %define rpmattr         %attr(0755, rpm, rpm)
238
239 %files
240 %defattr(-,root,root)
241 %doc RPM-PGP-KEY RPM-GPG-KEY CHANGES GROUPS doc/manual/[a-z]*
242 %attr(0755, rpm, rpm)   /bin/rpm
243
244 %ifos linux
245 %config(noreplace,missingok)    /etc/cron.daily/rpm
246 %config(noreplace,missingok)    /etc/logrotate.d/rpm
247 %dir                            /etc/rpm
248 %config(noreplace,missingok)    /etc/rpm/macros.*
249 %attr(0755, rpm, rpm)   %dir /var/lib/rpm
250
251 %define rpmdbattr %attr(0644, rpm, rpm) %verify(not md5 size mtime) %ghost %config(missingok,noreplace)
252 %rpmdbattr      /var/lib/rpm/Basenames
253 %rpmdbattr      /var/lib/rpm/Conflictname
254 %rpmdbattr      /var/lib/rpm/__db.0*
255 %rpmdbattr      /var/lib/rpm/Dirnames
256 %rpmdbattr      /var/lib/rpm/Group
257 %rpmdbattr      /var/lib/rpm/Installtid
258 %rpmdbattr      /var/lib/rpm/Name
259 %rpmdbattr      /var/lib/rpm/Packages
260 %rpmdbattr      /var/lib/rpm/Providename
261 %rpmdbattr      /var/lib/rpm/Provideversion
262 %rpmdbattr      /var/lib/rpm/Removetid
263 %rpmdbattr      /var/lib/rpm/Requirename
264 %rpmdbattr      /var/lib/rpm/Requireversion
265 %rpmdbattr      /var/lib/rpm/Triggername
266
267 %endif
268
269 %rpmattr        %{__prefix}/bin/rpm2cpio
270 %rpmattr        %{__prefix}/bin/gendiff
271 %rpmattr        %{__prefix}/bin/rpmdb
272 #%rpmattr       %{__prefix}/bin/rpm[eiu]
273 %rpmattr        %{__prefix}/bin/rpmsign
274 %rpmattr        %{__prefix}/bin/rpmquery
275 %rpmattr        %{__prefix}/bin/rpmverify
276
277 %{__prefix}/lib/librpm-4.1.so
278 %{__prefix}/lib/librpmdb-4.1.so
279 %{__prefix}/lib/librpmio-4.1.so
280 %{__prefix}/lib/librpmbuild-4.1.so
281
282 %rpmattr        %{__prefix}/lib/rpm/config.guess
283 %rpmattr        %{__prefix}/lib/rpm/config.sub
284 %rpmattr        %{__prefix}/lib/rpm/convertrpmrc.sh
285 %attr(0644, rpm, rpm)   %{__prefix}/lib/rpm/macros
286 %rpmattr        %{__prefix}/lib/rpm/mkinstalldirs
287 %rpmattr        %{__prefix}/lib/rpm/rpm.*
288 %rpmattr        %{__prefix}/lib/rpm/rpm[deiukqv]
289 %attr(0644, rpm, rpm)   %{__prefix}/lib/rpm/rpmpopt*
290 %attr(0644, rpm, rpm)   %{__prefix}/lib/rpm/rpmrc
291
292 %ifarch i386 i486 i586 i686 athlon
293 %attr(-, rpm, rpm)      %{__prefix}/lib/rpm/i[3456]86*
294 %endif
295 %ifarch alpha
296 %attr(-, rpm, rpm)      %{__prefix}/lib/rpm/alpha*
297 %endif
298 %ifarch sparc sparc64
299 %attr(-, rpm, rpm)      %{__prefix}/lib/rpm/sparc*
300 %endif
301 %ifarch ia64
302 %attr(-, rpm, rpm)      %{__prefix}/lib/rpm/ia64*
303 %endif
304 %ifarch powerpc ppc
305 %attr(-, rpm, rpm)      %{__prefix}/lib/rpm/ppc*
306 %endif
307 %ifarch s390 s390x
308 %attr(-, rpm, rpm)      %{__prefix}/lib/rpm/s390*
309 %endif
310 %ifarch armv3l armv4l
311 %attr(-, rpm, rpm)      %{__prefix}/lib/rpm/armv[34][lb]*
312 %endif
313 %attr(-, rpm, rpm)              %{__prefix}/lib/rpm/noarch*
314
315 %lang(cs)       %{__prefix}/*/locale/cs/LC_MESSAGES/rpm.mo
316 %lang(da)       %{__prefix}/*/locale/da/LC_MESSAGES/rpm.mo
317 %lang(de)       %{__prefix}/*/locale/de/LC_MESSAGES/rpm.mo
318 %lang(fi)       %{__prefix}/*/locale/fi/LC_MESSAGES/rpm.mo
319 %lang(fr)       %{__prefix}/*/locale/fr/LC_MESSAGES/rpm.mo
320 %lang(is)       %{__prefix}/*/locale/is/LC_MESSAGES/rpm.mo
321 %lang(ja)       %{__prefix}/*/locale/ja/LC_MESSAGES/rpm.mo
322 %lang(no)       %{__prefix}/*/locale/no/LC_MESSAGES/rpm.mo
323 %lang(pl)       %{__prefix}/*/locale/pl/LC_MESSAGES/rpm.mo
324 %lang(pt)       %{__prefix}/*/locale/pt/LC_MESSAGES/rpm.mo
325 %lang(pt_BR)    %{__prefix}/*/locale/pt_BR/LC_MESSAGES/rpm.mo
326 %lang(ro)       %{__prefix}/*/locale/ro/LC_MESSAGES/rpm.mo
327 %lang(ru)       %{__prefix}/*/locale/ru/LC_MESSAGES/rpm.mo
328 %lang(sk)       %{__prefix}/*/locale/sk/LC_MESSAGES/rpm.mo
329 %lang(sl)       %{__prefix}/*/locale/sl/LC_MESSAGES/rpm.mo
330 %lang(sr)       %{__prefix}/*/locale/sr/LC_MESSAGES/rpm.mo
331 %lang(sv)       %{__prefix}/*/locale/sv/LC_MESSAGES/rpm.mo
332 %lang(tr)       %{__prefix}/*/locale/tr/LC_MESSAGES/rpm.mo
333
334 %{__prefix}%{__share}/man/man1/gendiff.1*
335 %{__prefix}%{__share}/man/man8/rpm.8*
336 %{__prefix}%{__share}/man/man8/rpm2cpio.8*
337 %lang(pl) %{__prefix}%{__share}/man/pl/man[18]/*.[18]*
338 %lang(ru) %{__prefix}%{__share}/man/ru/man[18]/*.[18]*
339 %lang(sk) %{__prefix}%{__share}/man/sk/man[18]/*.[18]*
340
341 %files build
342 %defattr(-,root,root)
343 %dir %{__prefix}/src/redhat
344 %dir %{__prefix}/src/redhat/BUILD
345 %dir %{__prefix}/src/redhat/SPECS
346 %dir %{__prefix}/src/redhat/SOURCES
347 %dir %{__prefix}/src/redhat/SRPMS
348 %dir %{__prefix}/src/redhat/RPMS
349 %{__prefix}/src/redhat/RPMS/*
350 %rpmattr        %{__prefix}/bin/rpmbuild
351 %rpmattr        %{__prefix}/lib/rpm/brp-*
352 %rpmattr        %{__prefix}/lib/rpm/check-prereqs
353 %rpmattr        %{__prefix}/lib/rpm/config.site
354 %rpmattr        %{__prefix}/lib/rpm/cpanflute
355 %rpmattr        %{__prefix}/lib/rpm/cross-build
356 %rpmattr        %{__prefix}/lib/rpm/find-lang.sh
357 %rpmattr        %{__prefix}/lib/rpm/find-prov.pl
358 %rpmattr        %{__prefix}/lib/rpm/find-provides
359 %rpmattr        %{__prefix}/lib/rpm/find-provides.perl
360 %rpmattr        %{__prefix}/lib/rpm/find-req.pl
361 %rpmattr        %{__prefix}/lib/rpm/find-requires
362 %rpmattr        %{__prefix}/lib/rpm/find-requires.perl
363 %rpmattr        %{__prefix}/lib/rpm/get_magic.pl
364 %rpmattr        %{__prefix}/lib/rpm/getpo.sh
365 %rpmattr        %{__prefix}/lib/rpm/http.req
366 %rpmattr        %{__prefix}/lib/rpm/javadeps
367 %rpmattr        %{__prefix}/lib/rpm/magic.prov
368 %rpmattr        %{__prefix}/lib/rpm/magic.req
369 %rpmattr        %{__prefix}/lib/rpm/perl.prov
370 %rpmattr        %{__prefix}/lib/rpm/perl.req
371 %rpmattr        %{__prefix}/lib/rpm/rpm[bt]
372 %rpmattr        %{__prefix}/lib/rpm/rpmdiff
373 %rpmattr        %{__prefix}/lib/rpm/rpmdiff.cgi
374 %rpmattr        %{__prefix}/lib/rpm/u_pkg.sh
375 %rpmattr        %{__prefix}/lib/rpm/vpkg-provides.sh
376 %rpmattr        %{__prefix}/lib/rpm/vpkg-provides2.sh
377
378 %{__prefix}%{__share}/man/man8/rpmbuild.8*
379
380 %if %{with_python_subpackage}
381 %files python
382 %defattr(-,root,root)
383 %{__prefix}/lib/python1.5/site-packages/rpmmodule.so
384 %endif
385
386 %files devel
387 %defattr(-,root,root)
388 %if %{with_apidocs}
389 %doc apidocs
390 %endif
391 %{__prefix}/include/rpm
392 %{__prefix}/lib/librpm.a
393 %{__prefix}/lib/librpm.la
394 %{__prefix}/lib/librpm.so
395 %{__prefix}/lib/librpmdb.a
396 %{__prefix}/lib/librpmdb.la
397 %{__prefix}/lib/librpmdb.so
398 %{__prefix}/lib/librpmio.a
399 %{__prefix}/lib/librpmio.la
400 %{__prefix}/lib/librpmio.so
401 %{__prefix}/lib/librpmbuild.a
402 %{__prefix}/lib/librpmbuild.la
403 %{__prefix}/lib/librpmbuild.so
404
405 %files -n popt
406 %defattr(-,root,root)
407 %{__prefix}/lib/libpopt.so.*
408 %{__prefix}%{__share}/man/man3/popt.3*
409 %lang(cs)       %{__prefix}/*/locale/cs/LC_MESSAGES/popt.mo
410 %lang(da)       %{__prefix}/*/locale/da/LC_MESSAGES/popt.mo
411 %lang(gl)       %{__prefix}/*/locale/gl/LC_MESSAGES/popt.mo
412 %lang(hu)       %{__prefix}/*/locale/hu/LC_MESSAGES/popt.mo
413 %lang(is)       %{__prefix}/*/locale/is/LC_MESSAGES/popt.mo
414 %lang(no)       %{__prefix}/*/locale/no/LC_MESSAGES/popt.mo
415 %lang(pt)       %{__prefix}/*/locale/pt/LC_MESSAGES/popt.mo
416 %lang(ro)       %{__prefix}/*/locale/ro/LC_MESSAGES/popt.mo
417 %lang(ru)       %{__prefix}/*/locale/ru/LC_MESSAGES/popt.mo
418 %lang(sk)       %{__prefix}/*/locale/sk/LC_MESSAGES/popt.mo
419 %lang(sl)       %{__prefix}/*/locale/sl/LC_MESSAGES/popt.mo
420 %lang(sv)       %{__prefix}/*/locale/sv/LC_MESSAGES/popt.mo
421 %lang(tr)       %{__prefix}/*/locale/tr/LC_MESSAGES/popt.mo
422 %lang(uk)       %{__prefix}/*/locale/uk/LC_MESSAGES/popt.mo
423 %lang(wa)       %{__prefix}/*/locale/wa/LC_MESSAGES/popt.mo
424 %lang(zh_CN)    %{__prefix}/*/locale/zh_CN.GB2312/LC_MESSAGES/popt.mo
425
426 # XXX These may end up in popt-devel but it hardly seems worth the effort now.
427 %{__prefix}/lib/libpopt.a
428 %{__prefix}/lib/libpopt.la
429 %{__prefix}/lib/libpopt.so
430 %{__prefix}/include/popt.h
431
432 %changelog
433 * Mon Feb 19 2001 Jeff Johnson <jbj@redhat.com>
434 - start rpm-4.0.3 with --repackage.