public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Marek Szuba" <marecki@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-mta/proton-mail-bridge/, mail-mta/proton-mail-bridge/files/
Date: Tue, 22 Aug 2023 18:12:53 +0000 (UTC)	[thread overview]
Message-ID: <1692727957.81cd2d1eea86b73703fda5bd4b19dde5e7d250aa.marecki@gentoo> (raw)

commit:     81cd2d1eea86b73703fda5bd4b19dde5e7d250aa
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 22 18:10:00 2023 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Tue Aug 22 18:12:37 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=81cd2d1e

mail-mta/proton-mail-bridge: implement GUI building

Fun fact, while the bridge proper is still written in Go the current
version of the bridge GUI has been rewritten to C++. I am sure there is
a lesson in here somewhere.

Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 .../proton-mail-bridge-3.3.2-gui_gentoo.patch      | 68 ++++++++++++++++++++++
 ...roton-mail-bridge-3.3.2-telemetry_default.patch | 14 -----
 .../proton-mail-bridge-3.3.2.ebuild                | 66 ++++++++++++++++-----
 3 files changed, 119 insertions(+), 29 deletions(-)

diff --git a/mail-mta/proton-mail-bridge/files/proton-mail-bridge-3.3.2-gui_gentoo.patch b/mail-mta/proton-mail-bridge/files/proton-mail-bridge-3.3.2-gui_gentoo.patch
new file mode 100644
index 000000000000..6bf34627039f
--- /dev/null
+++ b/mail-mta/proton-mail-bridge/files/proton-mail-bridge-3.3.2-gui_gentoo.patch
@@ -0,0 +1,68 @@
+--- a/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt
++++ b/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt
+@@ -165,12 +165,9 @@
+         WIN32_EXECUTABLE TRUE
+         MACOSX_BUNDLE TRUE)
+ 
+-install(TARGETS bridge-gui
+-        RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
+-        BUNDLE DESTINATION  "${CMAKE_INSTALL_PREFIX}"
+-        LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}"
+-        )
++install(TARGETS bridge-gui)
+ 
++if(0)
+ qt_generate_deploy_app_script(
+         TARGET bridge-gui
+         FILENAME_VARIABLE deploy_script
+@@ -185,3 +182,4 @@
+ endif()
+ 
+ include(Deploy${DEPLOY_OS}.cmake)
++endif()
+--- a/internal/frontend/bridge-gui/bridge-gui/main.cpp
++++ b/internal/frontend/bridge-gui/bridge-gui/main.cpp
+@@ -53,7 +53,7 @@
+ 
+ QString const bridgeLock = "bridge-v3.lock"; ///< The file name used for the bridge-gui lock file.
+ QString const bridgeGUILock = "bridge-v3-gui.lock"; ///< The file name used for the bridge-gui lock file.
+-QString const exeName = "bridge" + exeSuffix; ///< The bridge executable file name.*
++QString const exeName = "proton-mail-bridge" + exeSuffix; ///< The bridge executable file name.*
+ qint64 const grpcServiceConfigWaitDelayMs = 180000; ///< The wait delay for the gRPC config file in milliseconds.
+ QString const waitFlag = "--wait"; ///< The wait command-line flag.
+ 
+--- a/internal/frontend/bridge-gui/bridgepp/CMakeLists.txt
++++ b/internal/frontend/bridge-gui/bridgepp/CMakeLists.txt
+@@ -161,6 +161,9 @@
+ 
+ target_precompile_headers(bridgepp PRIVATE Pch.h)
+ 
++install(TARGETS bridgepp)
++
++if(0)
+ #*****************************************************************************************************************************************************
+ # GoogleTest
+ #*****************************************************************************************************************************************************
+@@ -198,3 +201,4 @@
+ 
+ include(GoogleTest)
+ gtest_discover_tests(bridgepp-test)
++endif()
+--- a/internal/frontend/bridge-gui/BridgeSetup.cmake
++++ b/internal/frontend/bridge-gui/BridgeSetup.cmake
+@@ -45,6 +45,7 @@
+ endif()
+ 
+ 
++if(0)
+ #****************************************************************************************************************************************************
+ # vcpkg, toolchain, and architecture
+ #****************************************************************************************************************************************************
+@@ -87,4 +88,5 @@
+     set(VCPKG_TARGET_TRIPLET x64-windows)
+ endif()
+ 
+-set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "toolchain")
+\ No newline at end of file
++set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "toolchain")
++endif()

diff --git a/mail-mta/proton-mail-bridge/files/proton-mail-bridge-3.3.2-telemetry_default.patch b/mail-mta/proton-mail-bridge/files/proton-mail-bridge-3.3.2-telemetry_default.patch
deleted file mode 100644
index 3c8df6c2ef9d..000000000000
--- a/mail-mta/proton-mail-bridge/files/proton-mail-bridge-3.3.2-telemetry_default.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Such things really should be opt-in rather than opt-out, and doubly so given
-Gentoo does not package the bridge GUI yet.
-
---- a/internal/vault/types_settings.go
-+++ b/internal/vault/types_settings.go
-@@ -96,7 +96,7 @@
- 		ShowAllMail:       true,
- 		Autostart:         true,
- 		AutoUpdate:        true,
--		TelemetryDisabled: false,
-+		TelemetryDisabled: true,
- 
- 		LastVersion: "0.0.0",
- 		FirstStart:  true,

diff --git a/mail-mta/proton-mail-bridge/proton-mail-bridge-3.3.2.ebuild b/mail-mta/proton-mail-bridge/proton-mail-bridge-3.3.2.ebuild
index 7d85059d6295..013049b4d5c9 100644
--- a/mail-mta/proton-mail-bridge/proton-mail-bridge-3.3.2.ebuild
+++ b/mail-mta/proton-mail-bridge/proton-mail-bridge-3.3.2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit go-module systemd xdg-utils
+inherit cmake go-module systemd xdg-utils
 
 MY_PN="${PN/-mail/}"
 MY_P="${MY_PN}-${PV}"
@@ -22,11 +22,21 @@ IUSE="gui"
 PROPERTIES="test_network"
 RESTRICT="test"
 
-RDEPEND="app-crypt/libsecret"
+RDEPEND="app-crypt/libsecret
+	gui? (
+		>=dev-libs/protobuf-21.12:=
+		dev-libs/sentry-native
+		dev-qt/qtbase:6=[gui,icu,widgets]
+		dev-qt/qtdeclarative:6=[widgets]
+		dev-qt/qtsvg:6=
+		media-libs/mesa
+		net-libs/grpc:=
+	)
+"
 DEPEND="${RDEPEND}"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-3.3.2-telemetry_default.patch
+	"${FILESDIR}"/${PN}-3.3.2-gui_gentoo.patch
 )
 
 S="${WORKDIR}"/${MY_P}
@@ -34,14 +44,39 @@ S="${WORKDIR}"/${MY_P}
 src_prepare() {
 	xdg_environment_reset
 	default
+	if use gui; then
+		local PATCHES=()
+		BUILD_DIR="${WORKDIR}"/gui_build \
+			CMAKE_USE_DIR="${S}"/internal/frontend/bridge-gui/bridge-gui \
+			cmake_src_prepare
+	fi
+}
+
+src_configure() {
+	if use gui; then
+		# TODO:
+		#  - auto-sync version number between the two executables
+		#  - can we leave BRIDGE_TAG unset? Seems it gets displayed in some info box
+		local mycmakeargs=(
+			-DBRIDGE_APP_FULL_NAME="Proton Mail Bridge"
+			-DBRIDGE_APP_VERSION="${PV}+git"
+			-DBRIDGE_REPO_ROOT="${S}"
+			-DBRIDGE_TAG="NOTAG"
+			-DBRIDGE_VENDOR="Gentoo Linux"
+		)
+		BUILD_DIR="${WORKDIR}"/gui_build \
+			CMAKE_USE_DIR="${S}"/internal/frontend/bridge-gui/bridge-gui \
+			cmake_src_configure
+	fi
 }
 
 src_compile() {
+	emake build-nogui
+
 	if use gui; then
-		eerror "Since version 3.0.0, GUI support in ${PN} requires Qt6 and is therefore currently not available"
-		die "USE=gui requires Qt6"
-	else
-		emake build-nogui
+		BUILD_DIR="${WORKDIR}"/gui_build \
+			CMAKE_USE_DIR="${S}"/internal/frontend/bridge-gui/bridge-gui \
+			cmake_src_compile
 	fi
 }
 
@@ -53,31 +88,32 @@ src_install() {
 	exeinto /usr/bin
 	newexe bridge ${PN}
 
+	if use gui; then
+		BUILD_DIR="${WORKDIR}"/gui_build \
+			CMAKE_USE_DIR="${S}"/internal/frontend/bridge-gui/bridge-gui \
+			cmake_src_install
+		mv "${ED}"/usr/bin/bridge-gui "${ED}"/usr/bin/${PN}-gui || die
+	fi
+
 	systemd_newuserunit "${FILESDIR}"/${PN}.service-r1 ${PN}.service
 
 	einstalldocs
 }
 
 pkg_postinst() {
-	use gui && xdg_icon_cache_update
-
 	if [[ -n "${REPLACING_VERSIONS}" ]]; then
 		local oldver
 		for oldver in ${REPLACING_VERSIONS}; do
 			if ver_test "${oldver}" -lt 3.2.0; then
-				ewarn "Please note that since version 3.2.0, ${PN} can share usage statistics with upstream."
+				ewarn "Please note that since version 3.2.0, ${PN} by default shares usage statistics with upstream."
 				ewarn "For details, please see"
 				ewarn
 				ewarn "	https://proton.me/support/share-usage-statistics"
 				ewarn
-				ewarn "Gentoo ebuilds change the default value of the 'send telemetry' setting to disabled."
+				ewarn "This behaviour can be disabled through ${PN}-gui, under Advanced Settings."
 				ewarn
 				break
 			fi
 		done
 	fi
 }
-
-pkg_postrm() {
-	use gui && xdg_icon_cache_update
-}


             reply	other threads:[~2023-08-22 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 18:12 Marek Szuba [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-05-23 19:39 [gentoo-commits] repo/gentoo:master commit in: mail-mta/proton-mail-bridge/, mail-mta/proton-mail-bridge/files/ Marek Szuba
2023-04-10 16:32 Marek Szuba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1692727957.81cd2d1eea86b73703fda5bd4b19dde5e7d250aa.marecki@gentoo \
    --to=marecki@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox