Path: blob/master/Utilities/Release/macos/qt-5.9.9-macosx10.10-x86_64-arm64.bash
3153 views
#!/usr/bin/env bash12# Run this script on a macOS x86_64 host to generate Qt universal binaries.3#4# This script requires the 'makeuniversal' tool from:5#6# https://github.com/fizzyade/makeuniversal7#8# Build it with an existing local Qt installation first.9#10# Set the PATH environment variable to contain the location of 'makeuniversal'.1112set -e13set -x1415umask 0221617# Verify that 'makeuniversal' is available in the PATH.18type -p makeuniversal >/dev/null1920# Download, verify, and extract sources.21curl -OL https://download.qt.io/archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz22shasum -a 256 qt-everywhere-opensource-src-5.9.9.tar.xz | grep -q 5ce285209290a157d7f42ec8eb22bf3f1d76f2e03a95fc0b99b553391be0164223tar xjf qt-everywhere-opensource-src-5.9.9.tar.xz24patch -p0 < "${BASH_SOURCE%/*}/qt-5.9.9.patch"2526# Build the x86_64 variant.27mkdir qt-5.9.9-x86_6428cd qt-5.9.9-x86_6429../qt-everywhere-opensource-src-5.9.9/configure \30--prefix=/ \31-platform macx-clang \32-device-option QMAKE_APPLE_DEVICE_ARCHS=x86_64 \33-device-option QMAKE_MACOSX_DEPLOYMENT_TARGET=10.10 \34-release \35-opensource -confirm-license \36-gui \37-widgets \38-no-gif \39-no-icu \40-no-pch \41-no-angle \42-no-opengl \43-no-dbus \44-no-harfbuzz \45-skip declarative \46-skip multimedia \47-skip qtcanvas3d \48-skip qtcharts \49-skip qtconnectivity \50-skip qtdeclarative \51-skip qtgamepad \52-skip qtlocation \53-skip qtmultimedia \54-skip qtnetworkauth \55-skip qtpurchasing \56-skip qtremoteobjects \57-skip qtscript \58-skip qtsensors \59-skip qtserialbus \60-skip qtserialport \61-skip qtsvg \62-skip qtwebchannel \63-skip qtwebengine \64-skip qtwebsockets \65-skip qtxmlpatterns \66-nomake examples \67-nomake tests \68-nomake tools69make -j 870cd ..7172# Build the arm64 variant.73mkdir qt-5.9.9-arm6474cd qt-5.9.9-arm6475../qt-everywhere-opensource-src-5.9.9/configure \76--prefix=/ \77-platform macx-clang \78-device-option QMAKE_APPLE_DEVICE_ARCHS=arm64 \79-device-option QMAKE_MACOSX_DEPLOYMENT_TARGET=10.10 \80-release \81-opensource -confirm-license \82-gui \83-widgets \84-no-gif \85-no-icu \86-no-pch \87-no-angle \88-no-opengl \89-no-dbus \90-no-harfbuzz \91-skip declarative \92-skip multimedia \93-skip qtcanvas3d \94-skip qtcharts \95-skip qtconnectivity \96-skip qtdeclarative \97-skip qtgamepad \98-skip qtlocation \99-skip qtmultimedia \100-skip qtnetworkauth \101-skip qtpurchasing \102-skip qtremoteobjects \103-skip qtscript \104-skip qtsensors \105-skip qtserialbus \106-skip qtserialport \107-skip qtsvg \108-skip qtwebchannel \109-skip qtwebengine \110-skip qtwebsockets \111-skip qtxmlpatterns \112-nomake examples \113-nomake tests \114-nomake tools115# Some executables fail to link due to architecture mismatch.116# Build what we can first.117make -j 8 -k || true118# Provide needed executables using the x86_64 variants.119cp ../qt-5.9.9-x86_64/qtbase/bin/uic qtbase/bin/uic120install_name_tool -add_rpath @executable_path/../../../qt-5.9.9-x86_64/qtbase/lib qtbase/bin/uic121cp ../qt-5.9.9-x86_64/qtbase/bin/qlalr qtbase/bin/qlalr122install_name_tool -add_rpath @executable_path/../../../qt-5.9.9-x86_64/qtbase/lib qtbase/bin/qlalr123# Some parts still fail to build, but the parts we need can finish.124make -j 8 -k || true125cd ..126127# Combine the two builds into universal binaries.128makeuniversal qt-5.9.9-univ qt-5.9.9-x86_64 qt-5.9.9-arm64129cd qt-5.9.9-univ130make install -j 8 INSTALL_ROOT=/tmp/qt-5.9.9-macosx10.10-x86_64-arm64131cd ..132133# Create the final tarball containing universal binaries.134tar cjf qt-5.9.9-macosx10.10-x86_64-arm64.tar.xz -C /tmp qt-5.9.9-macosx10.10-x86_64-arm64135136137