about summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-6/modules/qtbase.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/qt-6/modules/qtbase.nix')
-rw-r--r--pkgs/development/libraries/qt-6/modules/qtbase.nix58
1 files changed, 43 insertions, 15 deletions
diff --git a/pkgs/development/libraries/qt-6/modules/qtbase.nix b/pkgs/development/libraries/qt-6/modules/qtbase.nix
index 436fe46330756..e1675e029fc3b 100644
--- a/pkgs/development/libraries/qt-6/modules/qtbase.nix
+++ b/pkgs/development/libraries/qt-6/modules/qtbase.nix
@@ -71,6 +71,13 @@
 , at-spi2-core
 , unixODBC
 , unixODBCDrivers
+  # darwin
+, xcbuild
+, AGL
+, AVFoundation
+, AppKit
+, GSS
+, MetalKit
   # optional dependencies
 , cups
 , libmysqlclient
@@ -79,7 +86,7 @@
 , dconf
 , gtk3
   # options
-, libGLSupported ? true
+, libGLSupported ? stdenv.isLinux
 , libGL
 , debug ? false
 , developerBuild ? false
@@ -111,13 +118,20 @@ stdenv.mkDerivation rec {
     pcre2
     pcre
     libproxy
-    xlibsWrapper
     zstd
     double-conversion
-    util-linux
-    systemd
     libb2
     md4c
+    dbus
+    glib
+    # unixODBC drivers
+    unixODBCDrivers.psql
+    unixODBCDrivers.sqlite
+    unixODBCDrivers.mariadb
+  ] ++ lib.optionals stdenv.isLinux [
+    xlibsWrapper
+    util-linux
+    systemd
     mtdev
     lksctp-tools
     libselinux
@@ -129,8 +143,6 @@ stdenv.mkDerivation rec {
     libdrm
     libdatrie
     valgrind
-    dbus
-    glib
     udev
     # Text rendering
     fontconfig
@@ -152,16 +164,21 @@ stdenv.mkDerivation rec {
     xorg.libXtst
     xorg.xcbutilcursor
     libepoxy
-  ] ++ (with unixODBCDrivers; [
-    psql
-    sqlite
-    mariadb
-  ]) ++ lib.optional libGLSupported libGL;
+  ] ++ lib.optionals stdenv.isDarwin [
+    AGL
+    AVFoundation
+    AppKit
+    GSS
+    MetalKit
+  ] ++ lib.optional libGLSupported libGL;
 
   buildInputs = [
     python3
     at-spi2-core
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     libinput
+  ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
+    AppKit
   ]
   ++ lib.optional withGtk3 gtk3
   ++ lib.optional developerBuild gdb
@@ -180,6 +197,8 @@ stdenv.mkDerivation rec {
   # https://bugreports.qt.io/browse/QTBUG-97568
   postPatch = ''
     substituteInPlace src/corelib/CMakeLists.txt --replace /bin/ls ${coreutils}/bin/ls
+  '' + lib.optionalString stdenv.isDarwin ''
+    substituteInPlace cmake/QtAutoDetect.cmake --replace "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
   '';
 
   fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
@@ -197,14 +216,23 @@ stdenv.mkDerivation rec {
   cmakeFlags = [
     "-DINSTALL_PLUGINSDIR=${qtPluginPrefix}"
     "-DINSTALL_QMLDIR=${qtQmlPrefix}"
-    "-DQT_FEATURE_journald=ON"
-    "-DQT_FEATURE_sctp=ON"
     "-DQT_FEATURE_libproxy=ON"
     "-DQT_FEATURE_system_sqlite=ON"
-    "-DQT_FEATURE_vulkan=ON"
     "-DQT_FEATURE_openssl_linked=ON"
+  ] ++ lib.optionals (!stdenv.isDarwin) [
+    "-DQT_FEATURE_sctp=ON"
+    "-DQT_FEATURE_journald=ON"
+    "-DQT_FEATURE_vulkan=ON"
+  ] ++ lib.optionals stdenv.isDarwin [
+    # build as a set of dynamic libraries
+    "-DFEATURE_framework=OFF"
   ];
 
+  NIX_LDFLAGS = toString (lib.optionals stdenv.isDarwin [
+    # Undefined symbols for architecture arm64: "___gss_c_nt_hostbased_service_oid_desc"
+    "-framework GSS"
+  ]);
+
   outputs = [ "out" "dev" ];
 
   postInstall = ''
@@ -259,6 +287,6 @@ stdenv.mkDerivation rec {
     description = "A cross-platform application framework for C++";
     license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ];
     maintainers = with maintainers; [ milahu nickcao LunNova ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }