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