about summary refs log tree commit diff
path: root/pkgs/desktops/deepin
diff options
context:
space:
mode:
authorrewine <luhongxu@deepin.org>2024-05-09 16:02:21 +0800
committerrewine <luhongxu@deepin.org>2024-05-09 17:44:27 +0800
commit703ccfb34aa3bdfc61399e53c72a671dc48958a8 (patch)
tree09797ed65ced9007e5b4a86ed80fdd9677f146b1 /pkgs/desktops/deepin
parentbdc7fd3ca999ed697e19404f6ed4407d81f3f0e7 (diff)
deepin.dtk6widget: init at 6.0.15
Diffstat (limited to 'pkgs/desktops/deepin')
-rw-r--r--pkgs/desktops/deepin/default.nix1
-rw-r--r--pkgs/desktops/deepin/library/dtk6widget/default.nix83
-rw-r--r--pkgs/desktops/deepin/library/dtk6widget/fix-build-on-qt-6_7.patch20
-rw-r--r--pkgs/desktops/deepin/library/dtk6widget/fix-pkgconfig-path.patch14
-rw-r--r--pkgs/desktops/deepin/library/dtk6widget/fix-pri-path.patch17
5 files changed, 135 insertions, 0 deletions
diff --git a/pkgs/desktops/deepin/default.nix b/pkgs/desktops/deepin/default.nix
index 234cad9d4b6ad..b0249c0f46252 100644
--- a/pkgs/desktops/deepin/default.nix
+++ b/pkgs/desktops/deepin/default.nix
@@ -25,6 +25,7 @@ let
     util-dfm = callPackage ./library/util-dfm { };
     dtk6core = callPackage ./library/dtk6core { };
     dtk6gui = callPackage ./library/dtk6gui { };
+    dtk6widget = callPackage ./library/dtk6widget { };
 
     #### CORE
     deepin-kwin = callPackage ./core/deepin-kwin { };
diff --git a/pkgs/desktops/deepin/library/dtk6widget/default.nix b/pkgs/desktops/deepin/library/dtk6widget/default.nix
new file mode 100644
index 0000000000000..3c1870581988d
--- /dev/null
+++ b/pkgs/desktops/deepin/library/dtk6widget/default.nix
@@ -0,0 +1,83 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, cmake
+, pkg-config
+, doxygen
+, qt6Packages
+, dtk6gui
+, cups
+, libstartup_notification
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "dtk6widget";
+  version = "6.0.15";
+
+  src = fetchFromGitHub {
+    owner = "linuxdeepin";
+    repo = "dtk6widget";
+    rev = finalAttrs.version;
+    hash = "sha256-QCdRjkD4JTPecLeZK+Y5U/H9pBgKI4DHRuchz/GymWQ=";
+  };
+
+  patches = [
+    ./fix-pkgconfig-path.patch
+    ./fix-pri-path.patch
+    ./fix-build-on-qt-6_7.patch
+  ];
+
+  postPatch = ''
+    substituteInPlace src/widgets/dapplication.cpp \
+      --replace-fail "auto dataDirs = DStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);" \
+                "auto dataDirs = DStandardPaths::standardLocations(QStandardPaths::GenericDataLocation) << \"$out/share\";"
+  '';
+
+  nativeBuildInputs = [
+    cmake
+    doxygen
+    pkg-config
+    qt6Packages.qttools
+    qt6Packages.wrapQtAppsHook
+  ];
+
+  buildInputs = [
+    cups
+    libstartup_notification
+  ] ++ (with qt6Packages; [
+    qtbase
+    qtmultimedia
+    qtsvg
+  ]);
+
+  propagatedBuildInputs = [ dtk6gui ];
+
+  cmakeFlags = [
+    "-DDTK_VERSION=${finalAttrs.version}"
+    "-DBUILD_DOCS=ON"
+    "-DMKSPECS_INSTALL_DIR=${placeholder "dev"}/mkspecs/modules"
+    "-DQCH_INSTALL_DESTINATION=${placeholder "doc"}/share/doc"
+  ];
+
+  preConfigure = ''
+    # qt.qpa.plugin: Could not find the Qt platform plugin "minimal"
+    # A workaround is to set QT_PLUGIN_PATH explicitly
+    export QT_PLUGIN_PATH=${lib.getBin qt6Packages.qtbase}/${qt6Packages.qtbase.qtPluginPrefix}
+  '';
+
+  outputs = [ "out" "dev" "doc" ];
+
+  postFixup = ''
+    for binary in $out/lib/dtk6/DWidget/bin/*; do
+      wrapQtApp $binary
+    done
+  '';
+
+  meta = {
+    description = "Deepin graphical user interface library";
+    homepage = "https://github.com/linuxdeepin/dtk6widget";
+    license = lib.licenses.lgpl3Plus;
+    platforms = lib.platforms.linux;
+    maintainers = lib.teams.deepin.members;
+  };
+})
diff --git a/pkgs/desktops/deepin/library/dtk6widget/fix-build-on-qt-6_7.patch b/pkgs/desktops/deepin/library/dtk6widget/fix-build-on-qt-6_7.patch
new file mode 100644
index 0000000000000..16d2d2ec9b54b
--- /dev/null
+++ b/pkgs/desktops/deepin/library/dtk6widget/fix-build-on-qt-6_7.patch
@@ -0,0 +1,20 @@
+diff --git a/src/widgets/dkeysequenceedit.cpp b/src/widgets/dkeysequenceedit.cpp
+index a99e17ae..0e1c57f6 100644
+--- a/src/widgets/dkeysequenceedit.cpp
++++ b/src/widgets/dkeysequenceedit.cpp
+@@ -276,13 +276,13 @@ void DKeySequenceEdit::keyPressEvent(QKeyEvent *e)
+     }
+ 
+     if (e->modifiers() & Qt::ShiftModifier) {
+-        QList<int> possibleKeys = QKeyMapper::possibleKeys(e);
++        auto possibleKeys = QKeyMapper::possibleKeys(e);
+         int pkTotal = possibleKeys.count();
+         if (!pkTotal)
+             return;
+         bool found = false;
+         for (int i = 0; i < possibleKeys.size(); ++i) {
+-            if (possibleKeys.at(i) - nextKey == int(e->modifiers())
++            if (static_cast<int>(possibleKeys.at(i)) - nextKey == static_cast<int>(e->modifiers())
+                 || (possibleKeys.at(i) == nextKey && e->modifiers() == Qt::ShiftModifier)) {
+                 nextKey = possibleKeys.at(i);
+                 found = true;
diff --git a/pkgs/desktops/deepin/library/dtk6widget/fix-pkgconfig-path.patch b/pkgs/desktops/deepin/library/dtk6widget/fix-pkgconfig-path.patch
new file mode 100644
index 0000000000000..df4452259580d
--- /dev/null
+++ b/pkgs/desktops/deepin/library/dtk6widget/fix-pkgconfig-path.patch
@@ -0,0 +1,14 @@
+diff --git a/misc/DtkWidget.pc.in b/misc/DtkWidget.pc.in
+index 3c610669..b6ed04ca 100644
+--- a/misc/DtkWidget.pc.in
++++ b/misc/DtkWidget.pc.in
+@@ -1,7 +1,7 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ exec_prefix=${prefix}
+-libdir=${prefix}/@LIBRARY_INSTALL_DIR@
+-includedir=${prefix}/@INCLUDE_INSTALL_DIR@
++libdir=@LIBRARY_INSTALL_DIR@
++includedir=@INCLUDE_INSTALL_DIR@
+ 
+ Name: dtk@DTK_VERSION_MAJOR@widget
+ Description: Deepin Tool Kit dtkwidget header files
diff --git a/pkgs/desktops/deepin/library/dtk6widget/fix-pri-path.patch b/pkgs/desktops/deepin/library/dtk6widget/fix-pri-path.patch
new file mode 100644
index 0000000000000..cf2faac948550
--- /dev/null
+++ b/pkgs/desktops/deepin/library/dtk6widget/fix-pri-path.patch
@@ -0,0 +1,17 @@
+diff --git a/misc/qt_lib_DtkWidget.pri.in b/misc/qt_lib_DtkWidget.pri.in
+index 623878d3..561f5186 100644
+--- a/misc/qt_lib_DtkWidget.pri.in
++++ b/misc/qt_lib_DtkWidget.pri.in
+@@ -4,9 +4,9 @@ QT.dtkwidget.MINOR_VERSION = @PROJECT_VERSION_MINOR@
+ QT.dtkwidget.PATCH_VERSION = @PROJECT_VERSION_PATCH@
+ QT.dtkwidget.name = dtkwidget
+ QT.dtkwidget.module = dtk@DTK_VERSION_MAJOR@widget
+-QT.dtkwidget.tools = @CMAKE_INSTALL_PREFIX@/@TOOL_INSTALL_DIR@
+-QT.dtkwidget.libs = @CMAKE_INSTALL_PREFIX@/@LIBRARY_INSTALL_DIR@
+-QT.dtkwidget.includes = @CMAKE_INSTALL_PREFIX@/@INCLUDE_INSTALL_DIR@
++QT.dtkwidget.tools = @TOOL_INSTALL_DIR@
++QT.dtkwidget.libs = @LIBRARY_INSTALL_DIR@
++QT.dtkwidget.includes = @INCLUDE_INSTALL_DIR@
+ QT.dtkwidget.frameworks =
+ QT.dtkwidget.depends = core gui dtkcore network concurrent dtkgui printsupport printsupport_private widgets widgets_private gui_private x11extras dbus
+ QT.dtkwidget.module_config = v2 internal_module ltcg