From 30e817d1b190eb446890f3464692f08fab8ef311 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Fri, 17 Apr 2026 08:03:43 +0300
Subject: trinity-base/trinity-prefix: new package, add 14

The package contains the files to define the necessary paths for
/usr/trinity prefix moved from trinity-base/tdelibs.

Bug: https://mirror.git.trinitydesktop.org/gitea/TDE/tde-packaging-gentoo/issues/474
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 .../trinity-prefix/trinity-prefix-14.ebuild        | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 trinity-base/trinity-prefix/trinity-prefix-14.ebuild

diff --git a/trinity-base/trinity-prefix/trinity-prefix-14.ebuild b/trinity-base/trinity-prefix/trinity-prefix-14.ebuild
new file mode 100644
index 00000000..6408da9f
--- /dev/null
+++ b/trinity-base/trinity-prefix/trinity-prefix-14.ebuild
@@ -0,0 +1,52 @@
+# Copyright 2026 The Trinity Desktop Project
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit trinity-functions-2 multilib
+
+DESCRIPTION="env.d files to define the necessary paths for /usr/trinity prefix"
+HOMEPAGE="https://trinitydesktop.org/"
+
+S="${WORKDIR}"
+
+LICENSE="|| ( GPL-2 GPL-3 )"
+SLOT="14"
+KEYWORDS="amd64 arm64 x86"
+
+set-trinityver
+
+src_install() {
+	keepdir "${TDEDIR}"
+
+	# TDE expects that the install path is listed first in TDEDIRS and the user
+	# directory (implicitly added) is the last entry. Doing otherwise breaks
+	# certain functionality. Do not break this (once again *sigh*), but read the code.
+	# TDE saves the installed path implicitly and so this is not needed, /usr
+	# is set in ${TDEDIR}/share/config/kdeglobals and so TDEDIRS is not needed.
+
+	# List all the multilib libdirs
+	local libdirs pkgconfigdirs
+	for libdir in $(get_all_libdirs); do
+		libdirs="${TDEDIR}/${libdir}:${libdirs}"
+	done
+	libdirs+="${TDEDIR}/$(get_libdir)/trinity"
+
+	newenvd - 60${P} <<-EOF # number goes down with version upgrade
+		PATH=${TDEDIR}/bin
+		ROOTPATH=${TDEDIR}/sbin:${TDEDIR}/bin
+		LDPATH=${libdirs#:}
+		MANPATH=${TDEDIR}/share/man
+		CONFIG_PROTECT="${TDEDIR}/share/config ${TDEDIR}/env ${TDEDIR}/shutdown /usr/share/config"
+		XDG_DATA_DIRS="${TDEDIR}/share"
+		XDG_CONFIG_DIRS="${TDEDIR}/etc/xdg"
+		PKG_CONFIG_PATH="${TDEDIR}/$(get_libdir)/pkgconfig"
+	EOF
+
+	# Make sure the target for the revdep-rebuild stuff exists. Fixes Gentoo BUG #184441.
+	dodir /etc/revdep-rebuild
+
+	cat <<-EOF >"${ED}/etc/revdep-rebuild/50-${P}"
+		SEARCH_DIRS="${TDEDIR}/bin ${TDEDIR}/lib*"
+	EOF
+}
-- 
cgit v1.2.3

