forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: David Seifert <[email protected]>
- Loading branch information
1 parent
ffddb1c
commit b5240fb
Showing
1 changed file
with
33 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,59 @@ | ||
# Copyright 1999-2021 Gentoo Authors | ||
# Copyright 1999-2023 Gentoo Authors | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
# @ECLASS: xdg.eclass | ||
# @MAINTAINER: | ||
# [email protected] | ||
# @AUTHOR: | ||
# Original author: Gilles Dartiguelongue <[email protected]> | ||
# @SUPPORTED_EAPIS: 5 6 7 8 | ||
# @SUPPORTED_EAPIS: 6 7 8 | ||
# @PROVIDES: xdg-utils | ||
# @BLURB: Provides phases for XDG compliant packages. | ||
# @DESCRIPTION: | ||
# Utility eclass to update the desktop, icon and shared mime info as laid | ||
# out in the freedesktop specs & implementations | ||
|
||
inherit xdg-utils | ||
|
||
_DEFINE_XDG_SRC_PREPARE=false | ||
case "${EAPI}" in | ||
5|6|7) | ||
# src_prepare is only exported in EAPI < 8. | ||
EXPORT_FUNCTIONS src_prepare | ||
_DEFINE_XDG_SRC_PREPARE=true | ||
;; | ||
8) | ||
;; | ||
*) die "${ECLASS}: EAPI=${EAPI} is not supported" ;; | ||
case ${EAPI} in | ||
6|7|8) ;; | ||
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; | ||
esac | ||
EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm | ||
|
||
if [[ -z ${_XDG_ECLASS} ]]; then | ||
_XDG_ECLASS=1 | ||
|
||
inherit xdg-utils | ||
|
||
# Avoid dependency loop as both depend on glib-2 | ||
if [[ ${CATEGORY}/${P} != dev-libs/glib-2.* ]] ; then | ||
_XDG_DEPEND=" | ||
[[ ${CATEGORY}/${P} != dev-libs/glib-2.* ]] && _XDG_DEPEND=" | ||
dev-util/desktop-file-utils | ||
x11-misc/shared-mime-info | ||
" | ||
|
||
case "${EAPI}" in | ||
5|6|7) | ||
case ${EAPI} in | ||
6|7) | ||
# src_prepare is only exported in EAPI < 8. | ||
# @FUNCTION: xdg_src_prepare | ||
# @DESCRIPTION: | ||
# Prepare sources to work with XDG standards. | ||
# Note that this function is only defined and exported in EAPIs < 8. | ||
xdg_src_prepare() { | ||
xdg_environment_reset | ||
default | ||
} | ||
|
||
EXPORT_FUNCTIONS src_prepare | ||
|
||
DEPEND="${_XDG_DEPEND}" | ||
;; | ||
*) | ||
xdg_src_prepare() { | ||
die "Called xdg_src_prepare in EAPI >= 8" | ||
} | ||
|
||
IDEPEND="${_XDG_DEPEND}" | ||
;; | ||
esac | ||
fi | ||
|
||
if ${_DEFINE_XDG_SRC_PREPARE}; then | ||
# @FUNCTION: xdg_src_prepare | ||
# @DESCRIPTION: | ||
# Prepare sources to work with XDG standards. | ||
# Note that this function is only defined and exported in EAPIs < 8. | ||
xdg_src_prepare() { | ||
xdg_environment_reset | ||
|
||
[[ ${EAPI} != 5 ]] && default | ||
} | ||
fi | ||
unset _XDG_DEPEND | ||
|
||
# @FUNCTION: xdg_pkg_preinst | ||
# @DESCRIPTION: | ||
|
@@ -127,3 +125,6 @@ xdg_pkg_postrm() { | |
fi | ||
} | ||
|
||
fi | ||
|
||
EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm |