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