Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | FILES_${PN}-dev += "${bindir}/*-config" |
| 2 | |
| 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${base_libdir}:=\\1OEBASELIBDIR:;'" % optional_quote |
| 9 | s += " -e 's:=%s${libdir}:=\\1OELIBDIR:;'" % optional_quote |
| 10 | s += " -e 's:=%s${includedir}:=\\1OEINCDIR:;'" % optional_quote |
| 11 | s += " -e 's:=%s${datadir}:=\\1OEDATADIR:'" % optional_quote |
| 12 | s += " -e 's:=%s${prefix}/:=\\1OEPREFIX/:'" % optional_quote |
| 13 | s += " -e 's:=%s${exec_prefix}/:=\\1OEEXECPREFIX/:'" % optional_quote |
| 14 | s += " -e 's:-L${libdir}:-LOELIBDIR:;'" |
| 15 | s += " -e 's:-I${includedir}:-IOEINCDIR:;'" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 16 | s += " -e 's:-L${WORKDIR}:-LOELIBDIR:'" |
| 17 | s += " -e 's:-I${WORKDIR}:-IOEINCDIR:'" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | s += " -e 's:OEBASELIBDIR:${STAGING_BASELIBDIR}:;'" |
| 19 | s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'" |
| 20 | s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'" |
| 21 | s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'" |
| 22 | s += " -e 's:OEPREFIX:${STAGING_DIR_HOST}${prefix}:'" |
| 23 | s += " -e 's:OEEXECPREFIX:${STAGING_DIR_HOST}${exec_prefix}:'" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 24 | if d.getVar("OE_BINCONFIG_EXTRA_MANGLE", False): |
| 25 | s += d.getVar("OE_BINCONFIG_EXTRA_MANGLE") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | |
| 27 | return s |
| 28 | |
| 29 | BINCONFIG_GLOB ?= "*-config" |
| 30 | |
| 31 | PACKAGE_PREPROCESS_FUNCS += "binconfig_package_preprocess" |
| 32 | |
| 33 | binconfig_package_preprocess () { |
Brad Bishop | a5c52ff | 2018-11-23 10:55:50 +1300 | [diff] [blame^] | 34 | for config in `find ${PKGD} -type f -name '${BINCONFIG_GLOB}'`; do |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | sed -i \ |
| 36 | -e 's:${STAGING_BASELIBDIR}:${base_libdir}:g;' \ |
| 37 | -e 's:${STAGING_LIBDIR}:${libdir}:g;' \ |
| 38 | -e 's:${STAGING_INCDIR}:${includedir}:g;' \ |
| 39 | -e 's:${STAGING_DATADIR}:${datadir}:' \ |
| 40 | -e 's:${STAGING_DIR_HOST}${prefix}:${prefix}:' \ |
| 41 | $config |
| 42 | done |
Brad Bishop | a5c52ff | 2018-11-23 10:55:50 +1300 | [diff] [blame^] | 43 | for lafile in `find ${PKGD} -type f -name "*.la"` ; do |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 44 | sed -i \ |
| 45 | -e 's:${STAGING_BASELIBDIR}:${base_libdir}:g;' \ |
| 46 | -e 's:${STAGING_LIBDIR}:${libdir}:g;' \ |
| 47 | -e 's:${STAGING_INCDIR}:${includedir}:g;' \ |
| 48 | -e 's:${STAGING_DATADIR}:${datadir}:' \ |
| 49 | -e 's:${STAGING_DIR_HOST}${prefix}:${prefix}:' \ |
| 50 | $lafile |
| 51 | done |
| 52 | } |
| 53 | |
| 54 | SYSROOT_PREPROCESS_FUNCS += "binconfig_sysroot_preprocess" |
| 55 | |
| 56 | binconfig_sysroot_preprocess () { |
Brad Bishop | a5c52ff | 2018-11-23 10:55:50 +1300 | [diff] [blame^] | 57 | for config in `find ${S} -type f -name '${BINCONFIG_GLOB}'` `find ${B} -type f -name '${BINCONFIG_GLOB}'`; do |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 58 | configname=`basename $config` |
| 59 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts} |
| 60 | sed ${@get_binconfig_mangle(d)} $config > ${SYSROOT_DESTDIR}${bindir_crossscripts}/$configname |
| 61 | chmod u+x ${SYSROOT_DESTDIR}${bindir_crossscripts}/$configname |
| 62 | done |
| 63 | } |