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 , gtk3
, dconf , dconf
, libglvnd , libglvnd
, darwin
, buildPackages , buildPackages
# options # options
@ -43,7 +44,7 @@ let
addPackages = self: with self; addPackages = self: with self;
let let
callPackage = self.newScope { inherit qtModule srcs; }; callPackage = self.newScope ({ inherit qtModule stdenv srcs; });
in in
{ {
@ -53,9 +54,16 @@ let
withGtk3 = true; withGtk3 = true;
inherit (srcs.qtbase) src version; inherit (srcs.qtbase) src version;
inherit bison cups harfbuzz libGL dconf gtk3 developerBuild cmake; inherit bison cups harfbuzz libGL dconf gtk3 developerBuild cmake;
inherit (darwin.apple_sdk_11_0.frameworks) AGL AVFoundation AppKit GSS MetalKit;
patches = [ patches = [
./patches/qtbase-qmake-pkg-config.patch ./patches/qtbase-qmake-pkg-config.patch
./patches/qtbase-tzdir.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 {}; env = callPackage ./qt-env.nix {};
@ -90,7 +98,9 @@ let
qt3d = callPackage ./modules/qt3d.nix { }; qt3d = callPackage ./modules/qt3d.nix { };
qt5compat = callPackage ./modules/qt5compat.nix { }; qt5compat = callPackage ./modules/qt5compat.nix { };
qtcharts = callPackage ./modules/qtcharts.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 { }; qtdatavis3d = callPackage ./modules/qtdatavis3d.nix { };
qtdeclarative = callPackage ./modules/qtdeclarative.nix { }; qtdeclarative = callPackage ./modules/qtdeclarative.nix { };
qtdoc = callPackage ./modules/qtdoc.nix { }; qtdoc = callPackage ./modules/qtdoc.nix { };
@ -100,6 +110,7 @@ let
qtlottie = callPackage ./modules/qtlottie.nix { }; qtlottie = callPackage ./modules/qtlottie.nix { };
qtmultimedia = callPackage ./modules/qtmultimedia.nix { qtmultimedia = callPackage ./modules/qtmultimedia.nix {
inherit gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi; 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 { }; qtnetworkauth = callPackage ./modules/qtnetworkauth.nix { };
qtpositioning = callPackage ./modules/qtpositioning.nix { }; qtpositioning = callPackage ./modules/qtpositioning.nix { };
@ -107,7 +118,9 @@ let
qtserialbus = callPackage ./modules/qtserialbus.nix { }; qtserialbus = callPackage ./modules/qtserialbus.nix { };
qtserialport = callPackage ./modules/qtserialport.nix { }; qtserialport = callPackage ./modules/qtserialport.nix { };
qtshadertools = callPackage ./modules/qtshadertools.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 { }; qtquick3d = callPackage ./modules/qtquick3d.nix { };
qtquick3dphysics = callPackage ./modules/qtquick3dphysics.nix { }; qtquick3dphysics = callPackage ./modules/qtquick3dphysics.nix { };
qtquicktimeline = callPackage ./modules/qtquicktimeline.nix { }; qtquicktimeline = callPackage ./modules/qtquicktimeline.nix { };
@ -121,7 +134,9 @@ let
qtwebchannel = callPackage ./modules/qtwebchannel.nix { }; qtwebchannel = callPackage ./modules/qtwebchannel.nix { };
qtwebengine = callPackage ./modules/qtwebengine.nix { }; qtwebengine = callPackage ./modules/qtwebengine.nix { };
qtwebsockets = callPackage ./modules/qtwebsockets.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 { wrapQtAppsHook = makeSetupHook {
deps = [ buildPackages.makeWrapper ]; deps = [ buildPackages.makeWrapper ];

View file

@ -71,6 +71,13 @@
, at-spi2-core , at-spi2-core
, unixODBC , unixODBC
, unixODBCDrivers , unixODBCDrivers
# darwin
, xcbuild
, AGL
, AVFoundation
, AppKit
, GSS
, MetalKit
# optional dependencies # optional dependencies
, cups , cups
, libmysqlclient , libmysqlclient
@ -79,7 +86,7 @@
, dconf , dconf
, gtk3 , gtk3
# options # options
, libGLSupported ? true , libGLSupported ? stdenv.isLinux
, libGL , libGL
, debug ? false , debug ? false
, developerBuild ? false , developerBuild ? false
@ -111,13 +118,20 @@ stdenv.mkDerivation rec {
pcre2 pcre2
pcre pcre
libproxy libproxy
xlibsWrapper
zstd zstd
double-conversion double-conversion
util-linux
systemd
libb2 libb2
md4c md4c
dbus
glib
# unixODBC drivers
unixODBCDrivers.psql
unixODBCDrivers.sqlite
unixODBCDrivers.mariadb
] ++ lib.optionals stdenv.isLinux [
xlibsWrapper
util-linux
systemd
mtdev mtdev
lksctp-tools lksctp-tools
libselinux libselinux
@ -129,8 +143,6 @@ stdenv.mkDerivation rec {
libdrm libdrm
libdatrie libdatrie
valgrind valgrind
dbus
glib
udev udev
# Text rendering # Text rendering
fontconfig fontconfig
@ -152,16 +164,21 @@ stdenv.mkDerivation rec {
xorg.libXtst xorg.libXtst
xorg.xcbutilcursor xorg.xcbutilcursor
libepoxy libepoxy
] ++ (with unixODBCDrivers; [ ] ++ lib.optionals stdenv.isDarwin [
psql AGL
sqlite AVFoundation
mariadb AppKit
]) ++ lib.optional libGLSupported libGL; GSS
MetalKit
] ++ lib.optional libGLSupported libGL;
buildInputs = [ buildInputs = [
python3 python3
at-spi2-core at-spi2-core
] ++ lib.optionals (!stdenv.isDarwin) [
libinput libinput
] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
AppKit
] ]
++ lib.optional withGtk3 gtk3 ++ lib.optional withGtk3 gtk3
++ lib.optional developerBuild gdb ++ lib.optional developerBuild gdb
@ -180,6 +197,8 @@ stdenv.mkDerivation rec {
# https://bugreports.qt.io/browse/QTBUG-97568 # https://bugreports.qt.io/browse/QTBUG-97568
postPatch = '' postPatch = ''
substituteInPlace src/corelib/CMakeLists.txt --replace /bin/ls ${coreutils}/bin/ls 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; fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
@ -197,14 +216,23 @@ stdenv.mkDerivation rec {
cmakeFlags = [ cmakeFlags = [
"-DINSTALL_PLUGINSDIR=${qtPluginPrefix}" "-DINSTALL_PLUGINSDIR=${qtPluginPrefix}"
"-DINSTALL_QMLDIR=${qtQmlPrefix}" "-DINSTALL_QMLDIR=${qtQmlPrefix}"
"-DQT_FEATURE_journald=ON"
"-DQT_FEATURE_sctp=ON"
"-DQT_FEATURE_libproxy=ON" "-DQT_FEATURE_libproxy=ON"
"-DQT_FEATURE_system_sqlite=ON" "-DQT_FEATURE_system_sqlite=ON"
"-DQT_FEATURE_vulkan=ON"
"-DQT_FEATURE_openssl_linked=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" ]; outputs = [ "out" "dev" ];
postInstall = '' postInstall = ''
@ -259,6 +287,6 @@ stdenv.mkDerivation rec {
description = "A cross-platform application framework for C++"; description = "A cross-platform application framework for C++";
license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ]; license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ];
maintainers = with maintainers; [ milahu nickcao LunNova ]; maintainers = with maintainers; [ milahu nickcao LunNova ];
platforms = platforms.linux; platforms = platforms.unix;
}; };
} }

View file

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

View file

@ -17,12 +17,21 @@
, elfutils , elfutils
, libunwind , libunwind
, orc , orc
, VideoToolbox
}: }:
qtModule { qtModule {
pname = "qtmultimedia"; pname = "qtmultimedia";
qtInputs = [ qtbase qtdeclarative qtsvg qtshadertools ]; qtInputs = [ qtbase qtdeclarative qtsvg qtshadertools ];
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
buildInputs = [ libpulseaudio elfutils libunwind alsa-lib wayland orc ]; buildInputs = [ libunwind orc ]
propagatedBuildInputs = [ gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi ]; ++ 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 { qtModule
, lib
, stdenv
, qtbase , qtbase
, qtquick3d , qtquick3d
}: }:
@ -6,4 +8,6 @@
qtModule { qtModule {
pname = "qtquick3dphysics"; pname = "qtquick3dphysics";
qtInputs = [ qtbase qtquick3d ]; qtInputs = [ qtbase qtquick3d ];
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64)
"-faligned-allocation";
} }

View file

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

View file

@ -1,15 +1,19 @@
{ qtModule { qtModule
, lib
, stdenv
, qtbase , qtbase
, qtmultimedia , qtmultimedia
, pkg-config , pkg-config
, flite , flite
, alsa-lib , alsa-lib
, speechd , speechd
, Cocoa
}: }:
qtModule { qtModule {
pname = "qtspeech"; pname = "qtspeech";
qtInputs = [ qtbase qtmultimedia ]; qtInputs = [ qtbase qtmultimedia ];
nativeBuildInputs = [ pkg-config ]; 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 , lib
, qtbase , qtbase
, qtdeclarative , qtdeclarative
, cups
, substituteAll , substituteAll
}: }:
qtModule { qtModule {
pname = "qttools"; pname = "qttools";
qtInputs = [ qtbase qtdeclarative ]; qtInputs = [ qtbase qtdeclarative ];
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ cups ];
patches = [ patches = [
../patches/qttools-paths.patch ../patches/qttools-paths.patch
]; ];

View file

@ -3,9 +3,12 @@
, qtModule , qtModule
, qtdeclarative , qtdeclarative
, qtwebengine , qtwebengine
, WebKit
}: }:
qtModule { qtModule {
pname = "qtwebview"; 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++"; description = "A cross-platform application framework for C++";
license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ]; license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ];
maintainers = with maintainers; [ milahu nickcao ]; maintainers = with maintainers; [ milahu nickcao ];
platforms = platforms.linux; platforms = platforms.unix;
} // (args.meta or { }); } // (args.meta or { });
}) })

View file

@ -23,9 +23,16 @@ stdenv.mkDerivation rec {
'' + lib.optionalString stdenv.isDarwin '' '' + lib.optionalString stdenv.isDarwin ''
# Fix darwin build # Fix darwin build
substituteInPlace pbfplugin.pro \ substituteInPlace pbfplugin.pro \
--replace '$$PROTOBUF/include' '${protobuf}/include' \
--replace '$$PROTOBUF/lib/libprotobuf-lite.a' '${protobuf}/lib/libprotobuf-lite.dylib' --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; { meta = with lib; {
description = "Qt image plugin for displaying Mapbox vector tiles"; description = "Qt image plugin for displaying Mapbox vector tiles";
longDescription = '' longDescription = ''

View file

@ -20,11 +20,10 @@
}; };
meta = with lib; { meta = with lib; {
broken = stdenv.isDarwin;
description = "Official PostgreSQL ODBC Driver"; description = "Official PostgreSQL ODBC Driver";
homepage = "https://odbc.postgresql.org/"; homepage = "https://odbc.postgresql.org/";
license = licenses.lgpl2; license = licenses.lgpl2;
platforms = platforms.linux; platforms = platforms.unix;
}; };
}; };
@ -47,7 +46,9 @@
preConfigure = '' preConfigure = ''
# we don't want to build a .pkg # 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 = [ cmakeFlags = [
@ -62,7 +63,6 @@
}; };
meta = with lib; { meta = with lib; {
broken = stdenv.isDarwin;
description = "MariaDB ODBC database driver"; description = "MariaDB ODBC database driver";
homepage = "https://downloads.mariadb.org/connector-odbc/"; homepage = "https://downloads.mariadb.org/connector-odbc/";
license = licenses.gpl2; license = licenses.gpl2;
@ -126,11 +126,10 @@
}; };
meta = with lib; { meta = with lib; {
broken = stdenv.isDarwin;
description = "ODBC driver for SQLite"; description = "ODBC driver for SQLite";
homepage = "http://www.ch-werner.de/sqliteodbc"; homepage = "http://www.ch-werner.de/sqliteodbc";
license = licenses.bsd2; license = licenses.bsd2;
platforms = platforms.linux; platforms = platforms.unix;
maintainers = with maintainers; [ vlstill ]; maintainers = with maintainers; [ vlstill ];
}; };
}; };

View file

@ -1,4 +1,5 @@
{ lib { lib
, stdenv
, buildPythonPackage , buildPythonPackage
, isPy27 , isPy27
, fetchPypi , fetchPypi
@ -134,5 +135,7 @@ buildPythonPackage rec {
license = licenses.gpl3Only; license = licenses.gpl3Only;
platforms = platforms.mesaPlatforms; platforms = platforms.mesaPlatforms;
maintainers = with maintainers; [ LunNova ]; 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 qt6 = recurseIntoAttrs (makeOverridable
(import ../development/libraries/qt-6) { (import ../development/libraries/qt-6) {
inherit newScope; 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 bison cups dconf harfbuzz libGL perl gtk3 ninja;
inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi; inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi;
inherit buildPackages; inherit darwin buildPackages libglvnd;
inherit libglvnd; stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
cmake = cmake.overrideAttrs (attrs: { cmake = cmake.overrideAttrs (attrs: {
patches = attrs.patches ++ [ patches = attrs.patches ++ [
../development/libraries/qt-6/patches/cmake.patch ../development/libraries/qt-6/patches/cmake.patch