commit:     fc1daa830ac42cf3a85709bb4d0c046792d3a0f8
Author:     Filip Kobierski <fkobi <AT> pm <DOT> me>
AuthorDate: Wed Jan  1 21:55:12 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan  6 04:15:49 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc1daa83

mail-mta/proton-mail-bridge: improve ebuild

changes as they go in the ebuild
- add comment regarding dependencies
- use upstream desktop file
  - required patching but the current installed file is named
    `proton-mail-bridge-gui-proton-mail-bridge.desktop`
- remove src_test() -- works without it
- remove old postinst warning about telemetry

Signed-off-by: Filip Kobierski <fkobi <AT> pm.me>
Closes: https://github.com/gentoo/gentoo/pull/39939
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../proton-mail-bridge-3.15.1-r1.ebuild            | 113 +++++++++++++++++++++
 1 file changed, 113 insertions(+)

diff --git a/mail-mta/proton-mail-bridge/proton-mail-bridge-3.15.1-r1.ebuild 
b/mail-mta/proton-mail-bridge/proton-mail-bridge-3.15.1-r1.ebuild
new file mode 100644
index 000000000000..f7c426050794
--- /dev/null
+++ b/mail-mta/proton-mail-bridge/proton-mail-bridge-3.15.1-r1.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake desktop go-env go-module systemd xdg-utils
+
+MY_PN="${PN/-mail/}"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Serves Proton Mail to IMAP/SMTP clients"
+HOMEPAGE="https://proton.me/mail/bridge 
https://github.com/ProtonMail/proton-bridge/";
+SRC_URI="https://github.com/ProtonMail/${MY_PN}/archive/refs/tags/v${PV}.tar.gz
 -> ${P}.tar.gz"
+SRC_URI+=" 
https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-deps.tar.xz";
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="Apache-2.0 BSD BSD-2 GPL-3+ ISC LGPL-3+ MIT MPL-2.0 Unlicense"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="gui"
+
+# Quite a few tests require Internet access
+PROPERTIES="test_network"
+RESTRICT="test"
+
+RDEPEND="
+       app-crypt/libsecret
+       gui? (
+               >=dev-libs/protobuf-21.12:=
+               >=dev-libs/sentry-native-0.6.5-r1
+               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.15.1-gui_gentoo.patch
+)
+
+src_unpack() {
+       default
+
+       if [[ -d "${WORKDIR}"/vendor ]]; then # if we ship the dependencies
+               mv "${WORKDIR}"/vendor "${S}"/vendor || die # move them into 
the tree
+       fi
+
+       go-env_set_compile_environment
+}
+
+src_prepare() {
+       xdg_environment_reset
+       default
+       if use gui; then
+               # prepare desktop file
+               local desktopFilePath="${S}"/dist/${MY_PN}.desktop
+               sed -i 's/protonmail/proton-mail/g' ${desktopFilePath} || die
+               sed -i 
's/Exec=proton-mail-bridge/Exec=proton-mail-bridge-gui/g' ${desktopFilePath} || 
die
+
+               # build GUI
+               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
+               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"
+                       -DCMAKE_DISABLE_PRECOMPILE_HEADERS=OFF
+               )
+               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
+               BUILD_DIR="${WORKDIR}"/gui_build \
+                       
CMAKE_USE_DIR="${S}"/internal/frontend/bridge-gui/bridge-gui \
+                       cmake_src_compile
+       fi
+}
+
+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
+               newicon {"${S}"/dist/bridge,${PN}}.svg
+               newmenu {dist/${MY_PN},${PN}}.desktop
+       fi
+
+       systemd_newuserunit "${FILESDIR}"/${PN}.service-r1 ${PN}.service
+
+       einstalldocs
+}

Reply via email to