commit:     de321b8b2d7039960c0725e8efb87cec1dcccd1c
Author:     Filip Kobierski <fkobi <AT> pm <DOT> me>
AuthorDate: Mon Nov 25 19:44:27 2024 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Jan  3 16:55:35 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de321b8b

net-p2p/retroshare: Patch bundled libraries, improve ebuild

- port a patch from bundled rapidjson
- use upstream .desktop file
- avoid evaluating `uselibupnp` if USE=miniupnp (default)

Signed-off-by: Filip Kobierski <fkobi <AT> pm.me>
Closes: https://github.com/gentoo/gentoo/pull/39471
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 .../files/retroshare-0.6.7_fix-old-rapidjson.patch |  24 ++++
 net-p2p/retroshare/retroshare-0.6.7-r3.ebuild      | 136 +++++++++++++++++++++
 2 files changed, 160 insertions(+)

diff --git a/net-p2p/retroshare/files/retroshare-0.6.7_fix-old-rapidjson.patch 
b/net-p2p/retroshare/files/retroshare-0.6.7_fix-old-rapidjson.patch
new file mode 100644
index 000000000000..90c973c53493
--- /dev/null
+++ b/net-p2p/retroshare/files/retroshare-0.6.7_fix-old-rapidjson.patch
@@ -0,0 +1,24 @@
+This fixes a c23 issue in the rapidjson library:
+
+     error: assignment of read-only member 
'rapidjson::GenericStringRef::length'
+
+This was fixed upstream in 2016 and this patch combines two commit from PR
+https://github.com/Tencent/rapidjson/pull/719
+We are using OpenBuildService as the tarball source and it bundles libraries 
that old.
+
+For Gentoo details see https://bugs.gentoo.org/945721
+--- a/supportlibs/rapidjson/include/rapidjson/document.h
++++ b/supportlibs/rapidjson/include/rapidjson/document.h
+@@ -316,10 +316,10 @@
+ 
+     GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), 
length(rhs.length) {}
+ 
+-    GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; 
length = rhs.length; }
+-
+     //! implicit conversion to plain CharType pointer
+     operator const Ch *() const { return s; }
++    //! Copy assignment operator not permitted - immutable type
++    GenericStringRef& operator=(const GenericStringRef& rhs) /* = delete */;
+ 
+     const Ch* const s; //!< plain CharType pointer
+     const SizeType length; //!< length of the string (excluding the trailing 
NULL terminator)

diff --git a/net-p2p/retroshare/retroshare-0.6.7-r3.ebuild 
b/net-p2p/retroshare/retroshare-0.6.7-r3.ebuild
new file mode 100644
index 000000000000..a9cec116ed37
--- /dev/null
+++ b/net-p2p/retroshare/retroshare-0.6.7-r3.ebuild
@@ -0,0 +1,136 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic desktop qmake-utils xdg
+
+DESCRIPTION="Friend to Friend secure communication and sharing application"
+HOMEPAGE="https://retroshare.cc";
+SRC_URI="https://download.opensuse.org/repositories/network:/retroshare/Debian_Testing/retroshare-common_${PV}.orig.tar.gz
 -> ${P}.tar.gz"
+S="${WORKDIR}/RetroShare"
+# NOTE: GitHub releases/archive is impractical to build so we use the OBS repo
+# but they squash point releases and include 3rd party libraries in the tarball
+
+LICENSE="AGPL-3 Apache-2.0 CC-BY-SA-4.0 GPL-2 GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="cli +gui +jsonapi keyring libupnp +miniupnp plugins +service +sqlcipher"
+
+REQUIRED_USE="
+       || ( gui service )
+       ?? ( libupnp miniupnp )
+       plugins? ( gui )
+       service? ( || ( cli jsonapi ) )
+"
+RDEPEND="
+       app-arch/bzip2
+       dev-libs/openssl:0=
+       sys-libs/zlib
+       gui? (
+               dev-qt/qtcore:5
+               dev-qt/qtgui:5
+               dev-qt/qtmultimedia:5
+               dev-qt/qtnetwork:5
+               dev-qt/qtprintsupport:5
+               dev-qt/qtwidgets:5
+               dev-qt/qtx11extras:5
+               dev-qt/qtxml:5
+               x11-libs/libX11
+               x11-libs/libXScrnSaver
+       )
+       keyring? ( app-crypt/libsecret )
+       libupnp? ( net-libs/libupnp:= )
+       miniupnp? ( net-libs/miniupnpc:= )
+       plugins? (
+               media-libs/speex
+               media-libs/speexdsp
+               <media-video/ffmpeg-5
+       )
+       sqlcipher? ( dev-db/sqlcipher )
+       !sqlcipher? ( dev-db/sqlite:3 )
+"
+DEPEND="
+       ${RDEPEND}
+       gui? ( dev-qt/designer:5 )
+       jsonapi? ( >=dev-libs/rapidjson-1.1.0 )
+"
+BDEPEND="
+       dev-build/cmake
+       dev-qt/qtcore:5
+       virtual/pkgconfig
+       gui? ( x11-base/xorg-proto )
+       jsonapi? ( app-text/doxygen )
+"
+PATCHES=(
+       "${FILESDIR}"/${P}-fix-miniupnp-api-v18.patch
+       "${FILESDIR}"/${P}_fix-old-rapidjson.patch
+)
+
+src_configure() {
+       local qconfigs=(
+               $(usex cli     '' 'no_')rs_service_terminal_login
+               $(usex keyring '' 'no_')rs_autologin
+               $(usex gui     '' 'no_')retroshare_gui
+               $(usex jsonapi '' 'no_')rs_jsonapi
+               $(usex service '' 'no_')retroshare_service
+               $(usex sqlcipher '' 'no_')sqlcipher
+               $(usex plugins '' 'no_')retroshare_plugins
+       )
+
+       local qupnplibs="none"
+       if use miniupnp; then
+               qupnplibs="miniupnpc"
+       elif use libupnp; then
+               qupnplibs="upnp ixml"
+       fi
+
+       # bug 907898
+       use elibc_musl && append-flags -D_LARGEFILE64_SOURCE
+
+       # REVIEW: qmake is deprecated
+       # https://github.com/RetroShare/RetroShare/tree/master/jsonapi-generator
+       eqmake5 CONFIG+="${qconfigs[*]}" \
+               RS_MAJOR_VERSION=$(ver_cut 1) \
+               RS_MINOR_VERSION=$(ver_cut 2) \
+               RS_MINI_VERSION=$(ver_cut 3) \
+               RS_EXTRA_VERSION="-gentoo-${PR}" \
+               RS_UPNP_LIB="${qupnplibs}"
+}
+
+src_install() {
+       use service && dobin retroshare-service/src/retroshare-service
+
+       insinto /usr/share/retroshare
+       doins libbitdht/src/bitdht/bdboot.txt
+
+       dodoc README.asciidoc
+
+       if use gui; then
+               dobin retroshare-gui/src/retroshare
+               doins -r retroshare-gui/src/qss
+
+               doicon data/${PN}.xpm
+               domenu data/${PN}.desktop
+               for i in 24 48 64 128 ; do
+                       doicon -s ${i} "data/${i}x${i}/apps/retroshare.png"
+               done
+       fi
+       if use plugins; then
+               insinto /usr/lib/retroshare/extensions6
+               doins plugins/*/lib/*.so
+       fi
+}
+
+pkg_preinst() {
+       xdg_pkg_preinst
+
+       if ! use sqlcipher && ! has_version "net-p2p/retroshare[-sqlcipher]"; 
then
+               ewarn "You have disabled GXS database encryption, ${PN} will 
use SQLite"
+               ewarn "instead of SQLCipher for GXS databases."
+               ewarn "Builds using SQLite and builds using SQLCipher have 
incompatible"
+               ewarn "database format, so you will need to manually delete GXS"
+               ewarn "database (loosing all your GXS data and identities) when 
you"
+               ewarn "toggle sqlcipher USE flag."
+       fi
+}

Reply via email to