* [gentoo-dev] [PATCH] font.eclass: Port to EAPI-7
@ 2019-03-24 17:17 Andreas Sturmlechner
2019-03-24 18:41 ` Michał Górny
0 siblings, 1 reply; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-03-24 17:17 UTC (permalink / raw
To: gentoo-dev
---
eclass/font.eclass | 57 +++++++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 29 deletions(-)
diff --git a/eclass/font.eclass b/eclass/font.eclass
index 58ec9e3..622f143 100644
--- a/eclass/font.eclass
+++ b/eclass/font.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: font.eclass
@@ -7,12 +7,11 @@
# @BLURB: Eclass to make font installation uniform
case ${EAPI:-0} in
- 0|1|2|3|4|5|6) ;;
- *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
+ 0|1|2|3|4|5|6) inherit eutils ;;
+ 7) ;;
+ *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
esac
-inherit eutils
-
EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
# @ECLASS-VARIABLE: FONT_SUFFIX
@@ -68,12 +67,12 @@ font_xfont_config() {
if has X ${IUSE//+} && use X ; then
dir_name="${1:-${FONT_PN}}"
ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
- rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
- mkfontscale "${ED}${FONTDIR}/${1//${S}/}"
+ rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
+ mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}"
mkfontdir \
-e ${EPREFIX}/usr/share/fonts/encodings \
-e ${EPREFIX}/usr/share/fonts/encodings/large \
- "${ED}${FONTDIR}/${1//${S}/}"
+ "${ED%/}/${FONTDIR}/${1//${S}/}"
eend $?
if [[ -e fonts.alias ]] ; then
doins fonts.alias
@@ -103,7 +102,7 @@ font_cleanup_dirs() {
local d f g generated candidate otherfile
ebegin "Cleaning up font directories"
- find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
+ find -L "${EROOT%/}"/usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
candidate=false
otherfile=false
for f in "${d}"/*; do
@@ -160,7 +159,7 @@ font_pkg_setup() {
# make sure we get no collisions
# setup is not the nicest place, but preinst doesn't cut it
- [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1"
+ [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT%/}/${FONTDIR}/fonts.cache-1"
}
# @FUNCTION: font_src_install
@@ -202,36 +201,42 @@ font_src_install() {
done
}
+# @FUNCTION: _update_fontcache
+# @DESCRIPTION:
+# Updates fontcache if !prefix and media-libs/fontconfig installed
+_update_fontcache() {
+ # TODO: cleanup after <EAPI-7 is banned
+ if has_version media-libs/fontconfig && { [[ -z ${ROOT} ]] || [[ ${ROOT} == / ]] ; } then
+ ebegin "Updating global fontcache"
+ fc-cache -fs
+ eend $?
+ else
+ einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
+ fi
+}
+
# @FUNCTION: font_pkg_postinst
# @DESCRIPTION:
# The font pkg_postinst function.
font_pkg_postinst() {
# unreadable font files = fontconfig segfaults
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
+ find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 -print0 \
| xargs -0 chmod -v 0644 2>/dev/null
if [[ -n ${FONT_CONF[@]} ]]; then
local conffile
- echo
elog "The following fontconfig configuration files have been installed:"
elog
for conffile in "${FONT_CONF[@]}"; do
- if [[ -e ${EROOT}etc/fonts/conf.avail/$(basename ${conffile}) ]]; then
+ if [[ -e ${EROOT%/}/etc/fonts/conf.avail/$(basename ${conffile}) ]]; then
elog " $(basename ${conffile})"
fi
done
elog
elog "Use \`eselect fontconfig\` to enable/disable them."
- echo
fi
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
- ebegin "Updating global fontcache"
- fc-cache -fs
- eend $?
- else
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
- fi
+ _update_fontcache
}
# @FUNCTION: font_pkg_postrm
@@ -241,14 +246,8 @@ font_pkg_postrm() {
font_cleanup_dirs
# unreadable font files = fontconfig segfaults
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
+ find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 -print0 \
| xargs -0 chmod -v 0644 2>/dev/null
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
- ebegin "Updating global fontcache"
- fc-cache -fs
- eend $?
- else
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
- fi
+ _update_fontcache
}
--
2.21.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [gentoo-dev] [PATCH] font.eclass: Port to EAPI-7
2019-03-24 17:17 [gentoo-dev] [PATCH] font.eclass: Port to EAPI-7 Andreas Sturmlechner
@ 2019-03-24 18:41 ` Michał Górny
2019-04-09 19:41 ` Andreas Sturmlechner
` (3 more replies)
0 siblings, 4 replies; 20+ messages in thread
From: Michał Górny @ 2019-03-24 18:41 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 5678 bytes --]
On Sun, 2019-03-24 at 18:17 +0100, Andreas Sturmlechner wrote:
> ---
> eclass/font.eclass | 57 +++++++++++++++++++++++-----------------------
> 1 file changed, 28 insertions(+), 29 deletions(-)
-U9999, please. This is a huge eclass and probably requires more work
than you're showing us ;-).
>
> diff --git a/eclass/font.eclass b/eclass/font.eclass
> index 58ec9e3..622f143 100644
> --- a/eclass/font.eclass
> +++ b/eclass/font.eclass
> @@ -1,4 +1,4 @@
> -# Copyright 1999-2015 Gentoo Foundation
> +# Copyright 1999-2019 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
>
> # @ECLASS: font.eclass
> @@ -7,12 +7,11 @@
> # @BLURB: Eclass to make font installation uniform
>
> case ${EAPI:-0} in
> - 0|1|2|3|4|5|6) ;;
> - *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
> + 0|1|2|3|4|5|6) inherit eutils ;;
> + 7) ;;
> + *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
> esac
>
> -inherit eutils
> -
> EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
>
> # @ECLASS-VARIABLE: FONT_SUFFIX
> @@ -68,12 +67,12 @@ font_xfont_config() {
> if has X ${IUSE//+} && use X ; then
> dir_name="${1:-${FONT_PN}}"
> ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
> - rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
> - mkfontscale "${ED}${FONTDIR}/${1//${S}/}"
> + rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
> + mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}"
> mkfontdir \
> -e ${EPREFIX}/usr/share/fonts/encodings \
> -e ${EPREFIX}/usr/share/fonts/encodings/large \
> - "${ED}${FONTDIR}/${1//${S}/}"
> + "${ED%/}/${FONTDIR}/${1//${S}/}"
> eend $?
> if [[ -e fonts.alias ]] ; then
> doins fonts.alias
Would it make sense to add some error handling? It seems silly to try
to do a few things, then report one $? for the last of them,
independently of whether previous actions succeeded or failed.
> @@ -103,7 +102,7 @@ font_cleanup_dirs() {
> local d f g generated candidate otherfile
>
> ebegin "Cleaning up font directories"
> - find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
> + find -L "${EROOT%/}"/usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
Move while to primary shell, and use < <(find ...).
> candidate=false
> otherfile=false
> for f in "${d}"/*; do
> @@ -160,7 +159,7 @@ font_pkg_setup() {
>
> # make sure we get no collisions
> # setup is not the nicest place, but preinst doesn't cut it
> - [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1"
> + [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT%/}/${FONTDIR}/fonts.cache-1"
What's the point of checking the existence, if you pass '-f' to rm
anyway?
> }
>
> # @FUNCTION: font_src_install
> @@ -202,36 +201,42 @@ font_src_install() {
> done
> }
>
> +# @FUNCTION: _update_fontcache
> +# @DESCRIPTION:
> +# Updates fontcache if !prefix and media-libs/fontconfig installed
> +_update_fontcache() {
> + # TODO: cleanup after <EAPI-7 is banned
> + if has_version media-libs/fontconfig && { [[ -z ${ROOT} ]] || [[ ${ROOT} == / ]] ; } then
[[ -z ${ROOT} || ${ROOT} == / ]] is valid in bash.
[[ -z ${ROOT%/} ]] is shorter.
> + ebegin "Updating global fontcache"
> + fc-cache -fs
> + eend $?
> + else
> + einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
> + fi
> +}
> +
> # @FUNCTION: font_pkg_postinst
> # @DESCRIPTION:
> # The font pkg_postinst function.
> font_pkg_postinst() {
> # unreadable font files = fontconfig segfaults
> - find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
> + find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 -print0 \
> | xargs -0 chmod -v 0644 2>/dev/null
find ... -exec chmod ... {} +
>
> if [[ -n ${FONT_CONF[@]} ]]; then
> local conffile
> - echo
> elog "The following fontconfig configuration files have been installed:"
> elog
> for conffile in "${FONT_CONF[@]}"; do
> - if [[ -e ${EROOT}etc/fonts/conf.avail/$(basename ${conffile}) ]]; then
> + if [[ -e ${EROOT%/}/etc/fonts/conf.avail/$(basename ${conffile}) ]]; then
Don't call basename if you can do the same via ${conffile##*/}.
> elog " $(basename ${conffile})"
> fi
> done
> elog
> elog "Use \`eselect fontconfig\` to enable/disable them."
> - echo
> fi
>
> - if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
> - ebegin "Updating global fontcache"
> - fc-cache -fs
> - eend $?
> - else
> - einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
> - fi
> + _update_fontcache
> }
>
> # @FUNCTION: font_pkg_postrm
> @@ -241,14 +246,8 @@ font_pkg_postrm() {
> font_cleanup_dirs
>
> # unreadable font files = fontconfig segfaults
> - find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
> + find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 -print0 \
> | xargs -0 chmod -v 0644 2>/dev/null
Likewise. Also, wouldn't it make sense to put it inside
_update_fontcache()? It seems identical here and in postinst.
>
> - if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
> - ebegin "Updating global fontcache"
> - fc-cache -fs
> - eend $?
> - else
> - einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
> - fi
> + _update_fontcache
> }
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [gentoo-dev] [PATCH] font.eclass: Port to EAPI-7
2019-03-24 18:41 ` Michał Górny
@ 2019-04-09 19:41 ` Andreas Sturmlechner
2019-04-10 13:21 ` Michał Górny
2019-07-08 20:14 ` [gentoo-dev] [PATCH] profiles: desktop: Add USE icu to make.defaults Andreas Sturmlechner
` (2 subsequent siblings)
3 siblings, 1 reply; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-04-09 19:41 UTC (permalink / raw
To: gentoo-dev
On Sonntag, 24. März 2019 19:41:24 CEST Michał Górny wrote:
> -U9999, please. This is a huge eclass and probably requires more work
> than you're showing us ;-).
As requested, without any changes to v2 - and if this does not receive
a reply I'll assume silent ack by fonts proj.
--- a/eclass/font.eclass 2019-04-04 08:28:12.336171811 +0200
+++ b/eclass/font.eclass 2019-03-25 20:34:15.306062926 +0100
@@ -1,254 +1,257 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: font.eclass
# @MAINTAINER:
# fonts@gentoo.org
# @BLURB: Eclass to make font installation uniform
case ${EAPI:-0} in
- 0|1|2|3|4|5|6) ;;
- *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
+ 0|1|2|3|4|5|6) inherit eutils ;;
+ 7) ;;
+ *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
esac
-inherit eutils
-
EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
# @ECLASS-VARIABLE: FONT_SUFFIX
# @DEFAULT_UNSET
# @REQUIRED
# @DESCRIPTION:
# Space delimited list of font suffixes to install.
FONT_SUFFIX=${FONT_SUFFIX:-}
# @ECLASS-VARIABLE: FONT_S
# @REQUIRED
# @DESCRIPTION:
# Space delimited list of directories containing the fonts.
FONT_S=${FONT_S:-${S}}
# @ECLASS-VARIABLE: FONT_PN
# @DESCRIPTION:
# Font name (ie. last part of FONTDIR).
FONT_PN=${FONT_PN:-${PN}}
# @ECLASS-VARIABLE: FONTDIR
# @DESCRIPTION:
# Full path to installation directory.
FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}}
# @ECLASS-VARIABLE: FONT_CONF
# @DEFAULT_UNSET
# @DESCRIPTION:
# Array containing fontconfig conf files to install.
FONT_CONF=( "" )
# @ECLASS-VARIABLE: DOCS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Space delimited list of docs to install.
# We always install these:
# COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt
DOCS=${DOCS:-}
IUSE="X"
DEPEND="X? (
|| ( >=x11-apps/mkfontscale-1.2.0 x11-apps/mkfontdir )
media-fonts/encodings
)"
RDEPEND=""
# @FUNCTION: font_xfont_config
# @DESCRIPTION:
# Generate Xorg font files (mkfontscale/mkfontdir).
font_xfont_config() {
local dir_name
if has X ${IUSE//+} && use X ; then
dir_name="${1:-${FONT_PN}}"
+ rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} \
+ || die "failed to prepare ${FONTDIR}/${1//${S}/}"
ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
- rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
- mkfontscale "${ED}${FONTDIR}/${1//${S}/}"
+ mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.scale"
mkfontdir \
-e ${EPREFIX}/usr/share/fonts/encodings \
-e ${EPREFIX}/usr/share/fonts/encodings/large \
- "${ED}${FONTDIR}/${1//${S}/}"
- eend $?
- if [[ -e fonts.alias ]] ; then
- doins fonts.alias
+ "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.dir"
+ if ! eend $? ; then
+ die "failed to run mkfontscale or mkfontdir"
fi
+ [[ -e fonts.alias ]] && doins fonts.alias
fi
}
# @FUNCTION: font_fontconfig
# @DESCRIPTION:
# Install fontconfig conf files given in FONT_CONF.
font_fontconfig() {
local conffile
if [[ -n ${FONT_CONF[@]} ]]; then
insinto /etc/fonts/conf.avail/
for conffile in "${FONT_CONF[@]}"; do
[[ -e ${conffile} ]] && doins ${conffile}
done
fi
}
# @FUNCTION: font_cleanup_dirs
# @DESCRIPTION:
# Remove font directories containing only generated files.
font_cleanup_dirs() {
local genfiles="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
# fonts.alias isn't generated but it's a special case (see below).
local d f g generated candidate otherfile
ebegin "Cleaning up font directories"
- find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
+ while read d; do
candidate=false
otherfile=false
for f in "${d}"/*; do
generated=false
# make sure this is a file and not a subdir
[[ -e ${f} || -L ${f} ]] || continue
for g in ${genfiles}; do
if [[ ${f##*/} == ${g} ]]; then
# this is a generated file
generated=true
break
fi
done
# if the file is a generated file then we know this is a font dir (as
# opposed to something like encodings or util) and a candidate for
# removal. if it's not generated then it's an "otherfile".
${generated} && candidate=true || otherfile=true
# if the directory is both a candidate for removal and contains at
# least one "otherfile" then don't remove it.
[[ ${candidate} == ${otherfile} ]] && break
done
# if in the end we only have generated files, purge the directory.
if [[ ${candidate} == true && ${otherfile} == false ]]; then
# we don't want to remove fonts.alias files that were installed by
# media-fonts/font-alias. any other fonts.alias files will have
# already been unmerged with their packages.
for g in ${genfiles}; do
- [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] \
- && rm "${d}"/${g}
+ if [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] ; then
+ rm "${d}"/${g} || eerror "failed to remove ${d}/${g}"
+ fi
done
# if there's nothing left remove the directory
- find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}' \;
+ find "${d}" -maxdepth 0 -type d -empty -delete || eerror "failed to purge ${d}"
fi
- done
+ done < <(find -L "${EROOT%/}"/usr/share/fonts/ -type d -print0)
eend 0
}
# @FUNCTION: font_pkg_setup
# @DESCRIPTION:
# The font pkg_setup function.
# Collision protection and Prefix compat for eapi < 3.
font_pkg_setup() {
# Prefix compat
case ${EAPI:-0} in
0|1|2)
if ! use prefix; then
EPREFIX=
ED=${D}
EROOT=${ROOT}
[[ ${EROOT} = */ ]] || EROOT+="/"
fi
;;
esac
# make sure we get no collisions
# setup is not the nicest place, but preinst doesn't cut it
- [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1"
+ if [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] ; then
+ rm "${EROOT%/}/${FONTDIR}/fonts.cache-1" || die "failed to remove fonts.cache-1"
+ fi
}
# @FUNCTION: font_src_install
# @DESCRIPTION:
# The font src_install function.
font_src_install() {
local dir suffix commondoc
set -- ${FONT_S:-${S}}
if [[ $# -gt 1 ]]; then
# if we have multiple FONT_S elements then we want to recreate the dir
# structure
for dir in ${FONT_S}; do
pushd "${dir}" > /dev/null
insinto "${FONTDIR}/${dir//${S}/}"
for suffix in ${FONT_SUFFIX}; do
doins *.${suffix}
done
font_xfont_config "${dir}"
popd > /dev/null
done
else
pushd "${FONT_S}" > /dev/null
insinto "${FONTDIR}"
for suffix in ${FONT_SUFFIX}; do
doins *.${suffix}
done
font_xfont_config
popd > /dev/null
fi
font_fontconfig
- [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; }
+ [[ -n ${DOCS} ]] && dodoc ${DOCS}
# install common docs
for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
[[ -s ${commondoc} ]] && dodoc ${commondoc}
done
}
+# @FUNCTION: _update_fontcache
+# @DESCRIPTION:
+# Updates fontcache if !prefix and media-libs/fontconfig installed
+_update_fontcache() {
+ # unreadable font files = fontconfig segfaults
+ find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 \
+ -exec chmod -v 0644 2>/dev/null {} + || die "failed to fix font files perms"
+
+ if [[ -z ${ROOT%/} ]] ; then
+ if has_version media-libs/fontconfig ; then
+ ebegin "Updating global fontcache"
+ fc-cache -fs
+ if ! eend $? ; then
+ die "failed to update global fontcache"
+ fi
+ else
+ einfo "Skipping fontcache update (media-libs/fontconfig not installed)"
+ fi
+ else
+ einfo "Skipping fontcache update (ROOT != /)"
+ fi
+}
+
# @FUNCTION: font_pkg_postinst
# @DESCRIPTION:
# The font pkg_postinst function.
font_pkg_postinst() {
- # unreadable font files = fontconfig segfaults
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
- | xargs -0 chmod -v 0644 2>/dev/null
-
if [[ -n ${FONT_CONF[@]} ]]; then
local conffile
- echo
elog "The following fontconfig configuration files have been installed:"
elog
for conffile in "${FONT_CONF[@]}"; do
- if [[ -e ${EROOT}etc/fonts/conf.avail/$(basename ${conffile}) ]]; then
- elog " $(basename ${conffile})"
+ if [[ -e "${EROOT%/}"/etc/fonts/conf.avail/${conffile##*/} ]]; then
+ elog " ${conffile##*/}"
fi
done
elog
elog "Use \`eselect fontconfig\` to enable/disable them."
- echo
fi
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
- ebegin "Updating global fontcache"
- fc-cache -fs
- eend $?
- else
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
- fi
+ _update_fontcache
}
# @FUNCTION: font_pkg_postrm
# @DESCRIPTION:
# The font pkg_postrm function.
font_pkg_postrm() {
font_cleanup_dirs
-
- # unreadable font files = fontconfig segfaults
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
- | xargs -0 chmod -v 0644 2>/dev/null
-
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
- ebegin "Updating global fontcache"
- fc-cache -fs
- eend $?
- else
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
- fi
+ _update_fontcache
}
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [gentoo-dev] [PATCH] font.eclass: Port to EAPI-7
2019-04-09 19:41 ` Andreas Sturmlechner
@ 2019-04-10 13:21 ` Michał Górny
2019-10-15 21:58 ` [gentoo-dev] [PATCH v2] " Andreas Sturmlechner
` (4 more replies)
0 siblings, 5 replies; 20+ messages in thread
From: Michał Górny @ 2019-04-10 13:21 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 10804 bytes --]
On Tue, 2019-04-09 at 21:41 +0200, Andreas Sturmlechner wrote:
> On Sonntag, 24. März 2019 19:41:24 CEST Michał Górny wrote:
> > -U9999, please. This is a huge eclass and probably requires more work
> > than you're showing us ;-).
>
> As requested, without any changes to v2 - and if this does not receive
> a reply I'll assume silent ack by fonts proj.
>
>
> --- a/eclass/font.eclass 2019-04-04 08:28:12.336171811 +0200
> +++ b/eclass/font.eclass 2019-03-25 20:34:15.306062926 +0100
> @@ -1,254 +1,257 @@
> -# Copyright 1999-2015 Gentoo Foundation
> +# Copyright 1999-2019 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
>
> # @ECLASS: font.eclass
> # @MAINTAINER:
> # fonts@gentoo.org
> # @BLURB: Eclass to make font installation uniform
>
> case ${EAPI:-0} in
> - 0|1|2|3|4|5|6) ;;
> - *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
> + 0|1|2|3|4|5|6) inherit eutils ;;
> + 7) ;;
> + *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
> esac
>
> -inherit eutils
> -
> EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
>
> # @ECLASS-VARIABLE: FONT_SUFFIX
> # @DEFAULT_UNSET
> # @REQUIRED
> # @DESCRIPTION:
> # Space delimited list of font suffixes to install.
> FONT_SUFFIX=${FONT_SUFFIX:-}
>
> # @ECLASS-VARIABLE: FONT_S
> # @REQUIRED
> # @DESCRIPTION:
> # Space delimited list of directories containing the fonts.
> FONT_S=${FONT_S:-${S}}
>
> # @ECLASS-VARIABLE: FONT_PN
> # @DESCRIPTION:
> # Font name (ie. last part of FONTDIR).
> FONT_PN=${FONT_PN:-${PN}}
>
> # @ECLASS-VARIABLE: FONTDIR
> # @DESCRIPTION:
> # Full path to installation directory.
> FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}}
>
> # @ECLASS-VARIABLE: FONT_CONF
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # Array containing fontconfig conf files to install.
> FONT_CONF=( "" )
>
> # @ECLASS-VARIABLE: DOCS
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # Space delimited list of docs to install.
> # We always install these:
> # COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt
> DOCS=${DOCS:-}
>
> IUSE="X"
>
> DEPEND="X? (
> || ( >=x11-apps/mkfontscale-1.2.0 x11-apps/mkfontdir )
> media-fonts/encodings
> )"
> RDEPEND=""
>
> # @FUNCTION: font_xfont_config
> # @DESCRIPTION:
> # Generate Xorg font files (mkfontscale/mkfontdir).
> font_xfont_config() {
> local dir_name
> if has X ${IUSE//+} && use X ; then
Looks like in_iuse candidate.
> dir_name="${1:-${FONT_PN}}"
> + rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} \
> + || die "failed to prepare ${FONTDIR}/${1//${S}/}"
> ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
> - rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
> - mkfontscale "${ED}${FONTDIR}/${1//${S}/}"
> + mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.scale"
> mkfontdir \
> -e ${EPREFIX}/usr/share/fonts/encodings \
> -e ${EPREFIX}/usr/share/fonts/encodings/large \
> - "${ED}${FONTDIR}/${1//${S}/}"
> - eend $?
> - if [[ -e fonts.alias ]] ; then
> - doins fonts.alias
> + "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.dir"
> + if ! eend $? ; then
> + die "failed to run mkfontscale or mkfontdir"
...but this doesn't catch failure from mkfontscale.
> fi
> + [[ -e fonts.alias ]] && doins fonts.alias
> fi
> }
>
> # @FUNCTION: font_fontconfig
> # @DESCRIPTION:
> # Install fontconfig conf files given in FONT_CONF.
> font_fontconfig() {
> local conffile
> if [[ -n ${FONT_CONF[@]} ]]; then
> insinto /etc/fonts/conf.avail/
> for conffile in "${FONT_CONF[@]}"; do
> [[ -e ${conffile} ]] && doins ${conffile}
> done
> fi
> }
>
> # @FUNCTION: font_cleanup_dirs
> # @DESCRIPTION:
> # Remove font directories containing only generated files.
> font_cleanup_dirs() {
> local genfiles="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
> # fonts.alias isn't generated but it's a special case (see below).
> local d f g generated candidate otherfile
>
> ebegin "Cleaning up font directories"
> - find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
> + while read d; do
read -d $'\0' -r
> candidate=false
> otherfile=false
> for f in "${d}"/*; do
> generated=false
> # make sure this is a file and not a subdir
> [[ -e ${f} || -L ${f} ]] || continue
> for g in ${genfiles}; do
Could you use 'has' here?
> if [[ ${f##*/} == ${g} ]]; then
> # this is a generated file
> generated=true
> break
> fi
> done
> # if the file is a generated file then we know this is a font dir (as
> # opposed to something like encodings or util) and a candidate for
> # removal. if it's not generated then it's an "otherfile".
> ${generated} && candidate=true || otherfile=true
> # if the directory is both a candidate for removal and contains at
> # least one "otherfile" then don't remove it.
> [[ ${candidate} == ${otherfile} ]] && break
> done
> # if in the end we only have generated files, purge the directory.
> if [[ ${candidate} == true && ${otherfile} == false ]]; then
> # we don't want to remove fonts.alias files that were installed by
> # media-fonts/font-alias. any other fonts.alias files will have
> # already been unmerged with their packages.
> for g in ${genfiles}; do
> - [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] \
> - && rm "${d}"/${g}
> + if [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] ; then
> + rm "${d}"/${g} || eerror "failed to remove ${d}/${g}"
> + fi
> done
> # if there's nothing left remove the directory
> - find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}' \;
> + find "${d}" -maxdepth 0 -type d -empty -delete || eerror "failed to purge ${d}"
> fi
> - done
> + done < <(find -L "${EROOT%/}"/usr/share/fonts/ -type d -print0)
> eend 0
> }
>
> # @FUNCTION: font_pkg_setup
> # @DESCRIPTION:
> # The font pkg_setup function.
> # Collision protection and Prefix compat for eapi < 3.
> font_pkg_setup() {
> # Prefix compat
> case ${EAPI:-0} in
> 0|1|2)
> if ! use prefix; then
> EPREFIX=
> ED=${D}
> EROOT=${ROOT}
> [[ ${EROOT} = */ ]] || EROOT+="/"
> fi
> ;;
> esac
This is really ugly but I guess you can ignore it.
>
> # make sure we get no collisions
> # setup is not the nicest place, but preinst doesn't cut it
> - [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1"
> + if [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] ; then
> + rm "${EROOT%/}/${FONTDIR}/fonts.cache-1" || die "failed to remove fonts.cache-1"
> + fi
> }
>
> # @FUNCTION: font_src_install
> # @DESCRIPTION:
> # The font src_install function.
> font_src_install() {
> local dir suffix commondoc
>
> set -- ${FONT_S:-${S}}
> if [[ $# -gt 1 ]]; then
> # if we have multiple FONT_S elements then we want to recreate the dir
> # structure
> for dir in ${FONT_S}; do
> pushd "${dir}" > /dev/null
> insinto "${FONTDIR}/${dir//${S}/}"
> for suffix in ${FONT_SUFFIX}; do
> doins *.${suffix}
Old EAPIs need ||die.
> done
> font_xfont_config "${dir}"
> popd > /dev/null
> done
> else
> pushd "${FONT_S}" > /dev/null
> insinto "${FONTDIR}"
> for suffix in ${FONT_SUFFIX}; do
> doins *.${suffix}
Likewise.
> done
> font_xfont_config
> popd > /dev/null
> fi
>
> font_fontconfig
>
> - [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; }
> + [[ -n ${DOCS} ]] && dodoc ${DOCS}
I suppose this kills proper support for old EAPIs.
>
> # install common docs
> for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
> [[ -s ${commondoc} ]] && dodoc ${commondoc}
> done
> }
>
> +# @FUNCTION: _update_fontcache
> +# @DESCRIPTION:
> +# Updates fontcache if !prefix and media-libs/fontconfig installed
> +_update_fontcache() {
> + # unreadable font files = fontconfig segfaults
> + find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 \
> + -exec chmod -v 0644 2>/dev/null {} + || die "failed to fix font files perms"
> +
> + if [[ -z ${ROOT%/} ]] ; then
> + if has_version media-libs/fontconfig ; then
> + ebegin "Updating global fontcache"
> + fc-cache -fs
> + if ! eend $? ; then
> + die "failed to update global fontcache"
> + fi
> + else
> + einfo "Skipping fontcache update (media-libs/fontconfig not installed)"
> + fi
> + else
> + einfo "Skipping fontcache update (ROOT != /)"
> + fi
> +}
> +
> # @FUNCTION: font_pkg_postinst
> # @DESCRIPTION:
> # The font pkg_postinst function.
> font_pkg_postinst() {
> - # unreadable font files = fontconfig segfaults
> - find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
> - | xargs -0 chmod -v 0644 2>/dev/null
> -
> if [[ -n ${FONT_CONF[@]} ]]; then
> local conffile
> - echo
> elog "The following fontconfig configuration files have been installed:"
> elog
> for conffile in "${FONT_CONF[@]}"; do
> - if [[ -e ${EROOT}etc/fonts/conf.avail/$(basename ${conffile}) ]]; then
> - elog " $(basename ${conffile})"
> + if [[ -e "${EROOT%/}"/etc/fonts/conf.avail/${conffile##*/} ]]; then
> + elog " ${conffile##*/}"
> fi
> done
> elog
> elog "Use \`eselect fontconfig\` to enable/disable them."
> - echo
> fi
>
> - if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
> - ebegin "Updating global fontcache"
> - fc-cache -fs
> - eend $?
> - else
> - einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
> - fi
> + _update_fontcache
> }
>
> # @FUNCTION: font_pkg_postrm
> # @DESCRIPTION:
> # The font pkg_postrm function.
> font_pkg_postrm() {
> font_cleanup_dirs
> -
> - # unreadable font files = fontconfig segfaults
> - find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
> - | xargs -0 chmod -v 0644 2>/dev/null
> -
> - if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
> - ebegin "Updating global fontcache"
> - fc-cache -fs
> - eend $?
> - else
> - einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
> - fi
> + _update_fontcache
> }
>
>
>
>
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH] profiles: desktop: Add USE icu to make.defaults
2019-03-24 18:41 ` Michał Górny
2019-04-09 19:41 ` Andreas Sturmlechner
@ 2019-07-08 20:14 ` Andreas Sturmlechner
2019-07-08 20:14 ` Andreas Sturmlechner
2019-07-08 20:14 ` Andreas Sturmlechner
3 siblings, 0 replies; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-07-08 20:14 UTC (permalink / raw
To: gentoo-dev
A lot of desktop packages depend on libraries built with USE icu to work;
some, but not nearly enough are currently handled by individual package.use,
leaving users to fix default conflicts.
desktop profile should rather have it enabled globally.
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
profiles/targets/desktop/gnome/package.use | 5 +----
profiles/targets/desktop/make.defaults | 4 ++--
profiles/targets/desktop/package.use | 6 +-----
profiles/targets/desktop/plasma/package.use | 5 +----
4 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/profiles/targets/desktop/gnome/package.use b/profiles/targets/
desktop/gnome/package.use
index 508542fbefe..ab548250d83 100644
--- a/profiles/targets/desktop/gnome/package.use
+++ b/profiles/targets/desktop/gnome/package.use
@@ -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
# Needed by gnome-photos
@@ -31,9 +31,6 @@ app-accessibility/speech-dispatcher python
# Pulled in by grilo-plugins which is needed for gnome-music
media-libs/grilo playlist
-# Required for webkit-gtk-2
-media-libs/harfbuzz icu
-
# Pulled in by tracker and grilo-plugins, has REQUIRED_USE="?? ( gtk qt5 )"
media-libs/libmediaart gtk -qt5
diff --git a/profiles/targets/desktop/make.defaults b/profiles/targets/
desktop/make.defaults
index 0c404bec2b2..5724093fcef 100644
--- a/profiles/targets/desktop/make.defaults
+++ b/profiles/targets/desktop/make.defaults
@@ -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
-USE="a52 aac acpi alsa bluetooth branding cairo cdda cdr consolekit cups dbus
dri dts dvd dvdr emboss encode exif fam flac gif glamor gpm gtk jpeg lcms ldap
libnotify mad mng mp3 mp4 mpeg ogg opengl pango pdf png policykit ppds qt5 sdl
spell startup-notification svg tiff truetype vorbis udev udisks unicode upower
usb wxwidgets X xcb x264 xml xv xvid"
+USE="a52 aac acpi alsa bluetooth branding cairo cdda cdr consolekit cups dbus
dri dts dvd dvdr emboss encode exif fam flac gif glamor gpm gtk icu jpeg lcms
ldap libnotify mad mng mp3 mp4 mpeg ogg opengl pango pdf png policykit ppds
qt5 sdl spell startup-notification svg tiff truetype vorbis udev udisks
unicode upower usb wxwidgets X xcb x264 xml xv xvid"
diff --git a/profiles/targets/desktop/package.use b/profiles/targets/desktop/
package.use
index 58f08ba8704..8abcb26fc9a 100644
--- a/profiles/targets/desktop/package.use
+++ b/profiles/targets/desktop/package.use
@@ -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
# Lars Wendler <polynomial-c@gentoo.org> (2019-03-20)
@@ -22,10 +22,6 @@ app-arch/unzip natspec
dev-libs/libpcre pcre16
dev-libs/libpcre2 pcre16
-# Andreas Sturmlechner <asturm@gentoo.org> (2017-11-30)
-# Required by kde-frameworks/kcoreaddons
-dev-qt/qtcore:5 icu
-
# Andreas Sturmlechner <asturm@gentoo.org> (2017-11-30)
# Required by kde-frameworks/kwayland
dev-qt/qtgui:5 egl libinput
diff --git a/profiles/targets/desktop/plasma/package.use b/profiles/targets/
desktop/plasma/package.use
index 021d9c78a1c..4bf47736482 100644
--- a/profiles/targets/desktop/plasma/package.use
+++ b/profiles/targets/desktop/plasma/package.use
@@ -1,9 +1,6 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-# Required by >=dev-qt/qtwebengine-5.9
-dev-libs/libxml2 icu
-
# Required by app-editors/okteta
dev-qt/qtscript:5 scripttools
--
2.22.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH] profiles: desktop: Add USE icu to make.defaults
2019-03-24 18:41 ` Michał Górny
2019-04-09 19:41 ` Andreas Sturmlechner
2019-07-08 20:14 ` [gentoo-dev] [PATCH] profiles: desktop: Add USE icu to make.defaults Andreas Sturmlechner
@ 2019-07-08 20:14 ` Andreas Sturmlechner
2019-07-08 20:14 ` Andreas Sturmlechner
3 siblings, 0 replies; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-07-08 20:14 UTC (permalink / raw
To: gentoo-dev
A lot of desktop packages depend on libraries built with USE icu to work;
some, but not nearly enough are currently handled by individual package.use,
leaving users to fix default conflicts.
desktop profile should rather have it enabled globally.
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
profiles/targets/desktop/gnome/package.use | 5 +----
profiles/targets/desktop/make.defaults | 4 ++--
profiles/targets/desktop/package.use | 6 +-----
profiles/targets/desktop/plasma/package.use | 5 +----
4 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/profiles/targets/desktop/gnome/package.use b/profiles/targets/
desktop/gnome/package.use
index 508542fbefe..ab548250d83 100644
--- a/profiles/targets/desktop/gnome/package.use
+++ b/profiles/targets/desktop/gnome/package.use
@@ -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
# Needed by gnome-photos
@@ -31,9 +31,6 @@ app-accessibility/speech-dispatcher python
# Pulled in by grilo-plugins which is needed for gnome-music
media-libs/grilo playlist
-# Required for webkit-gtk-2
-media-libs/harfbuzz icu
-
# Pulled in by tracker and grilo-plugins, has REQUIRED_USE="?? ( gtk qt5 )"
media-libs/libmediaart gtk -qt5
diff --git a/profiles/targets/desktop/make.defaults b/profiles/targets/
desktop/make.defaults
index 0c404bec2b2..5724093fcef 100644
--- a/profiles/targets/desktop/make.defaults
+++ b/profiles/targets/desktop/make.defaults
@@ -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
-USE="a52 aac acpi alsa bluetooth branding cairo cdda cdr consolekit cups dbus
dri dts dvd dvdr emboss encode exif fam flac gif glamor gpm gtk jpeg lcms ldap
libnotify mad mng mp3 mp4 mpeg ogg opengl pango pdf png policykit ppds qt5 sdl
spell startup-notification svg tiff truetype vorbis udev udisks unicode upower
usb wxwidgets X xcb x264 xml xv xvid"
+USE="a52 aac acpi alsa bluetooth branding cairo cdda cdr consolekit cups dbus
dri dts dvd dvdr emboss encode exif fam flac gif glamor gpm gtk icu jpeg lcms
ldap libnotify mad mng mp3 mp4 mpeg ogg opengl pango pdf png policykit ppds
qt5 sdl spell startup-notification svg tiff truetype vorbis udev udisks
unicode upower usb wxwidgets X xcb x264 xml xv xvid"
diff --git a/profiles/targets/desktop/package.use b/profiles/targets/desktop/
package.use
index 58f08ba8704..8abcb26fc9a 100644
--- a/profiles/targets/desktop/package.use
+++ b/profiles/targets/desktop/package.use
@@ -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
# Lars Wendler <polynomial-c@gentoo.org> (2019-03-20)
@@ -22,10 +22,6 @@ app-arch/unzip natspec
dev-libs/libpcre pcre16
dev-libs/libpcre2 pcre16
-# Andreas Sturmlechner <asturm@gentoo.org> (2017-11-30)
-# Required by kde-frameworks/kcoreaddons
-dev-qt/qtcore:5 icu
-
# Andreas Sturmlechner <asturm@gentoo.org> (2017-11-30)
# Required by kde-frameworks/kwayland
dev-qt/qtgui:5 egl libinput
diff --git a/profiles/targets/desktop/plasma/package.use b/profiles/targets/
desktop/plasma/package.use
index 021d9c78a1c..4bf47736482 100644
--- a/profiles/targets/desktop/plasma/package.use
+++ b/profiles/targets/desktop/plasma/package.use
@@ -1,9 +1,6 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-# Required by >=dev-qt/qtwebengine-5.9
-dev-libs/libxml2 icu
-
# Required by app-editors/okteta
dev-qt/qtscript:5 scripttools
--
2.22.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH] profiles: desktop: Add USE icu to make.defaults
2019-03-24 18:41 ` Michał Górny
` (2 preceding siblings ...)
2019-07-08 20:14 ` Andreas Sturmlechner
@ 2019-07-08 20:14 ` Andreas Sturmlechner
3 siblings, 0 replies; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-07-08 20:14 UTC (permalink / raw
To: gentoo-dev
A lot of desktop packages depend on libraries built with USE icu to work;
some, but not nearly enough are currently handled by individual package.use,
leaving users to fix default conflicts.
desktop profile should rather have it enabled globally.
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
profiles/targets/desktop/gnome/package.use | 5 +----
profiles/targets/desktop/make.defaults | 4 ++--
profiles/targets/desktop/package.use | 6 +-----
profiles/targets/desktop/plasma/package.use | 5 +----
4 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/profiles/targets/desktop/gnome/package.use b/profiles/targets/
desktop/gnome/package.use
index 508542fbefe..ab548250d83 100644
--- a/profiles/targets/desktop/gnome/package.use
+++ b/profiles/targets/desktop/gnome/package.use
@@ -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
# Needed by gnome-photos
@@ -31,9 +31,6 @@ app-accessibility/speech-dispatcher python
# Pulled in by grilo-plugins which is needed for gnome-music
media-libs/grilo playlist
-# Required for webkit-gtk-2
-media-libs/harfbuzz icu
-
# Pulled in by tracker and grilo-plugins, has REQUIRED_USE="?? ( gtk qt5 )"
media-libs/libmediaart gtk -qt5
diff --git a/profiles/targets/desktop/make.defaults b/profiles/targets/
desktop/make.defaults
index 0c404bec2b2..5724093fcef 100644
--- a/profiles/targets/desktop/make.defaults
+++ b/profiles/targets/desktop/make.defaults
@@ -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
-USE="a52 aac acpi alsa bluetooth branding cairo cdda cdr consolekit cups dbus
dri dts dvd dvdr emboss encode exif fam flac gif glamor gpm gtk jpeg lcms ldap
libnotify mad mng mp3 mp4 mpeg ogg opengl pango pdf png policykit ppds qt5 sdl
spell startup-notification svg tiff truetype vorbis udev udisks unicode upower
usb wxwidgets X xcb x264 xml xv xvid"
+USE="a52 aac acpi alsa bluetooth branding cairo cdda cdr consolekit cups dbus
dri dts dvd dvdr emboss encode exif fam flac gif glamor gpm gtk icu jpeg lcms
ldap libnotify mad mng mp3 mp4 mpeg ogg opengl pango pdf png policykit ppds
qt5 sdl spell startup-notification svg tiff truetype vorbis udev udisks
unicode upower usb wxwidgets X xcb x264 xml xv xvid"
diff --git a/profiles/targets/desktop/package.use b/profiles/targets/desktop/
package.use
index 58f08ba8704..8abcb26fc9a 100644
--- a/profiles/targets/desktop/package.use
+++ b/profiles/targets/desktop/package.use
@@ -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
# Lars Wendler <polynomial-c@gentoo.org> (2019-03-20)
@@ -22,10 +22,6 @@ app-arch/unzip natspec
dev-libs/libpcre pcre16
dev-libs/libpcre2 pcre16
-# Andreas Sturmlechner <asturm@gentoo.org> (2017-11-30)
-# Required by kde-frameworks/kcoreaddons
-dev-qt/qtcore:5 icu
-
# Andreas Sturmlechner <asturm@gentoo.org> (2017-11-30)
# Required by kde-frameworks/kwayland
dev-qt/qtgui:5 egl libinput
diff --git a/profiles/targets/desktop/plasma/package.use b/profiles/targets/
desktop/plasma/package.use
index 021d9c78a1c..4bf47736482 100644
--- a/profiles/targets/desktop/plasma/package.use
+++ b/profiles/targets/desktop/plasma/package.use
@@ -1,9 +1,6 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-# Required by >=dev-qt/qtwebengine-5.9
-dev-libs/libxml2 icu
-
# Required by app-editors/okteta
dev-qt/qtscript:5 scripttools
--
2.22.0
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH v2] font.eclass: Port to EAPI-7
2019-04-10 13:21 ` Michał Górny
@ 2019-10-15 21:58 ` Andreas Sturmlechner
2019-10-15 22:05 ` Andreas Sturmlechner
` (3 subsequent siblings)
4 siblings, 0 replies; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-10-15 21:58 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
On Wednesday, 10 April 2019 15:21:35 CEST Michał Górny wrote:
> On Tue, 2019-04-09 at 21:41 +0200, Andreas Sturmlechner wrote:
> > On Sonntag, 24. März 2019 19:41:24 CEST Michał Górny wrote:
> > > -U9999, please. This is a huge eclass and probably requires more work
> > > than you're showing us ;-).
> >
> > As requested, without any changes to v2 - and if this does not receive
> > a reply I'll assume silent ack by fonts proj.
One more time - happy testing, and if anyone answers, font proj is invited as
well.
--- a/eclass/font.eclass
+++ b/eclass/font.eclass
@@ -4,16 +4,15 @@
# @ECLASS: font.eclass
# @MAINTAINER:
# fonts@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
# @BLURB: Eclass to make font installation uniform
case ${EAPI:-0} in
- 0|1|2|3|4|5|6) ;;
- *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
+ 0|1|2|3|4|5|6) inherit eutils ;;
+ 7) ;;
+ *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
esac
-inherit eutils
-
EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
# @ECLASS-VARIABLE: FONT_SUFFIX
@@ -67,18 +66,18 @@ fi
# Generate Xorg font files (mkfontscale/mkfontdir).
font_xfont_config() {
local dir_name
- if has X ${IUSE//+} && use X ; then
+ if in_iuse X && use X ; then
dir_name="${1:-${FONT_PN}}"
- ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
- rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.
{dir,scale},encodings.dir}
- mkfontscale "${ED}${FONTDIR}/${1//${S}/}"
+ rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.
{dir,scale},encodings.dir} \
+ || die "failed to prepare ${FONTDIR}/${1//${S}/}"
+ einfo "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
+ mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to
create fonts.scale"
mkfontdir \
-e ${EPREFIX}/usr/share/fonts/encodings \
-e ${EPREFIX}/usr/share/fonts/encodings/large \
- "${ED}${FONTDIR}/${1//${S}/}"
- eend $?
- if [[ -e fonts.alias ]] ; then
- doins fonts.alias
+ "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create
fonts.dir"
+ if [[ -e fonts.alias ]]; then
+ doins fonts.alias || die "failed to install fonts.alias" #
TODO old EAPI cleanup
fi
fi
}
@@ -91,7 +90,9 @@ font_fontconfig() {
if [[ -n ${FONT_CONF[@]} ]]; then
insinto /etc/fonts/conf.avail/
for conffile in "${FONT_CONF[@]}"; do
- [[ -e ${conffile} ]] && doins ${conffile}
+ if [[ -e ${conffile} ]]; then
+ doins ${conffile} || die "failed to install conf file"
# TODO old EAPI cleanup
+ fi
done
fi
}
@@ -105,20 +106,18 @@ font_cleanup_dirs() {
local d f g generated candidate otherfile
^ permalink raw reply [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH v2] font.eclass: Port to EAPI-7
2019-04-10 13:21 ` Michał Górny
2019-10-15 21:58 ` [gentoo-dev] [PATCH v2] " Andreas Sturmlechner
@ 2019-10-15 22:05 ` Andreas Sturmlechner
2019-10-16 6:52 ` Michał Górny
2019-10-16 12:01 ` [gentoo-dev] [PATCH 1/2] kde.org.eclass: New eclass, split from kde5.eclass Andreas Sturmlechner
` (2 subsequent siblings)
4 siblings, 1 reply; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-10-15 22:05 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
(ignore previous mail, this time hopefully not scrambled)
--- a/eclass/font.eclass
+++ b/eclass/font.eclass
@@ -4,16 +4,15 @@
# @ECLASS: font.eclass
# @MAINTAINER:
# fonts@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
# @BLURB: Eclass to make font installation uniform
case ${EAPI:-0} in
- 0|1|2|3|4|5|6) ;;
- *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
+ 0|1|2|3|4|5|6) inherit eutils ;;
+ 7) ;;
+ *) die "EAPI ${EAPI} is not supported by font.eclass." ;;
esac
-inherit eutils
-
EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
# @ECLASS-VARIABLE: FONT_SUFFIX
@@ -67,18 +66,18 @@ fi
# Generate Xorg font files (mkfontscale/mkfontdir).
font_xfont_config() {
local dir_name
- if has X ${IUSE//+} && use X ; then
+ if in_iuse X && use X ; then
dir_name="${1:-${FONT_PN}}"
- ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
- rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
- mkfontscale "${ED}${FONTDIR}/${1//${S}/}"
+ rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} \
+ || die "failed to prepare ${FONTDIR}/${1//${S}/}"
+ einfo "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
+ mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.scale"
mkfontdir \
-e ${EPREFIX}/usr/share/fonts/encodings \
-e ${EPREFIX}/usr/share/fonts/encodings/large \
- "${ED}${FONTDIR}/${1//${S}/}"
- eend $?
- if [[ -e fonts.alias ]] ; then
- doins fonts.alias
+ "${ED%/}/${FONTDIR}/${1//${S}/}" || eerror "failed to create fonts.dir"
+ if [[ -e fonts.alias ]]; then
+ doins fonts.alias || die "failed to install fonts.alias" # TODO old EAPI cleanup
fi
fi
}
@@ -91,7 +90,9 @@ font_fontconfig() {
if [[ -n ${FONT_CONF[@]} ]]; then
insinto /etc/fonts/conf.avail/
for conffile in "${FONT_CONF[@]}"; do
- [[ -e ${conffile} ]] && doins ${conffile}
+ if [[ -e ${conffile} ]]; then
+ doins ${conffile} || die "failed to install conf file" # TODO old EAPI cleanup
+ fi
done
fi
}
@@ -105,20 +106,18 @@ font_cleanup_dirs() {
local d f g generated candidate otherfile
ebegin "Cleaning up font directories"
- find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do
+ while read -d $'\0' -r; do
candidate=false
otherfile=false
for f in "${d}"/*; do
generated=false
# make sure this is a file and not a subdir
[[ -e ${f} || -L ${f} ]] || continue
- for g in ${genfiles}; do
- if [[ ${f##*/} == ${g} ]]; then
- # this is a generated file
- generated=true
- break
- fi
- done
+ if has ${f##*/} ${genfiles}; then
+ # this is a generated file
+ generated=true
+ break
+ fi
# if the file is a generated file then we know this is a font dir (as
# opposed to something like encodings or util) and a candidate for
# removal. if it's not generated then it's an "otherfile".
@@ -133,13 +132,14 @@ font_cleanup_dirs() {
# media-fonts/font-alias. any other fonts.alias files will have
# already been unmerged with their packages.
for g in ${genfiles}; do
- [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] \
- && rm "${d}"/${g}
+ if [[ ${g} != fonts.alias && ( -e ${d}/${g} || -L ${d}/${g} ) ]] ; then
+ rm "${d}"/${g} || eerror "failed to remove ${d}/${g}"
+ fi
done
# if there's nothing left remove the directory
- find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}' \;
+ find "${d}" -maxdepth 0 -type d -empty -delete || eerror "failed to purge ${d}"
fi
- done
+ done < <(find -L "${EROOT%/}"/usr/share/fonts/ -type d -print0)
eend 0
}
@@ -162,7 +162,9 @@ font_pkg_setup() {
# make sure we get no collisions
# setup is not the nicest place, but preinst doesn't cut it
- [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1"
+ if [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] ; then
+ rm "${EROOT%/}/${FONTDIR}/fonts.cache-1" || die "failed to remove fonts.cache-1"
+ fi
}
# @FUNCTION: font_src_install
@@ -179,7 +181,7 @@ font_src_install() {
pushd "${dir}" > /dev/null
insinto "${FONTDIR}/${dir//${S}/}"
for suffix in ${FONT_SUFFIX}; do
- doins *.${suffix}
+ doins *.${suffix} || die "font installation failed" # TODO old EAPI cleanup
done
font_xfont_config "${dir}"
popd > /dev/null
@@ -188,7 +190,7 @@ font_src_install() {
pushd "${FONT_S}" > /dev/null
insinto "${FONTDIR}"
for suffix in ${FONT_SUFFIX}; do
- doins *.${suffix}
+ doins *.${suffix} || die "font installation failed" # TODO old EAPI cleanup
done
font_xfont_config
popd > /dev/null
@@ -196,7 +198,7 @@ font_src_install() {
font_fontconfig
- [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; }
+ [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; } # TODO old EAPI cleanup
# install common docs
for commondoc in COPYRIGHT README{,.md,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
@@ -204,36 +206,47 @@ font_src_install() {
done
}
+# @FUNCTION: _update_fontcache
+# @DESCRIPTION:
+# Updates fontcache if !prefix and media-libs/fontconfig installed
+_update_fontcache() {
+ # unreadable font files = fontconfig segfaults
+ find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 \
+ -exec chmod -v 0644 2>/dev/null {} + || die "failed to fix font files perms"
+
+ if [[ -z ${ROOT%/} ]] ; then
+ if has_version media-libs/fontconfig ; then
+ ebegin "Updating global fontcache"
+ fc-cache -fs
+ if ! eend $? ; then
+ die "failed to update global fontcache"
+ fi
+ else
+ einfo "Skipping fontcache update (media-libs/fontconfig not installed)"
+ fi
+ else
+ einfo "Skipping fontcache update (ROOT != /)"
+ fi
+}
+
# @FUNCTION: font_pkg_postinst
# @DESCRIPTION:
# The font pkg_postinst function.
font_pkg_postinst() {
- # unreadable font files = fontconfig segfaults
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
- | xargs -0 chmod -v 0644 2>/dev/null
-
if [[ -n ${FONT_CONF[@]} ]]; then
local conffile
- echo
elog "The following fontconfig configuration files have been installed:"
elog
for conffile in "${FONT_CONF[@]}"; do
- if [[ -e ${EROOT}etc/fonts/conf.avail/$(basename ${conffile}) ]]; then
- elog " $(basename ${conffile})"
+ if [[ -e "${EROOT%/}"/etc/fonts/conf.avail/${conffile##*/} ]]; then
+ elog " ${conffile##*/}"
fi
done
elog
elog "Use \`eselect fontconfig\` to enable/disable them."
- echo
fi
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
- ebegin "Updating global fontcache"
- fc-cache -fs
- eend $?
- else
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
- fi
+ _update_fontcache
}
# @FUNCTION: font_pkg_postrm
@@ -241,16 +254,5 @@ font_pkg_postinst() {
# The font pkg_postrm function.
font_pkg_postrm() {
font_cleanup_dirs
-
- # unreadable font files = fontconfig segfaults
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
- | xargs -0 chmod -v 0644 2>/dev/null
-
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then
- ebegin "Updating global fontcache"
- fc-cache -fs
- eend $?
- else
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)"
- fi
+ _update_fontcache
}
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [gentoo-dev] [PATCH v2] font.eclass: Port to EAPI-7
2019-10-15 22:05 ` Andreas Sturmlechner
@ 2019-10-16 6:52 ` Michał Górny
0 siblings, 0 replies; 20+ messages in thread
From: Michał Górny @ 2019-10-16 6:52 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 521 bytes --]
On Wed, 2019-10-16 at 00:05 +0200, Andreas Sturmlechner wrote:
> (ignore previous mail, this time hopefully not scrambled)
>
> --- a/eclass/font.eclass
> +++ b/eclass/font.eclass
> @@ -4,16 +4,15 @@
> # @ECLASS: font.eclass
> # @MAINTAINER:
> # fonts@gentoo.org
> -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
> +# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
> # @BLURB: Eclass to make font installation uniform
>
LGTM. Good work. Please merge it, and start killing EAPI 0 ;-).
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH 1/2] kde.org.eclass: New eclass, split from kde5.eclass
2019-04-10 13:21 ` Michał Górny
2019-10-15 21:58 ` [gentoo-dev] [PATCH v2] " Andreas Sturmlechner
2019-10-15 22:05 ` Andreas Sturmlechner
@ 2019-10-16 12:01 ` Andreas Sturmlechner
2019-10-16 12:01 ` [gentoo-dev] [PATCH 2/2] kde5.eclass: Inherit kde.org.eclass and drop moved functions/vars Andreas Sturmlechner
2019-11-04 23:30 ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Andreas Sturmlechner
4 siblings, 0 replies; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-10-16 12:01 UTC (permalink / raw
To: gentoo-dev
Right now we have kde5.eclass and kde5-functions.eclass, with their structure carried over from kde4*eclass times, but the lines were blurred somewhat when minimum version requirements for the main KDE products were moved into kde5-functions.eclass at some point. Direct usage of kde5-functions.eclass was always minimal and is zero at this point.
kde5.eclass already has KDE_AUTODEPS variable to enable use of it without inheriting build system and common dependencies (but still inheriting cmake-utils.eclass). The new eclass will start to break up that joint and contain only code to fetch releases or from git for projects hosted on kde.org infrastructure, without making assumptions about a build system, and carry over some general meta variables.
Going forward, the useful bits that remain from kde5{,-functions}.eclass will be absorbed into a new, more general purpose eclass that aims to be of service to non-KDE packages using ECM (and KDE Frameworks) as well.
tl;dr:
- pkg_nofetch and src_unpack move from kde5.eclass to kde.org.eclass
- kde5.eclass inherits kde.org.eclass
- ebuilds using kde5.eclass w/ KDE_AUTODEPS=false will only inherit kde.org
- more good things to come
--- /dev/null
+++ b/eclass/kde.org.eclass
@@ -0,0 +1,241 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: kde.org.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @SUPPORTED_EAPIS: 7
+# @BLURB: Support eclass for packages that are hosted on kde.org infrastructure.
+# @DESCRIPTION:
+# This eclass is mainly providing facilities for the upstream release groups
+# Frameworks, Plasma, Applications to assemble default SRC_URI for tarballs,
+# set up git-r3.eclass for stable/master branch versions or restrict access to
+# unreleased (packager access only) tarballs in Gentoo KDE overlay, but it may
+# be also used by any other package hosted on kde.org.
+# It also contains default meta variables for settings not specific to any
+# particular build system.
+
+if [[ -z ${_KDE_ORG_ECLASS} ]]; then
+_KDE_ORG_ECLASS=1
+
+# @ECLASS-VARIABLE: KDE_BUILD_TYPE
+# @DESCRIPTION:
+# If PV matches "*9999*", this is automatically set to "live".
+# Otherwise, this is automatically set to "release".
+KDE_BUILD_TYPE="release"
+if [[ ${PV} = *9999* ]]; then
+ KDE_BUILD_TYPE="live"
+fi
+export KDE_BUILD_TYPE
+
+if [[ ${KDE_BUILD_TYPE} = live ]]; then
+ inherit git-r3
+fi
+
+EXPORT_FUNCTIONS pkg_nofetch src_unpack
+
+# @ECLASS-VARIABLE: KDE_ORG_NAME
+# @DESCRIPTION:
+# If unset, default value is set to ${PN}.
+# Name of the package as hosted on kde.org mirrors.
+: ${KDE_ORG_NAME:=$PN}
+
+# @ECLASS-VARIABLE: KDE_SELINUX_MODULE
+# @DESCRIPTION:
+# If set to "none", do nothing.
+# For any other value, add selinux to IUSE, and depending on that useflag
+# add a dependency on sec-policy/selinux-${KDE_SELINUX_MODULE} to (R)DEPEND.
+: ${KDE_SELINUX_MODULE:=none}
+
+case ${KDE_SELINUX_MODULE} in
+ none) ;;
+ *)
+ IUSE+=" selinux"
+ RDEPEND+=" selinux? ( sec-policy/selinux-${KDE_SELINUX_MODULE} )"
+ ;;
+esac
+
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+ SLOT=5/${PV}
+ [[ ${KDE_BUILD_TYPE} = release ]] && SLOT=$(ver_cut 1)/$(ver_cut 1-2)
+fi
+
+# @ECLASS-VARIABLE: KDE_UNRELEASED
+# @INTERNAL
+# @DESCRIPTION
+# An array of $CATEGORY-$PV pairs of packages that are unreleased upstream.
+# Any package matching this will have fetch restriction enabled, and receive
+# a proper error message via pkg_nofetch.
+KDE_UNRELEASED=( )
+
+HOMEPAGE="https://kde.org/"
+
+_kde_is_unreleased() {
+ local pair
+ for pair in "${KDE_UNRELEASED[@]}" ; do
+ if [[ "${pair}" = "${CATEGORY}-${PV}" ]]; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+# Determine fetch location for released tarballs
+_calculate_src_uri() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local _src_uri="mirror://kde/"
+
+ case ${CATEGORY} in
+ kde-apps)
+ case ${PV} in
+ ??.??.[6-9]? )
+ _src_uri+="unstable/applications/${PV}/src/"
+ RESTRICT+=" mirror"
+ ;;
+ *) _src_uri+="stable/applications/${PV}/src/" ;;
+ esac
+ ;;
+ kde-frameworks)
+ _src_uri+="stable/frameworks/$(ver_cut 1-2)/"
+ case ${PN} in
+ kdelibs4support | \
+ kdewebkit | \
+ khtml | \
+ kjs | \
+ kjsembed | \
+ kmediaplayer | \
+ kross)
+ _src_uri+="portingAids/"
+ ;;
+ kdesignerplugin)
+ [[ ${PV} = 5.60.* ]] || _src_uri+="portingAids/"
+ ;;
+ esac
+ ;;
+ kde-plasma)
+ case ${PV} in
+ 5.??.[6-9]? )
+ _src_uri+="unstable/plasma/$(ver_cut 1-3)/"
+ RESTRICT+=" mirror"
+ ;;
+ *) _src_uri+="stable/plasma/$(ver_cut 1-3)/" ;;
+ esac
+ ;;
+ esac
+
+ if [[ ${PN} = kdevelop* ]]; then
+ case ${PV} in
+ *.*.[6-9]? )
+ _src_uri+="unstable/kdevelop/${PV}/src/"
+ RESTRICT+=" mirror"
+ ;;
+ *) _src_uri+="stable/kdevelop/${PV}/src/" ;;
+ esac
+ fi
+
+ SRC_URI="${_src_uri}${KDE_ORG_NAME}-${PV}.tar.xz"
+
+ if _kde_is_unreleased ; then
+ RESTRICT+=" fetch"
+ fi
+}
+
+# Determine fetch location for live sources
+_calculate_live_repo() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ SRC_URI=""
+
+ # @ECLASS-VARIABLE: EGIT_MIRROR
+ # @DESCRIPTION:
+ # This variable allows easy overriding of default kde mirror service
+ # (anongit) with anything else you might want to use.
+ EGIT_MIRROR=${EGIT_MIRROR:=https://anongit.kde.org}
+
+ if [[ ${PV} == ??.??.49.9999 && ${CATEGORY} = kde-apps ]]; then
+ EGIT_BRANCH="Applications/$(ver_cut 1-2)"
+ fi
+
+ if [[ ${PV} != 9999 && ${CATEGORY} = kde-plasma ]]; then
+ EGIT_BRANCH="Plasma/$(ver_cut 1-2)"
+ fi
+
+ if [[ ${PV} != 9999 && ${PN} = kdevelop* ]]; then
+ EGIT_BRANCH="$(ver_cut 1-2)"
+ fi
+
+ # @ECLASS-VARIABLE: EGIT_REPONAME
+ # @DESCRIPTION:
+ # This variable allows overriding of default repository
+ # name. Specify only if this differs from PN and KDE_ORG_NAME.
+ EGIT_REPO_URI="${EGIT_MIRROR}/${EGIT_REPONAME:=$KDE_ORG_NAME}"
+}
+
+case ${KDE_BUILD_TYPE} in
+ live) _calculate_live_repo ;;
+ *)
+ _calculate_src_uri
+ debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
+ ;;
+esac
+
+
+if [[ ${KDE_BUILD_TYPE} = release ]]; then
+ S=${WORKDIR}/${KDE_ORG_NAME}-${PV}
+fi
+
+# @FUNCTION: kde.org_pkg_nofetch
+# @DESCRIPTION:
+# Intended for use in the KDE overlay. If this package matches something in
+# KDE_UNRELEASED, display a giant warning that the package has not yet been
+# released upstream and should not be used.
+kde.org_pkg_nofetch() {
+ if ! _kde_is_unreleased ; then
+ return
+ fi
+
+ local sched_uri="https://community.kde.org/Schedules"
+ case ${CATEGORY} in
+ kde-frameworks) sched_uri+="/Frameworks" ;;
+ kde-plasma) sched_uri+="/Plasma_5" ;;
+ kde-apps) sched_uri+="/Applications/$(ver_cut 1-2)_Release_Schedule" ;;
+ esac
+
+ eerror " _ _ _ _ ____ _____ _ _____ _ ____ _____ ____ "
+ eerror "| | | | \ | | _ \| ____| | | ____| / \ / ___|| ____| _ \ "
+ eerror "| | | | \| | |_) | _| | | | _| / _ \ \___ \| _| | | | |"
+ eerror "| |_| | |\ | _ <| |___| |___| |___ / ___ \ ___) | |___| |_| |"
+ eerror " \___/|_| \_|_| \_\_____|_____|_____/_/ \_\____/|_____|____/ "
+ eerror " "
+ eerror " ____ _ ____ _ __ _ ____ _____ "
+ eerror "| _ \ / \ / ___| |/ / / \ / ___| ____|"
+ eerror "| |_) / _ \| | | ' / / _ \| | _| _| "
+ eerror "| __/ ___ \ |___| . \ / ___ \ |_| | |___ "
+ eerror "|_| /_/ \_\____|_|\_\/_/ \_\____|_____|"
+ eerror
+ eerror "${CATEGORY}/${P} has not been released to the public yet"
+ eerror "and is only available to packagers right now."
+ eerror ""
+ eerror "This is not a bug. Please do not file bugs or contact upstream about this."
+ eerror ""
+ eerror "Please consult the upstream release schedule to see when this "
+ eerror "package is scheduled to be released:"
+ eerror "${sched_uri}"
+}
+
+# @FUNCTION: kde.org_src_unpack
+# @DESCRIPTION:
+# Unpack the sources, automatically handling both release and live ebuilds.
+kde.org_src_unpack() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ ${KDE_BUILD_TYPE} = live ]]; then
+ git-r3_src_unpack
+ else
+ default
+ fi
+}
+
+fi
^ permalink raw reply [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH 2/2] kde5.eclass: Inherit kde.org.eclass and drop moved functions/vars
2019-04-10 13:21 ` Michał Górny
` (2 preceding siblings ...)
2019-10-16 12:01 ` [gentoo-dev] [PATCH 1/2] kde.org.eclass: New eclass, split from kde5.eclass Andreas Sturmlechner
@ 2019-10-16 12:01 ` Andreas Sturmlechner
2019-11-04 23:30 ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Andreas Sturmlechner
4 siblings, 0 replies; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-10-16 12:01 UTC (permalink / raw
To: gentoo-dev
Functions moved to kde.org:
- _kde_is_unreleased
- _calculate_src_uri
- _calculate_live_repo
- kde5_pkg_nofetch
- kde5_src_unpack
Variables moved to kde.org:
- KDE_BUILD_TYPE
- KDE_SELINUX_MODULE
- KDE_UNRELEASED
- HOMEPAGE
Variables deprecated:
- KDE_SUBSLOT (define SLOT in ebuild)
- KMNAME (use KDE_ORG_NAME in kde.org.eclass instead)
--- a/eclass/kde5.eclass
+++ b/eclass/kde5.eclass
@@ -25,6 +25,12 @@
if [[ -z ${_KDE5_ECLASS} ]]; then
_KDE5_ECLASS=1
+# Propagate KMNAME to kde.org.eclass
+# PORTING: Use KDE_ORG_NAME from kde.org.eclass instead
+if [[ -z ${KDE_ORG_NAME} ]]; then
+ KDE_ORG_NAME=${KMNAME:=$PN}
+fi
+
# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
# @DESCRIPTION:
# For proper description see virtualx.eclass manpage.
@@ -32,17 +38,13 @@ _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 xdg
-
-if [[ ${KDE_BUILD_TYPE} = live ]]; then
- inherit git-r3
-fi
+inherit cmake-utils flag-o-matic kde.org kde5-functions virtualx xdg
if [[ -v KDE_GCC_MINIMAL ]]; then
EXPORT_FUNCTIONS pkg_pretend
fi
-EXPORT_FUNCTIONS pkg_setup pkg_nofetch src_unpack src_prepare src_configure
src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test
src_install pkg_preinst pkg_postinst pkg_postrm
# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS
# @DESCRIPTION:
@@ -127,37 +129,19 @@ if [[ ${CATEGORY} = kde-frameworks ]]; then
fi
: ${KDE_TEST:=false}
-# @ECLASS-VARIABLE: KDE_SELINUX_MODULE
-# @DESCRIPTION:
-# If set to "none", do nothing.
-# For any other value, add selinux to IUSE, and depending on that useflag
-# add a dependency on sec-policy/selinux-${KDE_SELINUX_MODULE} to (R)DEPEND.
-: ${KDE_SELINUX_MODULE:=none}
-
# @ECLASS-VARIABLE: KDE_SUBSLOT
# @DESCRIPTION:
# If set to "false", do nothing.
# If set to "true", add a subslot to the package, where subslot is either
# defined as major.minor version for kde-*/ categories or ${PV} if other.
# For any other value, that value will be used as subslot.
+# PORTING: no replacement, define in ebuild
: ${KDE_SUBSLOT:=false}
-# @ECLASS-VARIABLE: KDE_UNRELEASED
-# @INTERNAL
-# @DESCRIPTION
-# An array of $CATEGORY-$PV pairs of packages that are unreleased upstream.
-# Any package matching this will have fetch restriction enabled, and receive
-# a proper error message via pkg_nofetch.
-KDE_UNRELEASED=( )
-
-HOMEPAGE="https://kde.org/"
+# PORTING: LICENSE no longer set by eclass, define in ebuild
LICENSE="GPL-2"
-
-SLOT=5
-
-if [[ ${CATEGORY} = kde-frameworks ]]; then
- KDE_SUBSLOT=true
-fi
+# PORTING: SLOT no longer set by eclass except for kde-frameworks
+[[ ${CATEGORY} = kde-frameworks ]] || SLOT=5
case ${KDE_SUBSLOT} in
false) ;;
@@ -245,154 +229,10 @@ case ${KDE_TEST} in
;;
esac
-case ${KDE_SELINUX_MODULE} in
- none) ;;
- *)
- IUSE+=" selinux"
- RDEPEND+=" selinux? ( sec-policy/selinux-${KDE_SELINUX_MODULE} )"
- ;;
-esac
-
DEPEND+=" ${COMMONDEPEND}"
RDEPEND+=" ${COMMONDEPEND}"
unset COMMONDEPEND
-if [[ -n ${KMNAME} && ${KMNAME} != ${PN} && ${KDE_BUILD_TYPE} = release ]];
then
- S=${WORKDIR}/${KMNAME}-${PV}
-fi
-
-_kde_is_unreleased() {
- local pair
- for pair in "${KDE_UNRELEASED[@]}" ; do
- if [[ "${pair}" = "${CATEGORY}-${PV}" ]]; then
- return 0
- fi
- done
-
- return 1
-}
-
-# Determine fetch location for released tarballs
-_calculate_src_uri() {
- debug-print-function ${FUNCNAME} "$@"
-
- local _kmname
-
- if [[ -n ${KMNAME} ]]; then
- _kmname=${KMNAME}
- else
- _kmname=${PN}
- fi
-
- case ${PN} in
- kdelibs4support | \
- kdewebkit | \
- khtml | \
- kjs | \
- kjsembed | \
- kmediaplayer | \
- kross)
- _kmname="portingAids/${_kmname}"
- ;;
- kdesignerplugin)
- [[ ${PV} = 5.6[01].* ]] || _kmname="portingAids/${_kmname}"
- ;;
- esac
-
- case ${CATEGORY} in
- kde-apps)
- case ${PV} in
- ??.?.[6-9]? | ??.??.[6-9]? )
- SRC_URI="mirror://kde/unstable/applications/$
{PV}/src/${_kmname}-${PV}.tar.xz"
- RESTRICT+=" mirror"
- ;;
- *)
- SRC_URI="mirror://kde/stable/applications/${PV}/
src/${_kmname}-${PV}.tar.xz" ;;
- esac
- ;;
- kde-frameworks)
- SRC_URI="mirror://kde/stable/frameworks/${PV%.*}/${_kmname}-
${PV}.tar.xz" ;;
- kde-plasma)
- local plasmapv=$(ver_cut 1-3)
-
- case ${PV} in
- 5.?.[6-9]? | 5.??.[6-9]? )
- # Plasma 5 beta releases
- SRC_URI="mirror://kde/unstable/plasma/$
{plasmapv}/${_kmname}-${PV}.tar.xz"
- RESTRICT+=" mirror"
- ;;
- *)
- # Plasma 5 stable releases
- SRC_URI="mirror://kde/stable/plasma/${plasmapv}/
${_kmname}-${PV}.tar.xz" ;;
- esac
- ;;
- esac
-
- if [[ ${PN} = kdevelop* ]]; then
- case ${PV} in
- *.*.[6-9]? )
- SRC_URI="mirror://kde/unstable/kdevelop/${PV}/src/$
{_kmname}-${PV}.tar.xz"
- RESTRICT+=" mirror"
- ;;
- *)
- SRC_URI="mirror://kde/stable/kdevelop/${PV}/src/$
{_kmname}-${PV}.tar.xz" ;;
- esac
- fi
-
- if _kde_is_unreleased ; then
- RESTRICT+=" fetch"
- fi
-}
-
-# Determine fetch location for live sources
-_calculate_live_repo() {
- debug-print-function ${FUNCNAME} "$@"
-
- SRC_URI=""
-
- # @ECLASS-VARIABLE: EGIT_MIRROR
- # @DESCRIPTION:
- # This variable allows easy overriding of default kde mirror service
- # (anongit) with anything else you might want to use.
- EGIT_MIRROR=${EGIT_MIRROR:=https://anongit.kde.org}
-
- local _kmname
-
- # @ECLASS-VARIABLE: EGIT_REPONAME
- # @DESCRIPTION:
- # This variable allows overriding of default repository
- # name. Specify only if this differ from PN and KMNAME.
- if [[ -n ${EGIT_REPONAME} ]]; then
- # the repository and kmname different
- _kmname=${EGIT_REPONAME}
- elif [[ -n ${KMNAME} ]]; then
- _kmname=${KMNAME}
- else
- _kmname=${PN}
- fi
-
- if [[ ${PV} == ??.??.49.9999 && ${CATEGORY} = kde-apps ]]; then
- EGIT_BRANCH="Applications/$(ver_cut 1-2)"
- fi
-
- if [[ ${PV} != 9999 && ${CATEGORY} = kde-plasma ]]; then
- EGIT_BRANCH="Plasma/$(ver_cut 1-2)"
- fi
-
- if [[ ${PV} != 9999 && ${PN} = kdevelop* ]]; then
- EGIT_BRANCH="$(ver_cut 1-2)"
- fi
-
- EGIT_REPO_URI="${EGIT_MIRROR}/${_kmname}"
-}
-
-case ${KDE_BUILD_TYPE} in
- live) _calculate_live_repo ;;
- *) _calculate_src_uri ;;
-esac
-
-debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
-
# @FUNCTION: kde5_pkg_pretend
# @DESCRIPTION:
# Checks if the active compiler meets the minimum version requirements.
@@ -410,49 +250,12 @@ kde5_pkg_setup() {
_check_gcc_version
}
-# @FUNCTION: kde5_pkg_nofetch
-# @DESCRIPTION:
-# Intended for use in the KDE overlay. If this package matches something in
-# KDE_UNRELEASED, display a giant warning that the package has not yet been
-# released upstream and should not be used.
-kde5_pkg_nofetch() {
- if ! _kde_is_unreleased ; then
- return
- fi
-
- eerror " _ _ _ _ ____ _____ _ _____ _ ____ _____ ____ "
- eerror "| | | | \ | | _ \| ____| | | ____| / \ / ___|| ____| _ \ "
- eerror "| | | | \| | |_) | _| | | | _| / _ \ \___ \| _| | | | |"
- eerror "| |_| | |\ | _ <| |___| |___| |___ / ___ \ ___) | |___| |_| |"
- eerror " \___/|_| \_|_| \_\_____|_____|_____/_/ \_\____/|_____|____/ "
- eerror " "
- eerror " ____ _ ____ _ __ _ ____ _____ "
- eerror "| _ \ / \ / ___| |/ / / \ / ___| ____|"
- eerror "| |_) / _ \| | | ' / / _ \| | _| _| "
- eerror "| __/ ___ \ |___| . \ / ___ \ |_| | |___ "
- eerror "|_| /_/ \_\____|_|\_\/_/ \_\____|_____|"
- eerror
- eerror "${CATEGORY}/${P} has not been released to the public yet"
- eerror "and is only available to packagers right now."
- eerror ""
- eerror "This is not a bug. Please do not file bugs or contact upstream
about this."
- eerror ""
- eerror "Please consult the upstream release schedule to see when this "
- eerror "package is scheduled to be released:"
- eerror "https://community.kde.org/Schedules"
-}
-
# @FUNCTION: kde5_src_unpack
# @DESCRIPTION:
# Unpack the sources, automatically handling both release and live ebuilds.
kde5_src_unpack() {
debug-print-function ${FUNCNAME} "$@"
-
- if [[ ${KDE_BUILD_TYPE} = live ]]; then
- git-r3_src_unpack
- else
- default
- fi
+ kde.org_src_unpack
}
# @FUNCTION: kde5_src_prepare
^ permalink raw reply [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass
2019-04-10 13:21 ` Michał Górny
` (3 preceding siblings ...)
2019-10-16 12:01 ` [gentoo-dev] [PATCH 2/2] kde5.eclass: Inherit kde.org.eclass and drop moved functions/vars Andreas Sturmlechner
@ 2019-11-04 23:30 ` Andreas Sturmlechner
2019-11-04 23:37 ` [gentoo-dev] [PATCH 2/3] kde5.eclass: Inherit ecm-utils.eclass and drop moved functions/vars Andreas Sturmlechner
2019-11-05 21:20 ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Michał Górny
4 siblings, 2 replies; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-11-04 23:30 UTC (permalink / raw
To: gentoo-dev
Support eclass for packages that use KDE extra-cmake-modules.
This eclass is intended to streamline the creation of ebuilds for packages
that follow KDE upstream packaging conventions. It's primarily intended for
the three upstream release groups (Frameworks, Plasma, Applications) but
is also for any package that follows similar conventions.
This eclass unconditionally inherits cmake-utils.eclass and all its public
variables and helper functions (not phase functions) may be considered as part
of this eclass's API.
When used together with kde.org.eclass this will replace kde5.eclass and
kde5-functions.eclass, most of the latter is becoming obsolete.
--- /dev/null
+++ b/eclass/ecm-utils.eclass
@@ -0,0 +1,549 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: ecm-utils.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @SUPPORTED_EAPIS: 7
+# @BLURB: Support eclass for packages that use KDE extra-cmake-modules.
+# @DESCRIPTION:
+# This eclass is intended to streamline the creation of ebuilds for packages
+# that follow KDE upstream packaging conventions. It's primarily intended for
+# the three upstream release groups (Frameworks, Plasma, Applications) but
+# is also for any package that follows similar conventions.
+#
+# This eclass unconditionally inherits cmake-utils.eclass and all its public
+# variables and helper functions (not phase functions) may be considered as
part
+# of this eclass's API.
+#
+# This eclass's phase functions are not intended to be mixed and matched, so
if
+# any phase functions are overridden the version here should also be called.
+
+if [[ -z ${_ECM_UTILS_ECLASS} ]]; then
+_ECM_UTILS_ECLASS=1
+
+# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
+# @DESCRIPTION:
+# For proper description see virtualx.eclass manpage.
+# Here we redefine default value to be manual, if your package needs virtualx
+# for tests you should proceed with setting VIRTUALX_REQUIRED=test.
+: ${VIRTUALX_REQUIRED:=manual}
+
+inherit cmake-utils flag-o-matic toolchain-funcs virtualx xdg
+
+case ${EAPI} in
+ 7) ;;
+ *) die "EAPI=${EAPI:-0} is not supported" ;;
+esac
+
+if [[ -v KDE_GCC_MINIMAL ]]; then
+ EXPORT_FUNCTIONS pkg_pretend
+fi
+
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_test pkg_preinst
pkg_postinst pkg_postrm
+
+# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS
+# @DESCRIPTION:
+# If set to "false", do nothing.
+# For any other value, assume the package is using KDEInstallDirs macro and
switch
+# KDE_INSTALL_USE_QT_SYS_PATHS to ON.
+: ${ECM_KDEINSTALLDIRS:=true}
+
+# @ECLASS-VARIABLE: ECM_NONGUI
+# @DESCRIPTION:
+# If set to "false", add dependency on kde-frameworks/breeze-icons
+# or kde-frameworks/oxygen-icons and run the xdg.eclass routines for
+# pkg_preinst, pkg_postinst and pkg_postrm.
+# For any other value, do nothing.
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+ : ${ECM_NONGUI:=true}
+fi
+: ${ECM_NONGUI:=false}
+
+# @ECLASS-VARIABLE: ECM_DEBUG
+# @DESCRIPTION:
+# If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and
+# -DQT_NO_DEBUG to CPPFLAGS.
+# Otherwise, add debug to IUSE.
+: ${ECM_DEBUG:=true}
+
+# @ECLASS-VARIABLE: ECM_DESIGNERPLUGIN
+# @DESCRIPTION:
+# If set to "false", do nothing.
+# Otherwise, add "designer" to IUSE to toggle build of designer plugins
+# and add the necessary BDEPEND.
+: ${ECM_DESIGNERPLUGIN:=false}
+
+# @ECLASS-VARIABLE: ECM_EXAMPLES
+# @DESCRIPTION:
+# If set to "false", unconditionally ignore a top-level examples
subdirectory.
+# Otherwise, add "examples" to IUSE to toggle adding that subdirectory.
+: ${ECM_EXAMPLES:=false}
+
+# @ECLASS-VARIABLE: ECM_HANDBOOK
+# @DESCRIPTION:
+# If set to "false", do nothing.
+# Otherwise, add "+handbook" to IUSE, add the appropriate dependency, and let
+# KF5DocTools generate and install the handbook from docbook file(s) found in
+# ECM_HANDBOOK_DIR. However if USE handbook is disabled, disable build of
+# ECM_HANDBOOK_DIR in CMakeLists.txt.
+# If set to "optional", config with -
DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON
+# when USE=!handbook. In case package requires KF5KDELibs4Support, see next:
+# If set to "forceoptional", remove a KF5DocTools dependency from the root
+# CMakeLists.txt in addition to the above.
+: ${ECM_HANDBOOK:=false}
+
+# @ECLASS-VARIABLE: ECM_HANDBOOK_DIR
+# @DESCRIPTION:
+# Specifies the directory containing the docbook file(s) relative to ${S} to
be
+# processed by KF5DocTools (kdoctools_install) if not the default.
+: ${ECM_HANDBOOK_DIR:=doc}
+
+# @ECLASS-VARIABLE: ECM_PO_DIRS
+# @DESCRIPTION:
+# Specifies the top-level directories of l10n files relative to ${S} to be
+# processed by KF5I18n (ki18n_install) if not the default. If IUSE nls exists
+# and is disabled then disable build of these directories in CMakeLists.txt.
+: ${ECM_PO_DIRS:="po poqm"}
+
+# @ECLASS-VARIABLE: ECM_QTHELP
+# @DESCRIPTION:
+# If set to "false", do nothing.
+# Otherwise, add "doc" to IUSE, add the appropriate dependency, generate
+# and install Qt compressed help files with -DBUILD_QCH=ON when USE=doc.
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+ : ${ECM_QTHELP:=true}
+fi
+: ${ECM_QTHELP:=false}
+
+# @ECLASS-VARIABLE: ECM_TEST
+# @DESCRIPTION:
+# If set to "false", do nothing.
+# For any other value, add test to IUSE and add a dependency on dev-qt/
qttest:5.
+# If set to "optional", configure with -
DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON
+# when USE=!test.
+# If set to "forceoptional", remove a Qt5Test dependency and comment test
+# subdirs from the root CMakeLists.txt in addition to the above.
+# If set to "forceoptional-recursive", remove Qt5Test dependencies and make
+# autotest(s), unittest(s) and test(s) subdirs from *any* CMakeLists.txt in $
{S}
+# and below conditional on BUILD_TESTING. This is always meant as a short-
term
+# fix and creates ${T}/${P}-tests-optional.patch to refine and submit
upstream.
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+ : ${ECM_TEST:=true}
+fi
+: ${ECM_TEST:=false}
+
+case ${ECM_NONGUI} in
+ false)
+ # gui applications need breeze or oxygen icons for basic iconset,
bug #564838
+ RDEPEND+=" || ( kde-frameworks/breeze-icons:5 kde-frameworks/
oxygen-icons:* )"
+ ;;
+ *) ;;
+esac
+
+case ${ECM_DEBUG} in
+ false) ;;
+ *)
+ IUSE+=" debug"
+ ;;
+esac
+
+case ${ECM_DESIGNERPLUGIN} in
+ false) ;;
+ *)
+ IUSE+=" designer"
+ BDEPEND+=" designer? ( dev-qt/designer:5 )"
+ ;;
+esac
+
+# @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN
+# @DESCRIPTION:
+# If set to "false", do nothing.
+# Otherwise, add "designer" to IUSE to toggle build of designer plugins
+# and add the necessary BDEPEND.
+# TODO: drop after KDE Applications 19.08.3 removal
+: ${KDE_DESIGNERPLUGIN:=false}
+case ${KDE_DESIGNERPLUGIN} in
+ false) ;;
+ *)
+ IUSE+=" designer"
+ BDEPEND+=" designer? ( kde-frameworks/kdesignerplugin:5 )"
+ ;;
+esac
+
+case ${ECM_EXAMPLES} in
+ false) ;;
+ *)
+ IUSE+=" examples"
+ ;;
+esac
+
+case ${ECM_HANDBOOK} in
+ false) ;;
+ *)
+ IUSE+=" +handbook"
+ BDEPEND+=" handbook? ( kde-frameworks/kdoctools:5 )"
+ ;;
+esac
+
+case ${ECM_QTHELP} in
+ false) ;;
+ *)
+ IUSE+=" doc"
+ COMMONDEPEND+=" doc? ( dev-qt/qt-docs:5 )"
+ BDEPEND+=" doc? (
+ >=app-doc/doxygen-1.8.13-r1
+ dev-qt/qthelp:5
+ )"
+ ;;
+esac
+
+case ${ECM_TEST} in
+ false) ;;
+ *)
+ IUSE+=" test"
+ DEPEND+=" test? ( dev-qt/qttest:5 )"
+ RESTRICT+=" !test? ( test )"
+ ;;
+esac
+
+BDEPEND+=" >=kde-frameworks/extra-cmake-modules-5.60.0"
+RDEPEND+=" >=kde-frameworks/kf-env-4"
+COMMONDEPEND+=" dev-qt/qtcore:5"
+
+DEPEND+=" ${COMMONDEPEND}"
+RDEPEND+=" ${COMMONDEPEND}"
+unset COMMONDEPEND
+
+# @ECLASS-VARIABLE: KDE_GCC_MINIMAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Minimum version of active GCC to require. This is checked in
+# ecm-utils_pkg_pretend and ecm-utils_pkg_setup.
+
+# @FUNCTION: _check_gcc_version
+# @INTERNAL
+# @DESCRIPTION:
+# Determine if the current GCC version is acceptable, otherwise die.
+_check_gcc_version() {
+ if [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && tc-is-gcc;
then
+
+ local version=$(gcc-version)
+ local major=${version%.*}
+ local minor=${version#*.}
+ local min_major=${KDE_GCC_MINIMAL%.*}
+ local min_minor=${KDE_GCC_MINIMAL#*.}
+
+ debug-print "GCC version check activated"
+ debug-print "Version detected:"
+ debug-print " - Full: ${version}"
+ debug-print " - Major: ${major}"
+ debug-print " - Minor: ${minor}"
+ debug-print "Version required:"
+ debug-print " - Major: ${min_major}"
+ debug-print " - Minor: ${min_minor}"
+
+ [[ ${major} -lt ${min_major} ]] || \
+ ( [[ ${major} -eq ${min_major} && ${minor} -lt $
{min_minor} ]] ) \
+ && die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later is
required for this package (found ${version})."
+ fi
+}
+
+# @FUNCTION: ecm_punt_bogus_dep
+# @USAGE: <prefix> <dependency>
+# @DESCRIPTION:
+# Removes a specified dependency from a find_package call with multiple
components.
+ecm_punt_bogus_dep() {
+ local prefix=${1}
+ local dep=${2}
+
+ if [[ ! -e "CMakeLists.txt" ]]; then
+ return
+ fi
+
+ pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)"
CMakeLists.txt > "${T}/bogus${dep}"
+
+ # pcregrep returns non-zero on no matches/error
+ if [[ $? != 0 ]] ; then
+ return
+ fi
+
+ local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1)
+ local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1)
+ local last=$(( ${length} + ${first} - 1))
+
+ sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die
+
+ if [[ ${length} = 1 ]] ; then
+ sed -e "/find_package\s*(\s*${prefix}\(\s\+\(REQUIRED\|CONFIG\|
COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by kde5-functions.eclass -
/" -i CMakeLists.txt || die
+ fi
+}
+
+# @FUNCTION: ecm-utils_pkg_pretend
+# @DESCRIPTION:
+# Checks if the active compiler meets the minimum version requirements.
+# phase function is only exported if KDE_GCC_MINIMAL is defined.
+ecm-utils_pkg_pretend() {
+ debug-print-function ${FUNCNAME} "$@"
+ _check_gcc_version
+}
+
+# @FUNCTION: ecm-utils_pkg_setup
+# @DESCRIPTION:
+# Checks if the active compiler meets the minimum version requirements.
+ecm-utils_pkg_setup() {
+ debug-print-function ${FUNCNAME} "$@"
+ _check_gcc_version
+}
+
+# @FUNCTION: ecm-utils_src_prepare
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_prepare with lots of extra logic for magic
+# handling of linguas, tests, handbook etc.
+ecm-utils_src_prepare() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ cmake-utils_src_prepare
+
+ # only build examples when required
+ if ! { in_iuse examples && use examples; } ; then
+ cmake_comment_add_subdirectory examples
+ fi
+
+ # only enable handbook when required
+ if in_iuse handbook && ! use handbook ; then
+ cmake_comment_add_subdirectory ${ECM_HANDBOOK_DIR}
+
+ if [[ ${ECM_HANDBOOK} = forceoptional ]] ; then
+ punt_bogus_dep KF5 DocTools
+ sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt ||
die
+ fi
+ fi
+
+ # drop translations when nls is not wanted
+ if in_iuse nls && ! use nls ; then
+ local po
+ for po in ${ECM_PO_DIRS}; do
+ if [[ -d ${po} ]] ; then
+ rm -r ${po} || die
+ fi
+ done
+ fi
+
+ # enable only the requested translations when required
+ # always install unconditionally for kconfigwidgets - if you use
language
+ # X as system language, and there is a combobox with language names, the
+ # translated language name for language Y is taken from
+ # /usr/share/locale/Y/kf5_entry.desktop
+ if [[ -v LINGUAS && ${PN} != kconfigwidgets ]] ; then
+ local po
+ for po in ${ECM_PO_DIRS}; do
+ if [[ -d ${po} ]] ; then
+ pushd ${po} > /dev/null || die
+ local lang
+ for lang in *; do
+ if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ;
then
+ case ${lang} in
+ cmake_modules | \
+ CMakeLists.txt | \
+ ${PN}.pot) ;;
+ *) rm -r ${lang} || die ;;
+ esac
+ if [[ -e CMakeLists.txt ]] ; then
+ cmake_comment_add_subdirectory ${lang}
+ sed -e "/add_subdirectory([[:space:]]*$
{lang}\/.*[[:space:]]*)/d" \
+ -i CMakeLists.txt || die
+ fi
+ fi
+ done
+ popd > /dev/null || die
+ fi
+ done
+ fi
+
+ # only build unit tests when required
+ if ! { in_iuse test && use test; } ; then
+ if [[ ${ECM_TEST} = forceoptional ]] ; then
+ punt_bogus_dep Qt5 Test
+ # if forceoptional, also cover non-kde categories
+ cmake_comment_add_subdirectory autotests test tests
+ elif [[ ${ECM_TEST} = forceoptional-recursive ]] ; then
+ punt_bogus_dep Qt5 Test
+ local f pf="${T}/${P}"-tests-optional.patch
+ touch ${pf} || die "Failed to touch patch file"
+ for f in $(find . -type f -name "CMakeLists.txt" -exec \
+ grep -l "^\s*add_subdirectory\s*\(\s*.*\(auto|unit\)\?
tests\?\s*)\s*\)" {} \;); do
+ cp ${f} ${f}.old || die "Failed to prepare patch
origfile"
+ pushd ${f%/*} > /dev/null || die
+ punt_bogus_dep Qt5 Test
+ sed -i CMakeLists.txt -e \
+ "/^#/! s/add_subdirectory\s*\(\s*.*\(auto|
unit\)\?tests\?\s*)\s*\)/if(BUILD_TESTING)\n&\nendif()/" \
+ || die
+ popd > /dev/null || die
+ diff -Naur ${f}.old ${f} 1>>${pf}
+ rm ${f}.old || die "Failed to clean up"
+ done
+ eqawarn "Build system was modified by
ECM_TEST=forceoptional-recursive."
+ eqawarn "Unified diff file ready for pickup in:"
+ eqawarn " ${pf}"
+ eqawarn "Push it upstream to make this message go away."
+ elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma
|| ${CATEGORY} = kde-apps ]] ; then
+ cmake_comment_add_subdirectory autotests test tests
+ fi
+ fi
+
+ # in frameworks, tests = manual tests so never build them
+ if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules
]]; then
+ cmake_comment_add_subdirectory tests
+ fi
+}
+
+# @FUNCTION: ecm-utils_src_configure
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_configure with extra logic for magic handling
of
+# handbook, tests etc.
+ecm-utils_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # we rely on cmake-utils.eclass to append -DNDEBUG too
+ if in_iuse debug && ! use debug; then
+ append-cppflags -DQT_NO_DEBUG
+ fi
+
+ local cmakeargs
+
+ if in_iuse test && ! use test ; then
+ cmakeargs+=( -DBUILD_TESTING=OFF )
+
+ if [[ ${ECM_TEST} = optional ]] ; then
+ cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON )
+ fi
+ fi
+
+ if in_iuse handbook && ! use handbook && [[ ${ECM_HANDBOOK} = optional
]] ; then
+ cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON )
+ fi
+
+ if in_iuse designer && [[ ${ECM_DESIGNERPLUGIN} != false ]]; then
+ cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) )
+ fi
+
+ # TODO: drop after KDE Applications 19.08.3 removal
+ if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then
+ cmakeargs+=( $(cmake-utils_use_find_package designer
KF5DesignerPlugin) )
+ fi
+
+ if [[ ${ECM_QTHELP} != false ]]; then
+ cmakeargs+=( -DBUILD_QCH=$(usex doc) )
+ fi
+
+ if [[ ${ECM_KDEINSTALLDIRS} != false ]] ; then
+ cmakeargs+=(
+ # install mkspecs in the same directory as qt stuff
+ -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
+ # move handbook outside of doc dir, bug 667138
+ -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help"
+ )
+ fi
+
+ # allow the ebuild to override what we set here
+ mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}")
+
+ cmake-utils_src_configure
+}
+
+# @FUNCTION: ecm-utils_src_compile
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_compile. Currently doesn't do anything extra,
but
+# is included as part of the API just in case it's needed in the future.
+ecm-utils_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ cmake-utils_src_compile "$@"
+}
+
+# @FUNCTION: ecm-utils_src_test
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_test with extra logic for magic handling of
dbus
+# and virtualx.
+ecm-utils_src_test() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _test_runner() {
+ if [[ -n "${VIRTUALDBUS_TEST}" ]]; then
+ export $(dbus-launch)
+ fi
+
+ cmake-utils_src_test
+ }
+
+ # When run as normal user during ebuild development with the ebuild
command, the
+ # kde tests tend to access the session DBUS. This however is not
possible in a real
+ # emerge or on the tinderbox.
+ # > make sure it does not happen, so bad tests can be recognized and
disabled
+ unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
+
+ if [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]];
then
+ virtx _test_runner
+ else
+ _test_runner
+ fi
+
+ if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then
+ kill ${DBUS_SESSION_BUS_PID}
+ fi
+}
+
+# @FUNCTION: ecm-utils_src_install
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra,
but
+# is included as part of the API just in case it's needed in the future.
+ecm-utils_src_install() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ cmake-utils_src_install
+}
+
+# @FUNCTION: ecm-utils_pkg_preinst
+# @DESCRIPTION:
+# Sets up environment variables required in ecm-utils_pkg_postinst.
+ecm-utils_pkg_preinst() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ case ${ECM_NONGUI} in
+ false) xdg_pkg_preinst ;;
+ *) ;;
+ esac
+}
+
+# @FUNCTION: ecm-utils_pkg_postinst
+# @DESCRIPTION:
+# Updates the various XDG caches (icon, desktop, mime) if necessary.
+ecm-utils_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ case ${ECM_NONGUI} in
+ false) xdg_pkg_postinst ;;
+ *) ;;
+ esac
+
+ if [[ -n ${_KDE_ORG_ECLASS} ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] &&
[[ ${KDE_BUILD_TYPE} = live ]]; then
+ einfo "WARNING! This is an experimental live ebuild of $
{CATEGORY}/${PN}"
+ einfo "Use it at your own risk."
+ einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this
ebuild!"
+ fi
+}
+
+# @FUNCTION: ecm-utils_pkg_postrm
+# @DESCRIPTION:
+# Updates the various XDG caches (icon, desktop, mime) if necessary.
+ecm-utils_pkg_postrm() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ case ${ECM_NONGUI} in
+ false) xdg_pkg_postrm ;;
+ *) ;;
+ esac
+}
+
+fi
^ permalink raw reply [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH 2/3] kde5.eclass: Inherit ecm-utils.eclass and drop moved functions/vars
2019-11-04 23:30 ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Andreas Sturmlechner
@ 2019-11-04 23:37 ` Andreas Sturmlechner
2019-11-04 23:42 ` [gentoo-dev] [PATCH 3/3] kde5-functions.eclass: Drop functions/vars moved to ecm-utils Andreas Sturmlechner
2019-11-05 21:20 ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Michał Górny
1 sibling, 1 reply; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-11-04 23:37 UTC (permalink / raw
To: gentoo-dev
Functions moved to ecm-utils:
- All phase functions so far exported by kde5
Variables moved to ecm-utils:
- ECM_KDEINSTALLDIRS
- KDE_DEBUG (-> ECM_DEBUG)
- KDE_DESIGNERPLUGIN (-> split into ECM_DESIGNERPLUGIN, KDE_DESIGNERPLUGIN)
- KDE_EXAMPLES (-> ECM_EXAMPLES)
- KDE_HANDBOOK (-> ECM_HANDBOOK)
- KDE_DOC_DIR (-> ECM_HANDBOOK_DIR)
- KDE_PO_DIRS (-> ECM_PO_DIRS)
- KDE_QTHELP (-> ECM_QTHELP)
- KDE_TEST (-> ECM_TEST)
- VIRTUALX_REQUIRED
Variables deprecated:
- KDE_AUTODEPS (re-use as a switch to inherit ecm-utils or cmake-utils)
Add meta variable fallbacks in case of KDE_AUTODEPS=false;
ECM_KDEINSTALLDIRS, KDE_DEBUG, KDE_TEST were found to be in use even
with KDE_AUTODEPS disabled.
--- a/eclass/kde5.eclass
+++ b/eclass/kde5.eclass
@@ -31,27 +31,7 @@ if [[ -z ${KDE_ORG_NAME} ]]; then
KDE_ORG_NAME=${KMNAME:=$PN}
fi
-# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
-# @DESCRIPTION:
-# For proper description see virtualx.eclass manpage.
-# Here we redefine default value to be manual, if your package needs virtualx
-# for tests you should proceed with setting VIRTUALX_REQUIRED=test.
-: ${VIRTUALX_REQUIRED:=manual}
-
-inherit cmake-utils flag-o-matic kde.org kde5-functions virtualx xdg
-
-if [[ -v KDE_GCC_MINIMAL ]]; then
- EXPORT_FUNCTIONS pkg_pretend
-fi
-
-EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
-
-# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS
-# @DESCRIPTION:
-# If set to "false", do nothing.
-# For any other value, assume the package is using KDEInstallDirs macro and switch
-# KDE_INSTALL_USE_QT_SYS_PATHS to ON.
-: ${ECM_KDEINSTALLDIRS:=true}
+inherit flag-o-matic kde.org kde5-functions xdg
# @ECLASS-VARIABLE: KDE_AUTODEPS
# @DESCRIPTION:
@@ -59,6 +39,7 @@ EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_in
# For any other value, add dependencies on dev-qt/qtcore:5, kde-frameworks/kf-env
# and kde-frameworks/extra-cmake-modules:5. Additionally, required blockers may
# be set depending on the value of CATEGORY.
+# PORTING: no replacement
: ${KDE_AUTODEPS:=true}
# @ECLASS-VARIABLE: KDE_DEBUG
@@ -66,6 +47,7 @@ EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_in
# If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and -DQT_NO_DEBUG
# to CPPFLAGS.
# Otherwise, add debug to IUSE.
+# PORTING: ECM_DEBUG in ecm-utils.eclass
: ${KDE_DEBUG:=true}
# @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN
@@ -73,12 +55,14 @@ EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_in
# If set to "false", do nothing.
# Otherwise, add "designer" to IUSE to toggle build of designer plugins
# and add the necessary DEPENDs.
+# PORTING: ECM_DESIGNERPLUGIN in ecm-utils.eclass
: ${KDE_DESIGNERPLUGIN:=false}
# @ECLASS-VARIABLE: KDE_EXAMPLES
# @DESCRIPTION:
# If set to "false", unconditionally ignore a top-level examples subdirectory.
# Otherwise, add "examples" to IUSE to toggle adding that subdirectory.
+# PORTING: ECM_EXAMPLES in ecm-utils.eclass
: ${KDE_EXAMPLES:=false}
# @ECLASS-VARIABLE: KDE_HANDBOOK
@@ -90,16 +74,19 @@ EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_in
# when USE=!handbook. In case package requires KF5KDELibs4Support, see next:
# If set to "forceoptional", remove a KF5DocTools dependency from the root
# CMakeLists.txt in addition to the above.
+# PORTING: ECM_HANDBOOK in ecm-utils.eclass
: ${KDE_HANDBOOK:=false}
# @ECLASS-VARIABLE: KDE_DOC_DIR
# @DESCRIPTION:
# Specifies the location of the KDE handbook if not the default.
+# PORTING: ECM_HANDBOOK_DIR in ecm-utils.eclass
: ${KDE_DOC_DIR:=doc}
# @ECLASS-VARIABLE: KDE_PO_DIRS
# @DESCRIPTION:
# Specifies the possible locations of KDE l10n files if not the default.
+# PORTING: ECM_PO_DIRS in ecm-utils.eclass
: ${KDE_PO_DIRS:="po poqm"}
# @ECLASS-VARIABLE: KDE_QTHELP
@@ -107,6 +94,7 @@ EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_in
# If set to "false", do nothing.
# Otherwise, add "doc" to IUSE, add the appropriate dependency, generate
# and install Qt compressed help files with -DBUILD_QCH=ON when USE=doc.
+# PORTING: ECM_QTHELP in ecm-utils.eclass
if [[ ${CATEGORY} = kde-frameworks ]]; then
: ${KDE_QTHELP:=true}
fi
@@ -124,6 +112,7 @@ fi
# autotest(s), unittest(s) and test(s) subdirs from *any* CMakeLists.txt in ${S}
# and below conditional on BUILD_TESTING. This is always meant as a short-term
# fix and creates ${T}/${P}-tests-optional.patch to refine and submit upstream.
+# PORTING: ECM_TEST in ecm-utils.eclass
if [[ ${CATEGORY} = kde-frameworks ]]; then
: ${KDE_TEST:=true}
fi
@@ -163,75 +152,68 @@ case ${KDE_SUBSLOT} in
esac
case ${KDE_AUTODEPS} in
- false) ;;
+ false)
+ inherit cmake-utils
+ # @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS
+ # @DESCRIPTION:
+ # If set to "false", do nothing.
+ # For any other value, assume the package is using KDEInstallDirs macro and switch
+ # KDE_INSTALL_USE_QT_SYS_PATHS to ON.
+ : ${ECM_KDEINSTALLDIRS:=true}
+ # @ECLASS-VARIABLE: KDE_DEBUG
+ # @DESCRIPTION:
+ # If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and -DQT_NO_DEBUG
+ # to CPPFLAGS.
+ # Otherwise, add debug to IUSE.
+ : ${KDE_DEBUG:=true}
+ case ${KDE_DEBUG} in
+ false) ;;
+ *)
+ IUSE+=" debug"
+ ;;
+ esac
+ # @ECLASS-VARIABLE: KDE_TEST
+ # @DESCRIPTION:
+ # If set to "false", do nothing.
+ # For any other value, add test to IUSE and add a dependency on dev-qt/qttest:5.
+ # If set to "optional", configure with -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON
+ # when USE=!test.
+ # If set to "forceoptional", remove a Qt5Test dependency and comment test
+ # subdirs from the root CMakeLists.txt in addition to the above.
+ if [[ ${CATEGORY} = kde-frameworks ]]; then
+ : ${KDE_TEST:=true}
+ fi
+ : ${KDE_TEST:=false}
+ case ${KDE_TEST} in
+ false) ;;
+ *)
+ IUSE+=" test"
+ DEPEND+=" test? ( dev-qt/qttest:5 )"
+ ;;
+ esac
+ ;;
*)
- BDEPEND+=" $(add_frameworks_dep extra-cmake-modules)"
- RDEPEND+=" >=kde-frameworks/kf-env-4"
- COMMONDEPEND+=" $(add_qt_dep qtcore)"
-
# all packages need breeze/oxygen icons for basic iconset, bug #564838
if [[ ${PN} != breeze-icons && ${PN} != oxygen-icons ]]; then
- RDEPEND+=" || ( $(add_frameworks_dep breeze-icons) kde-frameworks/oxygen-icons:* )"
+ ECM_NONGUI=false
fi
- ;;
-esac
-
-case ${KDE_DEBUG} in
- false) ;;
- *)
- IUSE+=" debug"
- ;;
-esac
-
-case ${KDE_DESIGNERPLUGIN} in
- false) ;;
- *)
- IUSE+=" designer"
- if [[ ${CATEGORY} = kde-apps && ${PV} = 19.0[48]* ]]; then
- BDEPEND+=" designer? ( $(add_frameworks_dep kdesignerplugin) )"
- else
- BDEPEND+=" designer? ( $(add_qt_dep designer) )"
+ # propagate deprecated variables to ecm-utils.eclass
+ if [[ -z ${ECM_DESIGNERPLUGIN} && ${CATEGORY} != kde-apps ]]; then
+ ECM_DESIGNERPLUGIN=${KDE_DESIGNERPLUGIN}
+ KDE_DESIGNERPLUGIN=false # use fallback var only for kde-apps
fi
-esac
-
-case ${KDE_EXAMPLES} in
- false) ;;
- *)
- IUSE+=" examples"
- ;;
-esac
-
-case ${KDE_HANDBOOK} in
- false) ;;
- *)
- IUSE+=" +handbook"
- BDEPEND+=" handbook? ( $(add_frameworks_dep kdoctools) )"
- ;;
-esac
-
-case ${KDE_QTHELP} in
- false) ;;
- *)
- IUSE+=" doc"
- COMMONDEPEND+=" doc? ( $(add_qt_dep qt-docs) )"
- BDEPEND+=" doc? (
- $(add_qt_dep qthelp)
- >=app-doc/doxygen-1.8.13-r1
- )"
- ;;
-esac
-
-case ${KDE_TEST} in
- false) ;;
- *)
- IUSE+=" test"
- DEPEND+=" test? ( $(add_qt_dep qttest) )"
+ [[ -z ${ECM_DEBUG} ]] && ECM_DEBUG=${KDE_DEBUG}
+ [[ -z ${ECM_EXAMPLES} ]] && ECM_EXAMPLES=${KDE_EXAMPLES}
+ [[ -z ${ECM_HANDBOOK} ]] && ECM_HANDBOOK=${KDE_HANDBOOK}
+ [[ -z ${ECM_HANDBOOK_DIR} ]] && ECM_HANDBOOK_DIR=${KDE_DOC_DIR}
+ [[ -z ${ECM_PO_DIRS} ]] && ECM_PO_DIRS=${KDE_PO_DIRS}
+ [[ -z ${ECM_QTHELP} ]] && ECM_QTHELP=${KDE_QTHELP}
+ [[ -z ${ECM_TEST} ]] && ECM_TEST=${KDE_TEST}
+ inherit ecm-utils
;;
esac
-DEPEND+=" ${COMMONDEPEND}"
-RDEPEND+=" ${COMMONDEPEND}"
-unset COMMONDEPEND
+EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
# @FUNCTION: kde5_pkg_pretend
# @DESCRIPTION:
@@ -239,7 +221,10 @@ unset COMMONDEPEND
# phase function is only exported if KDE_GCC_MINIMAL is defined.
kde5_pkg_pretend() {
debug-print-function ${FUNCNAME} "$@"
- _check_gcc_version
+ case ${KDE_AUTODEPS} in
+ false) ;;
+ *) ecm-utils_pkg_pretend ;;
+ esac
}
# @FUNCTION: kde5_pkg_setup
@@ -247,7 +232,10 @@ kde5_pkg_pretend() {
# Checks if the active compiler meets the minimum version requirements.
kde5_pkg_setup() {
debug-print-function ${FUNCNAME} "$@"
- _check_gcc_version
+ case ${KDE_AUTODEPS} in
+ false) ;;
+ *) ecm-utils_pkg_setup ;;
+ esac
}
# @FUNCTION: kde5_src_unpack
@@ -264,112 +252,26 @@ kde5_src_unpack() {
# handling of linguas, tests, handbook etc.
kde5_src_prepare() {
debug-print-function ${FUNCNAME} "$@"
-
- cmake-utils_src_prepare
-
- # only build examples when required
- if ! { in_iuse examples && use examples; } ; then
- cmake_comment_add_subdirectory examples
- fi
-
- # only enable handbook when required
- if in_iuse handbook && ! use handbook ; then
- cmake_comment_add_subdirectory ${KDE_DOC_DIR}
-
- if [[ ${KDE_HANDBOOK} = forceoptional ]] ; then
- punt_bogus_dep KF5 DocTools
- sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt || die
- fi
- fi
-
- # drop translations when nls is not wanted
- if in_iuse nls && ! use nls ; then
- local po
- for po in ${KDE_PO_DIRS}; do
- if [[ -d ${po} ]] ; then
- rm -r ${po} || die
- fi
- done
- fi
-
- # enable only the requested translations when required
- # always install unconditionally for kconfigwidgets - if you use language
- # X as system language, and there is a combobox with language names, the
- # translated language name for language Y is taken from /usr/share/locale/Y/kf5_entry.desktop
- if [[ -v LINGUAS && ${PN} != kconfigwidgets ]] ; then
- local po
- for po in ${KDE_PO_DIRS}; do
- if [[ -d ${po} ]] ; then
- pushd ${po} > /dev/null || die
- local lang
- for lang in *; do
- if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then
- case ${lang} in
- cmake_modules | \
- CMakeLists.txt | \
- ${PN}.pot) ;;
- *) rm -r ${lang} || die ;;
- esac
- if [[ -e CMakeLists.txt ]] ; then
- cmake_comment_add_subdirectory ${lang}
- sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:space:]]*)/d" \
- -i CMakeLists.txt || die
- fi
- fi
- done
- popd > /dev/null || die
- fi
- done
- fi
-
- if [[ ${KDE_BUILD_TYPE} = release && ${CATEGORY} != kde-apps ]] ; then
- if [[ ${KDE_HANDBOOK} != false && -d ${KDE_DOC_DIR} && -v LINGUAS ]] ; then
- pushd ${KDE_DOC_DIR} > /dev/null || die
- local lang
- for lang in *; do
- if ! has ${lang} ${LINGUAS} ; then
- cmake_comment_add_subdirectory ${lang}
- fi
- done
- popd > /dev/null || die
- fi
- fi
-
- # only build unit tests when required
- if ! { in_iuse test && use test; } ; then
- if [[ ${KDE_TEST} = forceoptional ]] ; then
- punt_bogus_dep Qt5 Test
- # if forceoptional, also cover non-kde categories
- cmake_comment_add_subdirectory autotests test tests
- elif [[ ${KDE_TEST} = forceoptional-recursive ]] ; then
- punt_bogus_dep Qt5 Test
- local f pf="${T}/${P}"-tests-optional.patch
- touch ${pf} || die "Failed to touch patch file"
- for f in $(find . -type f -name "CMakeLists.txt" -exec \
- grep -l "^\s*add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)" {} \;); do
- cp ${f} ${f}.old || die "Failed to prepare patch origfile"
- pushd ${f%/*} > /dev/null || die
+ case ${KDE_AUTODEPS} in
+ false)
+ cmake-utils_src_prepare
+ # only build unit tests when required
+ if ! { in_iuse test && use test; } ; then
+ if [[ ${KDE_TEST} = forceoptional ]] ; then
punt_bogus_dep Qt5 Test
- sed -i CMakeLists.txt -e \
- "/^#/! s/add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)/if(BUILD_TESTING)\n&\nendif()/" \
- || die
- popd > /dev/null || die
- diff -Naur ${f}.old ${f} 1>>${pf}
- rm ${f}.old || die "Failed to clean up"
- done
- eqawarn "Build system was modified by KDE_TEST=forceoptional-recursive."
- eqawarn "Unified diff file ready for pickup in:"
- eqawarn " ${pf}"
- eqawarn "Push it upstream to make this message go away."
- elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then
- cmake_comment_add_subdirectory autotests test tests
- fi
- fi
-
- # in frameworks, tests = manual tests so never build them
- if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules ]]; then
- cmake_comment_add_subdirectory tests
- fi
+ # if forceoptional, also cover non-kde categories
+ cmake_comment_add_subdirectory autotests test tests
+ elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then
+ cmake_comment_add_subdirectory autotests test tests
+ fi
+ fi
+ # in frameworks, tests = manual tests so never build them
+ if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules ]]; then
+ cmake_comment_add_subdirectory tests
+ fi
+ ;;
+ *) ecm-utils_src_prepare ;;
+ esac
}
# @FUNCTION: kde5_src_configure
@@ -378,55 +280,38 @@ kde5_src_prepare() {
# handbook, tests etc.
kde5_src_configure() {
debug-print-function ${FUNCNAME} "$@"
+ case ${KDE_AUTODEPS} in
+ false)
+ # we rely on cmake-utils.eclass to append -DNDEBUG too
+ if in_iuse debug && ! use debug; then
+ append-cppflags -DQT_NO_DEBUG
+ fi
- # we rely on cmake-utils.eclass to append -DNDEBUG too
- if in_iuse debug && ! use debug; then
- append-cppflags -DQT_NO_DEBUG
- fi
-
- local cmakeargs
-
- if in_iuse test && ! use test ; then
- cmakeargs+=( -DBUILD_TESTING=OFF )
+ local cmakeargs
- if [[ ${KDE_TEST} = optional ]] ; then
- cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON )
- fi
- fi
+ if in_iuse test && ! use test ; then
+ cmakeargs+=( -DBUILD_TESTING=OFF )
- if in_iuse handbook && ! use handbook && [[ ${KDE_HANDBOOK} = optional ]] ; then
- cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON )
- fi
-
- if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then
- if [[ ${CATEGORY} = kde-frameworks ]]; then
- cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) )
- else
- if [[ ${KDE_BUILD_TYPE} = live && ${PV} != 19.08* ]] ; then
- cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) )
- else
- cmakeargs+=( $(cmake-utils_use_find_package designer KF5DesignerPlugin) )
+ if [[ ${KDE_TEST} = optional ]] ; then
+ cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON )
+ fi
+ fi
+ if [[ ${ECM_KDEINSTALLDIRS} != false ]] ; then
+ cmakeargs+=(
+ # install mkspecs in the same directory as qt stuff
+ -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
+ # move handbook outside of doc dir, bug 667138
+ -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help"
+ )
fi
- fi
- fi
-
- if [[ ${KDE_QTHELP} != false ]]; then
- cmakeargs+=( -DBUILD_QCH=$(usex doc) )
- fi
-
- if [[ ${ECM_KDEINSTALLDIRS} != false ]] ; then
- cmakeargs+=(
- # install mkspecs in the same directory as qt stuff
- -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
- # move handbook outside of doc dir, bug 667138
- -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help"
- )
- fi
- # allow the ebuild to override what we set here
- mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}")
+ # allow the ebuild to override what we set here
+ mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}")
- cmake-utils_src_configure
+ cmake-utils_src_configure
+ ;;
+ *) ecm-utils_src_configure ;;
+ esac
}
# @FUNCTION: kde5_src_compile
@@ -435,8 +320,10 @@ kde5_src_configure() {
# is included as part of the API just in case it's needed in the future.
kde5_src_compile() {
debug-print-function ${FUNCNAME} "$@"
-
- cmake-utils_src_compile "$@"
+ case ${KDE_AUTODEPS} in
+ false) cmake-utils_src_compile ;;
+ *) ecm-utils_src_compile ;;
+ esac
}
# @FUNCTION: kde5_src_test
@@ -445,30 +332,10 @@ kde5_src_compile() {
# and virtualx.
kde5_src_test() {
debug-print-function ${FUNCNAME} "$@"
-
- _test_runner() {
- if [[ -n "${VIRTUALDBUS_TEST}" ]]; then
- export $(dbus-launch)
- fi
-
- cmake-utils_src_test
- }
-
- # When run as normal user during ebuild development with the ebuild command, the
- # kde tests tend to access the session DBUS. This however is not possible in a real
- # emerge or on the tinderbox.
- # > make sure it does not happen, so bad tests can be recognized and disabled
- unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
-
- if [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]]; then
- virtx _test_runner
- else
- _test_runner
- fi
-
- if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then
- kill ${DBUS_SESSION_BUS_PID}
- fi
+ case ${KDE_AUTODEPS} in
+ false) cmake-utils_src_test ;;
+ *) ecm-utils_src_test ;;
+ esac
}
# @FUNCTION: kde5_src_install
@@ -476,8 +343,10 @@ kde5_src_test() {
# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra.
kde5_src_install() {
debug-print-function ${FUNCNAME} "$@"
-
- cmake-utils_src_install
+ case ${KDE_AUTODEPS} in
+ false) cmake-utils_src_install ;;
+ *) ecm-utils_src_install ;;
+ esac
}
# @FUNCTION: kde5_pkg_preinst
@@ -485,8 +354,10 @@ kde5_src_install() {
# Sets up environment variables required in kde5_pkg_postinst.
kde5_pkg_preinst() {
debug-print-function ${FUNCNAME} "$@"
-
- xdg_pkg_preinst
+ case ${KDE_AUTODEPS} in
+ false) xdg_pkg_preinst ;;
+ *) ecm-utils_pkg_preinst ;;
+ esac
}
# @FUNCTION: kde5_pkg_postinst
@@ -494,17 +365,10 @@ kde5_pkg_preinst() {
# Updates the various XDG caches (icon, desktop, mime) if necessary.
kde5_pkg_postinst() {
debug-print-function ${FUNCNAME} "$@"
-
- xdg_pkg_postinst
-
- if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
- if [[ ${KDE_BUILD_TYPE} = live ]]; then
- echo
- einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}"
- einfo "Use it at your own risk."
- einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!"
- fi
- fi
+ case ${KDE_AUTODEPS} in
+ false) xdg_pkg_postinst ;;
+ *) ecm-utils_pkg_postinst ;;
+ esac
}
# @FUNCTION: kde5_pkg_postrm
@@ -512,8 +376,10 @@ kde5_pkg_postinst() {
# Updates the various XDG caches (icon, desktop, mime) if necessary.
kde5_pkg_postrm() {
debug-print-function ${FUNCNAME} "$@"
-
- xdg_pkg_postrm
+ case ${KDE_AUTODEPS} in
+ false) xdg_pkg_postrm ;;
+ *) ecm-utils_pkg_postrm ;;
+ esac
}
fi
^ permalink raw reply [flat|nested] 20+ messages in thread
* [gentoo-dev] [PATCH 3/3] kde5-functions.eclass: Drop functions/vars moved to ecm-utils
2019-11-04 23:37 ` [gentoo-dev] [PATCH 2/3] kde5.eclass: Inherit ecm-utils.eclass and drop moved functions/vars Andreas Sturmlechner
@ 2019-11-04 23:42 ` Andreas Sturmlechner
0 siblings, 0 replies; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-11-04 23:42 UTC (permalink / raw
To: gentoo-dev
Functions moved to ecm-utils:
- _check_gcc_version
- punt_bogus_dep
Variable moved to ecm-utils:
- KDE_GCC_MINIMAL
Deprecated:
- _add_category_dep()
- add_frameworks_dep()
- add_plasma_dep()
- add_kdeapps_dep()
- add_qt_dep()
--- a/eclass/kde5-functions.eclass
+++ b/eclass/kde5-functions.eclass
@@ -15,23 +15,11 @@
if [[ -z ${_KDE5_FUNCTIONS_ECLASS} ]]; then
_KDE5_FUNCTIONS_ECLASS=1
-inherit toolchain-funcs
-
case ${EAPI} in
7) ;;
*) die "EAPI=${EAPI:-0} is not supported" ;;
esac
-# @ECLASS-VARIABLE: KDE_BUILD_TYPE
-# @DESCRIPTION:
-# If PV matches "*9999*", this is automatically set to "live".
-# Otherwise, this is automatically set to "release".
-KDE_BUILD_TYPE="release"
-if [[ ${PV} = *9999* ]]; then
- KDE_BUILD_TYPE="live"
-fi
-export KDE_BUILD_TYPE
-
case ${CATEGORY} in
kde-frameworks)
[[ ${KDE_BUILD_TYPE} = live ]] && : ${FRAMEWORKS_MINIMAL:=9999}
@@ -65,40 +53,6 @@ esac
# Minimum version of KDE Applications to require. This affects add_kdeapps_dep.
: ${KDE_APPS_MINIMAL:=19.04.3}
-# @ECLASS-VARIABLE: KDE_GCC_MINIMAL
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Minimum version of active GCC to require. This is checked in kde5.eclass in
-# kde5_pkg_pretend and kde5_pkg_setup.
-
-# @FUNCTION: _check_gcc_version
-# @INTERNAL
-# @DESCRIPTION:
-# Determine if the current GCC version is acceptable, otherwise die.
-_check_gcc_version() {
- if [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && tc-is-gcc; then
-
- local version=$(gcc-version)
- local major=${version%.*}
- local minor=${version#*.}
- local min_major=${KDE_GCC_MINIMAL%.*}
- local min_minor=${KDE_GCC_MINIMAL#*.}
-
- debug-print "GCC version check activated"
- debug-print "Version detected:"
- debug-print " - Full: ${version}"
- debug-print " - Major: ${major}"
- debug-print " - Minor: ${minor}"
- debug-print "Version required:"
- debug-print " - Major: ${min_major}"
- debug-print " - Minor: ${min_minor}"
-
- [[ ${major} -lt ${min_major} ]] || \
- ( [[ ${major} -eq ${min_major} && ${minor} -lt ${min_minor} ]] ) \
- && die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later is required for this package (found ${version})."
- fi
-}
-
# @FUNCTION: _add_category_dep
# @INTERNAL
# @DESCRIPTION:
@@ -143,6 +97,7 @@ _add_category_dep() {
# The output of this should be added directly to DEPEND/RDEPEND, and may be
# wrapped in a USE conditional (but not an || conditional without an extra set
# of parentheses).
+# PORTING: no replacement
add_frameworks_dep() {
debug-print-function ${FUNCNAME} "$@"
@@ -175,6 +130,7 @@ add_frameworks_dep() {
# The output of this should be added directly to DEPEND/RDEPEND, and may be
# wrapped in a USE conditional (but not an || conditional without an extra set
# of parentheses).
+# PORTING: no replacement
add_plasma_dep() {
debug-print-function ${FUNCNAME} "$@"
@@ -207,6 +163,7 @@ add_plasma_dep() {
# The output of this should be added directly to DEPEND/RDEPEND, and may be
# wrapped in a USE conditional (but not an || conditional without an extra set
# of parentheses).
+# PORTING: no replacement
add_kdeapps_dep() {
debug-print-function ${FUNCNAME} "$@"
@@ -239,6 +196,7 @@ add_kdeapps_dep() {
# The output of this should be added directly to DEPEND/RDEPEND, and may be
# wrapped in a USE conditional (but not an || conditional without an extra set
# of parentheses).
+# PORTING: no replacement
add_qt_dep() {
debug-print-function ${FUNCNAME} "$@"
@@ -263,6 +221,7 @@ add_qt_dep() {
# @USAGE: <prefix> <dependency>
# @DESCRIPTION:
# Removes a specified dependency from a find_package call with multiple components.
+# PORTING: Use ecm_punt_bogus_dep from ecm-utils.eclass instead.
punt_bogus_dep() {
local prefix=${1}
local dep=${2}
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass
2019-11-04 23:30 ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Andreas Sturmlechner
2019-11-04 23:37 ` [gentoo-dev] [PATCH 2/3] kde5.eclass: Inherit ecm-utils.eclass and drop moved functions/vars Andreas Sturmlechner
@ 2019-11-05 21:20 ` Michał Górny
2019-11-06 1:19 ` Andreas Sturmlechner
1 sibling, 1 reply; 20+ messages in thread
From: Michał Górny @ 2019-11-05 21:20 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 14474 bytes --]
On Tue, 2019-11-05 at 00:30 +0100, Andreas Sturmlechner wrote:
> Support eclass for packages that use KDE extra-cmake-modules.
>
> This eclass is intended to streamline the creation of ebuilds for packages
> that follow KDE upstream packaging conventions. It's primarily intended for
> the three upstream release groups (Frameworks, Plasma, Applications) but
> is also for any package that follows similar conventions.
>
> This eclass unconditionally inherits cmake-utils.eclass and all its public
> variables and helper functions (not phase functions) may be considered as part
> of this eclass's API.
>
> When used together with kde.org.eclass this will replace kde5.eclass and
> kde5-functions.eclass, most of the latter is becoming obsolete.
>
> --- /dev/null
> +++ b/eclass/ecm-utils.eclass
I know we historically screwed this up repeatedly but please don't use
'-utils' for eclasses that export phases.
> @@ -0,0 +1,549 @@
> +# Copyright 1999-2019 Gentoo Authors
> +# Distributed under the terms of the GNU General Public License v2
> +
> +# @ECLASS: ecm-utils.eclass
> +# @MAINTAINER:
> +# kde@gentoo.org
> +# @SUPPORTED_EAPIS: 7
> +# @BLURB: Support eclass for packages that use KDE extra-cmake-modules.
> +# @DESCRIPTION:
> +# This eclass is intended to streamline the creation of ebuilds for packages
> +# that follow KDE upstream packaging conventions. It's primarily intended for
> +# the three upstream release groups (Frameworks, Plasma, Applications) but
> +# is also for any package that follows similar conventions.
> +#
> +# This eclass unconditionally inherits cmake-utils.eclass and all its public
> +# variables and helper functions (not phase functions) may be considered as
> part
> +# of this eclass's API.
> +#
> +# This eclass's phase functions are not intended to be mixed and matched, so
> if
> +# any phase functions are overridden the version here should also be called.
> +
> +if [[ -z ${_ECM_UTILS_ECLASS} ]]; then
> +_ECM_UTILS_ECLASS=1
> +
> +# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
> +# @DESCRIPTION:
> +# For proper description see virtualx.eclass manpage.
> +# Here we redefine default value to be manual, if your package needs virtualx
> +# for tests you should proceed with setting VIRTUALX_REQUIRED=test.
> +: ${VIRTUALX_REQUIRED:=manual}
> +
> +inherit cmake-utils flag-o-matic toolchain-funcs virtualx xdg
> +
> +case ${EAPI} in
> + 7) ;;
> + *) die "EAPI=${EAPI:-0} is not supported" ;;
> +esac
> +
> +if [[ -v KDE_GCC_MINIMAL ]]; then
> + EXPORT_FUNCTIONS pkg_pretend
> +fi
> +
> +EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_test pkg_preinst
> pkg_postinst pkg_postrm
> +
> +# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS
> +# @DESCRIPTION:
> +# If set to "false", do nothing.
> +# For any other value, assume the package is using KDEInstallDirs macro and
> switch
> +# KDE_INSTALL_USE_QT_SYS_PATHS to ON.
> +: ${ECM_KDEINSTALLDIRS:=true}
> +
> +# @ECLASS-VARIABLE: ECM_NONGUI
> +# @DESCRIPTION:
> +# If set to "false", add dependency on kde-frameworks/breeze-icons
> +# or kde-frameworks/oxygen-icons and run the xdg.eclass routines for
> +# pkg_preinst, pkg_postinst and pkg_postrm.
> +# For any other value, do nothing.
> +if [[ ${CATEGORY} = kde-frameworks ]]; then
> + : ${ECM_NONGUI:=true}
> +fi
> +: ${ECM_NONGUI:=false}
I don't think eclassdoc is going to parse this correctly.
> +
> +# @ECLASS-VARIABLE: ECM_DEBUG
> +# @DESCRIPTION:
> +# If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and
> +# -DQT_NO_DEBUG to CPPFLAGS.
> +# Otherwise, add debug to IUSE.
> +: ${ECM_DEBUG:=true}
To be honest, I don't really like this 'anything-or-false' logic. It's
rather confusing and error-prone. For example, if I misspell 'false'
the eclass is going to silently assume true.
> +
> +# @ECLASS-VARIABLE: ECM_DESIGNERPLUGIN
> +# @DESCRIPTION:
> +# If set to "false", do nothing.
> +# Otherwise, add "designer" to IUSE to toggle build of designer plugins
> +# and add the necessary BDEPEND.
> +: ${ECM_DESIGNERPLUGIN:=false}
> +
> +# @ECLASS-VARIABLE: ECM_EXAMPLES
> +# @DESCRIPTION:
> +# If set to "false", unconditionally ignore a top-level examples
> subdirectory.
> +# Otherwise, add "examples" to IUSE to toggle adding that subdirectory.
> +: ${ECM_EXAMPLES:=false}
> +
> +# @ECLASS-VARIABLE: ECM_HANDBOOK
> +# @DESCRIPTION:
> +# If set to "false", do nothing.
> +# Otherwise, add "+handbook" to IUSE, add the appropriate dependency, and let
> +# KF5DocTools generate and install the handbook from docbook file(s) found in
> +# ECM_HANDBOOK_DIR. However if USE handbook is disabled, disable build of
> +# ECM_HANDBOOK_DIR in CMakeLists.txt.
> +# If set to "optional", config with -
> DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON
> +# when USE=!handbook. In case package requires KF5KDELibs4Support, see next:
> +# If set to "forceoptional", remove a KF5DocTools dependency from the root
> +# CMakeLists.txt in addition to the above.
> +: ${ECM_HANDBOOK:=false}
> +
> +# @ECLASS-VARIABLE: ECM_HANDBOOK_DIR
> +# @DESCRIPTION:
> +# Specifies the directory containing the docbook file(s) relative to ${S} to
> be
> +# processed by KF5DocTools (kdoctools_install) if not the default.
> +: ${ECM_HANDBOOK_DIR:=doc}
> +
> +# @ECLASS-VARIABLE: ECM_PO_DIRS
> +# @DESCRIPTION:
> +# Specifies the top-level directories of l10n files relative to ${S} to be
> +# processed by KF5I18n (ki18n_install) if not the default. If IUSE nls exists
> +# and is disabled then disable build of these directories in CMakeLists.txt.
> +: ${ECM_PO_DIRS:="po poqm"}
> +
> +# @ECLASS-VARIABLE: ECM_QTHELP
> +# @DESCRIPTION:
> +# If set to "false", do nothing.
> +# Otherwise, add "doc" to IUSE, add the appropriate dependency, generate
> +# and install Qt compressed help files with -DBUILD_QCH=ON when USE=doc.
> +if [[ ${CATEGORY} = kde-frameworks ]]; then
> + : ${ECM_QTHELP:=true}
> +fi
> +: ${ECM_QTHELP:=false}
Again, I believe this and below won't be processed by eclassdoc
correctly.
> +
> +# @ECLASS-VARIABLE: ECM_TEST
> +# @DESCRIPTION:
> +# If set to "false", do nothing.
> +# For any other value, add test to IUSE and add a dependency on dev-qt/
> qttest:5.
> +# If set to "optional", configure with -
> DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON
> +# when USE=!test.
> +# If set to "forceoptional", remove a Qt5Test dependency and comment test
> +# subdirs from the root CMakeLists.txt in addition to the above.
> +# If set to "forceoptional-recursive", remove Qt5Test dependencies and make
> +# autotest(s), unittest(s) and test(s) subdirs from *any* CMakeLists.txt in $
> {S}
> +# and below conditional on BUILD_TESTING. This is always meant as a short-
> term
> +# fix and creates ${T}/${P}-tests-optional.patch to refine and submit
> upstream.
> +if [[ ${CATEGORY} = kde-frameworks ]]; then
> + : ${ECM_TEST:=true}
> +fi
> +: ${ECM_TEST:=false}
> +
> +case ${ECM_NONGUI} in
There's a @PRE_INHERIT thingie to indicate variables that need to be set
before 'inherit' to work correctly.
> + false)
> + # gui applications need breeze or oxygen icons for basic iconset,
> bug #564838
> + RDEPEND+=" || ( kde-frameworks/breeze-icons:5 kde-frameworks/
> oxygen-icons:* )"
> + ;;
> + *) ;;
> +esac
> +
> +case ${ECM_DEBUG} in
> + false) ;;
> + *)
> + IUSE+=" debug"
> + ;;
> +esac
> +
> +case ${ECM_DESIGNERPLUGIN} in
> + false) ;;
> + *)
> + IUSE+=" designer"
> + BDEPEND+=" designer? ( dev-qt/designer:5 )"
> + ;;
> +esac
> +
> +# @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN
> +# @DESCRIPTION:
> +# If set to "false", do nothing.
> +# Otherwise, add "designer" to IUSE to toggle build of designer plugins
> +# and add the necessary BDEPEND.
> +# TODO: drop after KDE Applications 19.08.3 removal
> +: ${KDE_DESIGNERPLUGIN:=false}
> +case ${KDE_DESIGNERPLUGIN} in
> + false) ;;
> + *)
> + IUSE+=" designer"
> + BDEPEND+=" designer? ( kde-frameworks/kdesignerplugin:5 )"
> + ;;
> +esac
> +
> +case ${ECM_EXAMPLES} in
> + false) ;;
> + *)
> + IUSE+=" examples"
> + ;;
> +esac
> +
> +case ${ECM_HANDBOOK} in
> + false) ;;
> + *)
> + IUSE+=" +handbook"
> + BDEPEND+=" handbook? ( kde-frameworks/kdoctools:5 )"
> + ;;
> +esac
> +
> +case ${ECM_QTHELP} in
> + false) ;;
> + *)
> + IUSE+=" doc"
> + COMMONDEPEND+=" doc? ( dev-qt/qt-docs:5 )"
> + BDEPEND+=" doc? (
> + >=app-doc/doxygen-1.8.13-r1
> + dev-qt/qthelp:5
> + )"
> + ;;
> +esac
> +
> +case ${ECM_TEST} in
> + false) ;;
> + *)
> + IUSE+=" test"
> + DEPEND+=" test? ( dev-qt/qttest:5 )"
> + RESTRICT+=" !test? ( test )"
> + ;;
> +esac
> +
> +BDEPEND+=" >=kde-frameworks/extra-cmake-modules-5.60.0"
> +RDEPEND+=" >=kde-frameworks/kf-env-4"
> +COMMONDEPEND+=" dev-qt/qtcore:5"
> +
> +DEPEND+=" ${COMMONDEPEND}"
> +RDEPEND+=" ${COMMONDEPEND}"
> +unset COMMONDEPEND
> +
> +# @ECLASS-VARIABLE: KDE_GCC_MINIMAL
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Minimum version of active GCC to require. This is checked in
> +# ecm-utils_pkg_pretend and ecm-utils_pkg_setup.
> +
> +# @FUNCTION: _check_gcc_version
Would be nice to prefix it with _ecm*.
> +# @INTERNAL
> +# @DESCRIPTION:
> +# Determine if the current GCC version is acceptable, otherwise die.
> +_check_gcc_version() {
> + if [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && tc-is-gcc;
> then
> +
> + local version=$(gcc-version)
> + local major=${version%.*}
> + local minor=${version#*.}
> + local min_major=${KDE_GCC_MINIMAL%.*}
> + local min_minor=${KDE_GCC_MINIMAL#*.}
> +
> + debug-print "GCC version check activated"
> + debug-print "Version detected:"
> + debug-print " - Full: ${version}"
> + debug-print " - Major: ${major}"
> + debug-print " - Minor: ${minor}"
> + debug-print "Version required:"
> + debug-print " - Major: ${min_major}"
> + debug-print " - Minor: ${min_minor}"
> +
> + [[ ${major} -lt ${min_major} ]] || \
> + ( [[ ${major} -eq ${min_major} && ${minor} -lt $
> {min_minor} ]] ) \
> + && die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later is
> required for this package (found ${version})."
Why not use ver_cmp from EAPI 7?
> + fi
> +}
> +
> +# @FUNCTION: ecm_punt_bogus_dep
> +# @USAGE: <prefix> <dependency>
> +# @DESCRIPTION:
> +# Removes a specified dependency from a find_package call with multiple
> components.
> +ecm_punt_bogus_dep() {
> + local prefix=${1}
> + local dep=${2}
> +
> + if [[ ! -e "CMakeLists.txt" ]]; then
Can this really ever happen in a valid use case? Maybe it should be
an error instead.
> + return
> + fi
> +
> + pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)"
> CMakeLists.txt > "${T}/bogus${dep}"
> +
> + # pcregrep returns non-zero on no matches/error
> + if [[ $? != 0 ]] ; then
-ne
> + return
> + fi
> +
> + local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1)
'wc -l < ...' and you won't have to cut.
> + local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1)
> + local last=$(( ${length} + ${first} - 1))
$(( length + first - 1 ))
> +
> + sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die
> +
> + if [[ ${length} = 1 ]] ; then
-eq
> + sed -e "/find_package\s*(\s*${prefix}\(\s\+\(REQUIRED\|CONFIG\|
> COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by kde5-functions.eclass -
> /" -i CMakeLists.txt || die
> + fi
> +}
> +
> +# @FUNCTION: ecm-utils_pkg_pretend
> +# @DESCRIPTION:
> +# Checks if the active compiler meets the minimum version requirements.
> +# phase function is only exported if KDE_GCC_MINIMAL is defined.
> +ecm-utils_pkg_pretend() {
> + debug-print-function ${FUNCNAME} "$@"
> + _check_gcc_version
> +}
> +
> +# @FUNCTION: ecm-utils_pkg_setup
> +# @DESCRIPTION:
> +# Checks if the active compiler meets the minimum version requirements.
> +ecm-utils_pkg_setup() {
> + debug-print-function ${FUNCNAME} "$@"
> + _check_gcc_version
> +}
> +
> +# @FUNCTION: ecm-utils_src_prepare
> +# @DESCRIPTION:
> +# Wrapper for cmake-utils_src_prepare with lots of extra logic for magic
> +# handling of linguas, tests, handbook etc.
> +ecm-utils_src_prepare() {
> + debug-print-function ${FUNCNAME} "$@"
> +
> + cmake-utils_src_prepare
> +
> + # only build examples when required
> + if ! { in_iuse examples && use examples; } ; then
> + cmake_comment_add_subdirectory examples
> + fi
> +
> + # only enable handbook when required
> + if in_iuse handbook && ! use handbook ; then
> + cmake_comment_add_subdirectory ${ECM_HANDBOOK_DIR}
> +
> + if [[ ${ECM_HANDBOOK} = forceoptional ]] ; then
> + punt_bogus_dep KF5 DocTools
> + sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt ||
> die
> + fi
> + fi
> +
> + # drop translations when nls is not wanted
> + if in_iuse nls && ! use nls ; then
> + local po
> + for po in ${ECM_PO_DIRS}; do
> + if [[ -d ${po} ]] ; then
Do you have a valid case for ${po} not being a directory? If not,
I think the whole thing could be simplified to:
rm -rf ${ECM_PO_DIRS}
> + rm -r ${po} || die
> + fi
> + done
> + fi
> +
> + # enable only the requested translations when required
> + # always install unconditionally for kconfigwidgets - if you use
> language
> + # X as system language, and there is a combobox with language names, the
> + # translated language name for language Y is taken from
> + # /usr/share/locale/Y/kf5_entry.desktop
> + if [[ -v LINGUAS && ${PN} != kconfigwidgets ]] ; then
> + local po
> + for po in ${ECM_PO_DIRS}; do
> + if [[ -d ${po} ]] ; then
Missing indent?
> + pushd ${po} > /dev/null || die
> + local lang
> + for lang in *; do
> + if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ;
> then
> + case ${lang} in
> + cmake_modules | \
> + CMakeLists.txt | \
> + ${PN}.pot) ;;
> + *) rm -r ${lang} || die ;;
> + esac
> + if [[ -e CMakeLists.txt ]] ; then
> + cmake_comment_add_subdirectory ${lang}
> + sed -e "/add_subdirectory([[:space:]]*$
> {lang}\/.*[[:space:]]*)/d" \
> + -i CMakeLists.txt || die
> + fi
> + fi
> + done
> + popd > /dev/null || die
> + fi
> + done
> + fi
> +
Overall, I find this whole thing disgusting and fragile but up to you.
>
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass
2019-11-05 21:20 ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Michał Górny
@ 2019-11-06 1:19 ` Andreas Sturmlechner
2019-11-06 7:15 ` Michał Górny
0 siblings, 1 reply; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-11-06 1:19 UTC (permalink / raw
To: gentoo-dev
On Tuesday, 5 November 2019 22:20:46 CET Michał Górny wrote:
> On Tue, 2019-11-05 at 00:30 +0100, Andreas Sturmlechner wrote:
> > --- /dev/null
> > +++ b/eclass/ecm-utils.eclass
>
> I know we historically screwed this up repeatedly but please don't use
> '-utils' for eclasses that export phases.
Fine, I would then choose ecm.eclass instead.
> > +# @ECLASS-VARIABLE: ECM_NONGUI
> > +# @DESCRIPTION:
> > +# If set to "false", add dependency on kde-frameworks/breeze-icons
> > +# or kde-frameworks/oxygen-icons and run the xdg.eclass routines for
> > +# pkg_preinst, pkg_postinst and pkg_postrm.
> > +# For any other value, do nothing.
> > +if [[ ${CATEGORY} = kde-frameworks ]]; then
> > + : ${ECM_NONGUI:=true}
> > +fi
> > +: ${ECM_NONGUI:=false}
>
> I don't think eclassdoc is going to parse this correctly.
Can we do something about that? I need to be able to set (overrideable)
defaults for a category without being limited by eclassdoc. @DEFAULT_UNSET
would not be precise. Same as ECM_QTHELP, this is what we do in kde5.eclass
already.
> > +# @ECLASS-VARIABLE: ECM_DEBUG
> > +# @DESCRIPTION:
> > +# If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and
> > +# -DQT_NO_DEBUG to CPPFLAGS.
> > +# Otherwise, add debug to IUSE.
> > +: ${ECM_DEBUG:=true}
>
> To be honest, I don't really like this 'anything-or-false' logic. It's
> rather confusing and error-prone. For example, if I misspell 'false'
> the eclass is going to silently assume true.
Making all options explicit then and erroring out on unknown input.
> > +# @FUNCTION: ecm_punt_bogus_dep
> > +# @USAGE: <prefix> <dependency>
> > +# @DESCRIPTION:
> > +# Removes a specified dependency from a find_package call with multiple
> > components.
> > +ecm_punt_bogus_dep() {
> > + local prefix=${1}
> > + local dep=${2}
> > +
> > + if [[ ! -e "CMakeLists.txt" ]]; then
>
> Can this really ever happen in a valid use case? Maybe it should be
> an error instead.
Even cmake-utils.eclass makes that check in cmake_comment_add_subdirectory and
leaves the erroring out if the file's missing central to src_prepare(), I
guess is why it was done that way.
Thanks for looking over it!
Regards,
Andreas
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass
2019-11-06 1:19 ` Andreas Sturmlechner
@ 2019-11-06 7:15 ` Michał Górny
2019-11-10 13:27 ` [gentoo-dev] [PATCH v2 1/3] ecm.eclass: " Andreas Sturmlechner
0 siblings, 1 reply; 20+ messages in thread
From: Michał Górny @ 2019-11-06 7:15 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]
On Wed, 2019-11-06 at 02:19 +0100, Andreas Sturmlechner wrote:
> > > +# @ECLASS-VARIABLE: ECM_NONGUI
> > > +# @DESCRIPTION:
> > > +# If set to "false", add dependency on kde-frameworks/breeze-icons
> > > +# or kde-frameworks/oxygen-icons and run the xdg.eclass routines for
> > > +# pkg_preinst, pkg_postinst and pkg_postrm.
> > > +# For any other value, do nothing.
> > > +if [[ ${CATEGORY} = kde-frameworks ]]; then
> > > + : ${ECM_NONGUI:=true}
> > > +fi
> > > +: ${ECM_NONGUI:=false}
> >
> > I don't think eclassdoc is going to parse this correctly.
>
> Can we do something about that? I need to be able to set (overrideable)
> defaults for a category without being limited by eclassdoc. @DEFAULT_UNSET
> would not be precise. Same as ECM_QTHELP, this is what we do in kde5.eclass
> already.
>
If I knew, I would've told you. I've personally settled for
@DEFAULT_UNSET, and explained what happens when it's unset.
Alternatively, you could set default earlier in a separate var, then do
something like:
: ${ECM_NONGUI:=${ECM_NONGUI_DEFAULT}}
but I don't think that will be very helpful. Maybe sth like:
: ${ECM_NONGUI:=${IS_KDE_FRAMEWORKS}}
but then, it's just a hack.
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [gentoo-dev] [PATCH v2 1/3] ecm.eclass: New eclass
2019-11-06 7:15 ` Michał Górny
@ 2019-11-10 13:27 ` Andreas Sturmlechner
2019-11-10 16:26 ` Gokturk Yuksek
0 siblings, 1 reply; 20+ messages in thread
From: Andreas Sturmlechner @ 2019-11-10 13:27 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
[-- Attachment #1: Type: text/plain, Size: 19989 bytes --]
--- /dev/null
+++ b/eclass/ecm.eclass
@@ -0,0 +1,639 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: ecm.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @SUPPORTED_EAPIS: 7
+# @BLURB: Support eclass for packages that use KDE Frameworks with ECM.
+# @DESCRIPTION:
+# This eclass is intended to streamline the creation of ebuilds for packages
+# that use cmake and KDE Frameworks' extra-cmake-modules, thereby following
+# some of their packaging conventions. It is primarily intended for the tree
+# upstream release groups (Frameworks, Plasma, Applications) but also for any
+# other package that follows similar conventions.
+#
+# This eclass unconditionally inherits cmake-utils.eclass and all its public
+# variables and helper functions (not phase functions) may be considered as part
+# of this eclass's API.
+#
+# This eclass's phase functions are not intended to be mixed and matched, so if
+# any phase functions are overridden the version here should also be called.
+#
+# Porting from kde5.class
+# - Convert all add_*_dep dependency functions to regular dependencies
+# - Manually set LICENSE
+# - Manually set SLOT
+# - Rename vars and function names as needed, see kde5.eclass PORTING comments
+# - Instead of FRAMEWORKS_MINIMAL, define KFMIN in ebuilds and use it for deps
+
+if [[ -z ${_ECM_UTILS_ECLASS} ]]; then
+_ECM_UTILS_ECLASS=1
+
+# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
+# @DESCRIPTION:
+# For proper description see virtualx.eclass manpage.
+# Here we redefine default value to be manual, if your package needs virtualx
+# for tests you should proceed with setting VIRTUALX_REQUIRED=test.
+: ${VIRTUALX_REQUIRED:=manual}
+
+inherit cmake-utils flag-o-matic toolchain-funcs virtualx xdg
+
+case ${EAPI} in
+ 7) ;;
+ *) die "EAPI=${EAPI:-0} is not supported" ;;
+esac
+
+if [[ -v KDE_GCC_MINIMAL ]]; then
+ EXPORT_FUNCTIONS pkg_pretend
+fi
+
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_test pkg_preinst pkg_postinst pkg_postrm
+
+# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS
+# @DESCRIPTION:
+# Assume the package is using KDEInstallDirs macro and switch
+# KDE_INSTALL_USE_QT_SYS_PATHS to ON. If set to "false", do nothing.
+: ${ECM_KDEINSTALLDIRS:=true}
+
+# @ECLASS-VARIABLE: ECM_NONGUI
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# By default, for all CATEGORIES except kde-frameworks, assume we are building
+# a GUI application. Add dependency on kde-frameworks/breeze-icons or
+# kde-frameworks/oxygen-icons and run the xdg.eclass routines for pkg_preinst,
+# pkg_postinst and pkg_postrm. If set to "true", do nothing.
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+ : ${ECM_NONGUI:=true}
+fi
+: ${ECM_NONGUI:=false}
+
+# @ECLASS-VARIABLE: ECM_DEBUG
+# @DESCRIPTION:
+# Add "debug" to IUSE. If !debug, add -DNDEBUG (via cmake-utils_src_configure)
+# and -DQT_NO_DEBUG to CPPFLAGS. If set to "false", do nothing.
+: ${ECM_DEBUG:=true}
+
+# @ECLASS-VARIABLE: ECM_DESIGNERPLUGIN
+# @DESCRIPTION:
+# If set to "true", add "designer" to IUSE to toggle build of designer plugins
+# and add the necessary BDEPEND. If set to "false", do nothing.
+: ${ECM_DESIGNERPLUGIN:=false}
+
+# @ECLASS-VARIABLE: ECM_EXAMPLES
+# @DESCRIPTION:
+# By default unconditionally ignore a top-level examples subdirectory.
+# If set to "true", add "examples" to IUSE to toggle adding that subdirectory.
+: ${ECM_EXAMPLES:=false}
+
+# @ECLASS-VARIABLE: ECM_HANDBOOK
+# @DESCRIPTION:
+# Will accept "true", "false", "optional", "forceoptional". If set to "false",
+# do nothing.
+# Otherwise, add "+handbook" to IUSE, add the appropriate dependency, and let
+# KF5DocTools generate and install the handbook from docbook file(s) found in
+# ECM_HANDBOOK_DIR. However if !handbook, disable build of ECM_HANDBOOK_DIR
+# in CMakeLists.txt.
+# If set to "optional", build with -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON
+# when !handbook. In case package requires KF5KDELibs4Support, see next:
+# If set to "forceoptional", remove a KF5DocTools dependency from the root
+# CMakeLists.txt in addition to the above.
+: ${ECM_HANDBOOK:=false}
+
+# @ECLASS-VARIABLE: ECM_HANDBOOK_DIR
+# @DESCRIPTION:
+# Specifies the directory containing the docbook file(s) relative to ${S} to
+# be processed by KF5DocTools (kdoctools_install).
+: ${ECM_HANDBOOK_DIR:=doc}
+
+# @ECLASS-VARIABLE: ECM_PO_DIRS
+# @DESCRIPTION:
+# Specifies directories of l10n files relative to ${S} to be processed by
+# KF5I18n (ki18n_install). If IUSE nls exists and is disabled then disable
+# build of these directories in CMakeLists.txt.
+: ${ECM_PO_DIRS:="po poqm"}
+
+# @ECLASS-VARIABLE: ECM_QTHELP
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Default value for all CATEGORIES except kde-frameworks is "false".
+# If set to "true", add "doc" to IUSE, add the appropriate dependency, let
+# -DBUILD_QCH=ON generate and install Qt compressed help files when USE=doc.
+# If set to "false", do nothing.
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+ : ${ECM_QTHELP:=true}
+fi
+: ${ECM_QTHELP:=false}
+
+# @ECLASS-VARIABLE: ECM_TEST
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Will accept "true", "false", "optional", "forceoptional",
+# "forceoptional-recursive".
+# Default value is "false", except for CATEGORY=kde-frameworks where it is
+# set to "true". If set to "false", do nothing.
+# For any other value, add "test" to IUSE and DEPEND on dev-qt/qttest:5.
+# If set to "optional", build with -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON
+# when USE=!test.
+# If set to "forceoptional", punt Qt5Test dependency and ignore "autotests",
+# "test", "tests" subdirs from top-level CMakeLists.txt when USE=!test.
+# If set to "forceoptional-recursive", punt Qt5Test dependencies and make
+# autotest(s), unittest(s) and test(s) subdirs from *any* CMakeLists.txt in
+# ${S} and below conditional on BUILD_TESTING when USE=!test. This is always
+# meant as a short-term fix and creates ${T}/${P}-tests-optional.patch to
+# refine and submit upstream.
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+ : ${ECM_TEST:=true}
+fi
+: ${ECM_TEST:=false}
+
+# @ECLASS-VARIABLE: KFMIN
+# @DESCRIPTION:
+# Minimum version of Frameworks to require. The default value is not going to
+# be changed unless we also bump EAPI, which usually implies (rev-)bumping.
+# Version will later be used to differentiate between KF5/Qt5 and KF6/Qt6.
+: ${KFMIN:=5.64.0}
+
+# @ECLASS-VARIABLE: KFSLOT
+# @INTERNAL
+# @DESCRIPTION:
+# KDE Frameworks and Qt slot dependency, implied by KFMIN version.
+: ${KFSLOT:=5}
+
+case ${ECM_NONGUI} in
+ true) ;;
+ false)
+ # gui applications need breeze or oxygen for basic iconset, bug #564838
+ if [[ -n ${_KDE5_ECLASS} ]] ; then
+ RDEPEND+=" || (
+ >=kde-frameworks/breeze-icons-${KFMIN}:${KFSLOT}
+ kde-frameworks/oxygen-icons:*
+ )"
+ else
+ RDEPEND+=" || (
+ kde-frameworks/breeze-icons:*
+ kde-frameworks/oxygen-icons:*
+ )"
+ fi
+ ;;
+ *)
+ eerror "Unknown value for \${ECM_NONGUI}"
+ die "Value ${ECM_NONGUI} is not supported"
+ ;;
+esac
+
+case ${ECM_DEBUG} in
+ true)
+ IUSE+=" debug"
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${ECM_DEBUG}"
+ die "Value ${ECM_DEBUG} is not supported"
+ ;;
+esac
+
+case ${ECM_DESIGNERPLUGIN} in
+ true)
+ IUSE+=" designer"
+ if [[ -n ${_KDE5_ECLASS} ]] ; then
+ BDEPEND+=" designer? ( >=dev-qt/designer-5.12.3:${KFSLOT} )"
+ else
+ BDEPEND+=" designer? ( dev-qt/designer:${KFSLOT} )"
+ fi
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${ECM_DESIGNERPLUGIN}"
+ die "Value ${ECM_DESIGNERPLUGIN} is not supported"
+ ;;
+esac
+
+# @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN
+# @DESCRIPTION:
+# If set to "false", do nothing.
+# Otherwise, add "designer" to IUSE to toggle build of designer plugins
+# and add the necessary BDEPEND.
+# TODO: drop after KDE Applications 19.08.3 removal
+: ${KDE_DESIGNERPLUGIN:=false}
+case ${KDE_DESIGNERPLUGIN} in
+ true)
+ IUSE+=" designer"
+ BDEPEND+="
+ designer? ( >=kde-frameworks/kdesignerplugin-${KFMIN}:${KFSLOT} )
+ "
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${KDE_DESIGNERPLUGIN}"
+ die "Value ${KDE_DESIGNERPLUGIN} is not supported"
+ ;;
+esac
+
+case ${ECM_EXAMPLES} in
+ true)
+ IUSE+=" examples"
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${ECM_EXAMPLES}"
+ die "Value ${ECM_EXAMPLES} is not supported"
+ ;;
+esac
+
+case ${ECM_HANDBOOK} in
+ true|optional|forceoptional)
+ IUSE+=" +handbook"
+ BDEPEND+=" handbook? ( >=kde-frameworks/kdoctools-${KFMIN}:${KFSLOT} )"
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${ECM_HANDBOOK}"
+ die "Value ${ECM_HANDBOOK} is not supported"
+ ;;
+esac
+
+case ${ECM_QTHELP} in
+ true)
+ IUSE+=" doc"
+ if [[ -n ${_KDE5_ECLASS} ]] ; then
+ COMMONDEPEND+=" doc? ( >=dev-qt/qt-docs-5.12.3:${KFSLOT} )"
+ BDEPEND+=" >=dev-qt/qthelp-5.12.3:${KFSLOT} )"
+ else
+ COMMONDEPEND+=" doc? ( dev-qt/qt-docs:${KFSLOT} )"
+ BDEPEND+=" dev-qt/qthelp:${KFSLOT} )"
+ fi
+ BDEPEND+=" doc? ( >=app-doc/doxygen-1.8.13-r1 )"
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${ECM_QTHELP}"
+ die "Value ${ECM_QTHELP} is not supported"
+ ;;
+esac
+
+case ${ECM_TEST} in
+ true|optional|forceoptional|forceoptional-recursive)
+ IUSE+=" test"
+ if [[ -n ${_KDE5_ECLASS} ]] ; then
+ DEPEND+=" test? ( >=dev-qt/qttest-5.12.3:${KFSLOT} )"
+ else
+ DEPEND+=" test? ( dev-qt/qttest:${KFSLOT} )"
+ fi
+ RESTRICT+=" !test? ( test )"
+ ;;
+ false) ;;
+ *)
+ eerror "Unknown value for \${ECM_TEST}"
+ die "Value ${ECM_TEST} is not supported"
+ ;;
+esac
+
+BDEPEND+=" >=kde-frameworks/extra-cmake-modules-${KFMIN}:${KFSLOT}"
+RDEPEND+=" >=kde-frameworks/kf-env-4"
+if [[ -n ${_KDE5_ECLASS} ]] ; then
+ COMMONDEPEND+=" >=dev-qt/qtcore-5.12.3:${KFSLOT}"
+else
+ COMMONDEPEND+=" dev-qt/qtcore:${KFSLOT}"
+fi
+
+DEPEND+=" ${COMMONDEPEND}"
+RDEPEND+=" ${COMMONDEPEND}"
+unset COMMONDEPEND
+
+# @ECLASS-VARIABLE: KDE_GCC_MINIMAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Minimum version of active GCC to require. This is checked in
+# ecm_pkg_pretend and ecm_pkg_setup.
+
+# @FUNCTION: _ecm_check_gcc_version
+# @INTERNAL
+# @DESCRIPTION:
+# Determine if the current GCC version is acceptable, otherwise die.
+_ecm_check_gcc_version() {
+ if [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && tc-is-gcc; then
+
+ local version=$(gcc-version)
+
+ debug-print "GCC version check activated"
+ debug-print "Version detected: ${version}"
+ debug-print "Version required: ${KDE_GCC_MINIMAL}"
+
+ ver_test ${version} -lt ${KDE_GCC_MINIMAL} &&
+ die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later is required for this package (found ${version})."
+ fi
+}
+
+# @FUNCTION: _ecm_strip_handbook_translations
+# @INTERNAL
+# @DESCRIPTION:
+# If LINGUAS is defined, enable only the requested translations when required.
+_ecm_strip_handbook_translations() {
+ if ! [[ -v LINGUAS ]]; then
+ return
+ fi
+
+ local lang po
+ for po in ${ECM_PO_DIRS}; do
+ if [[ -d ${po} ]] ; then
+ pushd ${po} > /dev/null || die
+ local lang
+ for lang in *; do
+ if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then
+ case ${lang} in
+ cmake_modules | \
+ CMakeLists.txt | \
+ ${PN}.pot) ;;
+ *) rm -r ${lang} || die ;;
+ esac
+ if [[ -e CMakeLists.txt ]] ; then
+ cmake_comment_add_subdirectory ${lang}
+ sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:space:]]*)/d" \
+ -i CMakeLists.txt || die
+ fi
+ fi
+ done
+ popd > /dev/null || die
+ fi
+ done
+}
+
+# @FUNCTION: ecm_punt_bogus_dep
+# @USAGE: <prefix> <dependency>
+# @DESCRIPTION:
+# Removes a specified dependency from a find_package call with multiple
+# components.
+ecm_punt_bogus_dep() {
+ local prefix=${1}
+ local dep=${2}
+
+ if [[ ! -e "CMakeLists.txt" ]]; then
+ return
+ fi
+
+ pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}"
+
+ # pcregrep returns non-zero on no matches/error
+ if [[ $? -ne 0 ]] ; then
+ return
+ fi
+
+ local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1)
+ local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1)
+ local last=$(( length + first - 1))
+
+ sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die
+
+ if [[ ${length} -eq 1 ]] ; then
+ sed -e "/find_package\s*(\s*${prefix}\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by ecm.eclass - /" -i CMakeLists.txt || die
+ fi
+}
+
+# @FUNCTION: ecm_pkg_pretend
+# @DESCRIPTION:
+# Checks if the active compiler meets the minimum version requirements.
+# phase function is only exported if KDE_GCC_MINIMAL is defined.
+ecm_pkg_pretend() {
+ debug-print-function ${FUNCNAME} "$@"
+ _ecm_check_gcc_version
+}
+
+# @FUNCTION: ecm_pkg_setup
+# @DESCRIPTION:
+# Checks if the active compiler meets the minimum version requirements.
+ecm_pkg_setup() {
+ debug-print-function ${FUNCNAME} "$@"
+ _ecm_check_gcc_version
+}
+
+# @FUNCTION: ecm_src_prepare
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_prepare with lots of extra logic for magic
+# handling of linguas, tests, handbook etc.
+ecm_src_prepare() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ cmake-utils_src_prepare
+
+ # only build examples when required
+ if ! { in_iuse examples && use examples; } ; then
+ cmake_comment_add_subdirectory examples
+ fi
+
+ # only enable handbook when required
+ if in_iuse handbook && ! use handbook ; then
+ cmake_comment_add_subdirectory ${ECM_HANDBOOK_DIR}
+
+ if [[ ${ECM_HANDBOOK} = forceoptional ]] ; then
+ punt_bogus_dep KF5 DocTools
+ sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt || die
+ fi
+ fi
+
+ # drop translations when nls is not wanted
+ if in_iuse nls && ! use nls ; then
+ local po
+ for po in ${ECM_PO_DIRS}; do
+ rm -rf ${po} || die
+ done
+ fi
+
+ # don't change behaviour for kde5.eclass consumers
+ # for ported ebuilds, limit playing field of this to kde-*/ categories
+ if [[ -n ${_KDE5_ECLASS} ]] ; then
+ _ecm_strip_handbook_translations # TODO: kde5.eclass cleanup
+ elif [[ ${CATEGORY} = kde-* ]] ; then
+ # always install unconditionally for kconfigwidgets - if you use
+ # language X as system language, and there is a combobox with language
+ # names, the translated language name for language Y is taken from
+ # /usr/share/locale/Y/kf5_entry.desktop
+ [[ ${PN} != kconfigwidgets ]] && _ecm_strip_handbook_translations
+ fi
+
+ # only build unit tests when required
+ if ! { in_iuse test && use test; } ; then
+ if [[ ${ECM_TEST} = forceoptional ]] ; then
+ punt_bogus_dep Qt5 Test
+ # if forceoptional, also cover non-kde categories
+ cmake_comment_add_subdirectory autotests test tests
+ elif [[ ${ECM_TEST} = forceoptional-recursive ]] ; then
+ punt_bogus_dep Qt5 Test
+ local f pf="${T}/${P}"-tests-optional.patch
+ touch ${pf} || die "Failed to touch patch file"
+ for f in $(find . -type f -name "CMakeLists.txt" -exec \
+ grep -l "^\s*add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)" {} \;); do
+ cp ${f} ${f}.old || die "Failed to prepare patch origfile"
+ pushd ${f%/*} > /dev/null || die
+ punt_bogus_dep Qt5 Test
+ sed -i CMakeLists.txt -e \
+ "/^#/! s/add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)/if(BUILD_TESTING)\n&\nendif()/" \
+ || die
+ popd > /dev/null || die
+ diff -Naur ${f}.old ${f} 1>>${pf}
+ rm ${f}.old || die "Failed to clean up"
+ done
+ eqawarn "Build system was modified by ECM_TEST=forceoptional-recursive."
+ eqawarn "Unified diff file ready for pickup in:"
+ eqawarn " ${pf}"
+ eqawarn "Push it upstream to make this message go away."
+ elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then
+ cmake_comment_add_subdirectory autotests test tests
+ fi
+ fi
+
+ # in frameworks, tests = manual tests so never build them
+ if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules ]]; then
+ cmake_comment_add_subdirectory tests
+ fi
+}
+
+# @FUNCTION: ecm_src_configure
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_configure with extra logic for magic handling of
+# handbook, tests etc.
+ecm_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # we rely on cmake-utils.eclass to append -DNDEBUG too
+ if in_iuse debug && ! use debug; then
+ append-cppflags -DQT_NO_DEBUG
+ fi
+
+ local cmakeargs
+
+ if in_iuse test && ! use test ; then
+ cmakeargs+=( -DBUILD_TESTING=OFF )
+
+ if [[ ${ECM_TEST} = optional ]] ; then
+ cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON )
+ fi
+ fi
+
+ if [[ ${ECM_HANDBOOK} = optional ]] ; then
+ cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=$(usex handbook) )
+ fi
+
+ if in_iuse designer && [[ ${ECM_DESIGNERPLUGIN} = true ]]; then
+ cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) )
+ fi
+
+ # TODO: drop after KDE Applications 19.08.3 removal
+ if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then
+ cmakeargs+=( $(cmake-utils_use_find_package designer KF5DesignerPlugin) )
+ fi
+
+ if [[ ${ECM_QTHELP} = true ]]; then
+ cmakeargs+=( -DBUILD_QCH=$(usex doc) )
+ fi
+
+ if [[ ${ECM_KDEINSTALLDIRS} = true ]] ; then
+ cmakeargs+=(
+ # install mkspecs in the same directory as Qt stuff
+ -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
+ # move handbook outside of doc dir, bug 667138
+ -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help"
+ )
+ fi
+
+ # allow the ebuild to override what we set here
+ mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}")
+
+ cmake-utils_src_configure
+}
+
+# @FUNCTION: ecm_src_compile
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_compile. Currently doesn't do anything extra, but
+# is included as part of the API just in case it's needed in the future.
+ecm_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ cmake-utils_src_compile "$@"
+}
+
+# @FUNCTION: ecm_src_test
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_test with extra logic for magic handling of dbus
+# and virtualx.
+ecm_src_test() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ _test_runner() {
+ if [[ -n "${VIRTUALDBUS_TEST}" ]]; then
+ export $(dbus-launch)
+ fi
+
+ cmake-utils_src_test
+ }
+
+ # When run as normal user during ebuild development with the ebuild command,
+ # tests tend to access the session DBUS. This however is not possible in a
+ # real emerge or on the tinderbox.
+ # make sure it does not happen, so bad tests can be recognized and disabled
+ unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
+
+ if [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]]; then
+ virtx _test_runner
+ else
+ _test_runner
+ fi
+
+ if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then
+ kill ${DBUS_SESSION_BUS_PID}
+ fi
+}
+
+# @FUNCTION: ecm_src_install
+# @DESCRIPTION:
+# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra, but
+# is included as part of the API just in case it's needed in the future.
+ecm_src_install() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ cmake-utils_src_install
+}
+
+# @FUNCTION: ecm_pkg_preinst
+# @DESCRIPTION:
+# Sets up environment variables required in ecm_pkg_postinst.
+ecm_pkg_preinst() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ case ${ECM_NONGUI} in
+ false) xdg_pkg_preinst ;;
+ *) ;;
+ esac
+}
+
+# @FUNCTION: ecm_pkg_postinst
+# @DESCRIPTION:
+# Updates the various XDG caches (icon, desktop, mime) if necessary.
+ecm_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ case ${ECM_NONGUI} in
+ false) xdg_pkg_postinst ;;
+ *) ;;
+ esac
+
+ if [[ -n ${_KDE_ORG_ECLASS} ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && [[ ${KDE_BUILD_TYPE} = live ]]; then
+ einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}"
+ einfo "Use it at your own risk."
+ einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!"
+ fi
+}
+
+# @FUNCTION: ecm_pkg_postrm
+# @DESCRIPTION:
+# Updates the various XDG caches (icon, desktop, mime) if necessary.
+ecm_pkg_postrm() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ case ${ECM_NONGUI} in
+ false) xdg_pkg_postrm ;;
+ *) ;;
+ esac
+}
+
+fi
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [gentoo-dev] [PATCH v2 1/3] ecm.eclass: New eclass
2019-11-10 13:27 ` [gentoo-dev] [PATCH v2 1/3] ecm.eclass: " Andreas Sturmlechner
@ 2019-11-10 16:26 ` Gokturk Yuksek
0 siblings, 0 replies; 20+ messages in thread
From: Gokturk Yuksek @ 2019-11-10 16:26 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 21033 bytes --]
>
> --- /dev/null
> +++ b/eclass/ecm.eclass
> @@ -0,0 +1,639 @@
> +# Copyright 1999-2019 Gentoo Authors
> +# Distributed under the terms of the GNU General Public License v2
> +
> +# @ECLASS: ecm.eclass
> +# @MAINTAINER:
> +# kde@gentoo.org
> +# @SUPPORTED_EAPIS: 7
> +# @BLURB: Support eclass for packages that use KDE Frameworks with ECM.
> +# @DESCRIPTION:
> +# This eclass is intended to streamline the creation of ebuilds for packages
> +# that use cmake and KDE Frameworks' extra-cmake-modules, thereby following
> +# some of their packaging conventions. It is primarily intended for the tree
s/tree/three/
> +# upstream release groups (Frameworks, Plasma, Applications) but also for any
> +# other package that follows similar conventions.
> +#
> +# This eclass unconditionally inherits cmake-utils.eclass and all its public
> +# variables and helper functions (not phase functions) may be considered as part
> +# of this eclass's API.
> +#
> +# This eclass's phase functions are not intended to be mixed and matched, so if
> +# any phase functions are overridden the version here should also be called.
> +#
> +# Porting from kde5.class
> +# - Convert all add_*_dep dependency functions to regular dependencies
> +# - Manually set LICENSE
> +# - Manually set SLOT
> +# - Rename vars and function names as needed, see kde5.eclass PORTING comments
> +# - Instead of FRAMEWORKS_MINIMAL, define KFMIN in ebuilds and use it for deps
> +
> +if [[ -z ${_ECM_UTILS_ECLASS} ]]; then
> +_ECM_UTILS_ECLASS=1
> +
> +# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
> +# @DESCRIPTION:
> +# For proper description see virtualx.eclass manpage.
> +# Here we redefine default value to be manual, if your package needs virtualx
> +# for tests you should proceed with setting VIRTUALX_REQUIRED=test.
> +: ${VIRTUALX_REQUIRED:=manual}
> +
> +inherit cmake-utils flag-o-matic toolchain-funcs virtualx xdg
> +
> +case ${EAPI} in
> + 7) ;;
> + *) die "EAPI=${EAPI:-0} is not supported" ;;
> +esac
> +
> +if [[ -v KDE_GCC_MINIMAL ]]; then
> + EXPORT_FUNCTIONS pkg_pretend
> +fi
> +
> +EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_test pkg_preinst pkg_postinst pkg_postrm
> +
> +# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS
> +# @DESCRIPTION:
> +# Assume the package is using KDEInstallDirs macro and switch
> +# KDE_INSTALL_USE_QT_SYS_PATHS to ON. If set to "false", do nothing.
> +: ${ECM_KDEINSTALLDIRS:=true}
> +
> +# @ECLASS-VARIABLE: ECM_NONGUI
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# By default, for all CATEGORIES except kde-frameworks, assume we are building
> +# a GUI application. Add dependency on kde-frameworks/breeze-icons or
> +# kde-frameworks/oxygen-icons and run the xdg.eclass routines for pkg_preinst,
> +# pkg_postinst and pkg_postrm. If set to "true", do nothing.
> +if [[ ${CATEGORY} = kde-frameworks ]]; then
> + : ${ECM_NONGUI:=true}
> +fi
> +: ${ECM_NONGUI:=false}
> +
> +# @ECLASS-VARIABLE: ECM_DEBUG
> +# @DESCRIPTION:
> +# Add "debug" to IUSE. If !debug, add -DNDEBUG (via cmake-utils_src_configure)
> +# and -DQT_NO_DEBUG to CPPFLAGS. If set to "false", do nothing.
> +: ${ECM_DEBUG:=true}
> +
> +# @ECLASS-VARIABLE: ECM_DESIGNERPLUGIN
> +# @DESCRIPTION:
> +# If set to "true", add "designer" to IUSE to toggle build of designer plugins
> +# and add the necessary BDEPEND. If set to "false", do nothing.
> +: ${ECM_DESIGNERPLUGIN:=false}
> +
> +# @ECLASS-VARIABLE: ECM_EXAMPLES
> +# @DESCRIPTION:
> +# By default unconditionally ignore a top-level examples subdirectory.
> +# If set to "true", add "examples" to IUSE to toggle adding that subdirectory.
> +: ${ECM_EXAMPLES:=false}
> +
> +# @ECLASS-VARIABLE: ECM_HANDBOOK
> +# @DESCRIPTION:
> +# Will accept "true", "false", "optional", "forceoptional". If set to "false",
> +# do nothing.
> +# Otherwise, add "+handbook" to IUSE, add the appropriate dependency, and let
> +# KF5DocTools generate and install the handbook from docbook file(s) found in
> +# ECM_HANDBOOK_DIR. However if !handbook, disable build of ECM_HANDBOOK_DIR
> +# in CMakeLists.txt.
> +# If set to "optional", build with -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON
> +# when !handbook. In case package requires KF5KDELibs4Support, see next:
> +# If set to "forceoptional", remove a KF5DocTools dependency from the root
> +# CMakeLists.txt in addition to the above.
> +: ${ECM_HANDBOOK:=false}
> +
> +# @ECLASS-VARIABLE: ECM_HANDBOOK_DIR
> +# @DESCRIPTION:
> +# Specifies the directory containing the docbook file(s) relative to ${S} to
> +# be processed by KF5DocTools (kdoctools_install).
> +: ${ECM_HANDBOOK_DIR:=doc}
> +
> +# @ECLASS-VARIABLE: ECM_PO_DIRS
> +# @DESCRIPTION:
> +# Specifies directories of l10n files relative to ${S} to be processed by
> +# KF5I18n (ki18n_install). If IUSE nls exists and is disabled then disable
> +# build of these directories in CMakeLists.txt.
> +: ${ECM_PO_DIRS:="po poqm"}
> +
> +# @ECLASS-VARIABLE: ECM_QTHELP
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Default value for all CATEGORIES except kde-frameworks is "false".
> +# If set to "true", add "doc" to IUSE, add the appropriate dependency, let
> +# -DBUILD_QCH=ON generate and install Qt compressed help files when USE=doc.
> +# If set to "false", do nothing.
> +if [[ ${CATEGORY} = kde-frameworks ]]; then
> + : ${ECM_QTHELP:=true}
> +fi
> +: ${ECM_QTHELP:=false}
> +
> +# @ECLASS-VARIABLE: ECM_TEST
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Will accept "true", "false", "optional", "forceoptional",
> +# "forceoptional-recursive".
> +# Default value is "false", except for CATEGORY=kde-frameworks where it is
> +# set to "true". If set to "false", do nothing.
> +# For any other value, add "test" to IUSE and DEPEND on dev-qt/qttest:5.
> +# If set to "optional", build with -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON
> +# when USE=!test.
> +# If set to "forceoptional", punt Qt5Test dependency and ignore "autotests",
> +# "test", "tests" subdirs from top-level CMakeLists.txt when USE=!test.
> +# If set to "forceoptional-recursive", punt Qt5Test dependencies and make
> +# autotest(s), unittest(s) and test(s) subdirs from *any* CMakeLists.txt in
> +# ${S} and below conditional on BUILD_TESTING when USE=!test. This is always
> +# meant as a short-term fix and creates ${T}/${P}-tests-optional.patch to
> +# refine and submit upstream.
> +if [[ ${CATEGORY} = kde-frameworks ]]; then
> + : ${ECM_TEST:=true}
> +fi
> +: ${ECM_TEST:=false}
> +
> +# @ECLASS-VARIABLE: KFMIN
> +# @DESCRIPTION:
> +# Minimum version of Frameworks to require. The default value is not going to
> +# be changed unless we also bump EAPI, which usually implies (rev-)bumping.
> +# Version will later be used to differentiate between KF5/Qt5 and KF6/Qt6.
> +: ${KFMIN:=5.64.0}
> +
> +# @ECLASS-VARIABLE: KFSLOT
> +# @INTERNAL
> +# @DESCRIPTION:
> +# KDE Frameworks and Qt slot dependency, implied by KFMIN version.
> +: ${KFSLOT:=5}
> +
> +case ${ECM_NONGUI} in
> + true) ;;
> + false)
> + # gui applications need breeze or oxygen for basic iconset, bug #564838
> + if [[ -n ${_KDE5_ECLASS} ]] ; then
> + RDEPEND+=" || (
> + >=kde-frameworks/breeze-icons-${KFMIN}:${KFSLOT}
> + kde-frameworks/oxygen-icons:*
> + )"
> + else
> + RDEPEND+=" || (
> + kde-frameworks/breeze-icons:*
> + kde-frameworks/oxygen-icons:*
> + )"
> + fi
> + ;;
> + *)
> + eerror "Unknown value for \${ECM_NONGUI}"
> + die "Value ${ECM_NONGUI} is not supported"
> + ;;
> +esac
> +
> +case ${ECM_DEBUG} in
> + true)
> + IUSE+=" debug"
> + ;;
> + false) ;;
> + *)
> + eerror "Unknown value for \${ECM_DEBUG}"
> + die "Value ${ECM_DEBUG} is not supported"
> + ;;
> +esac
> +
> +case ${ECM_DESIGNERPLUGIN} in
> + true)
> + IUSE+=" designer"
> + if [[ -n ${_KDE5_ECLASS} ]] ; then
> + BDEPEND+=" designer? ( >=dev-qt/designer-5.12.3:${KFSLOT} )"
> + else
> + BDEPEND+=" designer? ( dev-qt/designer:${KFSLOT} )"
> + fi
> + ;;
> + false) ;;
> + *)
> + eerror "Unknown value for \${ECM_DESIGNERPLUGIN}"
> + die "Value ${ECM_DESIGNERPLUGIN} is not supported"
> + ;;
> +esac
> +
> +# @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN
> +# @DESCRIPTION:
> +# If set to "false", do nothing.
> +# Otherwise, add "designer" to IUSE to toggle build of designer plugins
> +# and add the necessary BDEPEND.
> +# TODO: drop after KDE Applications 19.08.3 removal
> +: ${KDE_DESIGNERPLUGIN:=false}
> +case ${KDE_DESIGNERPLUGIN} in
> + true)
> + IUSE+=" designer"
> + BDEPEND+="
> + designer? ( >=kde-frameworks/kdesignerplugin-${KFMIN}:${KFSLOT} )
> + "
> + ;;
> + false) ;;
> + *)
> + eerror "Unknown value for \${KDE_DESIGNERPLUGIN}"
> + die "Value ${KDE_DESIGNERPLUGIN} is not supported"
> + ;;
> +esac
> +
> +case ${ECM_EXAMPLES} in
> + true)
> + IUSE+=" examples"
> + ;;
> + false) ;;
> + *)
> + eerror "Unknown value for \${ECM_EXAMPLES}"
> + die "Value ${ECM_EXAMPLES} is not supported"
> + ;;
> +esac
> +
> +case ${ECM_HANDBOOK} in
> + true|optional|forceoptional)
> + IUSE+=" +handbook"
> + BDEPEND+=" handbook? ( >=kde-frameworks/kdoctools-${KFMIN}:${KFSLOT} )"
> + ;;
> + false) ;;
> + *)
> + eerror "Unknown value for \${ECM_HANDBOOK}"
> + die "Value ${ECM_HANDBOOK} is not supported"
> + ;;
> +esac
> +
> +case ${ECM_QTHELP} in
> + true)
> + IUSE+=" doc"
> + if [[ -n ${_KDE5_ECLASS} ]] ; then
> + COMMONDEPEND+=" doc? ( >=dev-qt/qt-docs-5.12.3:${KFSLOT} )"
> + BDEPEND+=" >=dev-qt/qthelp-5.12.3:${KFSLOT} )"
> + else
> + COMMONDEPEND+=" doc? ( dev-qt/qt-docs:${KFSLOT} )"
> + BDEPEND+=" dev-qt/qthelp:${KFSLOT} )"
> + fi
> + BDEPEND+=" doc? ( >=app-doc/doxygen-1.8.13-r1 )"
> + ;;
> + false) ;;
> + *)
> + eerror "Unknown value for \${ECM_QTHELP}"
> + die "Value ${ECM_QTHELP} is not supported"
> + ;;
> +esac
> +
> +case ${ECM_TEST} in
> + true|optional|forceoptional|forceoptional-recursive)
> + IUSE+=" test"
> + if [[ -n ${_KDE5_ECLASS} ]] ; then
> + DEPEND+=" test? ( >=dev-qt/qttest-5.12.3:${KFSLOT} )"
> + else
> + DEPEND+=" test? ( dev-qt/qttest:${KFSLOT} )"
> + fi
> + RESTRICT+=" !test? ( test )"
> + ;;
> + false) ;;
> + *)
> + eerror "Unknown value for \${ECM_TEST}"
> + die "Value ${ECM_TEST} is not supported"
> + ;;
> +esac
> +
> +BDEPEND+=" >=kde-frameworks/extra-cmake-modules-${KFMIN}:${KFSLOT}"
> +RDEPEND+=" >=kde-frameworks/kf-env-4"
> +if [[ -n ${_KDE5_ECLASS} ]] ; then
> + COMMONDEPEND+=" >=dev-qt/qtcore-5.12.3:${KFSLOT}"
> +else
> + COMMONDEPEND+=" dev-qt/qtcore:${KFSLOT}"
> +fi
> +
> +DEPEND+=" ${COMMONDEPEND}"
> +RDEPEND+=" ${COMMONDEPEND}"
> +unset COMMONDEPEND
> +
> +# @ECLASS-VARIABLE: KDE_GCC_MINIMAL
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# Minimum version of active GCC to require. This is checked in
> +# ecm_pkg_pretend and ecm_pkg_setup.
> +
> +# @FUNCTION: _ecm_check_gcc_version
> +# @INTERNAL
> +# @DESCRIPTION:
> +# Determine if the current GCC version is acceptable, otherwise die.
> +_ecm_check_gcc_version() {
> + if [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && tc-is-gcc; then
> +
> + local version=$(gcc-version)
> +
> + debug-print "GCC version check activated"
> + debug-print "Version detected: ${version}"
> + debug-print "Version required: ${KDE_GCC_MINIMAL}"
> +
> + ver_test ${version} -lt ${KDE_GCC_MINIMAL} &&
> + die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later is required for this package (found ${version})."
> + fi
> +}
> +
> +# @FUNCTION: _ecm_strip_handbook_translations
> +# @INTERNAL
> +# @DESCRIPTION:
> +# If LINGUAS is defined, enable only the requested translations when required.
> +_ecm_strip_handbook_translations() {
> + if ! [[ -v LINGUAS ]]; then
> + return
> + fi
> +
> + local lang po
> + for po in ${ECM_PO_DIRS}; do
> + if [[ -d ${po} ]] ; then
> + pushd ${po} > /dev/null || die
> + local lang
> + for lang in *; do
> + if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then
> + case ${lang} in
> + cmake_modules | \
> + CMakeLists.txt | \
> + ${PN}.pot) ;;
> + *) rm -r ${lang} || die ;;
> + esac
> + if [[ -e CMakeLists.txt ]] ; then
> + cmake_comment_add_subdirectory ${lang}
> + sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:space:]]*)/d" \
> + -i CMakeLists.txt || die
> + fi
> + fi
> + done
> + popd > /dev/null || die
> + fi
> + done
> +}
> +
> +# @FUNCTION: ecm_punt_bogus_dep
> +# @USAGE: <prefix> <dependency>
> +# @DESCRIPTION:
> +# Removes a specified dependency from a find_package call with multiple
> +# components.
> +ecm_punt_bogus_dep() {
> + local prefix=${1}
> + local dep=${2}
> +
> + if [[ ! -e "CMakeLists.txt" ]]; then
> + return
> + fi
> +
> + pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}"
> +
> + # pcregrep returns non-zero on no matches/error
> + if [[ $? -ne 0 ]] ; then
> + return
> + fi
> +
> + local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1)
> + local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1)
> + local last=$(( length + first - 1))
> +
> + sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die
> +
> + if [[ ${length} -eq 1 ]] ; then
> + sed -e "/find_package\s*(\s*${prefix}\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by ecm.eclass - /" -i CMakeLists.txt || die
> + fi
> +}
> +
> +# @FUNCTION: ecm_pkg_pretend
> +# @DESCRIPTION:
> +# Checks if the active compiler meets the minimum version requirements.
> +# phase function is only exported if KDE_GCC_MINIMAL is defined.
> +ecm_pkg_pretend() {
> + debug-print-function ${FUNCNAME} "$@"
> + _ecm_check_gcc_version
> +}
> +
> +# @FUNCTION: ecm_pkg_setup
> +# @DESCRIPTION:
> +# Checks if the active compiler meets the minimum version requirements.
> +ecm_pkg_setup() {
> + debug-print-function ${FUNCNAME} "$@"
> + _ecm_check_gcc_version
> +}
> +
> +# @FUNCTION: ecm_src_prepare
> +# @DESCRIPTION:
> +# Wrapper for cmake-utils_src_prepare with lots of extra logic for magic
> +# handling of linguas, tests, handbook etc.
> +ecm_src_prepare() {
> + debug-print-function ${FUNCNAME} "$@"
> +
> + cmake-utils_src_prepare
> +
> + # only build examples when required
> + if ! { in_iuse examples && use examples; } ; then
> + cmake_comment_add_subdirectory examples
> + fi
> +
> + # only enable handbook when required
> + if in_iuse handbook && ! use handbook ; then
> + cmake_comment_add_subdirectory ${ECM_HANDBOOK_DIR}
> +
> + if [[ ${ECM_HANDBOOK} = forceoptional ]] ; then
> + punt_bogus_dep KF5 DocTools
> + sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt || die
> + fi
> + fi
> +
> + # drop translations when nls is not wanted
> + if in_iuse nls && ! use nls ; then
> + local po
> + for po in ${ECM_PO_DIRS}; do
> + rm -rf ${po} || die
> + done
> + fi
> +
> + # don't change behaviour for kde5.eclass consumers
> + # for ported ebuilds, limit playing field of this to kde-*/ categories
> + if [[ -n ${_KDE5_ECLASS} ]] ; then
> + _ecm_strip_handbook_translations # TODO: kde5.eclass cleanup
> + elif [[ ${CATEGORY} = kde-* ]] ; then
> + # always install unconditionally for kconfigwidgets - if you use
> + # language X as system language, and there is a combobox with language
> + # names, the translated language name for language Y is taken from
> + # /usr/share/locale/Y/kf5_entry.desktop
> + [[ ${PN} != kconfigwidgets ]] && _ecm_strip_handbook_translations
> + fi
> +
> + # only build unit tests when required
> + if ! { in_iuse test && use test; } ; then
> + if [[ ${ECM_TEST} = forceoptional ]] ; then
> + punt_bogus_dep Qt5 Test
> + # if forceoptional, also cover non-kde categories
> + cmake_comment_add_subdirectory autotests test tests
> + elif [[ ${ECM_TEST} = forceoptional-recursive ]] ; then
> + punt_bogus_dep Qt5 Test
> + local f pf="${T}/${P}"-tests-optional.patch
> + touch ${pf} || die "Failed to touch patch file"
> + for f in $(find . -type f -name "CMakeLists.txt" -exec \
> + grep -l "^\s*add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)" {} \;); do
> + cp ${f} ${f}.old || die "Failed to prepare patch origfile"
> + pushd ${f%/*} > /dev/null || die
> + punt_bogus_dep Qt5 Test
> + sed -i CMakeLists.txt -e \
> + "/^#/! s/add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)/if(BUILD_TESTING)\n&\nendif()/" \
> + || die
> + popd > /dev/null || die
> + diff -Naur ${f}.old ${f} 1>>${pf}
> + rm ${f}.old || die "Failed to clean up"
> + done
> + eqawarn "Build system was modified by ECM_TEST=forceoptional-recursive."
> + eqawarn "Unified diff file ready for pickup in:"
> + eqawarn " ${pf}"
> + eqawarn "Push it upstream to make this message go away."
> + elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then
> + cmake_comment_add_subdirectory autotests test tests
> + fi
> + fi
> +
> + # in frameworks, tests = manual tests so never build them
> + if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules ]]; then
> + cmake_comment_add_subdirectory tests
> + fi
> +}
> +
> +# @FUNCTION: ecm_src_configure
> +# @DESCRIPTION:
> +# Wrapper for cmake-utils_src_configure with extra logic for magic handling of
> +# handbook, tests etc.
> +ecm_src_configure() {
> + debug-print-function ${FUNCNAME} "$@"
> +
> + # we rely on cmake-utils.eclass to append -DNDEBUG too
> + if in_iuse debug && ! use debug; then
> + append-cppflags -DQT_NO_DEBUG
> + fi
> +
> + local cmakeargs
> +
> + if in_iuse test && ! use test ; then
> + cmakeargs+=( -DBUILD_TESTING=OFF )
> +
> + if [[ ${ECM_TEST} = optional ]] ; then
> + cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON )
> + fi
> + fi
> +
> + if [[ ${ECM_HANDBOOK} = optional ]] ; then
> + cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=$(usex handbook) )
> + fi
> +
> + if in_iuse designer && [[ ${ECM_DESIGNERPLUGIN} = true ]]; then
> + cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) )
> + fi
> +
> + # TODO: drop after KDE Applications 19.08.3 removal
> + if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then
> + cmakeargs+=( $(cmake-utils_use_find_package designer KF5DesignerPlugin) )
> + fi
> +
> + if [[ ${ECM_QTHELP} = true ]]; then
> + cmakeargs+=( -DBUILD_QCH=$(usex doc) )
> + fi
> +
> + if [[ ${ECM_KDEINSTALLDIRS} = true ]] ; then
> + cmakeargs+=(
> + # install mkspecs in the same directory as Qt stuff
> + -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
> + # move handbook outside of doc dir, bug 667138
> + -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help"
> + )
> + fi
> +
> + # allow the ebuild to override what we set here
> + mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}")
> +
> + cmake-utils_src_configure
> +}
> +
> +# @FUNCTION: ecm_src_compile
> +# @DESCRIPTION:
> +# Wrapper for cmake-utils_src_compile. Currently doesn't do anything extra, but
> +# is included as part of the API just in case it's needed in the future.
> +ecm_src_compile() {
> + debug-print-function ${FUNCNAME} "$@"
> +
> + cmake-utils_src_compile "$@"
> +}
> +
> +# @FUNCTION: ecm_src_test
> +# @DESCRIPTION:
> +# Wrapper for cmake-utils_src_test with extra logic for magic handling of dbus
> +# and virtualx.
> +ecm_src_test() {
> + debug-print-function ${FUNCNAME} "$@"
> +
> + _test_runner() {
> + if [[ -n "${VIRTUALDBUS_TEST}" ]]; then
> + export $(dbus-launch)
> + fi
> +
> + cmake-utils_src_test
> + }
> +
> + # When run as normal user during ebuild development with the ebuild command,
> + # tests tend to access the session DBUS. This however is not possible in a
> + # real emerge or on the tinderbox.
> + # make sure it does not happen, so bad tests can be recognized and disabled
> + unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
> +
> + if [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]]; then
> + virtx _test_runner
> + else
> + _test_runner
> + fi
> +
> + if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then
> + kill ${DBUS_SESSION_BUS_PID}
> + fi
> +}
> +
> +# @FUNCTION: ecm_src_install
> +# @DESCRIPTION:
> +# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra, but
> +# is included as part of the API just in case it's needed in the future.
> +ecm_src_install() {
> + debug-print-function ${FUNCNAME} "$@"
> +
> + cmake-utils_src_install
> +}
> +
> +# @FUNCTION: ecm_pkg_preinst
> +# @DESCRIPTION:
> +# Sets up environment variables required in ecm_pkg_postinst.
> +ecm_pkg_preinst() {
> + debug-print-function ${FUNCNAME} "$@"
> +
> + case ${ECM_NONGUI} in
> + false) xdg_pkg_preinst ;;
> + *) ;;
> + esac
> +}
> +
> +# @FUNCTION: ecm_pkg_postinst
> +# @DESCRIPTION:
> +# Updates the various XDG caches (icon, desktop, mime) if necessary.
> +ecm_pkg_postinst() {
> + debug-print-function ${FUNCNAME} "$@"
> +
> + case ${ECM_NONGUI} in
> + false) xdg_pkg_postinst ;;
> + *) ;;
> + esac
> +
> + if [[ -n ${_KDE_ORG_ECLASS} ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && [[ ${KDE_BUILD_TYPE} = live ]]; then
> + einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}"
> + einfo "Use it at your own risk."
> + einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!"
> + fi
> +}
> +
> +# @FUNCTION: ecm_pkg_postrm
> +# @DESCRIPTION:
> +# Updates the various XDG caches (icon, desktop, mime) if necessary.
> +ecm_pkg_postrm() {
> + debug-print-function ${FUNCNAME} "$@"
> +
> + case ${ECM_NONGUI} in
> + false) xdg_pkg_postrm ;;
> + *) ;;
> + esac
> +}
> +
> +fi
>
>
> *Attachments:*
> * signature.asc
[-- Attachment #2: Type: text/html, Size: 47062 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2019-11-10 16:27 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-24 17:17 [gentoo-dev] [PATCH] font.eclass: Port to EAPI-7 Andreas Sturmlechner
2019-03-24 18:41 ` Michał Górny
2019-04-09 19:41 ` Andreas Sturmlechner
2019-04-10 13:21 ` Michał Górny
2019-10-15 21:58 ` [gentoo-dev] [PATCH v2] " Andreas Sturmlechner
2019-10-15 22:05 ` Andreas Sturmlechner
2019-10-16 6:52 ` Michał Górny
2019-10-16 12:01 ` [gentoo-dev] [PATCH 1/2] kde.org.eclass: New eclass, split from kde5.eclass Andreas Sturmlechner
2019-10-16 12:01 ` [gentoo-dev] [PATCH 2/2] kde5.eclass: Inherit kde.org.eclass and drop moved functions/vars Andreas Sturmlechner
2019-11-04 23:30 ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Andreas Sturmlechner
2019-11-04 23:37 ` [gentoo-dev] [PATCH 2/3] kde5.eclass: Inherit ecm-utils.eclass and drop moved functions/vars Andreas Sturmlechner
2019-11-04 23:42 ` [gentoo-dev] [PATCH 3/3] kde5-functions.eclass: Drop functions/vars moved to ecm-utils Andreas Sturmlechner
2019-11-05 21:20 ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Michał Górny
2019-11-06 1:19 ` Andreas Sturmlechner
2019-11-06 7:15 ` Michał Górny
2019-11-10 13:27 ` [gentoo-dev] [PATCH v2 1/3] ecm.eclass: " Andreas Sturmlechner
2019-11-10 16:26 ` Gokturk Yuksek
2019-07-08 20:14 ` [gentoo-dev] [PATCH] profiles: desktop: Add USE icu to make.defaults Andreas Sturmlechner
2019-07-08 20:14 ` Andreas Sturmlechner
2019-07-08 20:14 ` Andreas Sturmlechner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox