diff options
| -rwxr-xr-x | meta/recipes-devtools/meson/meson/meson-setup.py | 8 | ||||
| -rwxr-xr-x | meta/recipes-devtools/meson/meson/meson-wrapper | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/meson/nativesdk-meson_0.58.1.bb | 46 |
3 files changed, 55 insertions, 0 deletions
diff --git a/meta/recipes-devtools/meson/meson/meson-setup.py b/meta/recipes-devtools/meson/meson/meson-setup.py index 7ac4e3ad47..daaa551de2 100755 --- a/meta/recipes-devtools/meson/meson/meson-setup.py +++ b/meta/recipes-devtools/meson/meson/meson-setup.py | |||
| @@ -27,9 +27,17 @@ except KeyError: | |||
| 27 | 27 | ||
| 28 | template_file = os.path.join(sysroot, 'usr/share/meson/meson.cross.template') | 28 | template_file = os.path.join(sysroot, 'usr/share/meson/meson.cross.template') |
| 29 | cross_file = os.path.join(sysroot, 'usr/share/meson/%smeson.cross' % os.environ["TARGET_PREFIX"]) | 29 | cross_file = os.path.join(sysroot, 'usr/share/meson/%smeson.cross' % os.environ["TARGET_PREFIX"]) |
| 30 | native_template_file = os.path.join(sysroot, 'usr/share/meson/meson.native.template') | ||
| 31 | native_file = os.path.join(sysroot, 'usr/share/meson/meson.native') | ||
| 30 | 32 | ||
| 31 | with open(template_file) as in_file: | 33 | with open(template_file) as in_file: |
| 32 | template = in_file.read() | 34 | template = in_file.read() |
| 33 | output = Template(template).substitute(Environ()) | 35 | output = Template(template).substitute(Environ()) |
| 34 | with open(cross_file, "w") as out_file: | 36 | with open(cross_file, "w") as out_file: |
| 35 | out_file.write(output) | 37 | out_file.write(output) |
| 38 | |||
| 39 | with open(native_template_file) as in_file: | ||
| 40 | template = in_file.read() | ||
| 41 | output = Template(template).substitute({'OECORE_NATIVE_SYSROOT': os.environ['OECORE_NATIVE_SYSROOT']}) | ||
| 42 | with open(native_file, "w") as out_file: | ||
| 43 | out_file.write(output) | ||
diff --git a/meta/recipes-devtools/meson/meson/meson-wrapper b/meta/recipes-devtools/meson/meson/meson-wrapper index d4ffe60f9a..d4b5187f8d 100755 --- a/meta/recipes-devtools/meson/meson/meson-wrapper +++ b/meta/recipes-devtools/meson/meson/meson-wrapper | |||
| @@ -11,4 +11,5 @@ unset CC CXX CPP LD AR NM STRIP | |||
| 11 | 11 | ||
| 12 | exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \ | 12 | exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \ |
| 13 | --cross-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \ | 13 | --cross-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \ |
| 14 | --native-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/meson.native" \ | ||
| 14 | "$@" | 15 | "$@" |
diff --git a/meta/recipes-devtools/meson/nativesdk-meson_0.58.1.bb b/meta/recipes-devtools/meson/nativesdk-meson_0.58.1.bb index 5657397ddc..7b77041c7e 100644 --- a/meta/recipes-devtools/meson/nativesdk-meson_0.58.1.bb +++ b/meta/recipes-devtools/meson/nativesdk-meson_0.58.1.bb | |||
| @@ -13,8 +13,54 @@ SRC_URI += "file://meson-setup.py \ | |||
| 13 | # real paths by meson-setup.sh when the SDK is extracted. | 13 | # real paths by meson-setup.sh when the SDK is extracted. |
| 14 | # - Some overrides aren't needed, since the SDK injects paths that take care of | 14 | # - Some overrides aren't needed, since the SDK injects paths that take care of |
| 15 | # them. | 15 | # them. |
| 16 | def var_list2str(var, d): | ||
| 17 | items = d.getVar(var).split() | ||
| 18 | return items[0] if len(items) == 1 else ', '.join(repr(s) for s in items) | ||
| 19 | |||
| 20 | def generate_native_link_template(d): | ||
| 21 | val = ['-L@{OECORE_NATIVE_SYSROOT}${libdir_native}', | ||
| 22 | '-L@{OECORE_NATIVE_SYSROOT}${base_libdir_native}', | ||
| 23 | '-Wl,-rpath-link,@{OECORE_NATIVE_SYSROOT}${libdir_native}', | ||
| 24 | '-Wl,-rpath-link,@{OECORE_NATIVE_SYSROOT}${base_libdir_native}', | ||
| 25 | '-Wl,--allow-shlib-undefined' | ||
| 26 | ] | ||
| 27 | build_arch = d.getVar('BUILD_ARCH') | ||
| 28 | if 'x86_64' in build_arch: | ||
| 29 | loader = 'ld-linux-x86-64.so.2' | ||
| 30 | elif 'i686' in build_arch: | ||
| 31 | loader = 'ld-linux.so.2' | ||
| 32 | elif 'aarch64' in build_arch: | ||
| 33 | loader = 'ld-linux-aarch64.so.1' | ||
| 34 | elif 'ppc64le' in build_arch: | ||
| 35 | loader = 'ld64.so.2' | ||
| 36 | |||
| 37 | if loader: | ||
| 38 | val += ['-Wl,--dynamic-linker=@{OECORE_NATIVE_SYSROOT}${base_libdir_native}/' + loader] | ||
| 39 | |||
| 40 | return repr(val) | ||
| 41 | |||
| 16 | do_install:append() { | 42 | do_install:append() { |
| 17 | install -d ${D}${datadir}/meson | 43 | install -d ${D}${datadir}/meson |
| 44 | |||
| 45 | cat >${D}${datadir}/meson/meson.native.template <<EOF | ||
| 46 | [binaries] | ||
| 47 | c = ${@meson_array('BUILD_CC', d)} | ||
| 48 | cpp = ${@meson_array('BUILD_CXX', d)} | ||
| 49 | ar = ${@meson_array('BUILD_AR', d)} | ||
| 50 | nm = ${@meson_array('BUILD_NM', d)} | ||
| 51 | strip = ${@meson_array('BUILD_STRIP', d)} | ||
| 52 | readelf = ${@meson_array('BUILD_READELF', d)} | ||
| 53 | pkgconfig = 'pkg-config-native' | ||
| 54 | |||
| 55 | [built-in options] | ||
| 56 | c_args = ['-isystem@{OECORE_NATIVE_SYSROOT}${includedir_native}' , ${@var_list2str('BUILD_OPTIMIZATION', d)}] | ||
| 57 | c_link_args = ${@generate_native_link_template(d)} | ||
| 58 | cpp_args = ['-isystem@{OECORE_NATIVE_SYSROOT}${includedir_native}' , ${@var_list2str('BUILD_OPTIMIZATION', d)}] | ||
| 59 | cpp_link_args = ${@generate_native_link_template(d)} | ||
| 60 | [properties] | ||
| 61 | sys_root = '@OECORE_NATIVE_SYSROOT' | ||
| 62 | EOF | ||
| 63 | |||
| 18 | cat >${D}${datadir}/meson/meson.cross.template <<EOF | 64 | cat >${D}${datadir}/meson/meson.cross.template <<EOF |
| 19 | [binaries] | 65 | [binaries] |
| 20 | c = @CC | 66 | c = @CC |
