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