-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mingw32 support qtbase #287077
Add mingw32 support qtbase #287077
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
@@ -69,47 +69,49 @@ let | |
]; | ||
}; | ||
env = callPackage ./qt-env.nix { }; | ||
full = callPackage ({ env, qtbase }: env "qt-full-${qtbase.version}" | ||
# `with self` is ok to use here because having these spliced is unnecessary | ||
( with self;[ | ||
qt3d | ||
qt5compat | ||
qtcharts | ||
qtconnectivity | ||
qtdatavis3d | ||
qtdeclarative | ||
qtdoc | ||
qtgraphs | ||
qtgrpc | ||
qthttpserver | ||
qtimageformats | ||
qtlanguageserver | ||
qtlocation | ||
qtlottie | ||
qtmultimedia | ||
qtmqtt | ||
qtnetworkauth | ||
qtpositioning | ||
qtsensors | ||
qtserialbus | ||
qtserialport | ||
qtshadertools | ||
qtspeech | ||
qtquick3d | ||
qtquick3dphysics | ||
qtquickeffectmaker | ||
qtquicktimeline | ||
qtremoteobjects | ||
qtsvg | ||
qtscxml | ||
qttools | ||
qttranslations | ||
qtvirtualkeyboard | ||
qtwebchannel | ||
qtwebengine | ||
qtwebsockets | ||
qtwebview | ||
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ qtwayland libglvnd ])) { }; | ||
full = callPackage | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please drop the formatting changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fine then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is a bug in nixpkgs-fmt that the after the callPackage a line break is added. Also it makes the entire PR looking bigger than it is. |
||
({ env, qtbase }: env "qt-full-${qtbase.version}" | ||
# `with self` is ok to use here because having these spliced is unnecessary | ||
(with self;[ | ||
qt3d | ||
qt5compat | ||
qtcharts | ||
qtconnectivity | ||
qtdatavis3d | ||
qtdeclarative | ||
qtdoc | ||
qtgraphs | ||
qtgrpc | ||
qthttpserver | ||
qtimageformats | ||
qtlanguageserver | ||
qtlocation | ||
qtlottie | ||
qtmultimedia | ||
qtmqtt | ||
qtnetworkauth | ||
qtpositioning | ||
qtsensors | ||
qtserialbus | ||
qtserialport | ||
qtshadertools | ||
qtspeech | ||
qtquick3d | ||
qtquick3dphysics | ||
qtquickeffectmaker | ||
qtquicktimeline | ||
qtremoteobjects | ||
qtsvg | ||
qtscxml | ||
qttools | ||
qttranslations | ||
qtvirtualkeyboard | ||
qtwebchannel | ||
qtwebengine | ||
qtwebsockets | ||
qtwebview | ||
] ++ lib.optionals (!stdenv.isDarwin) [ qtwayland libglvnd ])) | ||
{ }; | ||
|
||
qt3d = callPackage ./modules/qt3d.nix { }; | ||
qt5compat = callPackage ./modules/qt5compat.nix { }; | ||
|
@@ -162,11 +164,14 @@ let | |
GameController ImageCaptureCore LocalAuthentication | ||
MediaAccessibility MediaPlayer MetalKit Network OpenDirectory Quartz | ||
ReplayKit SecurityInterface Vision; | ||
qtModule = callPackage ({ qtModule }: qtModule.override { | ||
stdenv = if stdenv.hostPlatform.isDarwin | ||
then overrideSDK stdenv { darwinMinVersion = "10.13"; darwinSdkVersion = "11.0"; } | ||
else stdenv; | ||
}) { }; | ||
qtModule = callPackage | ||
({ qtModule }: qtModule.override { | ||
stdenv = | ||
if stdenv.isDarwin | ||
then overrideSDK stdenv { darwinMinVersion = "10.13"; darwinSdkVersion = "11.0"; } | ||
else stdenv; | ||
}) | ||
{ }; | ||
xcbuild = buildPackages.xcbuild.override { | ||
productBuildVer = "20A2408"; | ||
}; | ||
|
@@ -176,21 +181,25 @@ let | |
inherit (darwin.apple_sdk_11_0.frameworks) WebKit; | ||
}; | ||
|
||
wrapQtAppsHook = callPackage ({ makeBinaryWrapper }: makeSetupHook | ||
{ | ||
name = "wrap-qt6-apps-hook"; | ||
propagatedBuildInputs = [ makeBinaryWrapper ]; | ||
} ./hooks/wrap-qt-apps-hook.sh) { }; | ||
wrapQtAppsHook = callPackage | ||
({ makeBinaryWrapper }: makeSetupHook | ||
{ | ||
name = "wrap-qt6-apps-hook"; | ||
propagatedBuildInputs = [ makeBinaryWrapper ]; | ||
} ./hooks/wrap-qt-apps-hook.sh) | ||
{ }; | ||
|
||
qmake = callPackage ({ qtbase }: makeSetupHook | ||
{ | ||
name = "qmake6-hook"; | ||
propagatedBuildInputs = [ qtbase.dev ]; | ||
substitutions = { | ||
inherit debug; | ||
fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh; | ||
}; | ||
} ./hooks/qmake-hook.sh) { }; | ||
qmake = callPackage | ||
({ qtbase }: makeSetupHook | ||
{ | ||
name = "qmake6-hook"; | ||
propagatedBuildInputs = [ qtbase.dev ]; | ||
substitutions = { | ||
inherit debug; | ||
fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh; | ||
}; | ||
} ./hooks/qmake-hook.sh) | ||
{ }; | ||
} // lib.optionalAttrs config.allowAliases { | ||
# Convert to a throw on 03-01-2023 and backport the change. | ||
# Warnings show up in various cli tool outputs, throws do not. | ||
|
@@ -203,12 +212,13 @@ let | |
f = addPackages; | ||
}; | ||
|
||
bootstrapScope = baseScope.overrideScope(final: prev: { | ||
bootstrapScope = baseScope.overrideScope (final: prev: { | ||
qtbase = prev.qtbase.override { qttranslations = null; }; | ||
qtdeclarative = null; | ||
}); | ||
|
||
finalScope = baseScope.overrideScope(final: prev: { | ||
finalScope = baseScope.overrideScope (final: prev: { | ||
qttranslations = bootstrapScope.qttranslations; | ||
}); | ||
in finalScope | ||
in | ||
finalScope |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||||||
] ++ lib.optionals (!stdenv.hostPlatform.isMinGW) [ | ||||||
libproxy | ||||||
dbus | ||||||
glib | ||||||
# unixODBC drivers | ||||||
unixODBC | ||||||
unixODBCDrivers.psql | ||||||
unixODBCDrivers.sqlite | ||||||
unixODBCDrivers.mariadb | ||||||
|
@@ -174,21 +179,26 @@ stdenv.mkDerivation rec { | |||||
EventKit | ||||||
GSS | ||||||
MetalKit | ||||||
] ++ lib.optional libGLSupported libGL; | ||||||
] ++ lib.optionals libGLSupported [ | ||||||
libGL | ||||||
] ++ lib.optionals stdenv.hostPlatform.isMinGW [ | ||||||
vulkan-headers | ||||||
vulkan-loader | ||||||
]; | ||||||
Comment on lines
+184
to
+187
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why only for mingw? Shall we also add vulkan support to linux builds? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't a mingw only thing. See nixpkgs/pkgs/development/libraries/qt-6/modules/qtbase.nix Lines 142 to 143 in b5c9562
|
||||||
|
||||||
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 | ||||||
CoreBluetooth | ||||||
] | ||||||
++ 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" | ||||||
Comment on lines
+246
to
+247
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If these paths are explicitly set, maybe there's no need to put it in depsBuildBuild? (Also causes inf recursion.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are correct. Logic updated to only include this when stdenv.hostPlatform != stdenv.buildPlatform. Fixed. |
||||||
] | ||||||
++ 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,13 +267,15 @@ stdenv.mkDerivation rec { | |||||
|
||||||
dontStrip = debugSymbols; | ||||||
|
||||||
dontWrapQtApps = true; | ||||||
|
||||||
setupHook = ../hooks/qtbase-setup-hook.sh; | ||||||
|
||||||
meta = with lib; { | ||||||
homepage = "https://www.qt.io/"; | ||||||
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; | ||||||
}; | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't gtk3 available on mingw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, using
!lib.meta.availableOn stdenv.hostPlatform gtk3
is more appropriate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a bug in the in the gtk3 package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No change since gtk3 appears to indicate it has mingw support when in fact it doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really should fix this on the gtk3 side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My hope is that we can leave the mingw conditional for now to get initial mingw support for qtbase. When gtk3 actually has mingw support, we can change that line. I suspect that adding mingw support for gtk3 may not be trivial.