config/functions: use Here doc for create_meson_conf

This commit is contained in:
MilhouseVH 2018-03-27 22:51:21 +01:00
parent 7cbfd38b8d
commit 994d120bab

View File

@ -147,7 +147,7 @@ setup_toolchain() {
}
create_meson_conf() {
local endian root conf
local endian root
case "$1" in
target|init) endian="little"
root="$SYSROOT_PREFIX/usr"
@ -157,24 +157,25 @@ create_meson_conf() {
;;
esac
conf=$2
echo "[binaries]" > $conf
echo "c = '$CC'" >> $conf
echo "cpp = '$CXX'" >> $conf
echo "ar = '$AR'" >> $conf
echo "strip = '$STRIP'" >> $conf
echo "pkgconfig = '$PKG_CONFIG'" >> $conf
echo "" >> $conf
echo "[host_machine]" >> $conf
echo "system = 'linux'" >> $conf
echo "cpu_family = '$TARGET_ARCH'" >> $conf
echo "cpu = '$TARGET_SUBARCH'" >> $conf
echo "endian = '$endian'" >> $conf
echo "" >> $conf
echo "[properties]" >> $conf
echo "root = '$root'" >> $conf
python -c "import os; print('c_args = {}'.format([x for x in os.getenv('CFLAGS').split()]))" >> $conf
python -c "import os; print('c_link_args = {}'.format([x for x in os.getenv('LDFLAGS').split()]))" >> $conf
cat > $2 <<EOF
[binaries]
c = '$CC'
cpp = '$CXX'
ar = '$AR'
strip = '$STRIP'
pkgconfig = '$PKG_CONFIG'
[host_machine]
system = 'linux'
cpu_family = '$TARGET_ARCH'
cpu = '$TARGET_SUBARCH'
endian = '$endian'
[properties]
root = '$root'
$(python -c "import os; print('c_args = {}'.format([x for x in os.getenv('CFLAGS').split()]))")
$(python -c "import os; print('c_link_args = {}'.format([x for x in os.getenv('LDFLAGS').split()]))")
EOF
}
# unset all PKG_* vars apart from those exported by setup_toolchain, then set default values