3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #202015 from wegank/qt6-qtbase-darwin

qt6: add darwin support
This commit is contained in:
Sandro 2022-12-05 12:15:51 +01:00 committed by GitHub
commit 17491905e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 111 additions and 35 deletions

View file

@ -23,6 +23,7 @@
, gtk3
, dconf
, libglvnd
, darwin
, buildPackages
# options
@ -43,7 +44,7 @@ let
addPackages = self: with self;
let
callPackage = self.newScope { inherit qtModule srcs; };
callPackage = self.newScope ({ inherit qtModule stdenv srcs; });
in
{
@ -53,9 +54,16 @@ let
withGtk3 = true;
inherit (srcs.qtbase) src version;
inherit bison cups harfbuzz libGL dconf gtk3 developerBuild cmake;
inherit (darwin.apple_sdk_11_0.frameworks) AGL AVFoundation AppKit GSS MetalKit;
patches = [
./patches/qtbase-qmake-pkg-config.patch
./patches/qtbase-tzdir.patch
# Remove symlink check causing build to bail out and fail.
# https://gitlab.kitware.com/cmake/cmake/-/issues/23251
(fetchpatch {
url = "https://github.com/Homebrew/formula-patches/raw/c363f0edf9e90598d54bc3f4f1bacf95abbda282/qt/qt_internal_check_if_path_has_symlinks.patch";
sha256 = "sha256-Gv2L8ymZSbJxcmUijKlT2NnkIB3bVH9D7YSsDX2noTU=";
})
];
};
env = callPackage ./qt-env.nix {};
@ -90,7 +98,9 @@ let
qt3d = callPackage ./modules/qt3d.nix { };
qt5compat = callPackage ./modules/qt5compat.nix { };
qtcharts = callPackage ./modules/qtcharts.nix { };
qtconnectivity = callPackage ./modules/qtconnectivity.nix { };
qtconnectivity = callPackage ./modules/qtconnectivity.nix {
inherit (darwin.apple_sdk_11_0.frameworks) PCSC;
};
qtdatavis3d = callPackage ./modules/qtdatavis3d.nix { };
qtdeclarative = callPackage ./modules/qtdeclarative.nix { };
qtdoc = callPackage ./modules/qtdoc.nix { };
@ -100,6 +110,7 @@ let
qtlottie = callPackage ./modules/qtlottie.nix { };
qtmultimedia = callPackage ./modules/qtmultimedia.nix {
inherit gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi;
inherit (darwin.apple_sdk_11_0.frameworks) VideoToolbox;
};
qtnetworkauth = callPackage ./modules/qtnetworkauth.nix { };
qtpositioning = callPackage ./modules/qtpositioning.nix { };
@ -107,7 +118,9 @@ let
qtserialbus = callPackage ./modules/qtserialbus.nix { };
qtserialport = callPackage ./modules/qtserialport.nix { };
qtshadertools = callPackage ./modules/qtshadertools.nix { };
qtspeech = callPackage ./modules/qtspeech.nix { };
qtspeech = callPackage ./modules/qtspeech.nix {
inherit (darwin.apple_sdk_11_0.frameworks) Cocoa;
};
qtquick3d = callPackage ./modules/qtquick3d.nix { };
qtquick3dphysics = callPackage ./modules/qtquick3dphysics.nix { };
qtquicktimeline = callPackage ./modules/qtquicktimeline.nix { };
@ -121,7 +134,9 @@ let
qtwebchannel = callPackage ./modules/qtwebchannel.nix { };
qtwebengine = callPackage ./modules/qtwebengine.nix { };
qtwebsockets = callPackage ./modules/qtwebsockets.nix { };
qtwebview = callPackage ./modules/qtwebview.nix { };
qtwebview = callPackage ./modules/qtwebview.nix {
inherit (darwin.apple_sdk_11_0.frameworks) WebKit;
};
wrapQtAppsHook = makeSetupHook {
deps = [ buildPackages.makeWrapper ];

View file

@ -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;
};
}

View file

@ -5,11 +5,13 @@
, qtdeclarative
, bluez
, pkg-config
, PCSC
}:
qtModule {
pname = "qtconnectivity";
qtInputs = [ qtbase qtdeclarative ];
buildInputs = [ bluez ];
nativeBuildInputs = [ pkg-config ];
buildInputs = lib.optionals stdenv.isLinux [ bluez ];
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ PCSC ];
}

View file

@ -17,12 +17,21 @@
, elfutils
, libunwind
, orc
, VideoToolbox
}:
qtModule {
pname = "qtmultimedia";
qtInputs = [ qtbase qtdeclarative qtsvg qtshadertools ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libpulseaudio elfutils libunwind alsa-lib wayland orc ];
propagatedBuildInputs = [ gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi ];
buildInputs = [ libunwind orc ]
++ lib.optionals stdenv.isLinux [ libpulseaudio elfutils alsa-lib wayland ];
propagatedBuildInputs = [ gstreamer gst-plugins-base gst-plugins-good gst-libav ]
++ lib.optionals stdenv.isLinux [ gst-vaapi ]
++ lib.optionals stdenv.isDarwin [ VideoToolbox ];
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin
"-include AudioToolbox/AudioToolbox.h";
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin
"-framework AudioToolbox";
}

View file

@ -1,4 +1,6 @@
{ qtModule
, lib
, stdenv
, qtbase
, qtquick3d
}:
@ -6,4 +8,6 @@
qtModule {
pname = "qtquick3dphysics";
qtInputs = [ qtbase qtquick3d ];
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64)
"-faligned-allocation";
}

View file

@ -10,5 +10,5 @@ qtModule {
pname = "qtserialport";
qtInputs = [ qtbase ];
nativeBuildInputs = [ pkg-config ];
propagatedBuildInputs = [ udev ];
propagatedBuildInputs = lib.optionals stdenv.isLinux [ udev ];
}

View file

@ -1,15 +1,19 @@
{ qtModule
, lib
, stdenv
, qtbase
, qtmultimedia
, pkg-config
, flite
, alsa-lib
, speechd
, Cocoa
}:
qtModule {
pname = "qtspeech";
qtInputs = [ qtbase qtmultimedia ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ flite alsa-lib speechd ];
buildInputs = lib.optionals stdenv.isLinux [ flite alsa-lib speechd ];
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ Cocoa ];
}

View file

@ -3,12 +3,14 @@
, lib
, qtbase
, qtdeclarative
, cups
, substituteAll
}:
qtModule {
pname = "qttools";
qtInputs = [ qtbase qtdeclarative ];
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ cups ];
patches = [
../patches/qttools-paths.patch
];

View file

@ -3,9 +3,12 @@
, qtModule
, qtdeclarative
, qtwebengine
, WebKit
}:
qtModule {
pname = "qtwebview";
qtInputs = [ qtdeclarative qtwebengine ];
qtInputs = [ qtdeclarative ]
++ lib.optionals (!stdenv.isDarwin) [ qtwebengine ];
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ WebKit ];
}

View file

@ -83,6 +83,6 @@ stdenv.mkDerivation (args // {
description = "A cross-platform application framework for C++";
license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ];
maintainers = with maintainers; [ milahu nickcao ];
platforms = platforms.linux;
platforms = platforms.unix;
} // (args.meta or { });
})

View file

@ -23,9 +23,16 @@ stdenv.mkDerivation rec {
'' + lib.optionalString stdenv.isDarwin ''
# Fix darwin build
substituteInPlace pbfplugin.pro \
--replace '$$PROTOBUF/include' '${protobuf}/include' \
--replace '$$PROTOBUF/lib/libprotobuf-lite.a' '${protobuf}/lib/libprotobuf-lite.dylib'
'';
# error: 'path' is unavailable: introduced in macOS 10.15
qmakeFlags = lib.optionals stdenv.isDarwin [
"CONFIG+=c++17"
"QMAKE_MACOSX_DEPLOYMENT_TARGET=10.15"
];
meta = with lib; {
description = "Qt image plugin for displaying Mapbox vector tiles";
longDescription = ''

View file

@ -20,11 +20,10 @@
};
meta = with lib; {
broken = stdenv.isDarwin;
description = "Official PostgreSQL ODBC Driver";
homepage = "https://odbc.postgresql.org/";
license = licenses.lgpl2;
platforms = platforms.linux;
platforms = platforms.unix;
};
};
@ -47,7 +46,9 @@
preConfigure = ''
# we don't want to build a .pkg
sed -i 's/ADD_SUBDIRECTORY(osxinstall)//g' CMakeLists.txt
substituteInPlace CMakeLists.txt \
--replace "IF(APPLE)" "IF(0)" \
--replace "CMAKE_SYSTEM_NAME MATCHES AIX" "APPLE"
'';
cmakeFlags = [
@ -62,7 +63,6 @@
};
meta = with lib; {
broken = stdenv.isDarwin;
description = "MariaDB ODBC database driver";
homepage = "https://downloads.mariadb.org/connector-odbc/";
license = licenses.gpl2;
@ -126,11 +126,10 @@
};
meta = with lib; {
broken = stdenv.isDarwin;
description = "ODBC driver for SQLite";
homepage = "http://www.ch-werner.de/sqliteodbc";
license = licenses.bsd2;
platforms = platforms.linux;
platforms = platforms.unix;
maintainers = with maintainers; [ vlstill ];
};
};

View file

@ -1,4 +1,5 @@
{ lib
, stdenv
, buildPythonPackage
, isPy27
, fetchPypi
@ -134,5 +135,7 @@ buildPythonPackage rec {
license = licenses.gpl3Only;
platforms = platforms.mesaPlatforms;
maintainers = with maintainers; [ LunNova ];
# python3Packages.pyqt-builder needs to be patched
broken = stdenv.isDarwin;
};
}

View file

@ -22203,11 +22203,11 @@ with pkgs;
qt6 = recurseIntoAttrs (makeOverridable
(import ../development/libraries/qt-6) {
inherit newScope;
inherit lib stdenv fetchurl fetchpatch fetchgit fetchFromGitHub makeSetupHook makeWrapper writeText;
inherit lib fetchurl fetchpatch fetchgit fetchFromGitHub makeSetupHook makeWrapper writeText;
inherit bison cups dconf harfbuzz libGL perl gtk3 ninja;
inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi;
inherit buildPackages;
inherit libglvnd;
inherit darwin buildPackages libglvnd;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
cmake = cmake.overrideAttrs (attrs: {
patches = attrs.patches ++ [
../development/libraries/qt-6/patches/cmake.patch