Merge python-rpm.spec into rpm.spec and cleaning up the spec file.
[platform/upstream/rpm.git] / packaging / rpm.spec
1 %define rpmlibdir %{_prefix}/lib
2 %define rpmhome %{rpmlibdir}/rpm
3
4 Name:           rpm
5 Summary:        The Package Manager
6 License:        GPL-2.0+
7 Group:          Base/Package Management
8 Version:        4.11.0.1
9 Release:        0
10 Url:            http://www.rpm.org
11 BuildRequires:  binutils
12 BuildRequires:  bzip2
13 BuildRequires:  file-devel
14 BuildRequires:  findutils
15 BuildRequires:  gcc
16 BuildRequires:  gettext-tools
17 BuildRequires:  glibc-devel
18 BuildRequires:  gzip
19 BuildRequires:  libacl-devel
20 BuildRequires:  libattr-devel
21 BuildRequires:  pkgconfig(bzip2)
22 BuildRequires:  pkgconfig(libcap)
23 BuildRequires:  libelf-devel
24 BuildRequires:  libtool
25 BuildRequires:  pkgconfig(lua)
26 BuildRequires:  make
27 BuildRequires:  pkgconfig(ncurses)
28 BuildRequires:  patch
29 BuildRequires:  pkgconfig(popt)
30 BuildRequires:  xz-devel
31 BuildRequires:  pkgconfig(zlib)
32 BuildRequires:  pkgconfig(nss)
33 BuildRequires:  uthash-devel
34 BuildRequires:  pkgconfig(libxml-2.0)
35 BuildRequires:  pkgconfig(libsmack)
36 BuildRequires:  fdupes
37
38 Provides:       rpminst
39 Provides:       rpm-libs
40
41 Source1:       db-4.8.30.tar.bz2
42 Source2:       db-4.8.30-integration.dif
43 Source4:       rpm-tizen_macros
44 Source8:       rpmconfigcheck
45 Source13:      find-docs.sh
46 Source22:      device-sec-policy
47 Source23:      find-provides.ksyms
48 Source1001:    rpm.manifest
49 Source0:        rpm-%{version}.tar.bz2
50 #
51 # avoid bootstrapping problem
52 %define _binary_payload w9.bzdio
53
54 %description
55 RPM Package Manager is the main tool for managing the software packages
56 of Tizen.
57
58 RPM can be used to install and remove software packages. With rpm, it
59 is easy to update packages.  RPM keeps track of all these manipulations
60 in a central database.  This way it is possible to get an overview of
61 all installed packages.  RPM also supports database queries.
62
63 %package devel
64 Summary:        Include Files and Libraries mandatory for Development
65 Requires:       rpm = %{version}
66 Requires:       pkgconfig(popt)
67
68 %description devel
69 This package contains the RPM C library and header files.  These
70 development files will simplify the process of writing programs which
71 manipulate RPM packages and databases and are intended to make it
72 easier to create graphical package managers or any other tools that
73 need an intimate knowledge of RPM packages in order to function.
74
75 %package build
76 Summary:        Tools and Scripts to create rpm packages
77 Requires:       rpm = %{version}
78 Provides:       rpmbuild rpm:%{_bindir}/rpmbuild
79 Requires:       bzip2
80 Requires:       xz
81 Requires:       gzip
82 Requires:       binutils
83 Requires:       make
84 Requires:       gcc
85 Requires:       findutils
86 Requires:       patch
87 Requires:       glibc-devel
88
89 %description build
90 If you want to build a rpm, you need this package. It provides rpmbuild
91 and requires some packages that are usually required
92
93 %package security-plugin
94 Summary: MSM security plugin for rpm
95 Requires: rpm = %{version}-%{release}
96 Requires: smack
97 Requires: nss
98
99 %description security-plugin
100 This package contains the MSM security plugin for rpm that performs
101 security-related functionality.
102
103 %package -n python-rpm
104 Summary: Python Bindings for Manipulating RPM Packages
105 Requires:       rpm = %{version}
106 BuildRequires:  pkgconfig(python)
107
108 %description -n python-rpm
109 The python-rpm package contains a module that permits applications
110 written in the Python programming language to use the interface
111 supplied by RPM Package Manager libraries.
112
113 This package should be installed if you want to develop Python programs
114 that will manipulate RPM packages and databases.
115
116 %prep
117 %setup -q -n rpm-%{version}
118 cp %{SOURCE1001} .
119 rm -rf sqlite
120 tar xjf %{S:1}
121 ln -s db-4.8.30 db
122 chmod -R u+w db/*
123 # will get linked from db3
124 rm -f rpmdb/db.h
125 patch -p0 < %{S:2}
126 if [ -s %{_sysconfdir}/rpm/tizen_macros ]; then
127     cp -a %{_sysconfdir}/rpm/tizen_macros %{SOURCE4}
128 fi
129 cp -a %{SOURCE4} tizen_macros
130 rm -f m4/libtool.m4
131 rm -f m4/lt*.m4
132
133 %build
134 CPPFLAGS="$CPPFLAGS `pkg-config --cflags nss`"
135 export CPPFLAGS
136 export CFLAGS="%{optflags} -ffunction-sections"
137 export LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic-functions -ffunction-sections"
138 %ifarch armv5tel
139 export CFLAGS="-g -O0 -fno-strict-aliasing -ffunction-sections"
140 %endif
141
142 %if %{_target_cpu}
143 BUILDTARGET="--host=%{_target_cpu}-linux-gnu "
144 %ifarch %arm
145 BUILDTARGET+="--build=%{_target_cpu}-tizen-linux-gnueabi "
146 %else
147 BUILDTARGET+="--build=%{_target_cpu}-tizen-linux "
148 %endif
149 %endif
150
151 %reconfigure \
152     --disable-dependency-tracking \
153     --with-lua \
154     --with-acl \
155     --with-cap \
156     --enable-shared \
157     --enable-python \
158     --with-msm \
159     $BUILDTARGET
160
161 make %{?_smp_mflags}
162
163 %install
164 mkdir -p %{buildroot}%{rpmlibdir}
165 mkdir -p %{buildroot}%{_datadir}/locale
166 ln -s ../share/locale %{buildroot}%{rpmlibdir}/locale
167 %make_install
168 install -m 644 db3/db.h %{buildroot}%{_includedir}/rpm
169 mkdir -p %{buildroot}%{_sysconfdir}/rpm
170 cp -a tizen_macros %{buildroot}%{rpmhome}
171 mkdir -p %{buildroot}%{rpmhome}/tizen
172 install -m 755 %{SOURCE13} %{buildroot}%{rpmhome}/tizen
173 install -m 755 %{SOURCE23} %{buildroot}%{rpmhome}
174 install -m 644 %{SOURCE22} %{buildroot}%{_sysconfdir}/device-sec-policy
175 install -m 644 %{SOURCE22} %{buildroot}%{__plugindir}/msm-device-sec-policy
176 ln -s ../tizen_macros %{buildroot}%{rpmhome}/tizen/macros
177 for d in BUILD RPMS SOURCES SPECS SRPMS BUILDROOT ; do
178   mkdir -p %{buildroot}%{_usrsrc}/packages/$d
179   chmod 755 %{buildroot}%{_usrsrc}/packages/$d
180 done
181 for d in %{buildroot}%{rpmhome}/platform/*-linux/macros ; do
182   dd=${d%%-linux/macros}
183   dd=${dd##*/}
184   mkdir -p %{buildroot}%{_usrsrc}/packages/RPMS/$dd
185   chmod 755 %{buildroot}%{_usrsrc}/packages/RPMS/$dd
186 done
187 mkdir -p %{buildroot}%{_localstatedir}/lib/rpm
188 gzip -9 %{buildroot}%{_mandir}/man[18]/*.[18]
189 export RPM_BUILD_ROOT
190 chmod 755 doc/manual
191 rm -rf doc/manual/Makefile*
192 rm -f %{buildroot}%{rpmlibdir}/rpmpopt
193 rm -rf %{buildroot}%{_mandir}/{fr,ja,ko,pl,ru,sk}
194 rm -f %{buildroot}%{_datadir}/locale/de/LC_MESSAGES/rpm.mo
195 rm -f %{buildroot}%{rpmhome}/cpanflute %{buildroot}%{rpmhome}/cpanflute2
196 install -m 755 scripts/find-supplements{,.ksyms} %{buildroot}%{rpmhome}
197 install -m 755 scripts/firmware.prov %{buildroot}%{rpmhome}
198 install -m 755 scripts/debuginfo.prov %{buildroot}%{rpmhome}
199 rm -f %{buildroot}%{rpmlibdir}/locale %{buildroot}%{rpmlibdir}/rpmrc
200 mkdir -p %{buildroot}%{_sysconfdir}/rpm
201 chmod 755 %{buildroot}%{_sysconfdir}/rpm
202 mkdir -p %{buildroot}%{rpmhome}/macros.d
203 # remove some nonsense or non-working scripts
204 pushd %{buildroot}%{rpmhome}/
205 for f in rpm2cpio.sh rpm.daily rpmdiff* rpm.log rpm.xinetd freshen.sh u_pkg.sh \
206          magic magic.mgc magic.mime* rpmfile *.pl javadeps brp-redhat \
207          brp-strip-static-archive vpkg-provides*.sh http.req sql.req tcl.req \
208          rpmdb_* brp-sparc64-linux brp-strip-comment-note brp-java-gcjcompile
209 do
210     rm -f $f
211 done
212 for i in %{_datadir}/automake-*/*; do
213   if test -f "$i" && test -f "${i##*/}"; then
214     rm -f "${i##*/}"
215   fi
216 done
217 popd
218 rm -f %{buildroot}%{_libdir}/*.la
219 rm -f %{buildroot}%{__plugindir}/*.la
220
221 %fdupes %{buildroot}%{rpmhome}/platform
222
223 sh %{buildroot}%{rpmhome}/find-lang.sh %{buildroot} rpm
224
225 %ifarch armv7hl armv7l
226 # rpm is using the host_cpu as default for the platform,
227 #but armv7hl is not known by the kernel.
228 # so we need to enforce the platform here.
229 echo -n %{_target_cpu}-tizen-linux-gnueabi > %{buildroot}%{_sysconfdir}/rpm/platform
230 %endif
231
232 %post
233 /sbin/ldconfig
234 test -f %{_dbpath}/Packages || rpm --initdb
235 rm -f %{_dbpath}/Filemd5s \
236       %{_dbpath}/Filedigests \
237       %{_dbpath}/Requireversion \
238       %{_dbpath}/Provideversion
239
240 %postun
241 /sbin/ldconfig
242
243 %files
244 %manifest %{name}.manifest
245 %defattr(-,root,root)
246 %license COPYING
247 %{_sysconfdir}/rpm
248 /bin/rpm
249 %{_bindir}/rpm2cpio
250 %{_bindir}/rpmdb
251 %{_bindir}/rpmkeys
252 %{_bindir}/rpmquery
253 %{_bindir}/rpmverify
254 %{_bindir}/rpmqpack
255 %attr(0755, root, root) %dir %{rpmhome}
256 %{rpmhome}/macros
257 %{rpmhome}/macros.d
258 %{rpmhome}/rpmpopt*
259 %{rpmhome}/rpmrc
260 %{rpmhome}/tizen/macros
261 %{rpmhome}/tizen_macros
262 %{rpmhome}/rpm.supp
263 %{rpmhome}/tgpg
264 %{rpmhome}/platform
265 %dir    %{__plugindir}
266 %{__plugindir}/exec.so
267 %{_libdir}/librpm.so.*
268 %{_libdir}/librpmio.so.*
269 %{_libdir}/librpmbuild.so.*
270 %{_libdir}/librpmsign.so.*
271 %dir    %{_localstatedir}/lib/rpm
272 %dir    %attr(755,root,root) %{_usrsrc}/packages/BUILD
273 %dir    %attr(755,root,root) %{_usrsrc}/packages/SPECS
274 %dir    %attr(755,root,root) %{_usrsrc}/packages/SOURCES
275 %dir    %attr(755,root,root) %{_usrsrc}/packages/SRPMS
276 %dir    %attr(755,root,root) %{_usrsrc}/packages/RPMS
277 %dir    %attr(755,root,root) %{_usrsrc}/packages/BUILDROOT
278 %dir    %attr(755,root,root) %{_usrsrc}/packages/RPMS/*
279
280 %files build
281 %manifest %{name}.manifest
282 %defattr(-,root,root)
283 %{_bindir}/rpmbuild
284 %{_bindir}/gendiff
285 %{_bindir}/rpmspec
286 %{_bindir}/rpmsign
287 %{rpmhome}/tizen/find-*
288 %{rpmhome}/brp-*
289 %{rpmhome}/find-supplements*
290 %{rpmhome}/check-*
291 %{rpmhome}/debugedit
292 %{rpmhome}/find-debuginfo.sh
293 %{rpmhome}/find-lang.sh
294 %{rpmhome}/find-provides.ksyms
295 %{rpmhome}/*provides*
296 %{rpmhome}/*requires*
297 %{rpmhome}/*deps*
298 %{rpmhome}/*.prov
299 %{rpmhome}/*.req
300 %{rpmhome}/macros.*
301 %{rpmhome}/fileattrs
302
303 %files devel
304 %manifest %{name}.manifest
305 %defattr(644,root,root,755)
306 %attr(755,root,root) %{_bindir}/rpmgraph
307 %{_includedir}/rpm
308 %{_libdir}/librpm.so
309 %{_libdir}/librpmbuild.so
310 %{_libdir}/librpmio.so
311 %{_libdir}/librpmsign.so
312 %{_libdir}/pkgconfig/rpm.pc
313
314 %files security-plugin
315 %manifest %{name}.manifest
316 %defattr(-,root,root)
317 %{__plugindir}/msm.so
318 %{__plugindir}/msm-device-sec-policy
319 %config(noreplace) %{_sysconfdir}/device-sec-policy
320
321 %files -n python-rpm
322 %defattr(-,root,root)
323 %{_libdir}/python*/site-packages/rpm
324 %attr(755,root,root) %{_libdir}/python*/site-packages/rpm/transaction.py
325
326 %lang_package
327
328 %docs_package
329 %doc     GROUPS