fastjar: switch to BBCLASSEXTEND and clean up
[openembedded.git] / classes / binconfig.bbclass
blobb3b2236709616c09d3787636f49e2d36b0dd5848
1 FILES_${PN}-dev += "${bindir}/*-config"
3 # The namespaces can clash here hence the two step replace
4 def get_binconfig_mangle(d):
5         s = "-e ''"
6         if not bb.data.inherits_class('native', d):
7                 optional_quote = r"\(\"\?\)"
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:OELIBDIR:${STAGING_LIBDIR}:;'"
16                 s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'"
17                 s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'"
18                 s += " -e 's:OEPREFIX:${STAGING_DIR_HOST}${prefix}:'"
19                 s += " -e 's:OEEXECPREFIX:${STAGING_DIR_HOST}${exec_prefix}:'"
20                 s += " -e 's:-I${WORKDIR}:-I${STAGING_INCDIR}:'"
21                 s += " -e 's:-L${WORKDIR}:-L${STAGING_LIBDIR}:'"
22                 if bb.data.getVar("OE_BINCONFIG_EXTRA_MANGLE", d):
23                     s += bb.data.getVar("OE_BINCONFIG_EXTRA_MANGLE", d)
24         return s
26 BINCONFIG_GLOB ?= "*-config"
28 PACKAGE_PREPROCESS_FUNCS += "binconfig_package_preprocess"
30 binconfig_package_preprocess () {
31         for config in `find ${PKGD} -name '${BINCONFIG_GLOB}'`; do
32                 sed -i \
33                     -e 's:${STAGING_LIBDIR}:${libdir}:g;' \ 
34                     -e 's:${STAGING_INCDIR}:${includedir}:g;' \
35                     -e 's:${STAGING_DATADIR}:${datadir}:' \
36                     -e 's:${STAGING_DIR_HOST}${prefix}:${prefix}:' \
37                     $config
38         done
39         for lafile in `find ${PKGD} -name "*.la"` ; do
40                 sed -i \
41                     -e 's:${STAGING_LIBDIR}:${libdir}:g;' \
42                     -e 's:${STAGING_INCDIR}:${includedir}:g;' \
43                     -e 's:${STAGING_DATADIR}:${datadir}:' \
44                     -e 's:${STAGING_DIR_HOST}${prefix}:${prefix}:' \
45                     $lafile
46         done        
49 SYSROOT_PREPROCESS_FUNCS += "binconfig_sysroot_preprocess"
51 binconfig_sysroot_preprocess () {
52         for config in `find ${S} -name '${BINCONFIG_GLOB}'`; do
53                 configname=`basename $config`
54                 install -d ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}
55                 cat $config | sed ${@get_binconfig_mangle(d)} > ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}/$configname
56                 chmod u+x ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}/$configname
57         done