Skip to content

Latest commit

 

History

History
84 lines (61 loc) · 3.62 KB

BUILD.md

File metadata and controls

84 lines (61 loc) · 3.62 KB

Building QDirStat

The following instructions explain how to build a disk image (.dmg) containing QDirStat Universal Binaries. This means they support both arm64 (Apple silicon) and x86_64 (Intel) platforms with a single binary.

Requirements

  • Xcode 14.0.1 (use this exact version)
  • Qt 5 Open Source with support for Universal Binaries
  • create-dmg
  • An Apple Developer account

Notes:

  • Qt 5 does not officially support Universal Binaries. Qt 5 needs to be built manually from sources: Build Qt.
  • Using newer versions of Xcode will show instability warnings during the compilation process, as well as make applications usable only on macOS 14+
Project WARNING: Qt has only been tested with version 12 of the platform SDK, you're using 14.
Project WARNING: This is an unsupported configuration. You may experience build issues, and by using
Project WARNING: the 14.4 SDK you are opting in to new features that Qt has not been prepared for.
Project WARNING: Please downgrade the SDK you use to build your app to version 12, or configure
Project WARNING: with CONFIG+=sdk_no_version_check when running qmake to silence this warning.

Build notarized QDirStat disk image

# Build QDirStat.app
/usr/local/Qt-5.15.13/bin/qmake QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"
make
cd src
mv qdirstat.app QDirStat.app

# Add Frameworks and prepare for notarization
/usr/local/Qt-5.15.13/bin/macdeployqt QDirStat.app -sign-for-notarization=<APPLE_DEVELOPER_ID> -dmg

# Delete QDirStat.dmg generated by macdeployqt and instead use create-dmg to add an Applications shortcut. This is so we can drag QDirStat.app to the /Applications directory.
rm QDirStat.dmg

# Create final disk image, and notarize
create-dmg --volname "QDirStat" --codesign <APPLE_DEVELOPER_ID> --notarize "notarytool-password" --window-pos 200 120 --window-size 650 400 --app-drop-link 500 0 "QDirStat-version.dmg" "QDirStat.app"

Build Qt

The instructions used to build Qt 5 with Universal Binary support come from downtowndoughbrown.com.

  • Download Qt 5.15.13 source code and extract the compressed file.
  • Execute the following commands on a terminal
tar -xvf qt-everywhere-src-5.15.13.tar.xz
cd qt-everywhere-src-5.15.13
export PATH=$PATH:$(pwd)/qtbase/bin 
cd qtbase
./configure QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64" -release -opensource -confirm-license -nomake examples -nomake tests 
make -j$(sysctl -n hw.ncpu)
sudo make install
cd ../qttools
qmake
make -j$(sysctl -n hw.ncpu)
sudo make install
cd ../qtmacextras
qmake
make -j$(sysctl -n hw.ncpu)
sudo make install

The sudo make install commands will install Qt to /usr/local/Qt-5.15.13

Alternatives to building Qt

Qt Online Installer

The Qt Online Installer installs Qt 5 with x86_64 binaries, and no support for arm64 binaries. This works well for Intel machines, but it is less than ideal for Apple silicon machines, as Rosetta is needed to translate binary code.

Update Apr-10-2024: Qt Online Installer no longer shows supported Qt 5 releases, only older Qt 5 archive versions are available.

Qt installed from Homebrew

Homebrew installs Qt 5 with arm64 binaries. This does not help in building binaries for Intel machines. It might be possible to build Qt 5 with Universal Binary support from sources with Homebrew, but my attempts failed.