diff --git a/.github/workflows/scripts/macos/build-dependencies-universal.sh b/.github/workflows/scripts/macos/build-dependencies-universal.sh new file mode 100755 index 0000000000..1c47710c77 --- /dev/null +++ b/.github/workflows/scripts/macos/build-dependencies-universal.sh @@ -0,0 +1,385 @@ +#!/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 + +# The bundled ffmpeg has a lot of things disabled to reduce code size. +# Users may want to use system ffmpeg for additional features +: ${BUILD_FFMPEG:=1} + +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.3 +ZSTD=1.5.5 +LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29 +LIBPNG=1.6.43 +LIBJPEG=9f +LIBWEBP=1.3.2 +FFMPEG=6.0 +MOLTENVK=1.2.8 +QT=6.7.1 + +SHADERC=2024.1 +SHADERC_GLSLANG=142052fa30f9eca191aa9dcf65359fcaed09eeec +SHADERC_SPIRVHEADERS=5e3ad389ee56fca27c9705d093ae5387ce404df4 +SHADERC_SPIRVTOOLS=dd4b663e13c07fea4fbb3f70c1c91c86731099f7 + +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 <