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