summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/meson/meson/meson-wrapper
blob: fca64a5692996573b846cb2f9a87049c7c032128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
    exec "meson.real" "$@"
fi

if [ -z "$SSL_CERT_DIR" ]; then
    export SSL_CERT_DIR="$OECORE_NATIVE_SYSROOT/etc/ssl/certs/"
fi

# If these are set to a cross-compile path, meson will get confused and try to
# use them as native tools. Unset them to prevent this, as all the cross-compile
# config is already in meson.cross.
unset CC CXX CPP LD AR NM STRIP

for arg in "$@"; do
    case "$arg" in
    -*) continue ;;
    *) SUBCMD="$arg"; break ;;
    esac
done

if [ "$SUBCMD" = "setup" ] || [ -d "$SUBCMD" ]; then
    MESON_SUB_OPTS=" \
        --cross-file="$OECORE_NATIVE_SYSROOT/usr/share/meson/${TARGET_PREFIX}meson.cross" \
        --native-file="$OECORE_NATIVE_SYSROOT/usr/share/meson/meson.native" \
        "
fi

exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \
    "$@" \
    $MESON_SUB_OPTS