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 %reconfigure \
160     --disable-dependency-tracking \
161     --with-lua \
162     --with-acl \
163     --with-cap \
164     --enable-shared \
165     --enable-python \
166     --with-vendor=tizen \
167     --with-msm \
168     --enable-zstd \
169     --with-rpmconfigdir=%{rpmhome}
170
171 make %{?_smp_mflags}
172
173 %install
174 mkdir -p %{buildroot}%{rpmlibdir}
175 mkdir -p %{buildroot}%{_datadir}/locale
176 ln -s ../share/locale %{buildroot}%{rpmlibdir}/locale
177 %make_install
178 install -m 644 db3/db.h %{buildroot}%{_includedir}/rpm
179 mkdir -p %{buildroot}%{_sysconfdir}/rpm
180 mkdir -p %{buildroot}%{rpmhome}/tizen
181 cp -a tizen_macros %{buildroot}%{rpmhome}
182 install -m 755 %{SOURCE13} %{buildroot}%{rpmhome}/tizen
183 install -m 755 %{SOURCE14} %{buildroot}%{rpmhome}/tizen
184 install -m 755 %{SOURCE23} %{buildroot}%{rpmhome}
185 install -m 644 %{SOURCE9} %{buildroot}%{rpmhome}/fileattrs/libsymlink.attr
186 install -m 644 %{SOURCE22} %{buildroot}%{_sysconfdir}/device-sec-policy
187 install -m 644 %{SOURCE22} %{buildroot}%{__plugindir}/msm-device-sec-policy
188 ln -s ../tizen_macros %{buildroot}%{rpmhome}/tizen/macros
189 for d in BUILD RPMS SOURCES SPECS SRPMS BUILDROOT ; do
190   mkdir -p %{buildroot}%{_usrsrc}/packages/$d
191   chmod 755 %{buildroot}%{_usrsrc}/packages/$d
192 done
193 for d in %{buildroot}%{rpmhome}/platform/*-linux/macros ; do
194   dd=${d%%-linux/macros}
195   dd=${dd##*/}
196   mkdir -p %{buildroot}%{_usrsrc}/packages/RPMS/$dd
197   chmod 755 %{buildroot}%{_usrsrc}/packages/RPMS/$dd
198 done
199 mkdir -p %{buildroot}%{_localstatedir}/lib/rpm
200 gzip -9 %{buildroot}%{_mandir}/man[18]/*.[18]
201 export RPM_BUILD_ROOT
202 chmod 755 doc/manual
203 rm -rf doc/manual/Makefile*
204 rm -f %{buildroot}%{rpmlibdir}/rpmpopt
205 rm -rf %{buildroot}%{_mandir}/{fr,ja,ko,pl,ru,sk}
206 rm -f %{buildroot}%{_datadir}/locale/de/LC_MESSAGES/rpm.mo
207 rm -f %{buildroot}%{rpmhome}/cpanflute %{buildroot}%{rpmhome}/cpanflute2
208 install -m 755 scripts/find-supplements %{buildroot}%{rpmhome}
209 install -m 755 scripts/find-supplements.ksyms %{buildroot}%{rpmhome}
210 install -m 755 scripts/firmware.prov %{buildroot}%{rpmhome}
211 install -m 755 scripts/debuginfo.prov %{buildroot}%{rpmhome}
212 install -m 644 %{SOURCE24} %{buildroot}%{rpmhome}
213 rm -f %{buildroot}%{rpmlibdir}/locale %{buildroot}%{rpmlibdir}/rpmrc
214 mkdir -p %{buildroot}%{_sysconfdir}/rpm
215 chmod 755 %{buildroot}%{_sysconfdir}/rpm
216 mkdir -p %{buildroot}%{rpmhome}/macros.d
217 # remove some nonsense or non-working scripts
218 for f in rpm2cpio.sh rpm.daily rpmdiff* rpm.log rpm.xinetd freshen.sh u_pkg.sh \
219          magic magic.mgc magic.mime* rpmfile *.pl javadeps brp-redhat \
220          vpkg-provides*.sh http.req sql.req tcl.req \
221          rpmdb_* brp-sparc64-linux brp-java-gcjcompile
222 do
223     rm -f %{buildroot}%{rpmhome}/$f
224 done
225 for i in %{_datadir}/automake-*/*; do
226   if test -f "$i" && test -f %{buildroot}%{rpmhome}/"${i##*/}"; then
227     rm -f %{buildroot}%{rpmhome}/"${i##*/}"
228   fi
229 done
230 %ifarch aarch64 ppc64le
231 install -m 755 config.guess %{buildroot}%{rpmhome}
232 install -m 755 config.sub %{buildroot}%{rpmhome}
233 %endif
234 rm -f %{buildroot}%{_libdir}/*.la
235 rm -f %{buildroot}%{__plugindir}/*.la
236
237 %fdupes %{buildroot}%{rpmhome}/platform
238
239 sh %{buildroot}%{rpmhome}/find-lang.sh %{buildroot} rpm
240
241 %ifarch armv7hl armv7l
242 # rpm is using the host_cpu as default for the platform,
243 #but armv7hl is not known by the kernel.
244 # so we need to enforce the platform here.
245 echo -n %{_target_cpu}-tizen-linux-gnueabi > %{buildroot}%{_sysconfdir}/rpm/platform
246 %endif
247
248 grep -Rn '/usr/lib/rpm' %{_builddir} || echo "No hard-coded paths found"
249
250 %post
251 /sbin/ldconfig
252 test -f %{_dbpath}/Packages || rpm --initdb
253 rm -f %{_dbpath}/Filemd5s \
254       %{_dbpath}/Filedigests \
255       %{_dbpath}/Requireversion \
256       %{_dbpath}/Provideversion
257
258 %postun
259 /sbin/ldconfig
260
261 %files
262 %manifest %{name}.manifest
263 %defattr(-,root,root)
264 %license COPYING
265 %{_sysconfdir}/rpm
266 /bin/rpm
267 %{_bindir}/rpm2cpio
268 %{_bindir}/rpmdb
269 %{_bindir}/rpmkeys
270 %{_bindir}/rpmquery
271 %{_bindir}/rpmverify
272 %{_bindir}/rpmqpack
273 %{_bindir}/rpm2archive
274 %attr(0755, root, root) %dir %{rpmhome}
275 %{rpmhome}/macros
276 %{rpmhome}/macros.d
277 %{rpmhome}/rpmpopt*
278 %{rpmhome}/rpmrc
279 %attr(0755, root, root) %dir %{rpmhome}/tizen
280 %{rpmhome}/tizen/macros
281 %{rpmhome}/tizen_macros
282 %{rpmhome}/rpm.supp
283 %{rpmhome}/tgpg
284 %{rpmhome}/platform
285 %dir    %{__plugindir}
286 %{__plugindir}/ima.so
287 %{__plugindir}/prioreset.so
288 %{__plugindir}/syslog.so
289 %{_libdir}/librpm.so.*
290 %{_libdir}/librpmio.so.*
291 %{_libdir}/librpmbuild.so.*
292 %{_libdir}/librpmsign.so.*
293 %dir    %{_localstatedir}/lib/rpm
294 %dir    %attr(755,root,root) %{_usrsrc}/packages/BUILD
295 %dir    %attr(755,root,root) %{_usrsrc}/packages/SPECS
296 %dir    %attr(755,root,root) %{_usrsrc}/packages/SOURCES
297 %dir    %attr(755,root,root) %{_usrsrc}/packages/SRPMS
298 %dir    %attr(755,root,root) %{_usrsrc}/packages/RPMS
299 %dir    %attr(755,root,root) %{_usrsrc}/packages/BUILDROOT
300 %dir    %attr(755,root,root) %{_usrsrc}/packages/RPMS/*
301
302 %files build
303 %manifest %{name}.manifest
304 %defattr(-,root,root)
305 %license COPYING
306 %{_bindir}/rpmbuild
307 %{_bindir}/gendiff
308 %{_bindir}/rpmspec
309 %{_bindir}/rpmsign
310 %attr(0755, root, root) %dir %{rpmhome}/tizen
311 %{rpmhome}/tizen/find-*
312 %{rpmhome}/brp-*
313 %{rpmhome}/find-supplements*
314 %{rpmhome}/check-*
315 %{rpmhome}/debugedit
316 %{rpmhome}/sepdebugcrcfix
317 %{rpmhome}/python-macro-helper
318 %{rpmhome}/find-debuginfo.sh
319 %{rpmhome}/find-lang.sh
320 %{rpmhome}/find-provides.ksyms
321 %{rpmhome}/*provides*
322 %{rpmhome}/*requires*
323 %{rpmhome}/*deps*
324 %{rpmhome}/*.prov
325 %{rpmhome}/*.req
326 %{rpmhome}/macros.*
327 %{rpmhome}/fileattrs
328 %{rpmhome}/debug.manifest
329 %ifarch aarch64 ppc64le
330 %{rpmhome}/config.*
331 %endif
332
333 %files devel
334 %manifest %{name}.manifest
335 %defattr(644,root,root,755)
336 %license COPYING
337 %attr(755,root,root) %{_bindir}/rpmgraph
338 %{_includedir}/rpm
339 %{_libdir}/librpm.so
340 %{_libdir}/librpmbuild.so
341 %{_libdir}/librpmio.so
342 %{_libdir}/librpmsign.so
343 %{_libdir}/pkgconfig/rpm.pc
344
345 %files security-plugin
346 %manifest %{name}.manifest
347 %defattr(-,root,root)
348 %license COPYING
349 %{__plugindir}/msm.so
350 %{__plugindir}/msm-device-sec-policy
351 %config(noreplace) %{_sysconfdir}/device-sec-policy
352
353 %files -n python-rpm
354 %defattr(-,root,root)
355 %license COPYING
356 %{python_sitearch}/rpm
357 %attr(755,root,root) %{python_sitearch}/rpm/transaction.py
358
359 %lang_package
360
361 %docs_package
362 %doc     GROUPS