Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 70 additions & 3 deletions pkgs/development/libraries/qt-6/modules/qtbase.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
, libepoxy
, libiconv
, dbus
, dbusSupport ? true
, fontconfig
, freetype
, glib
Expand Down Expand Up @@ -68,6 +69,7 @@
, xcbutilwm
, zlib
, at-spi2-core
, odbcSupport ? stdenv.buildPlatform == stdenv.hostPlatform
, unixODBC
, unixODBCDrivers
# darwin
Expand All @@ -94,10 +96,49 @@
, debug ? false
, developerBuild ? false
, qttranslations ? null
, buildPackages
, pkgsBuildHost
, writeText
}:

let
debugSymbols = debug || developerBuild;

# Cross Compilation support
#
# NOTE! You must use `targetPlatform` instead of `hostPlatform`
# almost everywhere in this file. This is necessary because our
# qtbase expression has "the GCC problem": it builds both a
# compiler-like tool (qmake) and its target libraries (qtbase) as
# part of a single derivation. We should stop doing this.

qtPlatformCross = plat: with plat;
if isLinux
then "linux-generic-g++"
else throw "Please add a qtPlatformCross entry for ${plat.config}";

specsDirName = "nixpkgs-${stdenv.targetPlatform.config}";
specsFile = writeText "qmake.conf" (''
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
include(../common/linux.conf)
'' + lib.optionalString stdenv.cc.isGNU ''
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
'' + ''
QMAKE_CC = ${stdenv.cc.targetPrefix}gcc
QMAKE_CXX = ${stdenv.cc.targetPrefix}g++
QMAKE_LINK = ${stdenv.cc.targetPrefix}g++
QMAKE_LINK_SHLIB = ${stdenv.cc.targetPrefix}g++
QMAKE_AR = ${stdenv.cc.targetPrefix}ar cqs
QMAKE_OBJCOPY = ${stdenv.cc.targetPrefix}objcopy
QMAKE_NM = ${stdenv.cc.targetPrefix}nm -P
QMAKE_STRIP = ${stdenv.cc.targetPrefix}strip
load(qt_config)
'');

in
stdenv.mkDerivation rec {
pname = "qtbase";
Expand Down Expand Up @@ -126,15 +167,18 @@ stdenv.mkDerivation rec {
double-conversion
libb2
md4c
] ++ lib.optionals dbusSupport [
dbus
] ++ [
glib
] ++ lib.optionals odbcSupport [
# unixODBC drivers
unixODBCDrivers.psql
unixODBCDrivers.sqlite
unixODBCDrivers.mariadb
] ++ lib.optionals systemdSupport [
systemd
] ++ lib.optionals stdenv.isLinux [
] ++ lib.optionals stdenv.targetPlatform.isLinux [
util-linux
mtdev
lksctp-tools
Expand Down Expand Up @@ -179,6 +223,8 @@ stdenv.mkDerivation rec {
] ++ lib.optional libGLSupported libGL;

buildInputs = [
python3
] ++ lib.optionals dbusSupport [
at-spi2-core
] ++ lib.optionals (!stdenv.isDarwin) [
libinput
Expand Down Expand Up @@ -208,6 +254,9 @@ stdenv.mkDerivation rec {
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"
'' + lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
install -DT ${specsFile} mkspecs/${specsDirName}/qmake.conf
ln -s ../linux-g++/qplatformdefs.h mkspecs/${specsDirName}/qplatformdefs.h
'';

fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
Expand All @@ -231,10 +280,24 @@ stdenv.mkDerivation rec {
"-DQT_FEATURE_sctp=ON"
"-DQT_FEATURE_journald=${if systemdSupport then "ON" else "OFF"}"
"-DQT_FEATURE_vulkan=ON"
"-DQT_FEATURE_dbus=${if dbusSupport then "ON" else "OFF"}"
] ++ lib.optionals stdenv.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 (stdenv.buildPlatform != stdenv.targetPlatform) [
# Useful: https://raw.githubusercontent.com/qt/qtbase/dev/cmake/configure-cmake-mapping.md
#"-DQT_QMAKE_TARGET_MKSPEC=${specsDirName}"
#"-DFEATURE_thread=ON"
#"-DQT_BUILD_SHARED_LIBS=ON"
#"-DQT_FORCE_BUILD_TOOLS=TRUE"
"-DQT_QMAKE_TARGET_MKSPEC=devices/${qtPlatformCross stdenv.hostPlatform}"
"-DQT_QMAKE_DEVICE_OPTIONS=CROSS_COMPILE=${stdenv.cc.targetPrefix}"

#"-DQT_INSTALL_PREFIX=${builtins.placeholder "out"}"
"-DQT_HOST_PREFIX=${pkgsBuildHost.qt6Packages.qtbase}"
]
#++ lib.optional (qttranslations != null) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations"
;

NIX_LDFLAGS = toString (lib.optionals stdenv.isDarwin [
# Undefined symbols for architecture arm64: "___gss_c_nt_hostbased_service_oid_desc"
Expand All @@ -249,7 +312,11 @@ stdenv.mkDerivation rec {
moveToOutput "mkspecs/modules" "$dev"
fixQtModulePaths "$dev/mkspecs/modules"
fixQtBuiltinPaths "$out" '*.pr?'
'';
''
+ lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) ''
ln -s "${pkgsBuildHost.qt6Packages.qtbase}/libexec/moc" $out/libexec/moc || true
''
;

dontStrip = debugSymbols;

Expand Down
21 changes: 19 additions & 2 deletions pkgs/development/libraries/qt-6/modules/qtdeclarative.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
{ qtModule
{ lib
, stdenv
, qtModule
, qtbase
, qtlanguageserver
, qtshadertools
, qtdeclarative
, openssl
, python3
, buildPackages
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
}:

qtModule {
pname = "qtdeclarative";
propagatedBuildInputs = [ qtbase qtlanguageserver qtshadertools openssl python3 ];
buildInputs = [
openssl
python3
qtbase
];
nativeBuildInputs = [
python3
qtbase
qtshadertools
];
nativeQtBuildInputs = [ "qtdeclarative" ];
patches = [
# prevent headaches from stale qmlcache data
../patches/qtdeclarative-default-disable-qmlcache.patch
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/libraries/qt-6/modules/qtlocation.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{ qtModule
{ lib
, stdenv
, qtModule
, qtbase
, qtdeclarative
, qtpositioning
, pkgsBuildHost
}:

qtModule {
pname = "qtlocation";
propagatedBuildInputs = [ qtbase qtdeclarative qtpositioning ];
nativeQtBuildInputs = [ "qtpositioning" "qtdeclarative" ];
}
8 changes: 5 additions & 3 deletions pkgs/development/libraries/qt-6/modules/qtmultimedia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
, gst-plugins-good
, gst-libav
, gst-vaapi
, libpulseaudio
, pulseaudioSupport ? stdenv.hostPlatform.isLinux, libpulseaudio
, wayland
, elfutils
, libunwind
Expand All @@ -24,11 +24,13 @@ qtModule {
pname = "qtmultimedia";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libunwind orc ]
++ lib.optionals stdenv.isLinux [ libpulseaudio elfutils alsa-lib wayland ];
propagatedBuildInputs = [ qtbase qtdeclarative qtsvg qtshadertools ]
++ lib.optionals pulseaudioSupport [ libpulseaudio ] ++ lib.optionals stdenv.isLinux [ elfutils alsa-lib wayland ];
propagatedBuildInputs = [ qtbase qtdeclarative qtsvg ]
++ lib.optionals stdenv.isLinux [ gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi ]
++ lib.optionals stdenv.isDarwin [ VideoToolbox ];

nativeQtBuildInputs = [ "qtshadertools" "qtdeclarative" ];

env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin
"-include AudioToolbox/AudioToolbox.h";
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin
Expand Down
13 changes: 9 additions & 4 deletions pkgs/development/libraries/qt-6/modules/qtpositioning.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{ qtModule
{ lib
, stdenv
, qtModule
, qtbase
, qtdeclarative
, qtserialport
, pkg-config
, openssl
, pkgsBuildHost
}:

qtModule {
pname = "qtpositioning";
propagatedBuildInputs = [ qtbase qtdeclarative qtserialport ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
propagatedBuildInputs = [ qtbase qtserialport ];
nativeBuildInputs = [ qtbase.dev pkg-config ];
buildInputs = [ openssl qtdeclarative ];
nativeQtBuildInputs = [ "qtdeclarative" ];
}

14 changes: 11 additions & 3 deletions pkgs/development/libraries/qt-6/modules/qtquick3d.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
{ qtModule
{ lib
, stdenv
, qtModule
, qtbase
, qtdeclarative
, qtshadertools
, openssl
, pkgsBuildHost
}:

qtModule {
pname = "qtquick3d";
propagatedBuildInputs = [ qtbase qtdeclarative ];
buildInputs = [ openssl ];
propagatedBuildInputs = [ qtbase ];
nativeBuildInputs = [ qtshadertools ];
nativeQtBuildInputs = [ "qtdeclarative" ];
buildInputs = [ openssl qtdeclarative ];
dontIgnorePath = true;
}

7 changes: 6 additions & 1 deletion pkgs/development/libraries/qt-6/modules/qtquicktimeline.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{ qtModule
{ lib
, stdenv
, qtModule
, qtbase
, qtdeclarative
, pkgsBuildHost
}:

qtModule {
pname = "qtquicktimeline";
propagatedBuildInputs = [ qtbase qtdeclarative ];
nativeQtBuildInputs = [ "qtdeclarative" ];
}

6 changes: 4 additions & 2 deletions pkgs/development/libraries/qt-6/modules/qtshadertools.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{ qtModule
{ lib
, stdenv
, qtModule
, qtbase
}:

qtModule {
pname = "qtshadertools";
propagatedBuildInputs = [ qtbase ];
buildInputs = [ qtbase ];
}
15 changes: 11 additions & 4 deletions pkgs/development/libraries/qt-6/modules/qtwayland.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
{ qtModule
{ lib
, stdenv
, qtModule
, qtbase
, qtquick3d
, qtdeclarative
, qtwayland
, wayland
, wayland-scanner
, pkg-config
, libdrm
, pkgsBuildHost
, pkgsBuildBuild
}:

qtModule {
pname = "qtwayland";
propagatedBuildInputs = [ qtbase qtdeclarative ];
buildInputs = [ wayland libdrm ];
nativeBuildInputs = [ pkg-config ];
propagatedBuildInputs = [ qtbase ];
buildInputs = [ (lib.getLib wayland) libdrm qtdeclarative ];
nativeBuildInputs = [ pkg-config wayland-scanner ];
}

1 change: 1 addition & 0 deletions pkgs/development/libraries/qt-6/modules/qtwebchannel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ qtModule {
pname = "qtwebchannel";
propagatedBuildInputs = [ qtbase qtdeclarative qtwebsockets ];
buildInputs = [ openssl ];
nativeQtBuildInputs = [ "qtdeclarative" ];
}
12 changes: 9 additions & 3 deletions pkgs/development/libraries/qt-6/modules/qtwebengine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
, libevent
, openssl
, alsa-lib
, pulseaudio
, pulseaudioSupport ? stdenv.hostPlatform.isLinux, pulseaudio
, libcap
, pciutils
, systemd
, pipewire
, pipewireSupport ? stdenv.hostPlatform.isLinux, pipewire
, gn
, ffmpeg_4
, lib
Expand Down Expand Up @@ -129,7 +129,9 @@ qtModule {
# See https://github.com/NixOS/nixpkgs/issues/226484 for more context.
../patches/qtwebengine-xkb-includes.patch

] ++ lib.optionals pulseaudioSupport [
../patches/qtwebengine-link-pulseaudio.patch
] ++ [

# Override locales install path so they go to QtWebEngine's $out
../patches/qtwebengine-locales-path.patch
Expand Down Expand Up @@ -191,7 +193,7 @@ qtModule {
# "-DQT_FEATURE_webengine_native_spellchecker=ON"
"-DQT_FEATURE_webengine_sanitizer=ON"
"-DQT_FEATURE_webengine_kerberos=ON"
] ++ lib.optionals stdenv.isLinux [
] ++ lib.optionals pipewireSupport [
"-DQT_FEATURE_webengine_webrtc_pipewire=ON"
] ++ lib.optionals enableProprietaryCodecs [
"-DQT_FEATURE_webengine_proprietary_codecs=ON"
Expand Down Expand Up @@ -241,7 +243,9 @@ qtModule {

# Audio formats
alsa-lib
] ++ lib.optionals pulseaudioSupport [
pulseaudio
] ++ [

# Text rendering
fontconfig
Expand All @@ -265,8 +269,10 @@ qtModule {
libXi
xorg.libXext

] ++ lib.optionals pipewireSupport [
# Pipewire
pipewire
] ++ [

libkrb5
mesa
Expand Down
7 changes: 6 additions & 1 deletion pkgs/development/libraries/qt-6/modules/qtwebsockets.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{ qtModule
{ lib
, stdenv
, qtModule
, qtbase
, qtdeclarative
, openssl
, pkgsBuildHost
}:

qtModule {
pname = "qtwebsockets";
propagatedBuildInputs = [ qtbase qtdeclarative ];
buildInputs = [ openssl ];
nativeQtBuildInputs = [ "qtdeclarative" ];
}

Loading