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