[oe] [PATCHv2][RFC] binconfig: use / instead empty prefix/exec_prefix in get_binconfig_mangle

Martin Jansa martin.jansa at gmail.com
Wed Nov 24 07:36:24 UTC 2010


* 952e5e2b7a5c1deefc939594d40b81a71fb16a54 appends / in sed call,
  but it breaks ie =/usr replacement ie in libmikmod
* using at least / in SLASH_PREFIX/SLASH_EXEC_PREFIX is needed ie for micro
  distribution where prefix/exec_prefix are empty (/usr collapsed to /)
* prefix and exec_prefix are expanded only in shell environment (after
  get_binconfig_mangle is returned so to check if it's empty we have to
  pass them expanded as params)
* don't push this patch it fixes libmikmod with !micro, but in micro
  it's still broken, because libmikmod-config has empty 'prefix=' which
  is the case when we normaly don't want to add OEPREFIX (whole point of
  this patch), but in this case it's needed (let's just fix libmikmod.in)
* thanks to GNUtoo!
---
 classes/binconfig.bbclass |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/classes/binconfig.bbclass b/classes/binconfig.bbclass
index b3b2236..e462083 100644
--- a/classes/binconfig.bbclass
+++ b/classes/binconfig.bbclass
@@ -1,15 +1,21 @@
 FILES_${PN}-dev += "${bindir}/*-config"
 
 # The namespaces can clash here hence the two step replace
-def get_binconfig_mangle(d):
+def get_binconfig_mangle(d, env_prefix, env_exec_prefix):
+	SLASH_PREFIX = env_prefix
+	if SLASH_PREFIX is "":
+		SLASH_PREFIX = "/"
+	SLASH_EXEC_PREFIX = env_exec_prefix
+	if SLASH_EXEC_PREFIX is "":
+		SLASH_EXEC_PREFIX = "/"
 	s = "-e ''"
 	if not bb.data.inherits_class('native', d):
 		optional_quote = r"\(\"\?\)"
 		s += " -e 's:=%s${libdir}:=\\1OELIBDIR:;'" % optional_quote
 		s += " -e 's:=%s${includedir}:=\\1OEINCDIR:;'" % optional_quote
 		s += " -e 's:=%s${datadir}:=\\1OEDATADIR:'" % optional_quote
-		s += " -e 's:=%s${prefix}/:=\\1OEPREFIX/:'" % optional_quote
-		s += " -e 's:=%s${exec_prefix}/:=\\1OEEXECPREFIX/:'" % optional_quote
+		s += " -e 's:=%s%s:=\\1OEPREFIX:'" % (optional_quote, SLASH_PREFIX)
+		s += " -e 's:=%s%s:=\\1OEEXECPREFIX:'" % (optional_quote, SLASH_EXEC_PREFIX)
 		s += " -e 's:-L${libdir}:-LOELIBDIR:;'"
 		s += " -e 's:-I${includedir}:-IOEINCDIR:;'"
 		s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'"
@@ -52,7 +58,7 @@ binconfig_sysroot_preprocess () {
 	for config in `find ${S} -name '${BINCONFIG_GLOB}'`; do
 		configname=`basename $config`
 		install -d ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}
-		cat $config | sed ${@get_binconfig_mangle(d)} > ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}/$configname
+		cat $config | sed ${@get_binconfig_mangle(d, "${prefix}", "${exec_prefix}")} > ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}/$configname
 		chmod u+x ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}/$configname
 	done
 }
-- 
1.7.3.2





More information about the Openembedded-devel mailing list