summaryrefslogtreecommitdiff
path: root/x11-misc/xdg-utils
diff options
context:
space:
mode:
authorroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
committerroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
commitb590c8d7572b727d565cc0b8ff660d43569845de (patch)
tree06f7a4102ea4e845df8b66660f252920d52952f9 /x11-misc/xdg-utils
parent24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff)
downloadbaldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip
Adding metadata
Diffstat (limited to 'x11-misc/xdg-utils')
-rw-r--r--x11-misc/xdg-utils/Manifest1
-rw-r--r--x11-misc/xdg-utils/files/xdg-utils-1.2.1-fix-CVE-2020-27748.patch200
-rw-r--r--x11-misc/xdg-utils/files/xdg-utils-1.2.1-qtpaths.patch21
-rw-r--r--x11-misc/xdg-utils/files/xdg-utils-1.2.1-xdg-mime-default.patch143
-rw-r--r--x11-misc/xdg-utils/metadata.xml11
-rw-r--r--x11-misc/xdg-utils/xdg-utils-1.2.1-r10.ebuild103
-rw-r--r--x11-misc/xdg-utils/xdg-utils-1.2.1-r9.ebuild102
7 files changed, 581 insertions, 0 deletions
diff --git a/x11-misc/xdg-utils/Manifest b/x11-misc/xdg-utils/Manifest
new file mode 100644
index 000000000000..671b77fc7043
--- /dev/null
+++ b/x11-misc/xdg-utils/Manifest
@@ -0,0 +1 @@
+DIST xdg-utils-v1.2.1.tar.bz2 293386 BLAKE2B 9d6ce4be8c27ad5b8d0ae55ad0d8b4457b59cb1bd260884ca5bfd2cb8ed7ed68a2f5a8db6d660ceabab59cbb9880fd4f1a26cb71a8f759ec40c2f9f95bbc8a05 SHA512 d5436449fec2f4db952239ee910bfda203955c8df8cb92379f182dc36f9c82b6ceb092ccbebfd02ed00eb7ef5f6895ef745baca67906ae7490e425db27b1dbfc
diff --git a/x11-misc/xdg-utils/files/xdg-utils-1.2.1-fix-CVE-2020-27748.patch b/x11-misc/xdg-utils/files/xdg-utils-1.2.1-fix-CVE-2020-27748.patch
new file mode 100644
index 000000000000..faff8179b82e
--- /dev/null
+++ b/x11-misc/xdg-utils/files/xdg-utils-1.2.1-fix-CVE-2020-27748.patch
@@ -0,0 +1,200 @@
+https://bugs.gentoo.org/756838
+https://gitlab.freedesktop.org/xdg/xdg-utils/-/commit/5f3f563d69ae72bbefe9031c68d8167935abcba5
+
+From 5f3f563d69ae72bbefe9031c68d8167935abcba5 Mon Sep 17 00:00:00 2001
+From: Slatian <baschdel@disroot.org>
+Date: Sat, 14 Oct 2023 13:14:44 +0200
+Subject: [PATCH] Fix CVE-2020-27748 by paasing attachments seperately
+
+---
+ scripts/xdg-email.in | 42 ++++++++++++++++++++++++++++--------------
+ 1 file changed, 28 insertions(+), 14 deletions(-)
+
+diff --git a/scripts/xdg-email.in b/scripts/xdg-email.in
+index 4e3a5e8..6d83b0a 100644
+--- a/scripts/xdg-email.in
++++ b/scripts/xdg-email.in
+@@ -30,11 +30,14 @@ _USAGE
+
+ #@xdg-utils-common@
+
++# (thunderbird_binary, mailto_uri, attached_files)
+ run_thunderbird()
+ {
+ local THUNDERBIRD MAILTO NEWMAILTO TO CC BCC SUBJECT BODY ATTACH
+ THUNDERBIRD="$1"
+ MAILTO="$(echo "$2" | sed 's/^mailto://')"
++ ATTACH="$3"
++
+ echo "$MAILTO" | grep -qs "^?"
+ if [ "$?" = "0" ] ; then
+ MAILTO="$(echo "$MAILTO" | sed 's/^?//')"
+@@ -48,7 +51,6 @@ run_thunderbird()
+ BCC="$(/bin/echo -e "$(echo "$MAILTO" | grep '^bcc=' | sed 's/^bcc=//;s/%\(..\)/\\x\1/g' | awk '{ printf "%s,",$0 }')")"
+ SUBJECT="$(echo "$MAILTO" | grep '^subject=' | tail -n 1)"
+ BODY="$(echo "$MAILTO" | grep '^body=' | tail -n 1)"
+- ATTACH="$(/bin/echo -e "$(echo "$MAILTO" | grep '^attach=' | sed 's/^attach=//;s/%\(..\)/\\x\1/g' | awk '{ printf "%s,",$0 }' | sed 's/,$//')")"
+
+ if [ -z "$TO" ] ; then
+ NEWMAILTO=
+@@ -82,6 +84,7 @@ run_thunderbird()
+ fi
+ }
+
++# (mailto, attach)
+ open_kde()
+ {
+ local kreadconfig profile client
+@@ -104,7 +107,7 @@ open_kde()
+ fi
+
+ if echo "$client" | grep -Eq 'thunderbird|icedove'; then
+- run_thunderbird "$client" "$1"
++ run_thunderbird "$client" "$1" "$2"
+ fi
+ fi
+ fi
+@@ -137,6 +140,7 @@ open_kde()
+ fi
+ }
+
++# (mailto, attach)
+ open_gnome3()
+ {
+ local client
+@@ -144,7 +148,7 @@ open_gnome3()
+ desktop="$(xdg-mime query default "x-scheme-handler/mailto")"
+ client="$(desktop_file_to_binary "$desktop")"
+ case "$client" in *thunderbird*|*icedove*)
+- run_thunderbird "$client" "$1"
++ run_thunderbird "$client" "$1" "$2"
+ esac
+
+ if gio help open 2>/dev/null 1>&2; then
+@@ -165,12 +169,13 @@ open_gnome3()
+ fi
+ }
+
++# (mailto, attach)
+ open_gnome()
+ {
+ local client
+ client="$(gconftool-2 --get /desktop/gnome/url-handlers/mailto/command | cut -d ' ' -f 1)"
+ case "$client" in *thunderbird*|*icedove*)
+- run_thunderbird "$client" "$1"
++ run_thunderbird "$client" "$1" "$2"
+ esac
+
+ if gio help open 2>/dev/null 1>&2; then
+@@ -191,7 +196,7 @@ open_gnome()
+ fi
+ }
+
+-
++# (mailto, attach)
+ open_lxqt()
+ {
+ local client
+@@ -200,7 +205,7 @@ open_lxqt()
+ client="$(desktop_file_to_binary "$desktop")"
+ echo "$client" | grep -E 'thunderbird|icedove' > /dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+- run_thunderbird "$client" "$1"
++ run_thunderbird "$client" "$1" "$2"
+ fi
+
+ if qtxdg-mat open --help 2>/dev/null 1>&2; then
+@@ -261,6 +266,7 @@ open_flatpak()
+ fi
+ }
+
++# (mailto, attach)
+ open_generic()
+ {
+ local client
+@@ -268,7 +274,7 @@ open_generic()
+ desktop="$(xdg-mime query default "x-scheme-handler/mailto")"
+ client="$(desktop_file_to_binary "$desktop")"
+ case "$client" in *thunderbird*|*icedove*)
+- run_thunderbird "$client" "$1"
++ run_thunderbird "$client" "$1" "$2"
+ esac
+
+ xdg-open "$1"
+@@ -317,6 +323,8 @@ LC_ALL="$ORIG_LC_ALL"
+
+ options=
+ mailto=
++# attach is a comma seperated list of url encoded filenames
++attach=
+ utf8="iconv -t utf8"
+ while [ $# -gt 0 ] ; do
+ parm="$1"
+@@ -383,7 +391,7 @@ while [ $# -gt 0 ] ; do
+ fi
+
+ url_encode "$file"
+- options="${options}attach=${result}&"
++ attach="${attach}${attach:+,}${result}"
+ shift
+ ;;
+
+@@ -436,7 +444,7 @@ mailto="$(echo "${mailto}"| sed 's/[?&]$//')"
+ [ x"${mailto}" != x"" ] || exit_failure_syntax
+
+ if command -v @NAME@-hook.sh > /dev/null; then
+- @NAME@-hook.sh "${mailto}"
++ @NAME@-hook.sh "${mailto}" "$attach"
+ if [ $? -eq 0 ]; then
+ exit_success
+ else
+@@ -456,35 +464,41 @@ fi
+
+ case "$DE" in
+ envvar)
++ [ -z "$attach" ] || \
++ exit_failure_operation_impossible "Unable to use --attach with the MAILER envoirnment variable"
+ open_envvar "${mailto}"
+ ;;
+
+ kde)
+- open_kde "${mailto}"
++ open_kde "${mailto}" "$attach"
+ ;;
+
+ gnome)
+- open_gnome "${mailto}"
++ open_gnome "${mailto}" "$attach"
+ ;;
+
+ gnome3|cinnamon|lxde|mate|deepin)
+- open_gnome3 "${mailto}"
++ open_gnome3 "${mailto}" "$attach"
+ ;;
+
+ lxqt)
+- open_lxqt "${mailto}"
++ open_lxqt "${mailto}" "$attach"
+ ;;
+
+ xfce)
++ [ -z "$attach" ] || \
++ exit_failure_operation_impossible "Unable to use --attach with the Xfce opener"
+ open_xfce "${mailto}"
+ ;;
+
+ flatpak)
++ [ -z "$attach" ] || \
++ exit_failure_operation_impossible "Unable to use --attach from inside a flatpak"
+ open_flatpak "${mailto}"
+ ;;
+
+ generic|enlightenment)
+- open_generic "${mailto}"
++ open_generic "${mailto}" "$attach"
+ ;;
+
+ *)
+--
+2.52.0
+
diff --git a/x11-misc/xdg-utils/files/xdg-utils-1.2.1-qtpaths.patch b/x11-misc/xdg-utils/files/xdg-utils-1.2.1-qtpaths.patch
new file mode 100644
index 000000000000..67a84e9c4a9b
--- /dev/null
+++ b/x11-misc/xdg-utils/files/xdg-utils-1.2.1-qtpaths.patch
@@ -0,0 +1,21 @@
+Workaround for https://bugs.gentoo.org/934941.
+
+Pending questions:
+* Should qt6paths instead be in /usr/bin in Gentoo?
+* Why do we have a qtpaths6 as well as a qt6paths?
+--- a/scripts/xdg-mime.in
++++ b/scripts/xdg-mime.in
+@@ -166,8 +166,11 @@ make_default_kde()
+ # text/plain=gnome-gedit.desktop;gnu-emacs.desktop;
+ vendor="$1"
+ mimetype="$2"
+- if [ "${KDE_SESSION_VERSION:-0}" -gt 4 ] ; then
+- default_dir="$(qtpaths --writable-path ConfigLocation)"
++ if [ "${KDE_SESSION_VERSION:-0}" -gt 5 ] ; then
++ default_dir="$($(pkg-config --variable=bindir Qt6Core)/qtpaths6 --writable-path ConfigLocation)"
++ default_file="$default_dir/mimeapps.list"
++ elif [ x"$KDE_SESSION_VERSION" = x"5" ] ; then
++ default_dir="$(qtpaths5 --writable-path ConfigLocation)"
+ default_file="$default_dir/mimeapps.list"
+ elif [ x"$KDE_SESSION_VERSION" = x"4" ]; then
+ default_dir="$(kde4-config --path xdgdata-apps 2> /dev/null | cut -d ':' -f 1)"
diff --git a/x11-misc/xdg-utils/files/xdg-utils-1.2.1-xdg-mime-default.patch b/x11-misc/xdg-utils/files/xdg-utils-1.2.1-xdg-mime-default.patch
new file mode 100644
index 000000000000..8efcdca1cfef
--- /dev/null
+++ b/x11-misc/xdg-utils/files/xdg-utils-1.2.1-xdg-mime-default.patch
@@ -0,0 +1,143 @@
+https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/252
+https://gitlab.freedesktop.org/xdg/xdg-utils/-/commit/f113a8b997dcb9527b9694d31bddcfa05096aecf
+
+From f113a8b997dcb9527b9694d31bddcfa05096aecf Mon Sep 17 00:00:00 2001
+From: Slatian <baschdel@disroot.org>
+Date: Tue, 21 May 2024 04:08:23 +0000
+Subject: [PATCH] Make the desktop_file_to_binary function less likely to fall
+ over and do something unexpected.
+
+* Uses a shell implementation ( !24) of `which` in the `desktop_file_to_binary` to avoid tripping over unexpected output from `command -v`
+* In addition it also makes the parsing a bit more standards compliant than it previously was.
+* Adds a developer script to easier test internal functions in the xdg-utils-common.in file
+
+Fixes: #252
+---
+ scripts/test-common-function | 13 ++++++++
+ scripts/xdg-utils-common.in | 64 +++++++++++++++++++++++++++++++-----
+ 2 files changed, 68 insertions(+), 9 deletions(-)
+ create mode 100755 scripts/test-common-function
+
+diff --git a/scripts/test-common-function b/scripts/test-common-function
+new file mode 100755
+index 0000000..c8af98d
+--- /dev/null
++++ b/scripts/test-common-function
+@@ -0,0 +1,13 @@
++#!/bin/sh
++
++# This script is for testing internal functions of the xdg-utils-common.in file
++#
++# Example ./test-common-function xdg_which echo
++
++XDG_UTILS_DEBUG_LEVEL="${XDG_UTILS_DEBUG_LEVEL:-99}"
++
++. ./xdg-utils-common.in
++
++"$@"
++
++exit $?
+diff --git a/scripts/xdg-utils-common.in b/scripts/xdg-utils-common.in
+index f0a1aac..adab368 100644
+--- a/scripts/xdg-utils-common.in
++++ b/scripts/xdg-utils-common.in
+@@ -51,19 +51,24 @@ binary_to_desktop_file()
+ }
+
+ #-------------------------------------------------------------
+-# map a .desktop file to a binary
++# map a .desktop file name to its Exec binary
++# Returns the realpath resolved path to the binary or noting.
++
++# desktop_file_to_binary <desktop-file-name>
+ desktop_file_to_binary()
+ {
++ DEBUG 1 "desktop_file_to_binary '$1'"
+ search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
+ desktop="$(basename "$1")"
+ IFS=:
+ for dir in $search; do
++ DEBUG 2 "Searching in '$dir/{applications,applnk}'"
+ unset IFS
+- [ "$dir" ] && [ -d "$dir/applications" ] || [ -d "$dir/applnk" ] || continue
++ [ -n "$dir" ] && [ -d "$dir/applications" ] || [ -d "$dir/applnk" ] || continue
+ # Check if desktop file contains -
+ if [ "${desktop#*-}" != "$desktop" ]; then
+- vendor=${desktop%-*}
+- app=${desktop#*-}
++ vendor="${desktop%-*}"
++ app="${desktop#*-}"
+ if [ -r "$dir/applications/$vendor/$app" ]; then
+ file_path="$dir/applications/$vendor/$app"
+ elif [ -r "$dir/applnk/$vendor/$app" ]; then
+@@ -72,18 +77,31 @@ desktop_file_to_binary()
+ fi
+ if test -z "$file_path" ; then
+ for indir in "$dir"/applications/ "$dir"/applications/*/ "$dir"/applnk/ "$dir"/applnk/*/; do
++ DEBUG 4 "Does file exist? '$indir/$desktop'"
+ file="$indir/$desktop"
+ if [ -r "$file" ]; then
+- file_path=$file
++ file_path="$file"
+ break
+ fi
+ done
+ fi
+ if [ -r "$file_path" ]; then
+- # Remove any arguments (%F, %f, %U, %u, etc.).
+- command="$(grep -E "^Exec(\[[^]=]*])?=" "$file_path" | cut -d= -f 2- | first_word)"
+- command="$(command -v "$command")"
+- xdg_realpath "$command"
++ DEBUG 2 "Checking desktop file '$file_path'"
++ # Get the command name from the correct Exec
++ # Note: Ignoring quoting and escape sequences here, see #253
++ binary="$(awk -F '=' '
++ /^\[/{ in_entry=0 }
++ $0 == "[Desktop Entry]"{ in_entry=1 }
++ in_entry && /^Exec\s*=/ {
++ sub(/^\s+/,"",$2);
++ match($2,/^[^ ]+/);
++ print substr($2,RSTART,RLENGTH)
++ }' \
++ < "$file_path" )"
++ DEBUG 2 "Found command: $binary"
++ binary="$(xdg_which "$binary")"
++ DEBUG 2 "Resolved to command to file: '$binary'"
++ [ -z "$binary" ] || xdg_realpath "$binary"
+ return
+ fi
+ done
+@@ -461,3 +479,31 @@ xdg_realpath()
+ ;;
+ esac
+ }
++
++#----------------------------------------------------------------------------
++# The `which` command but as a shell implementation.
++# Returns either the path of the resolved binary or nothing
++# because command -v does not always return the path of a command
++# (builtins, aliases, functions, etc.)
++
++# xdg_which <command>
++xdg_which()
++{
++ if [ -z "$1" ] ; then
++ return 1
++ elif [ -x "$1" ] ; then
++ printf "%s\n" "$1"
++ else
++ # this should be faster than the real thing because of shell builtins
++ old_ifs="$IFS"
++ IFS=:
++ for p in $PATH ; do
++ IFS="$old_ifs"
++ if [ -x "$p/$1" ] ; then
++ printf "%s\n" "$p/$1"
++ return
++ fi
++ done
++ return 1
++ fi
++}
+--
+GitLab
diff --git a/x11-misc/xdg-utils/metadata.xml b/x11-misc/xdg-utils/metadata.xml
new file mode 100644
index 000000000000..cf1f30e4ab8f
--- /dev/null
+++ b/x11-misc/xdg-utils/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>freedesktop-bugs@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:freedesktop:xdg-utils</remote-id>
+ </upstream>
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>
diff --git a/x11-misc/xdg-utils/xdg-utils-1.2.1-r10.ebuild b/x11-misc/xdg-utils/xdg-utils-1.2.1-r10.ebuild
new file mode 100644
index 000000000000..0ec55a4d8ba7
--- /dev/null
+++ b/x11-misc/xdg-utils/xdg-utils-1.2.1-r10.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="Portland utils for cross-platform/cross-toolkit/cross-desktop interoperability"
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/xdg-utils/"
+if [[ ${PV} == *_p* ]] ; then
+ MY_COMMIT="d4f00e1d803038af4f245949d8c747a384117852"
+ SRC_URI="https://gitlab.freedesktop.org/xdg/xdg-utils/-/archive/${MY_COMMIT}/${P}.tar.bz2"
+ S="${WORKDIR}"/xdg-utils-${MY_COMMIT}
+else
+ SRC_URI="https://gitlab.freedesktop.org/xdg/xdg-utils/-/archive/v${PV}/${PN}-v${PV}.tar.bz2"
+ S="${WORKDIR}"/${PN}-v${PV}
+fi
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos"
+IUSE="dbus doc gnome perl plasma X"
+REQUIRED_USE="gnome? ( dbus )"
+
+# dev-perl/File-MimeInfo: mimeopen used by xdg-open
+RDEPEND="
+ dev-util/desktop-file-utils
+ x11-misc/shared-mime-info
+ dbus? (
+ sys-apps/dbus
+ gnome? (
+ dev-perl/Net-DBus
+ dev-perl/X11-Protocol
+ )
+ )
+ perl? ( dev-perl/File-MimeInfo )
+ plasma? ( virtual/pkgconfig )
+ X? (
+ x11-apps/xprop
+ x11-apps/xset
+ )
+"
+PDEPEND="
+ plasma? (
+ dev-qt/qtbase:6
+ kde-frameworks/kservice:6
+ kde-plasma/kde-cli-tools:*
+ )
+"
+BDEPEND="
+ app-alternatives/awk
+ >=app-text/xmlto-0.0.28-r3[text(+)]
+"
+
+# Tests run random system programs, including interactive programs
+# that block forever
+RESTRICT="test"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-xdg-mime-default.patch
+ "${FILESDIR}"/${PN}-1.2.1-qtpaths.patch
+ "${FILESDIR}"/${PN}-1.2.1-fix-CVE-2020-27748.patch
+)
+
+src_prepare() {
+ default
+
+ if [[ ${PV} == *_p* ]] ; then
+ # If you choose to do git snapshot instead of patchset, you need to remember
+ # to run `autoconf` in ./ and `make scripts-clean` in ./scripts/ to refresh
+ # all the files
+ eautoreconf
+ fi
+}
+
+src_configure() {
+ export ac_cv_path_XMLTO="$(type -P xmlto) --skip-validation" #502166
+ default
+ emake -C scripts scripts-clean
+}
+
+src_install() {
+ default
+
+ dodoc RELEASE_NOTES
+
+ newdoc scripts/xsl/README README.xsl
+ use doc && dodoc -r scripts/html
+
+ # Install default XDG_DATA_DIRS, bug #264647
+ echo XDG_DATA_DIRS=\"${EPREFIX}/usr/local/share\" > 30xdg-data-local || die
+ echo 'COLON_SEPARATED="XDG_DATA_DIRS XDG_CONFIG_DIRS"' >> 30xdg-data-local || die
+ doenvd 30xdg-data-local
+
+ echo XDG_DATA_DIRS=\"${EPREFIX}/usr/share\" > 90xdg-data-base || die
+ echo XDG_CONFIG_DIRS=\"${EPREFIX}/etc/xdg\" >> 90xdg-data-base || die
+ doenvd 90xdg-data-base
+}
+
+pkg_postinst() {
+ [[ -x $(type -P gtk-update-icon-cache) ]] \
+ || elog "Install dev-util/gtk-update-icon-cache for the gtk-update-icon-cache command."
+}
diff --git a/x11-misc/xdg-utils/xdg-utils-1.2.1-r9.ebuild b/x11-misc/xdg-utils/xdg-utils-1.2.1-r9.ebuild
new file mode 100644
index 000000000000..9200eab60a5d
--- /dev/null
+++ b/x11-misc/xdg-utils/xdg-utils-1.2.1-r9.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="Portland utils for cross-platform/cross-toolkit/cross-desktop interoperability"
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/xdg-utils/"
+if [[ ${PV} == *_p* ]] ; then
+ MY_COMMIT="d4f00e1d803038af4f245949d8c747a384117852"
+ SRC_URI="https://gitlab.freedesktop.org/xdg/xdg-utils/-/archive/${MY_COMMIT}/${P}.tar.bz2"
+ S="${WORKDIR}"/xdg-utils-${MY_COMMIT}
+else
+ SRC_URI="https://gitlab.freedesktop.org/xdg/xdg-utils/-/archive/v${PV}/${PN}-v${PV}.tar.bz2"
+ S="${WORKDIR}"/${PN}-v${PV}
+fi
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos"
+IUSE="dbus doc gnome perl plasma X"
+REQUIRED_USE="gnome? ( dbus )"
+
+# dev-perl/File-MimeInfo: mimeopen used by xdg-open
+RDEPEND="
+ dev-util/desktop-file-utils
+ x11-misc/shared-mime-info
+ dbus? (
+ sys-apps/dbus
+ gnome? (
+ dev-perl/Net-DBus
+ dev-perl/X11-Protocol
+ )
+ )
+ perl? ( dev-perl/File-MimeInfo )
+ plasma? ( virtual/pkgconfig )
+ X? (
+ x11-apps/xprop
+ x11-apps/xset
+ )
+"
+PDEPEND="
+ plasma? (
+ dev-qt/qtbase:6
+ kde-frameworks/kservice:6
+ kde-plasma/kde-cli-tools:*
+ )
+"
+BDEPEND="
+ app-alternatives/awk
+ >=app-text/xmlto-0.0.28-r3[text(+)]
+"
+
+# Tests run random system programs, including interactive programs
+# that block forever
+RESTRICT="test"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-xdg-mime-default.patch
+ "${FILESDIR}"/${PN}-1.2.1-qtpaths.patch
+)
+
+src_prepare() {
+ default
+
+ if [[ ${PV} == *_p* ]] ; then
+ # If you choose to do git snapshot instead of patchset, you need to remember
+ # to run `autoconf` in ./ and `make scripts-clean` in ./scripts/ to refresh
+ # all the files
+ eautoreconf
+ fi
+}
+
+src_configure() {
+ export ac_cv_path_XMLTO="$(type -P xmlto) --skip-validation" #502166
+ default
+ emake -C scripts scripts-clean
+}
+
+src_install() {
+ default
+
+ dodoc RELEASE_NOTES
+
+ newdoc scripts/xsl/README README.xsl
+ use doc && dodoc -r scripts/html
+
+ # Install default XDG_DATA_DIRS, bug #264647
+ echo XDG_DATA_DIRS=\"${EPREFIX}/usr/local/share\" > 30xdg-data-local || die
+ echo 'COLON_SEPARATED="XDG_DATA_DIRS XDG_CONFIG_DIRS"' >> 30xdg-data-local || die
+ doenvd 30xdg-data-local
+
+ echo XDG_DATA_DIRS=\"${EPREFIX}/usr/share\" > 90xdg-data-base || die
+ echo XDG_CONFIG_DIRS=\"${EPREFIX}/etc/xdg\" >> 90xdg-data-base || die
+ doenvd 90xdg-data-base
+}
+
+pkg_postinst() {
+ [[ -x $(type -P gtk-update-icon-cache) ]] \
+ || elog "Install dev-util/gtk-update-icon-cache for the gtk-update-icon-cache command."
+}