binconfig.bbclass 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. FILES:${PN}-dev += "${bindir}/*-config"
  2. # The namespaces can clash here hence the two step replace
  3. def get_binconfig_mangle(d):
  4. s = "-e ''"
  5. if not bb.data.inherits_class('native', d):
  6. optional_quote = r"\(\"\?\)"
  7. s += " -e 's:=%s${base_libdir}:=\\1OEBASELIBDIR:;'" % optional_quote
  8. s += " -e 's:=%s${libdir}:=\\1OELIBDIR:;'" % optional_quote
  9. s += " -e 's:=%s${includedir}:=\\1OEINCDIR:;'" % optional_quote
  10. s += " -e 's:=%s${datadir}:=\\1OEDATADIR:'" % optional_quote
  11. s += " -e 's:=%s${prefix}/:=\\1OEPREFIX/:'" % optional_quote
  12. s += " -e 's:=%s${exec_prefix}/:=\\1OEEXECPREFIX/:'" % optional_quote
  13. s += " -e 's:-L${libdir}:-LOELIBDIR:;'"
  14. s += " -e 's:-I${includedir}:-IOEINCDIR:;'"
  15. s += " -e 's:-L${WORKDIR}:-LOELIBDIR:'"
  16. s += " -e 's:-I${WORKDIR}:-IOEINCDIR:'"
  17. s += " -e 's:OEBASELIBDIR:${STAGING_BASELIBDIR}:;'"
  18. s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'"
  19. s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'"
  20. s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'"
  21. s += " -e 's:OEPREFIX:${STAGING_DIR_HOST}${prefix}:'"
  22. s += " -e 's:OEEXECPREFIX:${STAGING_DIR_HOST}${exec_prefix}:'"
  23. if d.getVar("OE_BINCONFIG_EXTRA_MANGLE", False):
  24. s += d.getVar("OE_BINCONFIG_EXTRA_MANGLE")
  25. return s
  26. BINCONFIG_GLOB ?= "*-config"
  27. PACKAGE_PREPROCESS_FUNCS += "binconfig_package_preprocess"
  28. binconfig_package_preprocess () {
  29. for config in `find ${PKGD} -type f -name '${BINCONFIG_GLOB}'`; do
  30. sed -i \
  31. -e 's:${STAGING_BASELIBDIR}:${base_libdir}:g;' \
  32. -e 's:${STAGING_LIBDIR}:${libdir}:g;' \
  33. -e 's:${STAGING_INCDIR}:${includedir}:g;' \
  34. -e 's:${STAGING_DATADIR}:${datadir}:' \
  35. -e 's:${STAGING_DIR_HOST}${prefix}:${prefix}:' \
  36. $config
  37. done
  38. }
  39. SYSROOT_PREPROCESS_FUNCS += "binconfig_sysroot_preprocess"
  40. binconfig_sysroot_preprocess () {
  41. for config in `find ${S} -type f -name '${BINCONFIG_GLOB}'` `find ${B} -type f -name '${BINCONFIG_GLOB}'`; do
  42. configname=`basename $config`
  43. install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
  44. sed ${@get_binconfig_mangle(d)} $config > ${SYSROOT_DESTDIR}${bindir_crossscripts}/$configname
  45. chmod u+x ${SYSROOT_DESTDIR}${bindir_crossscripts}/$configname
  46. done
  47. }