qt6.qtbase: add mingw support

This commit is contained in:
Sean Link 2024-02-27 13:15:58 -07:00
parent fd89f2b6fb
commit 174ca6a2ea
2 changed files with 29 additions and 13 deletions

View file

@ -42,7 +42,7 @@ let
qtModule = callPackage ./qtModule.nix { };
qtbase = callPackage ./modules/qtbase.nix {
withGtk3 = true;
withGtk3 = !stdenv.hostPlatform.isMinGW;
inherit (srcs.qtbase) src version;
inherit developerBuild;
inherit (darwin.apple_sdk_11_0.frameworks)

View file

@ -4,6 +4,7 @@
, patches ? [ ]
, version
, coreutils
, buildPackages
, bison
, flex
, gdb
@ -79,6 +80,8 @@
, EventKit
, GSS
, MetalKit
# mingw
, pkgsBuildBuild
# optional dependencies
, cups
, libmysqlclient
@ -96,6 +99,7 @@
let
debugSymbols = debug || developerBuild;
isCrossBuild = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
in
stdenv.mkDerivation rec {
pname = "qtbase";
@ -110,7 +114,6 @@ stdenv.mkDerivation rec {
openssl
sqlite
zlib
unixODBC
# Text rendering
harfbuzz
icu
@ -119,14 +122,16 @@ stdenv.mkDerivation rec {
libpng
pcre2
pcre
libproxy
zstd
double-conversion
libb2
md4c
double-conversion
] ++ lib.optionals (!stdenv.hostPlatform.isMinGW) [
libproxy
dbus
glib
# unixODBC drivers
unixODBC
unixODBCDrivers.psql
unixODBCDrivers.sqlite
unixODBCDrivers.mariadb
@ -174,11 +179,16 @@ stdenv.mkDerivation rec {
EventKit
GSS
MetalKit
] ++ lib.optional libGLSupported libGL;
] ++ lib.optionals libGLSupported [
libGL
] ++ lib.optionals stdenv.hostPlatform.isMinGW [
vulkan-headers
vulkan-loader
];
buildInputs = [
buildInputs = lib.optionals (lib.meta.availableOn stdenv.hostPlatform at-spi2-core) [
at-spi2-core
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform libinput) [
libinput
] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
AppKit
@ -186,9 +196,9 @@ stdenv.mkDerivation rec {
]
++ lib.optional withGtk3 gtk3
++ lib.optional developerBuild gdb
++ lib.optional (cups != null) cups
++ lib.optional (libmysqlclient != null) libmysqlclient
++ lib.optional (postgresql != null) postgresql;
++ lib.optional (cups != null && lib.meta.availableOn stdenv.hostPlatform cups) cups
++ lib.optional (libmysqlclient != null && !stdenv.hostPlatform.isMinGW) libmysqlclient
++ lib.optional (postgresql != null && lib.meta.availableOn stdenv.hostPlatform postgresql) postgresql;
nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which cmake xmlstarlet ninja ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ];
@ -203,7 +213,7 @@ stdenv.mkDerivation rec {
# https://bugreports.qt.io/browse/QTBUG-97568
postPatch = ''
substituteInPlace src/corelib/CMakeLists.txt --replace-fail "/bin/ls" "${coreutils}/bin/ls"
substituteInPlace src/corelib/CMakeLists.txt --replace-fail "/bin/ls" "${buildPackages.coreutils}/bin/ls"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace cmake/QtPublicAppleHelpers.cmake --replace-fail "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
'';
@ -232,7 +242,11 @@ stdenv.mkDerivation rec {
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
# error: 'path' is unavailable: introduced in macOS 10.15
"-DQT_FEATURE_cxx17_filesystem=OFF"
] ++ lib.optional (qttranslations != null) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations";
] ++ lib.optionals isCrossBuild [
"-DQT_HOST_PATH=${pkgsBuildBuild.qt6.qtbase}"
"-DQt6HostInfo_DIR=${pkgsBuildBuild.qt6.qtbase}/lib/cmake/Qt6HostInfo"
]
++ lib.optional (qttranslations != null && !isCrossBuild) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations";
env.NIX_LDFLAGS = toString (lib.optionals stdenv.hostPlatform.isDarwin [
# Undefined symbols for architecture arm64: "___gss_c_nt_hostbased_service_oid_desc"
@ -253,6 +267,8 @@ stdenv.mkDerivation rec {
dontStrip = debugSymbols;
dontWrapQtApps = true;
setupHook = ../hooks/qtbase-setup-hook.sh;
meta = with lib; {
@ -260,6 +276,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.unix;
platforms = platforms.unix ++ platforms.windows;
};
}