qt5.qtbase: build with the 14.4 SDK

Per upstream’s supported Darwin versions, built with the 14.4 SDK
(corresponding to Xcode 15) and a 10.14 deployment target. To ensure
that users of Qt have a compatible SDK and deployment target, propagate
the 10.14 SDK and a 10.14 minimum version. Users that need a newer
version can opt into using it by adding the SDK package to their build
inputs. aarch64-darwin uses 11.0 and 11.3 because those are the oldest
supported SDK and deployment target on that platform.

Note: upstream actually supports 10.13, but 10.14 was chosen as the
minimum and SDK because it ensures that automatic dark mode switching
works for x86_64-darwin users.
This commit is contained in:
Randy Eckenrode 2024-09-23 18:27:46 -04:00
parent e694240f77
commit 578b04cd1d
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9

View File

@ -4,8 +4,7 @@
, coreutils, bison, flex, gdb, gperf, lndir, perl, pkg-config, python3
, which
# darwin support
, libiconv, libobjc, xcbuild, AGL, AppKit, ApplicationServices, AVFoundation, Carbon, Cocoa, CoreAudio, CoreBluetooth
, CoreLocation, CoreServices, DiskArbitration, Foundation, OpenGL, MetalKit, IOKit
, darwinMinVersionHook, apple-sdk, apple-sdk_10_14, apple-sdk_14, xcbuild
, dbus, fontconfig, freetype, glib, harfbuzz, icu, libdrm, libX11, libXcomposite
, libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng , libxcb
@ -38,6 +37,13 @@ let
if isLinux
then "linux-generic-g++"
else throw "Please add a qtPlatformCross entry for ${plat.config}";
# Per https://doc.qt.io/qt-5/macos.html#supported-versions: deployment target = 10.13, build SDK = 14.x.
# Note that Qt propagates the 10.14 SDK instead of the 10.13 SDK to make sure that applications linked to Qt
# support automatic dark mode on x86_64-darwin (see: https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_macos_app).
propagatedAppleSDK = if lib.versionOlder (lib.getVersion apple-sdk) "10.14" then apple-sdk_10_14 else apple-sdk;
propagatedMinVersionHook = darwinMinVersionHook "10.13";
buildAppleSDK = apple-sdk_14;
in
stdenv.mkDerivation (finalAttrs: ({
@ -56,10 +62,8 @@ stdenv.mkDerivation (finalAttrs: ({
pcre2
] ++ (
if stdenv.hostPlatform.isDarwin then [
# TODO: move to buildInputs, this should not be propagated.
AGL AppKit ApplicationServices AVFoundation Carbon Cocoa CoreAudio CoreBluetooth
CoreLocation CoreServices DiskArbitration Foundation OpenGL
libobjc libiconv MetalKit IOKit
propagatedAppleSDK
propagatedMinVersionHook
] else [
dbus glib udev
@ -80,6 +84,7 @@ stdenv.mkDerivation (finalAttrs: ({
[ libinput ]
++ lib.optional withGtk3 gtk3
)
++ lib.optional stdenv.isDarwin buildAppleSDK
++ lib.optional developerBuild gdb
++ lib.optional (cups != null) cups
++ lib.optional (mysqlSupport) libmysqlclient
@ -141,15 +146,13 @@ stdenv.mkDerivation (finalAttrs: ({
patchShebangs ./bin
'' + (
if stdenv.hostPlatform.isDarwin then ''
sed -i \
-e 's|/usr/bin/xcode-select|xcode-select|' \
-e 's|/usr/bin/xcrun|xcrun|' \
-e 's|/usr/bin/xcodebuild|xcodebuild|' \
-e 's|QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`|QMAKE_CXX="clang++"\nQMAKE_CONF_COMPILER="clang++"|' \
./configure
substituteInPlace ./mkspecs/common/mac.conf \
--replace "/System/Library/Frameworks/OpenGL.framework/" "${OpenGL}/Library/Frameworks/OpenGL.framework/" \
--replace "/System/Library/Frameworks/AGL.framework/" "${AGL}/Library/Frameworks/AGL.framework/"
substituteInPlace configure \
--replace-fail '/usr/bin/xcode-select' '${lib.getBin xcbuild}/bin/xcode-select' \
--replace-fail '/usr/bin/xcrun' '${lib.getBin xcbuild}/bin/xcrun' \
--replace-fail '/System/Library/Frameworks/Cocoa.framework' "$SDKROOT/System/Library/Frameworks/Cocoa.framework"
substituteInPlace ./mkspecs/common/mac.conf \
--replace-fail "/System/Library/Frameworks/OpenGL.framework/" "$SDKROOT/System/Library/Frameworks/OpenGL.framework/" \
--replace-fail "/System/Library/Frameworks/AGL.framework/" "$SDKROOT/System/Library/Frameworks/AGL.framework/"
'' else lib.optionalString libGLSupported ''
sed -i mkspecs/common/linux.conf \
-e "/^QMAKE_INCDIR_OPENGL/ s|$|${lib.getDev libGL}/include|" \