From b7b125dbfefc32f07767b4390506bfd65a40e1a8 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 10 Aug 2022 00:17:59 -0400
Subject: [PATCH] New package: syncthingtray-1.2.2

closes #38550
---
 common/shlibs                  |  3 ++
 srcpkgs/syncthingtray-devel    |  1 +
 srcpkgs/syncthingtray-dolphin  |  1 +
 srcpkgs/syncthingtray-plasma   |  1 +
 srcpkgs/syncthingtray/template | 66 ++++++++++++++++++++++++++++++++++
 5 files changed, 72 insertions(+)
 create mode 120000 srcpkgs/syncthingtray-devel
 create mode 120000 srcpkgs/syncthingtray-dolphin
 create mode 120000 srcpkgs/syncthingtray-plasma
 create mode 100644 srcpkgs/syncthingtray/template

diff --git a/common/shlibs b/common/shlibs
index ae42824eac8..61924610cc5 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4187,3 +4187,6 @@ libopensmtpd.so.0 libopensmtpd-0.7_1
 libiio.so.0 libiio-0.23_1
 libqtforkawesome.so.0.0.4 qtforkawesome-0.0.4_1
 libqtquickforkawesome.so.0.0.4 qtforkawesome-0.0.4_1
+libsyncthingwidgets.so.1.2.2 syncthingtray-1.2.2_1
+libsyncthingmodel.so.1.2.2 syncthingtray-1.2.2_1
+libsyncthingconnector.so.1.2.2 syncthingtray-1.2.2_1
diff --git a/srcpkgs/syncthingtray-devel b/srcpkgs/syncthingtray-devel
new file mode 120000
index 00000000000..146441954aa
--- /dev/null
+++ b/srcpkgs/syncthingtray-devel
@@ -0,0 +1 @@
+syncthingtray
\ No newline at end of file
diff --git a/srcpkgs/syncthingtray-dolphin b/srcpkgs/syncthingtray-dolphin
new file mode 120000
index 00000000000..146441954aa
--- /dev/null
+++ b/srcpkgs/syncthingtray-dolphin
@@ -0,0 +1 @@
+syncthingtray
\ No newline at end of file
diff --git a/srcpkgs/syncthingtray-plasma b/srcpkgs/syncthingtray-plasma
new file mode 120000
index 00000000000..146441954aa
--- /dev/null
+++ b/srcpkgs/syncthingtray-plasma
@@ -0,0 +1 @@
+syncthingtray
\ No newline at end of file
diff --git a/srcpkgs/syncthingtray/template b/srcpkgs/syncthingtray/template
new file mode 100644
index 00000000000..4f338f2cc20
--- /dev/null
+++ b/srcpkgs/syncthingtray/template
@@ -0,0 +1,66 @@
+# Template file for 'syncthingtray'
+pkgname=syncthingtray
+version=1.2.2
+revision=1
+build_style=cmake
+configure_args="-DJS_PROVIDER=qml -DBUILTIN_TRANSLATIONS=ON -DSYSTEMD_SUPPORT=OFF
+ -DBUILD_SHARED_LIBS=ON -DWEBVIEW_PROVIDER=$(vopt_if webengine webengine none)"
+hostmakedepends="pkg-config qt5-host-tools qt5-qmake extra-cmake-modules plasma-framework"
+makedepends="cpp-utilities-devel qtutilities-devel qtforkawesome-devel
+ qt5-devel qt5-core qt5-network qt5-gui qt5-widgets qt5-svg qt5-declarative
+ qt5-quickcontrols qt5-location-devel boost-devel kio-devel plasma-framework-devel
+ $(vopt_if webengine 'qt5-webengine-devel qt5-webchannel-devel')"
+depends="syncthing"
+checkdepends="syncthing iproute2"
+short_desc="Tray application for Syncthing"
+maintainer="classabbyamp <void@placeviolette.net>"
+license="GPL-2.0-or-later"
+homepage="https://github.com/Martchus/syncthingtray"
+distfiles="https://github.com/Martchus/syncthingtray/archive/refs/tags/v${version}.tar.gz"
+checksum=0f556e30091ffc06e7e489c5e09e5460401c28fd1e8318b68cb6066ead7fe7a1
+
+# requires weird port-binding shenanigans that may not work on ipv6
+# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=syncthingtray#n50
+make_check=no
+
+build_options="webengine"
+desc_option_webengine="Build with Qt5 WebEngine support"
+
+# if not enabled, it will fall back to web browser
+if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
+	if [ "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
+		build_options_default+=" webengine"
+	fi
+fi
+
+syncthingtray-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+		for d in connector fileitemaction model plasmoid widgets; do
+			vmove "usr/share/syncthing${d}/cmake"
+		done
+	}
+}
+
+syncthingtray-plasma_package() {
+	depends="${sourcepkg}>=${version}_${revision} plasma-workspace"
+	short_desc+=" - KDE plasmoid"
+	pkg_install() {
+		vmove usr/lib/qt5/plugins/plasma
+		vmove usr/share/plasma
+		vmove usr/share/kservices5/plasma-applet-martchus.syncthingplasmoid.desktop
+	}
+}
+
+syncthingtray-dolphin_package() {
+	depends="${sourcepkg}>=${version}_${revision} kio"
+	short_desc+=" - KDE dolphin integration"
+	pkg_install() {
+		vmove usr/share/kservices5/syncthingfileitemaction.desktop
+		vmove "usr/lib/qt5/plugins/*.so"
+	}
+}