pyqt5: fix cross

This commit is contained in:
Adam Joseph 2023-11-03 22:25:17 -07:00 committed by Adam Joseph
parent b7b8175963
commit a2440fb078

View file

@ -12,6 +12,7 @@
, pyqt5_sip
, pyqt-builder
, libsForQt5
, enableVerbose ? true
, withConnectivity ? false
, withMultimedia ? false
, withWebKit ? false
@ -19,6 +20,9 @@
, withLocation ? false
, withSerialPort ? false
, withTools ? false
, pkgsBuildTarget
, buildPackages
, dbusSupport ? !stdenv.isDarwin
}:
buildPythonPackage rec {
@ -45,6 +49,7 @@ buildPythonPackage rec {
# be more verbose
''
cat >> pyproject.toml <<EOF
'' + lib.optionalString enableVerbose ''
[tool.sip.project]
verbose = true
''
@ -55,6 +60,37 @@ buildPythonPackage rec {
minimum-macos-version = "11.0"
'' + ''
EOF
''
# pyqt-builder tries to compile *and run* these programs. This
# is really sad because the only thing they do is print out a
# flag based on whether or not some compile-time symbol was
# defined. This could all be done without having to *execute*
# cross-compiled programs!
#
# Here is the complete list of things checked:
#
# QT_NO_PRINTDIALOG => PyQt_PrintDialog
# QT_NO_PRINTER => PyQt_Printer
# QT_NO_PRINTPREVIEWDIALOG => PyQt_PrintPreviewDialog
# QT_NO_PRINTPREVIEWWIDGET => PyQt_PrintPreviewWidget
# QT_NO_SSL => PyQt_SSL
# QT_SHARED || QT_DLL => shared (otherwise static)
# QT_NO_PROCESS => PyQt_Process
# QT_NO_FPU || Q_PROCESSOR_ARM || Q_OS_WINCE => PyQt_qreal_double
# sizeof (qreal) != sizeof (double) => PyQt_qreal_double
# !Q_COMPILER_CONSTEXPR !Q_COMPILER_UNIFORM_INIT => PyQt_CONSTEXPR
# QT_NO_ACCESSIBILITY => PyQt_Accessibility
# QT_NO_OPENGL => PyQt_OpenGL PyQt_Desktop_OpenGL
# defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_ES_3) => PyQt_Desktop_OpenGL
# QT_NO_RAWFONT => PyQt_RawFont
# QT_NO_SESSIONMANAGER => PyQt_SessionManager
#
+ lib.optionalString (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) ''
rm config-tests/cfgtest_QtCore.cpp
rm config-tests/cfgtest_QtGui.cpp
rm config-tests/cfgtest_QtNetwork.cpp
rm config-tests/cfgtest_QtPrintSupport.cpp
'';
enableParallelBuilding = true;
@ -68,16 +104,27 @@ buildPythonPackage rec {
export MAKEFLAGS+="''${enableParallelBuilding:+-j$NIX_BUILD_CORES}"
'';
# tons of warnings from subpackages, no point in playing whack-a-mole
env = lib.optionalAttrs (!enableVerbose) {
NIX_CFLAGS_COMPILE = "-w";
};
outputs = [ "out" "dev" ];
dontWrapQtApps = true;
nativeBuildInputs = with libsForQt5; [
nativeBuildInputs = [
pkg-config
qmake
] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [
libsForQt5.qmake
] ++ [
setuptools
lndir
sip
] ++ (with pkgsBuildTarget.targetPackages.libsForQt5; [
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
qmake
] ++ [
qtbase
qtsvg
qtdeclarative
@ -90,11 +137,13 @@ buildPythonPackage rec {
++ lib.optional withLocation qtlocation
++ lib.optional withSerialPort qtserialport
++ lib.optional withTools qttools
;
);
buildInputs = with libsForQt5; [
dbus
] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [
qtbase
] ++ [
qtsvg
qtdeclarative
pyqt-builder