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