Build: Use Qt 6.5.2 for macOS, drop libcurl

Also add qtimageformats.
This commit is contained in:
Stenzek 2023-08-22 18:35:30 +10:00
parent f75bf8517a
commit e108ca16ce
3 changed files with 41 additions and 53 deletions

View file

@ -22,9 +22,6 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(SUPPORTS_X11 TRUE)
endif()
# Set minimum OS version for macOS. 10.14 should work.
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "")
# Global options.
if(NOT ANDROID)
option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" OFF)

View file

@ -2,15 +2,14 @@
set -e
export MACOSX_DEPLOYMENT_TARGET=10.14
export MACOSX_DEPLOYMENT_TARGET=11.0
INSTALLDIR="$HOME/deps"
NPROCS="$(getconf _NPROCESSORS_ONLN)"
SDL=SDL2-2.26.2
QT=6.4.2
MOLTENVK=1.2.2
CURL=7.87.0
SDL=SDL2-2.28.2
QT=6.5.2
MOLTENVK=1.2.5
mkdir deps-build
mkdir -p deps-build
cd deps-build
export PKG_CONFIG_PATH="$INSTALLDIR/lib/pkgconfig:$PKG_CONFIG_PATH"
@ -19,22 +18,22 @@ export CFLAGS="-I$INSTALLDIR/include -Os $CFLAGS"
export CXXFLAGS="-I$INSTALLDIR/include -Os $CXXFLAGS"
cat > SHASUMS <<EOF
95d39bc3de037fbdfa722623737340648de4f180a601b0afad27645d150b99e0 $SDL.tar.gz
8065a10c2d70b561f48475dedb118e643176527b162d6e439fa127270c2a07dd v$MOLTENVK.tar.gz
8a063d664d1c23d35526b87a2bf15514962ffdd8ef7fd40519191b3c23e39548 curl-$CURL.tar.gz
a88bc6cedbb34878a49a622baa79cace78cfbad4f95fdbd3656ddb21c705525d qtbase-everywhere-src-$QT.tar.xz
b746af3cb1793621d8ed7eae38d9ad5a15541dc2742031069f2ae3fe87590314 qtsvg-everywhere-src-$QT.tar.xz
a31387916184e4a5ef522d3ea841e8e931cc0f88be0824a7a354a572d5826c68 qttools-everywhere-src-$QT.tar.xz
bbe0291502c2604b72fef730e1935bd22f8b921d8c473250f298a723b2a9c496 qttranslations-everywhere-src-$QT.tar.xz
64b1102fa22093515b02ef33dd8739dee1ba57e9dbba6a092942b8bbed1a1c5e $SDL.tar.gz
946d8f0e7ae3b47774b03a610d3a3e7e4bcbef3e667e1362325936839035a115 v$MOLTENVK.tar.gz
3db4c729b4d80a9d8fda8dd77128406353baff4755ca619177eda4cddae71269 qtbase-everywhere-src-$QT.tar.xz
48b4cc1093af2e0ab3bea30f60651bddd877a2335d16e7207879a2e9e81963a3 qtsvg-everywhere-src-$QT.tar.xz
551ffb22751d8fd4d88e9ebd55b9131f4ca55341ee497fdbbba4da8d10d94341 qttools-everywhere-src-$QT.tar.xz
aae0c08924c6a5e47f9d57e031673d611ffff7aab2bee2e1cc460471ecac6743 qtimageformats-everywhere-src-$QT.tar.xz
337c45637e757e754c2f0ea65c20de3e6e53a841dda1253db15baa622515beeb qttranslations-everywhere-src-$QT.tar.xz
EOF
curl -L \
-O "https://libsdl.org/release/$SDL.tar.gz" \
-O "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v$MOLTENVK.tar.gz" \
-O "https://curl.se/download/curl-$CURL.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/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/qtimageformats-everywhere-src-$QT.tar.xz" \
-O "https://download.qt.io/official_releases/qt/${QT%.*}/$QT/submodules/qttranslations-everywhere-src-$QT.tar.xz"
shasum -a 256 --check SHASUMS
@ -43,7 +42,7 @@ echo "Installing SDL..."
tar xf "$SDL.tar.gz"
cd "$SDL"
# Patch clang wrappers to require 10.14 for x64.
# Patch clang wrappers to require 11.0 for x64.
patch -u build-scripts/clang-fat.sh <<EOF
--- clang-fat.bak 2023-02-05 13:22:17.032581300 +1000
+++ clang-fat.sh 2023-02-05 13:23:15.668561400 +1000
@ -54,13 +53,13 @@ patch -u build-scripts/clang-fat.sh <<EOF
-# Intel 64-bit compiler flags (10.9 runtime compatibility)
-CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.9 \\
--DMAC_OS_X_VERSION_MIN_REQUIRED=1070 \\
+# Intel 64-bit compiler flags (10.14 runtime compatibility)
+CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.14 \\
+# Intel 64-bit compiler flags (11.0 runtime compatibility)
+CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=11.0 \\
+-DMAC_OS_X_VERSION_MIN_REQUIRED=101400 \\
-I/usr/local/include"
-CLANG_LINK_X64="-mmacosx-version-min=10.9"
+CLANG_LINK_X64="-mmacosx-version-min=10.14"
+CLANG_LINK_X64="-mmacosx-version-min=11.0"
# ARM 64-bit compiler flags (11.0 runtime compatibility)
CLANG_COMPILE_ARM64="clang -arch arm64 -mmacosx-version-min=11.0 \\
@ -75,12 +74,12 @@ patch -u build-scripts/clang++-fat.sh << EOF
-# Intel 64-bit compiler flags (10.7 runtime compatibility)
-CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.7 \\
+# Intel 64-bit compiler flags (10.14 runtime compatibility)
+CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.14 \\
+# Intel 64-bit compiler flags (11.0 runtime compatibility)
+CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=11.0 \\
-I/usr/local/include"
-CLANG_LINK_X64="-mmacosx-version-min=10.7"
+CLANG_LINK_X64="-mmacosx-version-min=10.14"
+CLANG_LINK_X64="-mmacosx-version-min=11.0"
# ARM 64-bit compiler flags (11.0 runtime compatibility)
CLANG_COMPILE_ARM64="clang++ -arch arm64 -mmacosx-version-min=11.0 \\
@ -91,31 +90,13 @@ make "-j$NPROCS"
make install
cd ..
echo "Installing curl..."
tar xf "curl-$CURL.tar.gz"
cd "curl-$CURL"
mkdir build-x64
cd build-x64
../configure --prefix "$INSTALLDIR" --with-secure-transport --without-brotli
make "-j$NPROCS"
make install
cd ..
# Build arm64, but don't install it, instead just add the arm64 binary into the existing x64 dylib.
mkdir build-arm64
cd build-arm64
CFLAGS="-arch arm64" ../configure --host x86_64-apple-darwin --prefix "$INSTALLDIR" --with-secure-transport --without-brotli
make "-j$NPROCS"
lipo -create "$INSTALLDIR/lib/libcurl.4.dylib" "lib/.libs/libcurl.4.dylib" -o "$INSTALLDIR/lib/libcurl.4.dylib"
cd ../..
# MoltenVK already builds universal binaries, nothing special to do here.
echo "Installing MoltenVK..."
tar xf "v$MOLTENVK.tar.gz"
cd "MoltenVK-${MOLTENVK}"
./fetchDependencies --macos
make macos
cp Package/Latest/MoltenVK/dylib/macOS/libMoltenVK.dylib $HOME/deps/lib/
cp Package/Latest/MoltenVK/dylib/macOS/libMoltenVK.dylib "$INSTALLDIR/lib/"
cd ..
echo "Installing Qt Base..."
@ -125,7 +106,7 @@ mkdir build
cd build
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -DFEATURE_optimize_size=ON -DFEATURE_dbus=OFF -DFEATURE_framework=OFF -DFEATURE_icu=OFF -DFEATURE_opengl=OFF -DFEATURE_printsupport=OFF -DFEATURE_sql=OFF -DFEATURE_gssapi=OFF ..
cmake --build . --parallel
cmake --install .
ninja install
cd ../../
echo "Installing Qt SVG..."
@ -133,9 +114,9 @@ tar xf "qtsvg-everywhere-src-$QT.tar.xz"
cd "qtsvg-everywhere-src-$QT"
mkdir build
cd build
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=MinSizeRel ..
"$INSTALLDIR/bin/qt-configure-module" ..
cmake --build . --parallel
cmake --install .
ninja install
cd ../../
echo "Installing Qt Tools..."
@ -157,9 +138,19 @@ patch -u src/linguist/CMakeLists.txt <<EOF
EOF
mkdir build
cd build
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -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 ..
"$INSTALLDIR/bin/qt-configure-module" .. -- -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 ..
cmake --build . --parallel
cmake --install .
ninja install
cd ../../
echo "Installing Qt Image Formats..."
tar xf "qtimageformats-everywhere-src-$QT.tar.xz"
cd "qtimageformats-everywhere-src-$QT"
mkdir build
cd build
"$INSTALLDIR/bin/qt-configure-module" ..
cmake --build . --parallel
ninja install
cd ../../
echo "Installing Qt Translations..."
@ -167,9 +158,9 @@ tar xf "qttranslations-everywhere-src-$QT.tar.xz"
cd "qttranslations-everywhere-src-$QT"
mkdir build
cd build
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
"$INSTALLDIR/bin/qt-configure-module" ..
cmake --build . --parallel
cmake --install .
ninja install
cd ../../
echo "Cleaning up..."

View file

@ -15,8 +15,8 @@ SOURCEDIR="$1"
echo "Build x64..."
mkdir build-x64
cd build-x64
export MACOSX_DEPLOYMENT_TARGET=10.14
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
export MACOSX_DEPLOYMENT_TARGET=11.0
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
cmake --build . --parallel
cd ..
@ -24,7 +24,7 @@ echo "Build arm64..."
mkdir build-arm64
cd build-arm64
export MACOSX_DEPLOYMENT_TARGET=11.00
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DENABLE_OPENGL=ON -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
cmake --build . --parallel
cd ..