From 1fb9ffecd44731c2268d45f01c4731a40c622571 Mon Sep 17 00:00:00 2001 From: rewine Date: Sat, 28 Oct 2023 17:43:07 +0800 Subject: [PATCH] qt6Packages.wayqt: init at 0.2.0 --- pkgs/development/libraries/wayqt/default.nix | 61 +++++++++++++++++++ .../wayqt/fix-qtwayland-header-path.diff | 16 +++++ pkgs/top-level/qt6-packages.nix | 2 + 3 files changed, 79 insertions(+) create mode 100644 pkgs/development/libraries/wayqt/default.nix create mode 100644 pkgs/development/libraries/wayqt/fix-qtwayland-header-path.diff diff --git a/pkgs/development/libraries/wayqt/default.nix b/pkgs/development/libraries/wayqt/default.nix new file mode 100644 index 000000000000..47e11c9f10d0 --- /dev/null +++ b/pkgs/development/libraries/wayqt/default.nix @@ -0,0 +1,61 @@ +{ stdenv +, lib +, fetchFromGitLab +, substituteAll +, meson +, pkg-config +, qttools +, ninja +, qtbase +, qtwayland +, wayland +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "wayqt"; + version = "0.2.0"; + + src = fetchFromGitLab { + owner = "desktop-frameworks"; + repo = "wayqt"; + rev = "v${finalAttrs.version}"; + hash = "sha256-qlRRkqhKlcsd9lzlqfE0V0gjudELyENu4IH1NfO/+pI="; + }; + + patches = [ + # qmake get qtbase's path, but wayqt need qtwayland + (substituteAll { + src = ./fix-qtwayland-header-path.diff; + qtWaylandPath = "${qtwayland}/include"; + }) + ]; + + nativeBuildInputs = [ + meson + pkg-config + qttools + ninja + ]; + + buildInputs = [ + qtbase + qtwayland + wayland + ]; + + mesonFlags = [ + "-Duse_qt_version=qt6" + ]; + + dontWrapQtApps = true; + + outputs = [ "out" "dev" ]; + + meta = { + homepage = "https://gitlab.com/desktop-frameworks/wayqt"; + description = "Qt-based library to handle Wayland and Wlroots protocols to be used with any Qt project"; + maintainers = with lib.maintainers; [ rewine ]; + platforms = lib.platforms.linux; + license = lib.licenses.mit; + }; +}) diff --git a/pkgs/development/libraries/wayqt/fix-qtwayland-header-path.diff b/pkgs/development/libraries/wayqt/fix-qtwayland-header-path.diff new file mode 100644 index 000000000000..648cecd918e8 --- /dev/null +++ b/pkgs/development/libraries/wayqt/fix-qtwayland-header-path.diff @@ -0,0 +1,16 @@ +diff --git a/meson.build b/meson.build +index 5c09644..fc65d37 100644 +--- a/meson.build ++++ b/meson.build +@@ -39,9 +39,8 @@ elif get_option('use_qt_version') == 'qt6' + private_headers: [ 'Gui', 'WaylandClient', 'WaylandGlobalPrivate' ], + ) + +- qmake = find_program( [ 'qmake-qt6', 'qmake6' ], required: true ) +- ret = run_command( qmake, '-query', 'QT_INSTALL_HEADERS', check: true ) +- QtHeaderPath = ret.stdout().strip() ++ qmake = find_program( [ 'qmake-qt6', 'qmake6' ], required: false ) ++ QtHeaderPath = '@qtWaylandPath@' + + QtGlobal = '@0@/QtWaylandGlobal/@1@'.format( QtHeaderPath, QtDeps.version() ) + diff --git a/pkgs/top-level/qt6-packages.nix b/pkgs/top-level/qt6-packages.nix index 571a12ef50d6..3732386d8688 100644 --- a/pkgs/top-level/qt6-packages.nix +++ b/pkgs/top-level/qt6-packages.nix @@ -90,6 +90,8 @@ makeScopeWithSplicing' { waylib = callPackage ../development/libraries/waylib { }; + wayqt = callPackage ../development/libraries/wayqt { }; + } // lib.optionalAttrs pkgs.config.allowAliases { # Convert to a throw on 01-01-2023. # Warnings show up in various cli tool outputs, throws do not.