891033bee7c540328249871d91b8b43e1059c8b2
[scm/bb/meta-tizen.git] / recipes-tizen / rpm / rpm.inc
1 DESCRIPTION = "The RPM Package Manager"
2 HOMEPAGE = "http://www.rpm.org"
3 SECTION = "Base/Package Management"
4 LICENSE = "GPL-2.0+"
5
6 SRC_URI = ""
7
8 S = "${WORKDIR}/git"
9
10 inherit autotools-brokensep
11
12 PROVIDES = ""
13
14 #PROVIDES by rpm-security-plugin 
15
16
17 #PROVIDES by rpm-build 
18 # the PROVIDES rules is ignore "rpmbuild  "
19 PROVIDES += "rpmbuild"
20 RPROVIDES_rpm-build += "rpmbuild"
21 # the PROVIDES rules is ignore "rpm:${prefix}/bin/rpmbuild  "
22 PROVIDES += "rpm:${prefix}/bin/rpmbuild"
23 RPROVIDES_rpm-build += "rpm:${prefix}/bin/rpmbuild"
24
25
26 #PROVIDES by rpm-locale  
27 # the PROVIDES rules is ignore "rpm-lang-all = 4.11.0.1"
28 PROVIDES += "rpm-lang-all"
29 RPROVIDES_rpm-locale  += "rpm-lang-all"
30
31
32 #PROVIDES by rpm-dev 
33
34
35 #PROVIDES by rpm 
36 # the PROVIDES rules is ignore "rpminst  "
37 PROVIDES += "rpminst"
38 RPROVIDES_rpm += "rpminst"
39 # the PROVIDES rules is ignore "rpm-libs  "
40 PROVIDES += "rpm-libs"
41 RPROVIDES_rpm += "rpm-libs"
42
43
44 #PROVIDES by rpm-docs  
45
46
47 RDEPENDS = ""
48 #RDEPENDS of rpm-security-plugin (${PN}-security-plugin)
49 RDEPENDS_${PN}-security-plugin += "libxml2"
50 RDEPENDS_${PN}-security-plugin += "smack"
51 RDEPENDS_${PN}-security-plugin += "nss"
52 RDEPENDS_${PN}-security-plugin += "rpm"
53
54 #RDEPENDS of rpm-build (${PN}-build)
55 RDEPENDS_${PN}-build += "bzip2"
56 RDEPENDS_${PN}-build += "make"
57 RDEPENDS_${PN}-build += "gcc"
58 RDEPENDS_${PN}-build += "patch"
59 RDEPENDS_${PN}-build += "xz"
60 RDEPENDS_${PN}-build += "eglibc"
61 RDEPENDS_${PN}-build += "findutils"
62 RDEPENDS_${PN}-build += "gzip"
63 RDEPENDS_${PN}-build += "rpm"
64 RDEPENDS_${PN}-build += "binutils"
65
66 #RDEPENDS of rpm-locale  (${PN}-locale )
67 RDEPENDS_${PN}-locale  += "rpm"
68
69 #RDEPENDS of rpm-dev (${PN}-dev)
70 RDEPENDS_${PN}-dev += "rpm"
71 RDEPENDS_${PN}-dev += "popt"
72
73
74 DEPENDS = ""
75 #DEPENDS of rpm 
76 DEPENDS += "aul-1"
77 DEPENDS += "libxml2"
78 DEPENDS += "xz"
79 DEPENDS += "findutils"
80 DEPENDS += "file"
81 DEPENDS += "popt"
82 DEPENDS += "uthash"
83 DEPENDS += "nss"
84 DEPENDS += "bzip2"
85 DEPENDS += "elfutils"
86 DEPENDS += "patch"
87 DEPENDS += "lua"
88 DEPENDS += "libcap"
89 DEPENDS += "ncurses"
90 DEPENDS += "smack"
91 DEPENDS += "libtool-cross"
92 #Replace "DEPENDS" on gettext by "inherit gettext"
93 inherit gettext
94 DEPENDS += "attr"
95 DEPENDS += "zlib"
96 DEPENDS += "acl"
97 DEPENDS += "gzip"
98 DEPENDS += "make"
99 DEPENDS += "binutils"
100
101 do_prep() {
102  cd ${S}
103  chmod -Rf a+rX,u+w,g-w,o-w ${S}
104  #setup -q -n rpm-4.11.0.1
105  ### PREP BEGIN ###
106  cp ${S}/packaging/rpm.manifest .
107  rm -rf sqlite
108  tar xjf ${S}/packaging/db-4.8.30.tar.bz2
109  ln -s db-4.8.30 db
110  chmod -R u+w db/*
111  # will get linked from db3
112  rm -f rpmdb/db.h
113  patch -p0 < ${S}/packaging/db-4.8.30-integration.dif
114  
115  if [ -s /etc/rpm/tizen_macros ]; then
116         cp -a /etc/rpm/tizen_macros ${S}/packaging/rpm-tizen_macros
117  fi
118  cp -a ${S}/packaging/rpm-tizen_macros tizen_macros
119  rm -f m4/libtool.m4
120  rm -f m4/lt*.m4
121  ### PREP END ###
122  
123  
124 }
125 do_patch_append() {
126     bb.build.exec_func('do_prep', d)
127 }
128
129 do_configure() {
130 }
131
132 do_compile() {
133  cd ${S}
134  LANG=C
135  export LANG
136  unset DISPLAY
137  CFLAGS="-O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables" ; export CFLAGS ; 
138  CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ; 
139  FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I%_fmoddir}" ; export FFLAGS ; 
140  LD_AS_NEEDED=1; export LD_AS_NEEDED ; 
141  
142  ### BUILD BEGIN ###
143  CPPFLAGS="$CPPFLAGS `pkg-config --cflags nss`"
144  export CPPFLAGS 
145  export CFLAGS="-O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -ffunction-sections"
146  export LDFLAGS="-Wl,-Bsymbolic-functions -ffunction-sections"
147  
148  BUILDTARGET="--build=x86_64-tizen-linux"
149  
150  autoreconf -i -f
151  ./configure --disable-dependency-tracking --prefix=${prefix} --mandir=${mandir} --infodir=${infodir} \
152  --libdir=${prefix}/lib --sysconfdir=/etc --localstatedir=/var  --with-lua \
153  --with-acl --with-cap  --enable-shared  --with-msm $BUILDTARGET
154  
155  make -j16
156  ### BUILD END ###
157  
158  
159  
160 }
161
162 do_install() {
163  echo export RPM_BUILD_ROOT=${D}
164  cd ${S}
165  LANG=C
166  export LANG
167  unset DISPLAY
168  rm -rf ${D} 
169  mkdir -p ${D} 
170  
171  mkdir -p ${D}/usr/lib
172  mkdir -p ${D}/usr/share/locale
173  ln -s ../share/locale ${D}/usr/lib/locale
174  
175    oe_runmake \
176          DESTDIR=${D} \
177          INSTALL_ROOT=${D} \
178          BINDIR=${prefix}/bin \
179    install  
180    rm -f ${D}${infodir}/dir 
181    find ${D} -regex ".*\.la$" | xargs rm -f -- 
182    find ${D} -regex ".*\.a$" | xargs rm -f --
183  install -m 644 db3/db.h ${D}/usr/include/rpm
184  # remove .la file and the static variant of libpopt
185  # have to remove the dependency from other .la files as well
186  #for f in ${D}/${prefix}/lib/*.la; do
187  #    sed -i -e "s,/lib/libpopt.la,-lpopt,g" $f
188  #done
189  mkdir -p ${D}${sysconfdir}/rpm
190  cp -a tizen_macros ${D}/usr/lib/rpm
191  mkdir -p ${D}/usr/lib/rpm/tizen
192  install -m 755 ${S}/packaging/find-docs.sh ${D}/usr/lib/rpm/tizen
193  install -m 755 ${S}/packaging/find-provides.ksyms ${D}/usr/lib/rpm
194  install -m 644 ${S}/packaging/device-sec-policy ${D}${sysconfdir}/device-sec-policy
195  install -m 644 ${S}/packaging/device-sec-policy ${D}${prefix}/lib/rpm-plugins/msm-device-sec-policy
196  ln -s ../tizen_macros ${D}/usr/lib/rpm/tizen/macros
197  for d in BUILD RPMS SOURCES SPECS SRPMS BUILDROOT ; do
198    mkdir -p ${D}/usr/src/packages/$d
199    chmod 755 ${D}/usr/src/packages/$d
200  done
201  for d in ${D}/usr/lib/rpm/platform/*-linux/macros ; do
202    dd=${d%-linux/macros}
203    dd=${dd##*/}
204    mkdir ${D}/usr/src/packages/RPMS/$dd
205    chmod 755 ${D}/usr/src/packages/RPMS/$dd
206  done
207  mkdir -p ${D}/var/lib/rpm
208  gzip -9 ${D}/${mandir}/man[18]/*.[18]
209  export RPM_BUILD_ROOT
210  chmod 755 doc/manual
211  rm -rf doc/manual/Makefile*
212  rm -f ${D}/usr/lib/rpmpopt
213  rm -rf ${D}${mandir}/{fr,ja,ko,pl,ru,sk}
214  rm -f ${D}${prefix}/share/locale/de/LC_MESSAGES/rpm.mo
215  rm -f ${D}/usr/lib/rpm/cpanflute ${D}/usr/lib/rpm/cpanflute2
216  install -m 755 scripts/find-supplements{,.ksyms} ${D}/usr/lib/rpm
217  install -m 755 scripts/firmware.prov ${D}/usr/lib/rpm
218  install -m 755 scripts/debuginfo.prov ${D}/usr/lib/rpm
219  rm -f ${D}/usr/lib/locale ${D}/usr/lib/rpmrc
220  mkdir -p ${D}/etc/rpm
221  chmod 755 ${D}/etc/rpm
222  mkdir -p ${D}/usr/lib/rpm/macros.d
223  # remove some nonsense or non-working scripts
224  pushd ${D}/usr/lib/rpm/
225  for f in rpm2cpio.sh rpm.daily rpmdiff* rpm.log rpm.xinetd freshen.sh u_pkg.sh \
226           magic magic.mgc magic.mime* rpmfile *.pl javadeps brp-redhat \
227           brp-strip-static-archive vpkg-provides*.sh http.req sql.req tcl.req \
228           rpmdb_* brp-sparc64-linux brp-strip-comment-note brp-java-gcjcompile
229  do
230      rm -f $f
231  done
232  for i in /usr/share/automake-*/*; do
233    if test -f "$i" && test -f "${i##*/}"; then
234      rm -f "${i##*/}"
235    fi
236  done
237  popd
238  rm -rf ${D}/${prefix}/lib/python2.7
239  rm -f ${D}${prefix}/lib/*.la
240  rm -f ${D}${prefix}/lib/rpm-plugins/*.la
241  sh ${D}/usr/lib/rpm/find-lang.sh ${D} rpm
242  
243  
244 }
245
246 PACKAGES += " rpm-security-plugin "
247 PACKAGES += " rpm-build "
248 PACKAGES += " rpm-docs "
249
250 rpm-security-plugin_files = ""
251 rpm-security-plugin_files += "rpm.manifest"
252 rpm-security-plugin_files += "${prefix}/lib/rpm-plugins/msm.so"
253 rpm-security-plugin_files += "${prefix}/lib/rpm-plugins/msm-device-sec-policy"
254 rpm-security-plugin_files += "${sysconfdir}/device-sec-policy"
255
256 rpm-build_files = ""
257 rpm-build_files += "rpm.manifest"
258 rpm-build_files += "${prefix}/bin/rpmbuild"
259 rpm-build_files += "${prefix}/bin/gendiff"
260 rpm-build_files += "${prefix}/bin/rpmspec"
261 rpm-build_files += "${prefix}/bin/rpmsign"
262 rpm-build_files += "/usr/lib/rpm/tizen/find-*"
263 rpm-build_files += "/usr/lib/rpm/brp-*"
264 rpm-build_files += "/usr/lib/rpm/find-supplements*"
265 rpm-build_files += "/usr/lib/rpm/check-*"
266 rpm-build_files += "/usr/lib/rpm/debugedit"
267 rpm-build_files += "/usr/lib/rpm/find-debuginfo.sh"
268 rpm-build_files += "/usr/lib/rpm/find-lang.sh"
269 rpm-build_files += "/usr/lib/rpm/find-provides.ksyms"
270 rpm-build_files += "/usr/lib/rpm/*provides*"
271 rpm-build_files += "/usr/lib/rpm/*requires*"
272 rpm-build_files += "/usr/lib/rpm/*deps*"
273 rpm-build_files += "/usr/lib/rpm/*.prov"
274 rpm-build_files += "/usr/lib/rpm/*.req"
275 rpm-build_files += "/usr/lib/rpm/macros.*"
276 rpm-build_files += "/usr/lib/rpm/fileattrs"
277
278 rpm-dev_files = ""
279 rpm-dev_files += "rpm.manifest"
280 rpm-dev_files += "${prefix}/bin/rpmgraph"
281 rpm-dev_files += "/usr/include/rpm"
282 rpm-dev_files += "${prefix}/lib/librpm.so"
283 rpm-dev_files += "${prefix}/lib/librpmbuild.so"
284 rpm-dev_files += "${prefix}/lib/librpmio.so"
285 rpm-dev_files += "${prefix}/lib/librpmsign.so"
286 rpm-dev_files += "${prefix}/lib/pkgconfig/rpm.pc"
287
288 rpm-locale_files = ""
289
290 rpm-docs_files = ""
291 rpm-docs_files += "GROUPS"
292
293 rpm_files = ""
294 rpm_files += "rpm.manifest"
295 rpm_files += "/etc/rpm"
296 rpm_files += "/bin/rpm"
297 rpm_files += "${prefix}/bin/rpm2cpio"
298 rpm_files += "${prefix}/bin/rpmdb"
299 rpm_files += "${prefix}/bin/rpmkeys"
300 rpm_files += "${prefix}/bin/rpmquery"
301 rpm_files += "${prefix}/bin/rpmverify"
302 rpm_files += "${prefix}/bin/rpmqpack"
303 rpm_files += "%dir /usr/lib/rpm"
304 rpm_files += "/usr/lib/rpm/macros"
305 rpm_files += "/usr/lib/rpm/macros.d"
306 rpm_files += "/usr/lib/rpm/rpmpopt*"
307 rpm_files += "/usr/lib/rpm/rpmrc"
308 rpm_files += "/usr/lib/rpm/tizen/macros"
309 rpm_files += "/usr/lib/rpm/tizen_macros"
310 rpm_files += "/usr/lib/rpm/rpm.supp"
311 rpm_files += "/usr/lib/rpm/tgpg"
312 rpm_files += "/usr/lib/rpm/platform"
313 rpm_files += "${prefix}/lib/rpm-plugins"
314 rpm_files += "${prefix}/lib/rpm-plugins/exec.so"
315 rpm_files += "${prefix}/lib/librpm.so.*"
316 rpm_files += "${prefix}/lib/librpmio.so.*"
317 rpm_files += "${prefix}/lib/librpmbuild.so.*"
318 rpm_files += "${prefix}/lib/librpmsign.so.*"
319 rpm_files += "/var/lib/rpm"
320 rpm_files += "%attr(755,root,root) /usr/src/packages/BUILD"
321 rpm_files += "%attr(755,root,root) /usr/src/packages/SPECS"
322 rpm_files += "%attr(755,root,root) /usr/src/packages/SOURCES"
323 rpm_files += "%attr(755,root,root) /usr/src/packages/SRPMS"
324
325 FILES_${PN}-security-plugin = "${rpm-security-plugin_files}"
326 FILES_${PN}-build = "${rpm-build_files}"
327 FILES_${PN}-dev = "${rpm-dev_files}"
328 FILES_${PN}-locale = "${rpm-locale_files}"
329 FILES_${PN}-docs = "${rpm-docs_files}"
330 FILES_${PN} = "${rpm_files}"
331
332 PKG_rpm-security-plugin= "rpm-security-plugin"
333 PKG_rpm-build= "rpm-build"
334 PKG_rpm-dev= "rpm-dev"
335 PKG_rpm-locale= "rpm-locale"
336 PKG_rpm-docs= "rpm-docs"
337 PKG_rpm= "rpm"
338
339 require rpm-extraconf.inc
340