#!/bin/bash set -e merge_binaries() { X86DIR=$1 ARMDIR=$2 echo "Merging ARM64 binaries from $ARMDIR into fat binaries at $X86DIR..." IFS=" " pushd "$X86DIR" for X86BIN in $(find . -type f \( -name '*.dylib' -o -name '*.a' -o -perm +111 \)); do if file "$X86DIR/$X86BIN" | grep "Mach-O " >/dev/null; then ARMBIN="${ARMDIR}/${X86BIN}" echo "Merge $ARMBIN to $X86BIN..." lipo -create "$X86BIN" "$ARMBIN" -o "$X86BIN" fi done popd } if [ "$#" -ne 1 ]; then echo "Syntax: $0 " exit 1 fi export MACOSX_DEPLOYMENT_TARGET=11.0 NPROCS="$(getconf _NPROCESSORS_ONLN)" SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}")) INSTALLDIR="$1" if [ "${INSTALLDIR:0:1}" != "/" ]; then INSTALLDIR="$PWD/$INSTALLDIR" fi FREETYPE=2.13.2 HARFBUZZ=8.3.1 SDL=SDL2-2.30.4 ZSTD=1.5.6 LIBPNG=1.6.43 LIBJPEG=9f LIBWEBP=1.4.0 MOLTENVK=1.2.9 QT=6.7.2 SHADERC=2024.1 SHADERC_GLSLANG=142052fa30f9eca191aa9dcf65359fcaed09eeec SHADERC_SPIRVHEADERS=5e3ad389ee56fca27c9705d093ae5387ce404df4 SHADERC_SPIRVTOOLS=dd4b663e13c07fea4fbb3f70c1c91c86731099f7 SPIRV_CROSS=vulkan-sdk-1.3.283.0 CPUINFO=05332fd802d9109a2a151ec32154b107c1e5caf9 DISCORD_RPC=842c15192041f8e71c512851834f4dadb1a554fb mkdir -p deps-build cd deps-build export PKG_CONFIG_PATH="$INSTALLDIR/lib/pkgconfig:$PKG_CONFIG_PATH" export LDFLAGS="-L$INSTALLDIR/lib $LDFLAGS" export CFLAGS="-I$INSTALLDIR/include $CFLAGS" export CXXFLAGS="-I$INSTALLDIR/include $CXXFLAGS" CMAKE_COMMON=( -DCMAKE_BUILD_TYPE=Release -DCMAKE_SHARED_LINKER_FLAGS="-dead_strip -dead_strip_dylibs" -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_INSTALL_NAME_DIR='$/lib' ) CMAKE_ARCH_X64=-DCMAKE_OSX_ARCHITECTURES="x86_64" CMAKE_ARCH_ARM64=-DCMAKE_OSX_ARCHITECTURES="arm64" CMAKE_ARCH_UNIVERSAL=-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" cat > SHASUMS <