2022-06-16 17:23:12 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, src
|
|
|
|
, patches ? [ ]
|
|
|
|
, version
|
|
|
|
, bison
|
|
|
|
, flex
|
|
|
|
, gperf
|
|
|
|
, lndir
|
|
|
|
, perl
|
|
|
|
, pkg-config
|
|
|
|
, which
|
|
|
|
, cmake
|
|
|
|
, ninja
|
|
|
|
, xmlstarlet
|
|
|
|
, libproxy
|
|
|
|
, xorg
|
|
|
|
, zstd
|
|
|
|
, double-conversion
|
|
|
|
, util-linux
|
|
|
|
, systemd
|
2024-02-29 20:09:43 +00:00
|
|
|
, systemdSupport ? stdenv.hostPlatform.isLinux
|
2022-06-16 17:23:12 +00:00
|
|
|
, libb2
|
|
|
|
, md4c
|
|
|
|
, mtdev
|
|
|
|
, lksctp-tools
|
|
|
|
, libselinux
|
|
|
|
, libsepol
|
|
|
|
, vulkan-headers
|
|
|
|
, vulkan-loader
|
|
|
|
, libthai
|
|
|
|
, libdrm
|
|
|
|
, libdatrie
|
|
|
|
, lttng-ust
|
|
|
|
, libepoxy
|
|
|
|
, dbus
|
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, glib
|
|
|
|
, harfbuzz
|
|
|
|
, icu
|
|
|
|
, libX11
|
|
|
|
, libXcomposite
|
|
|
|
, libXext
|
|
|
|
, libXi
|
|
|
|
, libXrender
|
|
|
|
, libinput
|
|
|
|
, libjpeg
|
|
|
|
, libpng
|
|
|
|
, libxcb
|
|
|
|
, libxkbcommon
|
|
|
|
, libxml2
|
|
|
|
, libxslt
|
|
|
|
, openssl
|
|
|
|
, pcre
|
|
|
|
, pcre2
|
|
|
|
, sqlite
|
|
|
|
, udev
|
|
|
|
, xcbutil
|
|
|
|
, xcbutilimage
|
|
|
|
, xcbutilkeysyms
|
|
|
|
, xcbutilrenderutil
|
|
|
|
, xcbutilwm
|
|
|
|
, zlib
|
|
|
|
, at-spi2-core
|
|
|
|
, unixODBC
|
|
|
|
, unixODBCDrivers
|
2022-12-17 10:02:37 +00:00
|
|
|
# darwin
|
2023-04-29 16:46:19 +00:00
|
|
|
, moveBuildTree
|
2022-12-17 10:02:37 +00:00
|
|
|
, xcbuild
|
|
|
|
, AGL
|
|
|
|
, AVFoundation
|
|
|
|
, AppKit
|
2023-04-29 16:46:19 +00:00
|
|
|
, Contacts
|
|
|
|
, CoreBluetooth
|
|
|
|
, EventKit
|
2022-12-17 10:02:37 +00:00
|
|
|
, GSS
|
|
|
|
, MetalKit
|
2024-02-29 20:09:43 +00:00
|
|
|
# mingw
|
|
|
|
, pkgsBuildBuild
|
2022-06-16 17:23:12 +00:00
|
|
|
# optional dependencies
|
|
|
|
, cups
|
|
|
|
, libmysqlclient
|
|
|
|
, postgresql
|
|
|
|
, withGtk3 ? false
|
|
|
|
, dconf
|
|
|
|
, gtk3
|
|
|
|
# options
|
2024-02-29 20:09:43 +00:00
|
|
|
, libGLSupported ? stdenv.hostPlatform.isLinux
|
2022-06-16 17:23:12 +00:00
|
|
|
, libGL
|
2023-10-09 19:29:22 +00:00
|
|
|
, qttranslations ? null
|
2022-06-16 17:23:12 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-02-29 20:09:43 +00:00
|
|
|
isCrossBuild = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
2022-06-16 17:23:12 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "qtbase";
|
|
|
|
|
|
|
|
inherit src version;
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
libxml2
|
|
|
|
libxslt
|
|
|
|
openssl
|
|
|
|
sqlite
|
|
|
|
zlib
|
|
|
|
# Text rendering
|
|
|
|
harfbuzz
|
|
|
|
icu
|
|
|
|
# Image formats
|
|
|
|
libjpeg
|
|
|
|
libpng
|
|
|
|
pcre2
|
|
|
|
pcre
|
|
|
|
zstd
|
|
|
|
libb2
|
|
|
|
md4c
|
2024-02-29 20:09:43 +00:00
|
|
|
double-conversion
|
|
|
|
] ++ lib.optionals (!stdenv.hostPlatform.isMinGW) [
|
|
|
|
libproxy
|
2022-12-17 10:02:37 +00:00
|
|
|
dbus
|
|
|
|
glib
|
|
|
|
# unixODBC drivers
|
2024-02-29 20:09:43 +00:00
|
|
|
unixODBC
|
2022-12-17 10:02:37 +00:00
|
|
|
unixODBCDrivers.psql
|
|
|
|
unixODBCDrivers.sqlite
|
|
|
|
unixODBCDrivers.mariadb
|
2023-01-11 07:51:40 +00:00
|
|
|
] ++ lib.optionals systemdSupport [
|
2022-12-17 10:02:37 +00:00
|
|
|
systemd
|
2024-02-29 20:09:43 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
2023-01-20 10:41:00 +00:00
|
|
|
util-linux
|
2022-06-16 17:23:12 +00:00
|
|
|
mtdev
|
|
|
|
lksctp-tools
|
|
|
|
libselinux
|
|
|
|
libsepol
|
|
|
|
lttng-ust
|
|
|
|
vulkan-headers
|
|
|
|
vulkan-loader
|
|
|
|
libthai
|
|
|
|
libdrm
|
|
|
|
libdatrie
|
|
|
|
udev
|
|
|
|
# Text rendering
|
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
# X11 libs
|
|
|
|
libX11
|
|
|
|
libXcomposite
|
|
|
|
libXext
|
|
|
|
libXi
|
|
|
|
libXrender
|
|
|
|
libxcb
|
|
|
|
libxkbcommon
|
|
|
|
xcbutil
|
|
|
|
xcbutilimage
|
|
|
|
xcbutilkeysyms
|
|
|
|
xcbutilrenderutil
|
|
|
|
xcbutilwm
|
|
|
|
xorg.libXdmcp
|
|
|
|
xorg.libXtst
|
|
|
|
xorg.xcbutilcursor
|
|
|
|
libepoxy
|
2024-02-29 20:09:43 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2022-12-17 10:02:37 +00:00
|
|
|
AGL
|
|
|
|
AVFoundation
|
|
|
|
AppKit
|
2023-04-29 16:46:19 +00:00
|
|
|
Contacts
|
|
|
|
CoreBluetooth
|
|
|
|
EventKit
|
2022-12-17 10:02:37 +00:00
|
|
|
GSS
|
|
|
|
MetalKit
|
2024-02-29 20:09:43 +00:00
|
|
|
] ++ lib.optionals libGLSupported [
|
|
|
|
libGL
|
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isMinGW [
|
|
|
|
vulkan-headers
|
|
|
|
vulkan-loader
|
|
|
|
];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
buildInputs = lib.optionals (lib.meta.availableOn stdenv.hostPlatform at-spi2-core) [
|
2022-06-16 17:23:12 +00:00
|
|
|
at-spi2-core
|
2024-02-29 20:09:43 +00:00
|
|
|
] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform libinput) [
|
2022-06-16 17:23:12 +00:00
|
|
|
libinput
|
2024-02-29 20:09:43 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
|
2022-12-17 10:02:37 +00:00
|
|
|
AppKit
|
2023-04-29 16:46:19 +00:00
|
|
|
CoreBluetooth
|
2022-06-16 17:23:12 +00:00
|
|
|
]
|
|
|
|
++ lib.optional withGtk3 gtk3
|
2024-02-29 20:09:43 +00:00
|
|
|
++ 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;
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which cmake xmlstarlet ninja ]
|
2024-02-29 20:09:43 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
propagatedNativeBuildInputs = [ lndir ];
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
inherit patches;
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2024-02-29 20:09:43 +00:00
|
|
|
substituteInPlace cmake/QtPublicAppleHelpers.cmake --replace-fail "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
|
|
|
|
fix_qt_module_paths = ../hooks/fix-qt-module-paths.sh;
|
|
|
|
preHook = ''
|
|
|
|
. "$fix_qt_builtin_paths"
|
|
|
|
. "$fix_qt_module_paths"
|
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
qtPluginPrefix = "lib/qt-6/plugins";
|
|
|
|
qtQmlPrefix = "lib/qt-6/qml";
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2023-04-29 16:46:19 +00:00
|
|
|
"-DQT_EMBED_TOOLCHAIN_COMPILER=OFF"
|
2022-06-16 17:23:12 +00:00
|
|
|
"-DINSTALL_PLUGINSDIR=${qtPluginPrefix}"
|
|
|
|
"-DINSTALL_QMLDIR=${qtQmlPrefix}"
|
|
|
|
"-DQT_FEATURE_libproxy=ON"
|
|
|
|
"-DQT_FEATURE_system_sqlite=ON"
|
|
|
|
"-DQT_FEATURE_openssl_linked=ON"
|
2024-02-29 20:09:43 +00:00
|
|
|
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
2022-12-17 10:02:37 +00:00
|
|
|
"-DQT_FEATURE_sctp=ON"
|
2023-01-11 07:51:40 +00:00
|
|
|
"-DQT_FEATURE_journald=${if systemdSupport then "ON" else "OFF"}"
|
2022-12-17 10:02:37 +00:00
|
|
|
"-DQT_FEATURE_vulkan=ON"
|
2024-02-29 20:09:43 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2023-02-09 11:40:11 +00:00
|
|
|
# error: 'path' is unavailable: introduced in macOS 10.15
|
|
|
|
"-DQT_FEATURE_cxx17_filesystem=OFF"
|
2024-02-29 20:09:43 +00:00
|
|
|
] ++ 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";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
env.NIX_LDFLAGS = toString (lib.optionals stdenv.hostPlatform.isDarwin [
|
2022-12-17 10:02:37 +00:00
|
|
|
# Undefined symbols for architecture arm64: "___gss_c_nt_hostbased_service_oid_desc"
|
|
|
|
"-framework GSS"
|
|
|
|
]);
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-DNIXPKGS_QT_PLUGIN_PREFIX=\"${qtPluginPrefix}\"";
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
moveToDev = false;
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
postFixup = ''
|
2023-04-29 16:46:19 +00:00
|
|
|
moveToOutput "mkspecs/modules" "$dev"
|
|
|
|
fixQtModulePaths "$dev/mkspecs/modules"
|
|
|
|
fixQtBuiltinPaths "$out" '*.pr?'
|
2024-09-26 11:04:55 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
# FIXME: not sure why this isn't added automatically?
|
|
|
|
patchelf --add-rpath "${libmysqlclient}/lib/mariadb" $out/${qtPluginPrefix}/sqldrivers/libqsqlmysql.so
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
setupHook = ../hooks/qtbase-setup-hook.sh;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.qt.io/";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Cross-platform application framework for C++";
|
2022-11-21 17:40:18 +00:00
|
|
|
license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ];
|
2022-10-21 18:38:19 +00:00
|
|
|
maintainers = with maintainers; [ milahu nickcao LunNova ];
|
2024-02-29 20:09:43 +00:00
|
|
|
platforms = platforms.unix ++ platforms.windows;
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
|
|
|
}
|