ish/xcode-meson.sh
2018-11-30 12:33:06 -08:00

52 lines
1.1 KiB
Bash
Executable File

#!/bin/bash -x
mkdir -p $MESON_BUILD_DIR
cd $MESON_BUILD_DIR
config=$(meson introspect --buildoptions)
if [[ $? -ne 0 ]]; then
export CC="env -u SDKROOT -u IPHONEOS_DEPLOYMENT_TARGET clang"
crossfile=cross.txt
echo $ARCHS
arch=${ARCHS%% *}
meson_arch=$arch
case "$arch" in
arm64)
meson_arch=aarch64
;;
esac
cat > $crossfile <<EOF
[binaries]
c = 'clang'
ar = 'ar'
[host_machine]
system = 'darwin'
cpu_family = '$meson_arch'
cpu = '$meson_arch'
endian = 'little'
[properties]
c_args = ['-arch', '$arch']
needs_exe_wrapper = true
EOF
meson $SRCROOT --cross-file $crossfile
fi
buildtype=debug
b_ndebug=false
if [[ $CONFIGURATION == Release ]]; then
buildtype=debugoptimized
b_ndebug=true
fi
b_sanitize=none
log=$ISH_LOG
log_handler=nslog
jit=true
for var in buildtype log b_ndebug b_sanitize log_handler jit; do
old_value=$(jq -r ".[] | select(.name==\"$var\") | .value" <<< $config)
new_value=${!var}
if [[ $old_value != $new_value ]]; then
meson configure "-D$var=$new_value"
fi
done