[oe] binconfig.bbclass optional last slash handling
Denis 'GNUtoo' Carikli
GNUtoo at no-log.org
Sat Nov 13 14:30:24 UTC 2010
hi,
Martin Jansa (JaMa on irc(#oe on Freenode))told me that libmikmod-config
--libs had the following output:
-L/usr/lib -lmikmod -ldl -lm
Which is obviously problematic,because it was the libmikmod-config from
sysroot which prevented some compilation of packages like
supertux-qvga(fixes like 9a97090b98ee4177b806c305168473562580d0c7 ,
which resulted from a misunderstanding between me and Martin Jansa are
wrong because they only workaround the problem instead of fixing the
real issue, which is discussed here)
so I digged into it and here's what I found:
Here's the beginning of libmikmod-config as generated(and before the
binconfig mangling):
>#! /bin/sh
>
>prefix=/usr
>exec_prefix=/usr
>exec_prefix_set=no
Then because in libmikmod, binconfig is inherited, the following is
called:
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
chmod u+x ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}/$configname
done
with get_binconfig_mangle beeing the following function:
# The namespaces can clash here hence the two step replace
def get_binconfig_mangle(d):
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:-L${libdir}:-LOELIBDIR:;'"
s += " -e 's:-I${includedir}:-IOEINCDIR:;'"
s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'"
s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'"
s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'"
s += " -e 's:OEPREFIX:${STAGING_DIR_HOST}${prefix}:'"
s += " -e 's:OEEXECPREFIX:${STAGING_DIR_HOST}${exec_prefix}:'"
s += " -e 's:-I${WORKDIR}:-I${STAGING_INCDIR}:'"
s += " -e 's:-L${WORKDIR}:-L${STAGING_LIBDIR}:'"
if bb.data.getVar("OE_BINCONFIG_EXTRA_MANGLE", d):
s += bb.data.getVar("OE_BINCONFIG_EXTRA_MANGLE", d)
return s
which turns into:
cat libmikmod-config | sed
-e ''
-e 's:=\("\?\)/usr/lib:=\1OELIBDIR:;'
-e 's:=\("\?\)/usr/include:=\1OEINCDIR:;'
-e 's:=\("\?\)/usr/share:=\1OEDATADIR:'
-e 's:=\("\?\)/usr/:=\1OEPREFIX/:'
-e 's:=\("\?\)/usr/:=\1OEEXECPREFIX/:'
-e 's:-L/usr/lib:-LOELIBDIR:;'
-e 's:-I/usr/include:-IOEINCDIR:;'
-e
's:OELIBDIR:/home/gnutoo/embedded/oe/oetmps/nokia900/sysroots/armv7a-oe-linux-gnueabi/usr/lib:;'
-e
's:OEINCDIR:/home/gnutoo/embedded/oe/oetmps/nokia900/sysroots/armv7a-oe-linux-gnueabi/usr/include:;'
-e
's:OEDATADIR:/home/gnutoo/embedded/oe/oetmps/nokia900/sysroots/armv7a-oe-linux-gnueabi/usr/share:'
-e
's:OEPREFIX:/home/gnutoo/embedded/oe/oetmps/nokia900/sysroots/armv7a-oe-linux-gnueabi/usr:'
-e
's:OEEXECPREFIX:/home/gnutoo/embedded/oe/oetmps/nokia900/sysroots/armv7a-oe-linux-gnueabi/usr:'
-e
's:-I/home/gnutoo/embedded/oe/oetmps/nokia900/work/armv7a-oe-linux-gnueabi/libmikmod-3.2.0-beta2-r3:-I/home/gnutoo/embedded/oe/oetmps/nokia900/sysroots/armv7a-oe-linux-gnueabi/usr/include:'
-e
's:-L/home/gnutoo/embedded/oe/oetmps/nokia900/work/armv7a-oe-linux-gnueabi/libmikmod-3.2.0-beta2-r3:-L/home/gnutoo/embedded/oe/oetmps/nokia900/sysroots/armv7a-oe-linux-gnueabi/usr/lib:'
let's examine that part : -e 's:=\("\?\)/usr/:=\1OEPREFIX/:'
echo prefix=/usr | sed -e 's:=\("\?\)/usr/:=\1OEPREFIX/:' gives:
prefix=/usr
echo prefix=/usr/ | sed -e 's:=\("\?\)/usr/:=\1OEPREFIX/:' gives:
prefix=OEPREFIX/
we have in the bbclass:
s += " -e 's:=%s${prefix}/:=\\1OEPREFIX/:'" % optional_quote
s += " -e 's:=%s${exec_prefix}/:=\\1OEEXECPREFIX/:'" % optional_quote
So, should I make the last slash optional, or should I remove it ?
Making it optional would result in the following code:
optional_slash = r"\(\/\?\)"
s += " -e 's:=%s${prefix}%s:=\\1OEPREFIX/:'" % (optional_quote ,optional_slash)
s += " -e 's:=%s${exec_prefix}%s:=\\1OEEXECPREFIX/:'" % (optional_quote ,optional_slash)
Denis.
More information about the Openembedded-devel
mailing list