-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 04/11/2016 08:14 PM, NP-Hardass wrote:
> On 04/11/2016 01:09 AM, NP-Hardass wrote:
>> Greetings all,
> 
>> As all potential new eclasses are supposed to be discussed here,
>> I thought I'd file a message and see if anyone had anything to 
>> contribute on the matter.
> 
>> I'm in the midst of a major version bump for the entirety of the 
>> MATE desktop environment, consisting of 40-50 packages.  There is
>> a huge amount of repetition in my ebuilds, and a lot of things
>> are formulaic (SRC_URI, HOMEPAGE, EGIT_REPO_URI, inherits,
>> src_prepare, etc).  As such, I think that moving all of that to
>> an eclass would greatly simplify my life and my ebuilds, so I
>> thought I'd look into creating an eclass.
> 
>> Any opinions either way?   Thanks in advance.
> 
> 
> 
> 
> A little background, MATE is a fork of GNOME, so there are many
> things in common, however, the two aren't always in sync.  As such,
> there is often code reuse, but not always.  For example, GNOME has
> deprecated GNOME_DEBUG macros whereas MATE has not done so yet.
> 
> Attached are two eclasses mate-desktop.org.eclass and mate.eclass.
> 
> mate-desktop.org.eclass mimics the gnome.org eclass.  It defines a 
> couple of useful variables, as well as sets SRC_URI or
> EGIT_REPO_URI for a live ebuild.
> 
> mate.eclass is supposed to parallel gnome2.eclass.  A couple of
> notes: mate-desktop.org.eclass is necessary to override all of the
> defaults in gnome.org.eclass which are not applicable to MATE. The
> src_prepare function is borrowed from autotools-utils.  With EAPI
> 6, if any user is capable of modifying the build system via
> eapply_user, I'd like to be able to detect and regenerate the build
> system accordingly. Additionally, upstream does not supply
> Makefiles or configure scripts for live ebuilds, so I always have
> to run eautoreconf in those cases. Stubs: Well, you will probably
> notice that I have stubs to the gnome2 remaining functions.  This
> was done for several reasons.  1) in the event that the gnome2
> eclass goes in a different direction than MATE, it's easy to switch
> our own implementation, and 2) if I don't and I have reference to
> the gnome2 eclass, I have to explicitly inherit it in all ebuilds,
> which somewhat defeats the point the indirection gained by having
> the mate eclass.   I'd have to inherit gnome2 mate mate-desktop.org
> in every ebuild to ensure that everything is inherited properly.
> It's a little bit messy, but still doable.  But for the previous
> reason, built in independence from the gnome eclass if needed, it
> seems much easier to me to stub out gnome2 in the meantime .
> 
> 
Added new function to wrap around a MATE autotools function
mate-doc-common and add it to src_prepare

- -- 
NP-Hardass
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXDFeaAAoJEBzZQR2yrxj7LIgP+QGFJ+xdigWpxSDIIqabwozT
qL6hwvAQVHe3gBjGvs3FPOo+FJgzteQE4pRhhkU+g+Zgs9z1f7NIQQZbMwfVrHg+
KYKdufL4Wd2rF/X1qAf5EOqToBxZxpEYH0rPlfirOE4WA0HC5Gke0fwppeu6L8S3
7+N68ZdPKYnJ55+FZAiQCuy9QX3gDHsKhSpd1P4q5+Fi6D+qGYFalOlhhtW6qiOR
Rv41/xEabUha4V9H7YG5j+rROL5mSFchIT6wzx5dDTwQKS2dTclcqEbuS/k45E44
aemZFfb6l8Ymg+o28sCidPlOYyVaF5j7VbIAHNwEN4DNlbbpOJKAE5wTc6zrAyv5
zRVmmlxMlJvwr26faQsKgEGcVTWenmyCDeguSwgDetv1oQrzHtkI9lJMoUdRW39S
5nNp3mA2isUVmQIZRidAnPIJwLWBo7pmRZ67leCuK1UXGvGQWFDKXzPcRShTZRYb
nnE5VamFBlZtfpAnuoLYhNf9i21GJ/SJMxEwWNutdhf343qogfOk+Q7cKuYATEwm
OP499WmH7WNNjMnQiiyj9fC3epXslHN9ibYNoq1tf1Q3s5wIvzJ0ivcD9HZxxERv
usYALHiK1YZrjGpy3Tm1+pt44jwCRt+hVBL+2fpez3ZOpPqRjW24KCnM1ZHILbx4
CSPRFgrQnPUMI4/r6Ew9
=JV4I
-----END PGP SIGNATURE-----
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

# @ECLASS: mate.eclass
# @MAINTAINER:
# m...@gentoo.org
# @AUTHOR:
# Authors: NP-Hardass <np-hard...@gentoo.org> based upon the gnome2
# and autotools-utils eclasses
# @BLURB: Provides phases for MATE based packages.
# @DESCRIPTION:
# Exports portage base functions used by ebuilds written for packages using the
# MATE framework. Occassionally acts as a wrapper to gnome2 due to the
# fact that MATE is a GNOME fork. For additional functions, see 
gnome2-utils.eclass.

# Check EAPI only
case "${EAPI:-0}" in
        5|6) ;;
        *) die "EAPI=${EAPI} is not supported" ;;
esac

# Inherit happens below after declaration of GNOME2_LA_PUNT

# @ECLASS-VARIABLE: MATE_LA_PUNT
# @DESCRIPTION:
# Available values for MATE_LA_PUNT:
# - "no": will not clean any .la files
# - "yes": will run prune_libtool_files --modules
# - If it is not set, it will run prune_libtool_files
# MATE_LA_PUNT is a stub to GNOME2_LA_PUNT
GNOME2_LA_PUNT=${MATE_LA_PUNT:-""}

inherit autotools gnome2 mate-desktop.org

case "${EAPI:-0}" in
        5|6)
                EXPORT_FUNCTIONS src_prepare src_configure src_install 
pkg_preinst pkg_postinst pkg_postrm
                ;;
        *) die "EAPI=${EAPI} is not supported" ;;
esac

# Autotools requires our MATE m4 files
DEPEND=">=mate-base/mate-common-${MATE_BRANCH}"

# @FUNCTION: python_cond_func_wrap
# @DESCRIPTION: Wraps a function for conditional python use, to run for each
# python implementation in the build directory.
python_cond_func_wrap() {
        if use python; then
                python_foreach_impl run_in_build_dir $@
        else
                $@
        fi
}

# @FUNCTION: ematedocize
# @DESCRIPTION: A wrapper around mate-doc-common
ematedocize() {
        ebegin "Running mate-doc-common --copy"
                mate-doc-common --copy || die
        eend $?
}

# @FUNCTION: mate_src_prepare
# @DESCRIPTION:
# Call gnome2_src_prepare to handle environment setup and patching, then
# call eautoreconf if necessary
mate_src_prepare() {
        debug-print-function ${FUNCNAME} "$@"

        local force_autoreconf=${FORCE_AUTORECONF:-false}
        [[ ${PV} == 9999 ]] && force_autoreconf=true

        gen_chksum() {
                find '(' -name 'Makefile.am' \
                        -o -name 'configure.ac' \
                        -o -name 'configure.in' ')' \
                        -exec cksum + | sort -k2
        }

        local chksum=$(gen_chksum)

        gnome2_src_prepare

        if ${force_autoreconf} || [[ ${chksum} != $(gen_chksum) ]]; then
                eautoreconf
                ematedocize
        fi
}

# @FUNCTION: mate_src_configure
# @DESCRIPTION:
# MATE specific configure handling
# Stub to gnome2_src_configure()
mate_src_configure() {
        gnome2_src_configure
}

# @FUNCTION: mate_src_install
# @DESCRIPTION:
# MATE specific install. Stub to gnome2_src_install
mate_src_install() {
        gnome2_src_install
}

# @FUNCTION: mate_pkg_preinst
# @DESCRIPTION:
# Finds Icons, GConf and GSettings schemas for later handling in pkg_postinst
# Stub to gnome2_pkg_preinst
mate_pkg_preinst() {
        gnome2_pkg_preinst
}

# @FUNCTION: mate_pkg_postinst
# @DESCRIPTION:
# Handle scrollkeeper, GConf, GSettings, Icons, desktop and mime
# database updates.
# Stub to gnome2_pkg_postinst
mate_pkg_postinst() {
        gnome2_pkg_postinst
}

# @FUNCTION: mate_pkg_postrm
# @DESCRIPTION:
# Handle scrollkeeper, GSettings, Icons, desktop and mime database updates.
# Stub to gnome2_pkg_postrm
mate_pkg_postrm() {
        gnome2_pkg_postrm
}

Attachment: mate.eclass.sig
Description: PGP signature

Reply via email to