diff options
Diffstat (limited to 'meta/classes-recipe/meson.bbclass')
-rw-r--r-- | meta/classes-recipe/meson.bbclass | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass index 03fa2c06eb..c8b3e1ec29 100644 --- a/meta/classes-recipe/meson.bbclass +++ b/meta/classes-recipe/meson.bbclass | |||
@@ -9,7 +9,6 @@ inherit python3native meson-routines qemu | |||
9 | DEPENDS:append = " meson-native ninja-native" | 9 | DEPENDS:append = " meson-native ninja-native" |
10 | 10 | ||
11 | EXEWRAPPER_ENABLED:class-native = "False" | 11 | EXEWRAPPER_ENABLED:class-native = "False" |
12 | EXEWRAPPER_ENABLED:class-nativesdk = "False" | ||
13 | EXEWRAPPER_ENABLED ?= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)}" | 12 | EXEWRAPPER_ENABLED ?= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)}" |
14 | DEPENDS:append = "${@' qemu-native' if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ''}" | 13 | DEPENDS:append = "${@' qemu-native' if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ''}" |
15 | 14 | ||
@@ -23,6 +22,9 @@ MESON_SOURCEPATH = "${S}" | |||
23 | # The target to build in do_compile. If unset the default targets are built. | 22 | # The target to build in do_compile. If unset the default targets are built. |
24 | MESON_TARGET ?= "" | 23 | MESON_TARGET ?= "" |
25 | 24 | ||
25 | # Since 0.60.0 you can specify custom tags to install | ||
26 | MESON_INSTALL_TAGS ?= "" | ||
27 | |||
26 | def noprefix(var, d): | 28 | def noprefix(var, d): |
27 | return d.getVar(var).replace(d.getVar('prefix') + '/', '', 1) | 29 | return d.getVar(var).replace(d.getVar('prefix') + '/', '', 1) |
28 | 30 | ||
@@ -60,6 +62,14 @@ def rust_tool(d, target_var): | |||
60 | cmd = [rustc, "--target", d.getVar(target_var)] + d.getVar("RUSTFLAGS").split() | 62 | cmd = [rustc, "--target", d.getVar(target_var)] + d.getVar("RUSTFLAGS").split() |
61 | return "rust = %s" % repr(cmd) | 63 | return "rust = %s" % repr(cmd) |
62 | 64 | ||
65 | def bindgen_args(d): | ||
66 | args = '${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} --target=${TARGET_SYS}' | ||
67 | # For SDK packages TOOLCHAIN_OPTIONS don't contain full sysroot path | ||
68 | if bb.data.inherits_class("nativesdk", d): | ||
69 | args += ' --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE}${prefix_nativesdk}' | ||
70 | items = d.expand(args).split() | ||
71 | return repr(items[0] if len(items) == 1 else items) | ||
72 | |||
63 | addtask write_config before do_configure | 73 | addtask write_config before do_configure |
64 | do_write_config[vardeps] += "CC CXX AR NM STRIP READELF OBJCOPY CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS EXEWRAPPER_ENABLED" | 74 | do_write_config[vardeps] += "CC CXX AR NM STRIP READELF OBJCOPY CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS EXEWRAPPER_ENABLED" |
65 | do_write_config() { | 75 | do_write_config() { |
@@ -91,6 +101,7 @@ cpp_link_args = ${@meson_array('LDFLAGS', d)} | |||
91 | [properties] | 101 | [properties] |
92 | needs_exe_wrapper = true | 102 | needs_exe_wrapper = true |
93 | sys_root = '${STAGING_DIR_HOST}' | 103 | sys_root = '${STAGING_DIR_HOST}' |
104 | bindgen_clang_arguments = ${@bindgen_args(d)} | ||
94 | 105 | ||
95 | [host_machine] | 106 | [host_machine] |
96 | system = '${@meson_operating_system('HOST_OS', d)}' | 107 | system = '${@meson_operating_system('HOST_OS', d)}' |
@@ -127,7 +138,7 @@ cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)} | |||
127 | EOF | 138 | EOF |
128 | } | 139 | } |
129 | 140 | ||
130 | do_write_config:append:class-target() { | 141 | write_qemuwrapper() { |
131 | # Write out a qemu wrapper that will be used as exe_wrapper so that meson | 142 | # Write out a qemu wrapper that will be used as exe_wrapper so that meson |
132 | # can run target helper binaries through that. | 143 | # can run target helper binaries through that. |
133 | qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" | 144 | qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" |
@@ -145,6 +156,14 @@ EOF | |||
145 | chmod +x ${WORKDIR}/meson-qemuwrapper | 156 | chmod +x ${WORKDIR}/meson-qemuwrapper |
146 | } | 157 | } |
147 | 158 | ||
159 | do_write_config:append:class-target() { | ||
160 | write_qemuwrapper | ||
161 | } | ||
162 | |||
163 | do_write_config:append:class-nativesdk() { | ||
164 | write_qemuwrapper | ||
165 | } | ||
166 | |||
148 | # Tell externalsrc that changes to this file require a reconfigure | 167 | # Tell externalsrc that changes to this file require a reconfigure |
149 | CONFIGURE_FILES = "meson.build" | 168 | CONFIGURE_FILES = "meson.build" |
150 | 169 | ||
@@ -175,7 +194,10 @@ meson_do_compile() { | |||
175 | } | 194 | } |
176 | 195 | ||
177 | meson_do_install() { | 196 | meson_do_install() { |
178 | meson install --destdir ${D} --no-rebuild | 197 | if [ "x${MESON_INSTALL_TAGS}" != "x" ] ; then |
198 | meson_install_tags="--tags ${MESON_INSTALL_TAGS}" | ||
199 | fi | ||
200 | meson install --destdir ${D} --no-rebuild $meson_install_tags | ||
179 | } | 201 | } |
180 | 202 | ||
181 | EXPORT_FUNCTIONS do_configure do_compile do_install | 203 | EXPORT_FUNCTIONS do_configure do_compile do_install |