2022-07-31 04:46:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-02-03 07:12:40 +00:00
|
|
|
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
|
2024-03-06 06:16:50 +00:00
|
|
|
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
|
2024-02-03 07:12:40 +00:00
|
|
|
done
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$#" -ne 1 ]; then
|
|
|
|
echo "Syntax: $0 <output directory>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-08-22 08:35:30 +00:00
|
|
|
export MACOSX_DEPLOYMENT_TARGET=11.0
|
2024-03-24 04:07:32 +00:00
|
|
|
|
2024-02-03 07:12:40 +00:00
|
|
|
INSTALLDIR="$1"
|
2022-07-31 04:46:30 +00:00
|
|
|
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
2024-04-04 07:04:52 +00:00
|
|
|
SDL=SDL2-2.30.2
|
2024-03-24 04:07:32 +00:00
|
|
|
ZLIB=1.3.1
|
2024-02-03 07:12:40 +00:00
|
|
|
ZSTD=1.5.5
|
2024-03-24 04:07:32 +00:00
|
|
|
LIBPNG=1.6.43
|
|
|
|
LIBJPEG=9f
|
|
|
|
LIBWEBP=1.3.2
|
|
|
|
MOLTENVK=1.2.8
|
2024-04-04 07:04:52 +00:00
|
|
|
QT=6.7.0
|
2024-03-24 04:07:32 +00:00
|
|
|
|
|
|
|
if [ "${INSTALLDIR:0:1}" != "/" ]; then
|
|
|
|
INSTALLDIR="$PWD/$INSTALLDIR"
|
|
|
|
fi
|
2022-07-31 04:46:30 +00:00
|
|
|
|
2023-08-22 08:35:30 +00:00
|
|
|
mkdir -p deps-build
|
2022-07-31 04:46:30 +00:00
|
|
|
cd deps-build
|
|
|
|
|
|
|
|
export PKG_CONFIG_PATH="$INSTALLDIR/lib/pkgconfig:$PKG_CONFIG_PATH"
|
2024-03-24 04:07:32 +00:00
|
|
|
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_PREFIX_PATH="$INSTALLDIR"
|
|
|
|
-DCMAKE_INSTALL_PREFIX="$INSTALLDIR"
|
|
|
|
-DCMAKE_INSTALL_NAME_DIR='$<INSTALL_PREFIX>/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"
|
2022-07-31 04:46:30 +00:00
|
|
|
|
|
|
|
cat > SHASUMS <<EOF
|
2024-04-04 07:04:52 +00:00
|
|
|
891d66ac8cae51361d3229e3336ebec1c407a8a2a063b61df14f5fdf3ab5ac31 $SDL.tar.gz
|
2024-03-24 04:07:32 +00:00
|
|
|
9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 zlib-$ZLIB.tar.gz
|
2024-02-03 07:12:40 +00:00
|
|
|
9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4 zstd-$ZSTD.tar.gz
|
2024-03-24 04:07:32 +00:00
|
|
|
6a5ca0652392a2d7c9db2ae5b40210843c0bbc081cbd410825ab00cc59f14a6c libpng-$LIBPNG.tar.xz
|
|
|
|
2a499607df669e40258e53d0ade8035ba4ec0175244869d1025d460562aa09b4 libwebp-$LIBWEBP.tar.gz
|
|
|
|
04705c110cb2469caa79fb71fba3d7bf834914706e9641a4589485c1f832565b jpegsrc.v$LIBJPEG.tar.gz
|
|
|
|
85beaf8abfcc54d9da0ff0257ae311abd9e7aa96e53da37e1c37d6bc04ac83cd v$MOLTENVK.tar.gz
|
2024-04-04 07:04:52 +00:00
|
|
|
11b2e29e2e52fb0e3b453ea13bbe51a10fdff36e1c192d8868c5a40233b8b254 qtbase-everywhere-src-$QT.tar.xz
|
|
|
|
516ce07ec8dd5a11c59816fe33ddb71d4f691d0ebbc1798ac338f23b86c029a7 qtimageformats-everywhere-src-$QT.tar.xz
|
|
|
|
1518f40e08ff5e6153a6e26e5b95b033413ac143b70795dc1317e7f73ebf922d qtsvg-everywhere-src-$QT.tar.xz
|
|
|
|
c8da6b239e82fe1e23465cbf0936c0da5a334438d3fb433e19c503cbb1abee7b qttools-everywhere-src-$QT.tar.xz
|
|
|
|
26fc8047062ca4bacd1bd953be86fd39c6e0a5f5e9920c72ba9d40876cea4b56 qttranslations-everywhere-src-$QT.tar.xz
|
2022-07-31 04:46:30 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
curl -L \
|
2024-03-24 04:07:32 +00:00
|
|
|
-O "https://libsdl.org/release/$SDL.tar.gz" \
|
|
|
|
-O "http://zlib.net/zlib-$ZLIB.tar.gz" \
|
|
|
|
-O "https://github.com/facebook/zstd/releases/download/v$ZSTD/zstd-$ZSTD.tar.gz" \
|
|
|
|
-O "https://downloads.sourceforge.net/project/libpng/libpng16/$LIBPNG/libpng-$LIBPNG.tar.xz" \
|
|
|
|
-O "https://ijg.org/files/jpegsrc.v$LIBJPEG.tar.gz" \
|
|
|
|
-O "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-$LIBWEBP.tar.gz" \
|
|
|
|
-O "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v$MOLTENVK.tar.gz" \
|
|
|
|
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtbase-everywhere-src-$QT.tar.xz" \
|
|
|
|
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtimageformats-everywhere-src-$QT.tar.xz" \
|
|
|
|
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qtsvg-everywhere-src-$QT.tar.xz" \
|
|
|
|
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttools-everywhere-src-$QT.tar.xz" \
|
|
|
|
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz"
|
2022-07-31 04:46:30 +00:00
|
|
|
|
|
|
|
shasum -a 256 --check SHASUMS
|
|
|
|
|
|
|
|
echo "Installing SDL..."
|
2024-03-24 04:07:32 +00:00
|
|
|
rm -fr "$SDL"
|
2022-07-31 04:46:30 +00:00
|
|
|
tar xf "$SDL.tar.gz"
|
|
|
|
cd "$SDL"
|
2024-03-24 04:07:32 +00:00
|
|
|
cmake -B build "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DSDL_X11=OFF -DBUILD_SHARED_LIBS=ON
|
|
|
|
make -C build "-j$NPROCS"
|
|
|
|
make -C build install
|
|
|
|
cd ..
|
|
|
|
|
2024-03-25 14:45:04 +00:00
|
|
|
# Temporarily disabled, because the updater doesn't get fixup'd, so the dylib doesn't get added to its bundle.
|
|
|
|
#echo "Installing Zlib..."
|
|
|
|
#rm -fr "zlib-$ZLIB"
|
|
|
|
#tar xf "zlib-$ZLIB.tar.gz"
|
|
|
|
#cd "zlib-$ZLIB"
|
|
|
|
#cmake -B build "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DBUILD_SHARED_LIBS=ON -DZLIB_BUILD_EXAMPLES=OFF
|
|
|
|
#make -C build "-j$NPROCS"
|
|
|
|
#make -C build install
|
|
|
|
#cd ..
|
2024-03-24 04:07:32 +00:00
|
|
|
|
|
|
|
echo "Installing Zstd..."
|
|
|
|
rm -fr "zstd-$ZSTD"
|
|
|
|
tar xf "zstd-$ZSTD.tar.gz"
|
|
|
|
cd "zstd-$ZSTD"
|
|
|
|
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_X64" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_PROGRAMS=OFF -B build-dir build/cmake
|
|
|
|
make -C build-dir "-j$NPROCS"
|
|
|
|
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_ARM64" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_PROGRAMS=OFF -B build-dir-arm64 build/cmake
|
|
|
|
make -C build-dir-arm64 "-j$NPROCS"
|
|
|
|
merge_binaries $(realpath build-dir) $(realpath build-dir-arm64)
|
|
|
|
make -C build-dir install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "Installing libpng..."
|
|
|
|
rm -fr "libpng-$LIBPNG"
|
|
|
|
tar xf "libpng-$LIBPNG.tar.xz"
|
|
|
|
cd "libpng-$LIBPNG"
|
|
|
|
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_X64" -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -B build
|
|
|
|
make -C build "-j$NPROCS"
|
|
|
|
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_ARM64" -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_ARM_NEON=on -B build-arm64
|
|
|
|
make -C build-arm64 "-j$NPROCS"
|
|
|
|
merge_binaries $(realpath build) $(realpath build-arm64)
|
|
|
|
make -C build install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "Building libjpeg..."
|
|
|
|
rm -fr "jpeg-$LIBJPEG"
|
|
|
|
tar xf "jpegsrc.v$LIBJPEG.tar.gz"
|
|
|
|
cd "jpeg-$LIBJPEG"
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
../configure --prefix="$INSTALLDIR" --disable-static --enable-shared --host="x86_64-apple-darwin" CFLAGS="-arch x86_64"
|
|
|
|
make "-j$NPROCS"
|
|
|
|
cd ..
|
|
|
|
mkdir build-arm64
|
|
|
|
cd build-arm64
|
|
|
|
../configure --prefix="$INSTALLDIR" --disable-static --enable-shared --host="aarch64-apple-darwin" CFLAGS="-arch arm64"
|
|
|
|
make "-j$NPROCS"
|
|
|
|
cd ..
|
|
|
|
merge_binaries $(realpath build) $(realpath build-arm64)
|
|
|
|
make -C build install
|
|
|
|
cd ..
|
2022-07-31 06:40:34 +00:00
|
|
|
|
2024-03-24 04:07:32 +00:00
|
|
|
echo "Installing WebP..."
|
|
|
|
rm -fr "libwebp-$LIBWEBP"
|
|
|
|
tar xf "libwebp-$LIBWEBP.tar.gz"
|
|
|
|
cd "libwebp-$LIBWEBP"
|
|
|
|
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_X64" -B build \
|
|
|
|
-DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF \
|
|
|
|
-DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON
|
2024-02-03 07:12:40 +00:00
|
|
|
make -C build "-j$NPROCS"
|
2024-03-24 04:07:32 +00:00
|
|
|
cmake "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_ARM64" -B build-arm64 \
|
|
|
|
-DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF \
|
|
|
|
-DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON
|
|
|
|
make -C build-arm64 "-j$NPROCS"
|
|
|
|
merge_binaries $(realpath build) $(realpath build-arm64)
|
2024-02-03 07:12:40 +00:00
|
|
|
make -C build install
|
2022-07-31 04:46:30 +00:00
|
|
|
cd ..
|
|
|
|
|
2022-07-31 06:40:34 +00:00
|
|
|
# MoltenVK already builds universal binaries, nothing special to do here.
|
2022-07-31 04:46:30 +00:00
|
|
|
echo "Installing MoltenVK..."
|
2024-03-24 04:07:32 +00:00
|
|
|
rm -fr "MoltenVK-${MOLTENVK}"
|
2022-07-31 04:46:30 +00:00
|
|
|
tar xf "v$MOLTENVK.tar.gz"
|
|
|
|
cd "MoltenVK-${MOLTENVK}"
|
|
|
|
./fetchDependencies --macos
|
|
|
|
make macos
|
2024-03-24 04:07:32 +00:00
|
|
|
cp Package/Latest/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib "$INSTALLDIR/lib/"
|
2022-07-31 04:46:30 +00:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "Installing Qt Base..."
|
2024-03-24 04:07:32 +00:00
|
|
|
rm -fr "qtbase-everywhere-src-$QT"
|
2022-07-31 04:46:30 +00:00
|
|
|
tar xf "qtbase-everywhere-src-$QT.tar.xz"
|
|
|
|
cd "qtbase-everywhere-src-$QT"
|
2023-12-25 09:41:00 +00:00
|
|
|
# since we don't have a direct reference to QtSvg, it doesn't deployed directly from the main binary
|
|
|
|
# (only indirectly from iconengines), and the libqsvg.dylib imageformat plugin does not get deployed.
|
|
|
|
# We could run macdeployqt twice, but that's even more janky than patching it.
|
|
|
|
patch -u src/tools/macdeployqt/shared/shared.cpp <<EOF
|
|
|
|
--- shared.cpp
|
|
|
|
+++ shared.cpp
|
|
|
|
@@ -1119,14 +1119,8 @@
|
|
|
|
addPlugins(QStringLiteral("networkinformation"));
|
|
|
|
}
|
|
|
|
|
|
|
|
- // All image formats (svg if QtSvg is used)
|
|
|
|
- const bool usesSvg = deploymentInfo.containsModule("Svg", libInfix);
|
|
|
|
- addPlugins(QStringLiteral("imageformats"), [usesSvg](const QString &lib) {
|
|
|
|
- if (lib.contains(QStringLiteral("qsvg")) && !usesSvg)
|
|
|
|
- return false;
|
|
|
|
- return true;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
+ // All image formats
|
|
|
|
+ addPlugins(QStringLiteral("imageformats"));
|
|
|
|
addPlugins(QStringLiteral("iconengines"));
|
|
|
|
|
|
|
|
// Platforminputcontext plugins if QtGui is in use
|
|
|
|
EOF
|
2024-03-24 04:07:32 +00:00
|
|
|
cmake -B build "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DFEATURE_dbus=OFF -DFEATURE_framework=OFF -DFEATURE_icu=OFF -DFEATURE_opengl=OFF -DFEATURE_printsupport=OFF -DFEATURE_sql=OFF -DFEATURE_gssapi=OFF -DFEATURE_system_png=ON -DFEATURE_system_jpeg=ON -DFEATURE_system_zlib=ON
|
|
|
|
make -C build "-j$NPROCS"
|
|
|
|
make -C build install
|
|
|
|
cd ..
|
2022-07-31 04:46:30 +00:00
|
|
|
|
|
|
|
echo "Installing Qt SVG..."
|
2024-03-24 04:07:32 +00:00
|
|
|
rm -fr "qtsvg-everywhere-src-$QT"
|
2022-07-31 04:46:30 +00:00
|
|
|
tar xf "qtsvg-everywhere-src-$QT.tar.xz"
|
|
|
|
cd "qtsvg-everywhere-src-$QT"
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2024-03-24 04:07:32 +00:00
|
|
|
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL"
|
|
|
|
make "-j$NPROCS"
|
|
|
|
make install
|
|
|
|
cd ../..
|
|
|
|
|
|
|
|
echo "Installing Qt Image Formats..."
|
|
|
|
rm -fr "qtimageformats-everywhere-src-$QT"
|
|
|
|
tar xf "qtimageformats-everywhere-src-$QT.tar.xz"
|
|
|
|
cd "qtimageformats-everywhere-src-$QT"
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DFEATURE_system_webp=ON
|
|
|
|
make "-j$NPROCS"
|
|
|
|
make install
|
|
|
|
cd ../..
|
2022-07-31 04:46:30 +00:00
|
|
|
|
|
|
|
echo "Installing Qt Tools..."
|
2024-03-24 04:07:32 +00:00
|
|
|
rm -fr "qttools-everywhere-src-$QT"
|
2022-07-31 04:46:30 +00:00
|
|
|
tar xf "qttools-everywhere-src-$QT.tar.xz"
|
|
|
|
cd "qttools-everywhere-src-$QT"
|
|
|
|
# Linguist relies on a library in the Designer target, which takes 5-7 minutes to build on the CI
|
|
|
|
# Avoid it by not building Linguist, since we only need the tools that come with it
|
|
|
|
patch -u src/linguist/CMakeLists.txt <<EOF
|
|
|
|
--- src/linguist/CMakeLists.txt
|
|
|
|
+++ src/linguist/CMakeLists.txt
|
|
|
|
@@ -14,7 +14,7 @@
|
|
|
|
add_subdirectory(lrelease-pro)
|
|
|
|
add_subdirectory(lupdate)
|
|
|
|
add_subdirectory(lupdate-pro)
|
|
|
|
-if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND NOT no-png)
|
|
|
|
+if(QT_FEATURE_process AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets AND TARGET Qt::PrintSupport AND NOT no-png)
|
|
|
|
add_subdirectory(linguist)
|
|
|
|
endif()
|
|
|
|
EOF
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2024-03-24 04:07:32 +00:00
|
|
|
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL" -DFEATURE_assistant=OFF -DFEATURE_clang=OFF -DFEATURE_designer=OFF -DFEATURE_kmap2qmap=OFF -DFEATURE_pixeltool=OFF -DFEATURE_pkg_config=OFF -DFEATURE_qev=OFF -DFEATURE_qtattributionsscanner=OFF -DFEATURE_qtdiag=OFF -DFEATURE_qtplugininfo=OFF
|
|
|
|
make "-j$NPROCS"
|
|
|
|
make install
|
|
|
|
cd ../..
|
2022-07-31 04:46:30 +00:00
|
|
|
|
|
|
|
echo "Installing Qt Translations..."
|
2024-03-24 04:07:32 +00:00
|
|
|
rm -fr "qttranslations-everywhere-src-$QT"
|
2022-07-31 04:46:30 +00:00
|
|
|
tar xf "qttranslations-everywhere-src-$QT.tar.xz"
|
|
|
|
cd "qttranslations-everywhere-src-$QT"
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2024-03-24 04:07:32 +00:00
|
|
|
"$INSTALLDIR/bin/qt-configure-module" .. -- "${CMAKE_COMMON[@]}" "$CMAKE_ARCH_UNIVERSAL"
|
2024-03-06 11:03:21 +00:00
|
|
|
make "-j$NPROCS"
|
2024-03-24 04:07:32 +00:00
|
|
|
make install
|
|
|
|
cd ../..
|
2024-02-03 07:12:40 +00:00
|
|
|
|
2022-07-31 04:46:30 +00:00
|
|
|
echo "Cleaning up..."
|
|
|
|
cd ..
|
2024-03-24 04:07:32 +00:00
|
|
|
rm -rf deps-build
|