Skip to content

Commit cbe8d02

Browse files
committed
meson: add native-file
The native file is used to specify the tools to be used for building native binaries. Without this file meson uses the system toolchain in /usr/bin if available.
1 parent 315d5c6 commit cbe8d02

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

classes/meson.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,19 @@ buildSetup: |
9898
export LDFLAGS=$(meson_join_space "${MESON_LDFLAGS[@]}")
9999
fi
100100
101+
cat >native_file.txt << EOF
102+
[binaries]
103+
c = '${AUTOCONF_BUILD:+${AUTOCONF_BUILD}-}gcc'
104+
cpp = '${AUTOCONF_BUILD:+${AUTOCONF_BUILD}-}g++'
105+
ar = '${AUTOCONF_BUILD:+${AUTOCONF_BUILD}-}ar'
106+
nm = '${AUTOCONF_BUILD:+${AUTOCONF_BUILD}-}nm'
107+
[built-in options]
108+
c_args = [$(meson_join_list "${MESON_CFLAGS[@]}")]
109+
cpp_args = [$(meson_join_list "${MESON_CXXFLAGS[@]}")]
110+
c_link_args = [$(meson_join_list "${MESON_LDFLAGS[@]}")]
111+
cpp_link_args = [$(meson_join_list "${MESON_LDFLAGS[@]}")]
112+
EOF
113+
101114
# $1 : source path
102115
mesonBuild()
103116
{
@@ -111,6 +124,7 @@ buildSetup: |
111124
MESON_OPTIONS+=("--cross-file" "$BOB_CWD/cross_file.txt")
112125
fi
113126
MESON_OPTIONS+=("-Ddefault_library=$(cpackageLibraryType)")
127+
MESON_OPTIONS+=("--native-file" "$BOB_CWD/native_file.txt")
114128
MESON_OPTIONS+=( --prefix /usr --libdir lib --buildtype plain )
115129
MESON_OPTIONS+=( "${@:2}" )
116130
meson setup "${MESON_OPTIONS[@]}"

0 commit comments

Comments
 (0)