summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-02-16 12:59:29 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-02-16 12:59:29 +0000
commit79599515788b85b18aa655e7b7f8cc05c1bbddd8 (patch)
treeade7cb031f363fad64c77139dea7aa3d81908537 /eclass
parent6bc2e4d7c5906e46a8f275a876ead6ec41aca5bb (diff)
gentoo resync : 16.02.1018
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin37442 -> 37443 bytes
-rw-r--r--eclass/flag-o-matic.eclass7
-rw-r--r--eclass/gnome.org.eclass13
-rw-r--r--eclass/gnome2-utils.eclass114
-rw-r--r--eclass/gnome2.eclass9
-rw-r--r--eclass/kde5.eclass135
-rw-r--r--eclass/kernel-2.eclass11
-rw-r--r--eclass/mozconfig-v6.60.eclass10
-rw-r--r--eclass/toolchain-glibc.eclass5
-rw-r--r--eclass/toolchain.eclass7
-rw-r--r--eclass/vala.eclass31
-rw-r--r--eclass/xdg-utils.eclass75
-rw-r--r--eclass/xdg.eclass43
13 files changed, 188 insertions, 272 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index c9bc53f1bba4..0a50771fae27 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 582339096573..933104190ae3 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -69,6 +69,13 @@ setup-allowed-flags() {
# gcc 4.9
-mno-avx512cd -mno-avx512er -mno-avx512f -mno-avx512pf -mno-sha
)
+
+ # Allow some safe individual flags. Should come along with the bug reference.
+ ALLOWED_FLAGS+=(
+ # Allow explicit stack realignment to run non-conformant
+ # binaries: bug #677852
+ -mstackrealign
+ )
}
# inverted filters for hardened compiler. This is trying to unpick
diff --git a/eclass/gnome.org.eclass b/eclass/gnome.org.eclass
index 6b2ae672a2d4..fd6077e4594c 100644
--- a/eclass/gnome.org.eclass
+++ b/eclass/gnome.org.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: gnome.org.eclass
@@ -11,7 +11,8 @@
# @DESCRIPTION:
# Provide a default SRC_URI for tarball hosted on gnome.org mirrors.
-inherit versionator
+# versionator inherit kept for older EAPIs due to ebuilds (potentially) relying on it
+[[ ${EAPI} == [0123456] ]] && inherit eapi7-ver versionator
# @ECLASS-VARIABLE: GNOME_TARBALL_SUFFIX
# @DESCRIPTION:
@@ -28,7 +29,11 @@ fi
# Even though xz-utils are in @system, they must still be added to DEPEND; see
# https://archives.gentoo.org/gentoo-dev/msg_a0d4833eb314d1be5d5802a3b710e0a4.xml
if [[ ${GNOME_TARBALL_SUFFIX} == "xz" ]]; then
- DEPEND="${DEPEND} app-arch/xz-utils"
+ if [[ ${EAPI:-0} != [0123456] ]]; then
+ BDEPEND="app-arch/xz-utils"
+ else
+ DEPEND="app-arch/xz-utils"
+ fi
fi
# @ECLASS-VARIABLE: GNOME_ORG_MODULE
@@ -41,7 +46,7 @@ fi
# @INTERNAL
# @DESCRIPTION:
# Major and minor numbers of the version number.
-: ${GNOME_ORG_PVP:=$(get_version_component_range 1-2)}
+: ${GNOME_ORG_PVP:=$(ver_cut 1-2)}
SRC_URI="mirror://gnome/sources/${GNOME_ORG_MODULE}/${GNOME_ORG_PVP}/${GNOME_ORG_MODULE}-${PV}.tar.${GNOME_TARBALL_SUFFIX}"
diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
index b2f536a45e96..06683a7467f8 100644
--- a/eclass/gnome2-utils.eclass
+++ b/eclass/gnome2-utils.eclass
@@ -1,25 +1,25 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: gnome2-utils.eclass
# @MAINTAINER:
# gnome@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
# @BLURB: Auxiliary functions commonly used by Gnome packages.
# @DESCRIPTION:
# This eclass provides a set of auxiliary functions needed by most Gnome
# packages. It may be used by non-Gnome packages as needed for handling various
# Gnome stack related functions such as:
-# * Gtk+ icon cache management
# * GSettings schemas management
# * GConf schemas management
# * scrollkeeper (old Gnome help system) management
[[ ${EAPI:-0} == [012345] ]] && inherit multilib
-inherit eutils xdg-utils
+[[ ${EAPI:-0} == [0123456] ]] && inherit eutils
+inherit xdg-utils
case "${EAPI:-0}" in
- 0|1|2|3|4|5|6) ;;
+ 0|1|2|3|4|5|6|7) ;;
*) die "EAPI=${EAPI} is not supported" ;;
esac
@@ -41,12 +41,6 @@ esac
# Path to scrollkeeper-update
: ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
-# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
-# @INTERNAL
-# @DESCRIPTION:
-# Path to gtk-update-icon-cache
-: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
-
# @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS
# @INTERNAL
# @DESCRIPTION:
@@ -83,8 +77,6 @@ esac
# @DESCRIPTION:
# List of gdk-pixbuf loaders provided by the package
-DEPEND=">=sys-apps/sed-4"
-
# @FUNCTION: gnome2_environment_reset
# @DESCRIPTION:
@@ -102,7 +94,7 @@ gnome2_environment_reset() {
# Ensure we don't rely on dconf/gconf while building, bug #511946
export GSETTINGS_BACKEND="memory"
- if has ${EAPI:-0} 6; then
+ if has ${EAPI:-0} 6 7; then
# Try to cover the packages honoring this variable, bug #508124
export GST_INSPECT="$(type -P true)"
@@ -205,72 +197,6 @@ gnome2_gconf_uninstall() {
fi
}
-# @FUNCTION: gnome2_icon_savelist
-# @DESCRIPTION:
-# Find the icons that are about to be installed and save their location
-# in the GNOME2_ECLASS_ICONS environment variable. This is only
-# necessary for eclass implementations that call
-# gnome2_icon_cache_update conditionally.
-# This function should be called from pkg_preinst.
-gnome2_icon_savelist() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
- pushd "${ED}" > /dev/null || die
- export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
- popd > /dev/null || die
-}
-
-# @FUNCTION: gnome2_icon_cache_update
-# @DESCRIPTION:
-# Updates Gtk+ icon cache files under /usr/share/icons.
-# This function should be called from pkg_postinst and pkg_postrm.
-gnome2_icon_cache_update() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
- local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
-
- if [[ ! -x "${updater}" ]] ; then
- debug-print "${updater} is not executable"
- return
- fi
-
- ebegin "Updating icons cache"
-
- local retval=0
- local fails=( )
-
- for dir in "${EROOT%/}"/usr/share/icons/*
- do
- if [[ -f "${dir}/index.theme" ]] ; then
- local rv=0
-
- "${updater}" -qf "${dir}"
- rv=$?
-
- if [[ ! $rv -eq 0 ]] ; then
- debug-print "Updating cache failed on ${dir}"
-
- # Add to the list of failures
- fails+=( "${dir}" )
-
- retval=2
- fi
- elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
- # Clear stale cache files after theme uninstallation
- rm "${dir}/icon-theme.cache"
- fi
-
- if [[ -z $(ls "${dir}") ]]; then
- # Clear empty theme directories after theme uninstallation
- rmdir "${dir}"
- fi
- done
-
- eend ${retval}
-
- for f in "${fails[@]}" ; do
- eerror "Failed to update cache with icon $f"
- done
-}
-
# @FUNCTION: gnome2_omf_fix
# @DESCRIPTION:
# Workaround applied to Makefile rules in order to remove redundant
@@ -523,3 +449,31 @@ gnome2_disable_deprecation_warning() {
ewarn "Failed to disable deprecation warnings in ${makefile}"
done
}
+
+case ${EAPI:-0} in
+0|1|2|3|4|5|6)
+
+# @FUNCTION: gnome2_icon_savelist
+# @DESCRIPTION:
+# Find the icons that are about to be installed and save their location
+# in the GNOME2_ECLASS_ICONS environment variable. This is only
+# necessary for eclass implementations that call
+# gnome2_icon_cache_update conditionally.
+# This function should be called from pkg_preinst.
+gnome2_icon_savelist() {
+ has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
+ pushd "${ED}" > /dev/null || die
+ export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
+ popd > /dev/null || die
+}
+
+# @FUNCTION: gnome2_icon_cache_update
+# @DESCRIPTION:
+# Updates Gtk+ icon cache files under /usr/share/icons.
+# Deprecated. Please use xdg_icon_cache_update from xdg-utils.eclass
+gnome2_icon_cache_update() {
+ xdg_icon_cache_update
+}
+
+;;
+esac
diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass
index f741a041c27a..d19bd0b9ac69 100644
--- a/eclass/gnome2.eclass
+++ b/eclass/gnome2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: gnome2.eclass
@@ -316,7 +316,6 @@ gnome2_src_install() {
gnome2_pkg_preinst() {
xdg_pkg_preinst
gnome2_gconf_savelist
- gnome2_icon_savelist
gnome2_schemas_savelist
gnome2_scrollkeeper_savelist
gnome2_gdk_pixbuf_savelist
@@ -338,9 +337,6 @@ gnome2_pkg_preinst() {
gnome2_pkg_postinst() {
xdg_pkg_postinst
gnome2_gconf_install
- if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
- gnome2_icon_cache_update
- fi
if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
gnome2_schemas_update
fi
@@ -362,9 +358,6 @@ gnome2_pkg_postinst() {
# Handle scrollkeeper, GSettings, Icons, desktop and mime database updates.
gnome2_pkg_postrm() {
xdg_pkg_postrm
- if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
- gnome2_icon_cache_update
- fi
if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
gnome2_schemas_update
fi
diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass
index 82655acabcc0..eaa81039183d 100644
--- a/eclass/kde5.eclass
+++ b/eclass/kde5.eclass
@@ -31,11 +31,10 @@ _KDE5_ECLASS=1
# for tests you should proceed with setting VIRTUALX_REQUIRED=test.
: ${VIRTUALX_REQUIRED:=manual}
-inherit cmake-utils flag-o-matic kde5-functions virtualx
+inherit cmake-utils flag-o-matic kde5-functions virtualx xdg
case ${EAPI} in
- 6) inherit eapi7-ver eutils gnome2-utils xdg ;;
- 7) inherit xdg-utils ;;
+ 6) inherit eapi7-ver eutils gnome2-utils ;;
esac
if [[ ${KDE_BUILD_TYPE} = live ]]; then
@@ -717,129 +716,13 @@ kde5_src_install() {
fi
}
-# @FUNCTION: _xdg_icon_cache_update
-# @DESCRIPTION: Forked from future xdg-utils.eclass. REMOVEME!
-# Updates Gtk+ icon cache files under /usr/share/icons.
-# This function should be called from pkg_postinst and pkg_postrm.
-_xdg_icon_cache_update() {
- if [[ ${EBUILD_PHASE} != post* ]] ; then
- die "xdg_icon_cache_update must be used in pkg_post* phases."
- fi
-
- if ! type gtk-update-icon-cache &>/dev/null; then
- debug-print "gtk-update-icon-cache is not found"
- return
- fi
-
- ebegin "Updating icons cache"
- local retval=0
- local fails=( )
- for dir in "${EROOT%/}"/usr/share/icons/*
- do
- if [[ -f "${dir}/index.theme" ]] ; then
- local rv=0
- gtk-update-icon-cache -qf "${dir}"
- rv=$?
- if [[ ! $rv -eq 0 ]] ; then
- debug-print "Updating cache failed on ${dir}"
- # Add to the list of failures
- fails+=( "${dir}" )
- retval=2
- fi
- elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
- # Clear stale cache files after theme uninstallation
- rm "${dir}/icon-theme.cache"
- fi
- if [[ -z $(ls "${dir}") ]]; then
- # Clear empty theme directories after theme uninstallation
- rmdir "${dir}"
- fi
- done
- eend ${retval}
- for f in "${fails[@]}" ; do
- eerror "Failed to update cache with icon $f"
- done
-}
-
-# @FUNCTION: _xdg_pkg_preinst
-# @DESCRIPTION: Forked from future xdg.eclass. REMOVEME!
-# Finds .desktop, icon and mime info files for later handling in pkg_postinst.
-# Locations are stored in XDG_ECLASS_DESKTOPFILES, XDG_ECLASS_ICONFILES
-# and XDG_ECLASS_MIMEINFOFILES respectively.
-_xdg_pkg_preinst() {
- local f
-
- XDG_ECLASS_DESKTOPFILES=()
- while IFS= read -r -d '' f; do
- XDG_ECLASS_DESKTOPFILES+=( ${f} )
- done < <(cd "${ED}" && find 'usr/share/applications' -type f -print0 2>/dev/null)
-
- XDG_ECLASS_ICONFILES=()
- while IFS= read -r -d '' f; do
- XDG_ECLASS_ICONFILES+=( ${f} )
- done < <(cd "${ED}" && find 'usr/share/icons' -type f -print0 2>/dev/null)
-
- XDG_ECLASS_MIMEINFOFILES=()
- while IFS= read -r -d '' f; do
- XDG_ECLASS_MIMEINFOFILES+=( ${f} )
- done < <(cd "${ED}" && find 'usr/share/mime' -type f -print0 2>/dev/null)
-}
-
-# @FUNCTION: _xdg_pkg_postinst
-# @DESCRIPTION: Forked from future xdg.eclass. REMOVEME!
-# Handle desktop, icon and mime info database updates.
-_xdg_pkg_postinst() {
- if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
- xdg_desktop_database_update
- else
- debug-print "No .desktop files to add to database"
- fi
-
- if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
- _xdg_icon_cache_update
- else
- debug-print "No icon files to add to cache"
- fi
-
- if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
- xdg_mimeinfo_database_update
- else
- debug-print "No mime info files to add to database"
- fi
-}
-
-# @FUNCTION: _xdg_pkg_postrm
-# @DESCRIPTION: Forked from future xdg.eclass. REMOVEME!
-# Handle desktop, icon and mime info database updates.
-_xdg_pkg_postrm() {
- if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
- xdg_desktop_database_update
- else
- debug-print "No .desktop files to add to database"
- fi
-
- if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
- _xdg_icon_cache_update
- else
- debug-print "No icon files to add to cache"
- fi
-
- if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
- xdg_mimeinfo_database_update
- else
- debug-print "No mime info files to add to database"
- fi
-}
-
# @FUNCTION: kde5_pkg_preinst
# @DESCRIPTION:
# Sets up environment variables required in kde5_pkg_postinst.
kde5_pkg_preinst() {
debug-print-function ${FUNCNAME} "$@"
- [[ ${EAPI} == 6 ]] && gnome2_icon_savelist
- [[ ${EAPI} == 6 ]] && xdg_pkg_preinst
- [[ ${EAPI} == 7 ]] && _xdg_pkg_preinst
+ xdg_pkg_preinst
}
# @FUNCTION: kde5_pkg_postinst
@@ -848,11 +731,7 @@ kde5_pkg_preinst() {
kde5_pkg_postinst() {
debug-print-function ${FUNCNAME} "$@"
- if [[ ${EAPI} == 6 && -n ${GNOME2_ECLASS_ICONS} ]]; then
- gnome2_icon_cache_update
- fi
- [[ ${EAPI} == 6 ]] && xdg_pkg_postinst
- [[ ${EAPI} == 7 ]] && _xdg_pkg_postinst
+ xdg_pkg_postinst
if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
if [[ ${KDE_BUILD_TYPE} = live ]]; then
@@ -870,11 +749,7 @@ kde5_pkg_postinst() {
kde5_pkg_postrm() {
debug-print-function ${FUNCNAME} "$@"
- if [[ ${EAPI} == 6 && -n ${GNOME2_ECLASS_ICONS} ]]; then
- gnome2_icon_cache_update
- fi
- [[ ${EAPI} == 6 ]] && xdg_pkg_postrm
- [[ ${EAPI} == 7 ]] && _xdg_pkg_postrm
+ xdg_pkg_postrm
}
fi
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 48146b7284b9..edbb4a8584d4 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: kernel-2.eclass
@@ -624,8 +624,9 @@ if [[ ${ETYPE} == sources ]]; then
IUSE="${IUSE} deblob"
# Reflect that kernels contain firmware blobs unless otherwise
- # stripped
- LICENSE="${LICENSE} !deblob? ( linux-firmware )"
+ # stripped. Starting with version 4.14, the whole firmware
+ # tree has been dropped from the kernel.
+ kernel_is lt 4 14 && LICENSE+=" !deblob? ( linux-firmware )"
DEPEND+=" deblob? ( ${PYTHON_DEPS} )"
@@ -654,10 +655,10 @@ if [[ ${ETYPE} == sources ]]; then
${DEBLOB_URI}
${DEBLOB_CHECK_URI}
)"
- else
+ elif kernel_is lt 4 14; then
# We have no way to deblob older kernels, so just mark them as
# tainted with non-libre materials.
- LICENSE="${LICENSE} linux-firmware"
+ LICENSE+=" linux-firmware"
fi
fi
diff --git a/eclass/mozconfig-v6.60.eclass b/eclass/mozconfig-v6.60.eclass
index de09ebcd6408..b090218ac814 100644
--- a/eclass/mozconfig-v6.60.eclass
+++ b/eclass/mozconfig-v6.60.eclass
@@ -114,7 +114,10 @@ RDEPEND=">=app-text/hunspell-1.5.4:=
system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 )
system-libevent? ( >=dev-libs/libevent-2.0:0= )
system-sqlite? ( >=dev-db/sqlite-3.23.1:3[secure-delete,debug=] )
- system-libvpx? ( >=media-libs/libvpx-1.5.0:0=[postproc] )
+ system-libvpx? (
+ >=media-libs/libvpx-1.5.0:0=[postproc]
+ <media-libs/libvpx-1.8
+ )
system-harfbuzz? ( >=media-libs/harfbuzz-1.4.2:0= >=media-gfx/graphite2-1.3.9-r1 )
"
@@ -218,6 +221,11 @@ mozconfig_config() {
# Must pass release in order to properly select linker
mozconfig_annotate 'Enable by Gentoo' --enable-release
+ # Set correct update channel, bug 677722
+ if [[ -n "${MOZ_ESR}" ]] ; then
+ mozconfig_annotate 'set update channel to ESR' --enable-update-channel=esr
+ fi
+
# Avoid auto-magic on linker
if use clang ; then
# This is upstream's default
diff --git a/eclass/toolchain-glibc.eclass b/eclass/toolchain-glibc.eclass
index 6698f2045e22..81d494c6fd53 100644
--- a/eclass/toolchain-glibc.eclass
+++ b/eclass/toolchain-glibc.eclass
@@ -842,6 +842,11 @@ glibc_do_configure() {
if version_is_at_least 2.25 ; then
case ${CTARGET} in
+ m68k*)
+ # setjmp() is not compatible with stack protection:
+ # https://sourceware.org/PR24202
+ myconf+=( --enable-stack-protector=no )
+ ;;
mips*)
# dlopen() detects stack smash on mips n32 ABI.
# Cause is unknown: https://bugs.gentoo.org/640130
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 56921228daa9..daa62e3a67c0 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1278,7 +1278,8 @@ toolchain_src_configure() {
if in_iuse vtv ; then
confgcc+=(
$(use_enable vtv vtable-verify)
- $(use_enable vtv libvtv)
+ # See Note [implicitly enabled flags]
+ $(usex vtv '' --disable-libvtv)
)
fi
@@ -2514,7 +2515,9 @@ toolchain_death_notice() {
#
# GCC does not follow this pattern and instead overrides autodetection
# of the feature and enables it unconditionally.
-# See https://gcc.gnu.org/PR85663
+# See bugs:
+# https://gcc.gnu.org/PR85663 (libsanitizer on mips)
+# https://bugs.gentoo.org/661252 (libvtv on powerpc64)
#
# Thus safer way to enable/disable the feature is to rely on implicit
# enabled-by-default state:
diff --git a/eclass/vala.eclass b/eclass/vala.eclass
index 11fd875d5d99..7ce2a5e681fd 100644
--- a/eclass/vala.eclass
+++ b/eclass/vala.eclass
@@ -32,7 +32,7 @@ VALA_MIN_API_VERSION=${VALA_MIN_API_VERSION:-0.32}
# @ECLASS-VARIABLE: VALA_MAX_API_VERSION
# @DESCRIPTION:
# Maximum vala API version (e.g. 0.32).
-VALA_MAX_API_VERSION=${VALA_MAX_API_VERSION:-0.36}
+VALA_MAX_API_VERSION=${VALA_MAX_API_VERSION:-0.44}
# @ECLASS-VARIABLE: VALA_USE_DEPEND
# @DEFAULT_UNSET
@@ -59,16 +59,33 @@ vala_api_versions() {
done
}
+# Outputs VALA_USE_DEPEND as a a USE-dependency string
+_vala_use_depend() {
+ local u="" vala_use
+
+ if [[ -n ${VALA_USE_DEPEND} ]]; then
+ for vala_use in ${VALA_USE_DEPEND}; do
+ case ${vala_use} in
+ vapigen) u="${u},${vala_use}(+)" ;;
+ valadoc) u="${u},${vala_use}(-)" ;;
+ esac
+ done
+ u="[${u#,}]"
+ fi
+
+ echo -n "${u}"
+}
+
# @FUNCTION: vala_depend
# @DESCRIPTION:
# Outputs a ||-dependency string on vala from VALA_MAX_API_VERSION down to
# VALA_MIN_API_VERSION
vala_depend() {
- local u v versions=$(vala_api_versions)
- [[ ${VALA_USE_DEPEND} ]] && u="[${VALA_USE_DEPEND}(+)]"
+ local u v
+ u=$(_vala_use_depend)
echo -n "|| ("
- for v in ${versions}; do
+ for v in $(vala_api_versions); do
echo -n " dev-lang/vala:${v}${u}"
done
echo " )"
@@ -80,7 +97,8 @@ vala_depend() {
# VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
vala_best_api_version() {
local u v
- [[ ${VALA_USE_DEPEND} ]] && u="[${VALA_USE_DEPEND}(+)]"
+ u=$(_vala_use_depend)
+
for v in $(vala_api_versions); do
has_version "dev-lang/vala:${v}${u}" && echo "${v}" && return
done
@@ -130,6 +148,9 @@ vala_src_prepare() {
valafoo=$(type -P vapigen-${version})
[[ ${valafoo} ]] && export VAPIGEN="${valafoo}"
+ valafoo=$(type -P valadoc-${version})
+ [[ ${valafoo} ]] && has valadoc ${VALA_USE_DEPEND} && export VALADOC="${valafoo}"
+
valafoo="${EPREFIX}/usr/share/vala/Makefile.vapigen"
[[ -e ${valafoo} ]] && export VAPIGEN_MAKEFILE="${valafoo}"
diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index fe1eef213ea4..f5121830d888 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: xdg-utils.eclass
@@ -12,6 +12,7 @@
# This eclass provides a set of auxiliary functions needed by most XDG
# compliant packages.
# It provides XDG stack related functions such as:
+# * GTK/Qt5 icon theme cache management
# * XDG .desktop files cache management
# * XDG mime information database management
@@ -20,24 +21,12 @@ case "${EAPI:-0}" in
*) die "EAPI=${EAPI} is not supported" ;;
esac
-# @ECLASS-VARIABLE: DESKTOP_DATABASE_UPDATE_BIN
-# @INTERNAL
-# @DESCRIPTION:
-# Path to update-desktop-database
-: ${DESKTOP_DATABASE_UPDATE_BIN:="/usr/bin/update-desktop-database"}
-
# @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR
# @INTERNAL
# @DESCRIPTION:
# Directory where .desktop files database is stored
: ${DESKTOP_DATABASE_DIR="/usr/share/applications"}
-# @ECLASS-VARIABLE: MIMEINFO_DATABASE_UPDATE_BIN
-# @INTERNAL
-# @DESCRIPTION:
-# Path to update-mime-database
-: ${MIMEINFO_DATABASE_UPDATE_BIN:="/usr/bin/update-mime-database"}
-
# @ECLASS-VARIABLE: MIMEINFO_DATABASE_DIR
# @INTERNAL
# @DESCRIPTION:
@@ -67,39 +56,79 @@ xdg_environment_reset() {
# Updates the .desktop files database.
# Generates a list of mimetypes linked to applications that can handle them
xdg_desktop_database_update() {
- local updater="${EROOT%/}${DESKTOP_DATABASE_UPDATE_BIN}"
-
if [[ ${EBUILD_PHASE} != post* ]] ; then
die "xdg_desktop_database_update must be used in pkg_post* phases."
fi
- if [[ ! -x "${updater}" ]] ; then
- debug-print "${updater} is not executable"
+ if ! type update-desktop-database &>/dev/null; then
+ debug-print "update-desktop-database is not found"
return
fi
ebegin "Updating .desktop files database"
- "${updater}" -q "${EROOT%/}${DESKTOP_DATABASE_DIR}"
+ update-desktop-database -q "${EROOT%/}${DESKTOP_DATABASE_DIR}"
eend $?
}
+# @FUNCTION: xdg_icon_cache_update
+# @DESCRIPTION:
+# Updates icon theme cache files under /usr/share/icons.
+# This function should be called from pkg_postinst and pkg_postrm.
+xdg_icon_cache_update() {
+ if [[ ${EBUILD_PHASE} != post* ]] ; then
+ die "xdg_icon_cache_update must be used in pkg_post* phases."
+ fi
+
+ if ! type gtk-update-icon-cache &>/dev/null; then
+ debug-print "gtk-update-icon-cache is not found"
+ return
+ fi
+
+ ebegin "Updating icons cache"
+ local retval=0
+ local fails=( )
+ for dir in "${EROOT%/}"/usr/share/icons/*
+ do
+ if [[ -f "${dir}/index.theme" ]] ; then
+ local rv=0
+ gtk-update-icon-cache -qf "${dir}"
+ rv=$?
+ if [[ ! $rv -eq 0 ]] ; then
+ debug-print "Updating cache failed on ${dir}"
+ # Add to the list of failures
+ fails+=( "${dir}" )
+ retval=2
+ fi
+ elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
+ # Clear stale cache files after theme uninstallation
+ rm "${dir}/icon-theme.cache"
+ fi
+ if [[ -z $(ls "${dir}") ]]; then
+ # Clear empty theme directories after theme uninstallation
+ rmdir "${dir}"
+ fi
+ done
+ eend ${retval}
+ for f in "${fails[@]}" ; do
+ eerror "Failed to update cache with icon $f"
+ done
+}
+
# @FUNCTION: xdg_mimeinfo_database_update
# @DESCRIPTION:
# Update the mime database.
# Creates a general list of mime types from several sources
xdg_mimeinfo_database_update() {
- local updater="${EROOT%/}${MIMEINFO_DATABASE_UPDATE_BIN}"
-
if [[ ${EBUILD_PHASE} != post* ]] ; then
die "xdg_mimeinfo_database_update must be used in pkg_post* phases."
fi
- if [[ ! -x "${updater}" ]] ; then
- debug-print "${updater} is not executable"
+ if ! type update-mime-database &>/dev/null; then
+ debug-print "update-mime-database is not found"
return
fi
ebegin "Updating shared mime info database"
- "${updater}" "${EROOT%/}${MIMEINFO_DATABASE_DIR}"
+ update-mime-database "${EROOT%/}${MIMEINFO_DATABASE_DIR}"
eend $?
}
diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 9ee771223dc0..219be712e84d 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: xdg.eclass
@@ -6,16 +6,16 @@
# freedesktop-bugs@gentoo.org
# @AUTHOR:
# Original author: Gilles Dartiguelongue <eva@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6
+# @SUPPORTED_EAPIS: 4 5 6 7
# @BLURB: Provides phases for XDG compliant packages.
# @DESCRIPTION:
-# Utility eclass to update the desktop and shared mime info as laid
+# Utility eclass to update the desktop, icon and shared mime info as laid
# out in the freedesktop specs & implementations
inherit xdg-utils
case "${EAPI:-0}" in
- 4|5|6)
+ 4|5|6|7)
EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
;;
*) die "EAPI=${EAPI} is not supported" ;;
@@ -35,33 +35,36 @@ fi
xdg_src_prepare() {
xdg_environment_reset
- has ${EAPI:-0} 6 && default
+ [[ ${EAPI:-0} != [45] ]] && default
}
# @FUNCTION: xdg_pkg_preinst
# @DESCRIPTION:
-# Finds .desktop and mime info files for later handling in pkg_postinst.
-# Locations are stored in XDG_ECLASS_DESKTOPFILES and XDG_ECLASS_MIMEINFOFILES
-# respectively.
+# Finds .desktop, icon and mime info files for later handling in pkg_postinst.
+# Locations are stored in XDG_ECLASS_DESKTOPFILES, XDG_ECLASS_ICONFILES
+# and XDG_ECLASS_MIMEINFOFILES respectively.
xdg_pkg_preinst() {
local f
XDG_ECLASS_DESKTOPFILES=()
while IFS= read -r -d '' f; do
XDG_ECLASS_DESKTOPFILES+=( ${f} )
- done < <(cd "${D}" && find 'usr/share/applications' -type f -print0 2>/dev/null)
+ done < <(cd "${ED}" && find 'usr/share/applications' -type f -print0 2>/dev/null)
+
+ XDG_ECLASS_ICONFILES=()
+ while IFS= read -r -d '' f; do
+ XDG_ECLASS_ICONFILES+=( ${f} )
+ done < <(cd "${ED}" && find 'usr/share/icons' -type f -print0 2>/dev/null)
XDG_ECLASS_MIMEINFOFILES=()
while IFS= read -r -d '' f; do
XDG_ECLASS_MIMEINFOFILES+=( ${f} )
- done < <(cd "${D}" && find 'usr/share/mime' -type f -print0 2>/dev/null)
-
- export XDG_ECLASS_DESKTOPFILES XDG_ECLASS_MIMEINFOFILES
+ done < <(cd "${ED}" && find 'usr/share/mime' -type f -print0 2>/dev/null)
}
# @FUNCTION: xdg_pkg_postinst
# @DESCRIPTION:
-# Handle desktop and mime info database updates.
+# Handle desktop, icon and mime info database updates.
xdg_pkg_postinst() {
if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
xdg_desktop_database_update
@@ -69,6 +72,12 @@ xdg_pkg_postinst() {
debug-print "No .desktop files to add to database"
fi
+ if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
+ xdg_icon_cache_update
+ else
+ debug-print "No icon files to add to cache"
+ fi
+
if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
xdg_mimeinfo_database_update
else
@@ -78,7 +87,7 @@ xdg_pkg_postinst() {
# @FUNCTION: xdg_pkg_postrm
# @DESCRIPTION:
-# Handle desktop and mime info database updates.
+# Handle desktop, icon and mime info database updates.
xdg_pkg_postrm() {
if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
xdg_desktop_database_update
@@ -86,6 +95,12 @@ xdg_pkg_postrm() {
debug-print "No .desktop files to add to database"
fi
+ if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
+ xdg_icon_cache_update
+ else
+ debug-print "No icon files to add to cache"
+ fi
+
if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
xdg_mimeinfo_database_update
else