Nearly all the work is just removing uses of autotools-multilib and
autotools-utils. The new code should work in EAPI 4 and 5. Don't add
support for EAPI 6; that ship has already sailed.
---
There are a number of trivial x11 bumps coming up, so I figured I'd try
to finally add EAPI=7 support to xorg-2.eclass. This is lightly tested,
and I don't feel like an expert at this, so any review and feedback is
appreciated.

I find the if-multilib ... fi blocks a little odd. Is there a better way
to do that?

 eclass/xorg-2.eclass | 80 ++++++++++++++++++++++++++------------------
 1 file changed, 48 insertions(+), 32 deletions(-)

diff --git a/eclass/xorg-2.eclass b/eclass/xorg-2.eclass
index 74660e7f213..eb2aa1594b4 100644
--- a/eclass/xorg-2.eclass
+++ b/eclass/xorg-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: xorg-2.eclass
@@ -7,7 +7,7 @@
 # @AUTHOR:
 # Author: Tomáš Chvátal <scarab...@gentoo.org>
 # Author: Donnie Berkholz <dberkh...@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5
+# @SUPPORTED_EAPIS: 4 5 7
 # @BLURB: Reduces code duplication in the modularized X11 ebuilds.
 # @DESCRIPTION:
 # This eclass makes trivial X ebuilds possible for apps, fonts, drivers,
@@ -44,16 +44,16 @@ fi
 : ${XORG_MULTILIB:="no"}
 
 # we need to inherit autotools first to get the deps
-inherit autotools autotools-utils eutils libtool multilib toolchain-funcs \
+inherit autotools eutils libtool multilib toolchain-funcs \
        flag-o-matic ${FONT_ECLASS} ${GIT_ECLASS}
 
 if [[ ${XORG_MULTILIB} == yes ]]; then
-       inherit autotools-multilib
+       inherit multilib-minimal
 fi
 
-EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm"
+EXPORTED_FUNCTIONS="src_prepare src_configure src_unpack src_compile 
src_install pkg_postinst pkg_postrm"
 case "${EAPI:-0}" in
-       4|5) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare 
src_configure" ;;
+       4|5|7) ;;
        *) die "EAPI=${EAPI} is not supported" ;;
 esac
 
@@ -129,7 +129,16 @@ for arch in ${XORG_EAUTORECONF_ARCHES}; do
        EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )"
 done
 DEPEND+=" ${EAUTORECONF_DEPENDS}"
-[[ ${XORG_EAUTORECONF} != no ]] && DEPEND+=" ${EAUTORECONF_DEPEND}"
+if [[ ${XORG_EAUTORECONF} != no ]] ; then
+       case "${EAPI:-0}" in
+               4|5)
+                       DEPEND+=" ${EAUTORECONF_DEPEND}"
+                       ;;
+               7)
+                       BDEPEND+=" ${EAUTORECONF_DEPEND}"
+                       ;;
+       esac
+fi
 unset EAUTORECONF_DEPENDS
 unset EAUTORECONF_DEPEND
 
@@ -311,20 +320,6 @@ xorg-2_src_unpack() {
        [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}"
 }
 
-# @FUNCTION: xorg-2_patch_source
-# @DESCRIPTION:
-# Apply all patches
-xorg-2_patch_source() {
-       debug-print-function ${FUNCNAME} "$@"
-
-       # Use standardized names and locations with bulk patching
-       # Patch directory is ${WORKDIR}/patch
-       # See epatch() in eutils.eclass for more documentation
-       EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
-
-       [[ -d "${EPATCH_SOURCE}" ]] && epatch
-}
-
 # @FUNCTION: xorg-2_reconf_source
 # @DESCRIPTION:
 # Run eautoreconf if necessary, and run elibtoolize.
@@ -335,14 +330,17 @@ xorg-2_reconf_source() {
                *-aix* | *-winnt*)
                        # some hosts need full eautoreconf
                        [[ -e "./configure.ac" || -e "./configure.in" ]] \
-                               && AUTOTOOLS_AUTORECONF=1
+                               && XORG_EAUTORECONF=yes
                        ;;
                *)
                        # elibtoolize required for BSD
                        [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" 
|| -e "./configure.in" ) ]] \
-                               && AUTOTOOLS_AUTORECONF=1
+                               && XORG_EAUTORECONF=yes
                        ;;
        esac
+
+       [[ ${XORG_EAUTORECONF} != no ]] && eautoreconf
+       elibtoolize --patch-only
 }
 
 # @FUNCTION: xorg-2_src_prepare
@@ -351,9 +349,10 @@ xorg-2_reconf_source() {
 xorg-2_src_prepare() {
        debug-print-function ${FUNCNAME} "$@"
 
-       xorg-2_patch_source
+       default
        xorg-2_reconf_source
-       autotools-utils_src_prepare "$@"
+
+       [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
 }
 
 # @FUNCTION: xorg-2_font_configure
@@ -447,17 +446,28 @@ xorg-2_src_configure() {
                local selective_werror="--disable-selective-werror"
        fi
 
-       local myeconfargs=(
+       local econfargs=(
                ${dep_track}
                ${selective_werror}
                ${FONT_OPTIONS}
                "${xorgconfadd[@]}"
        )
 
+       # Handle static-libs found in IUSE, disable them by default
+       if in_iuse static-libs; then
+               econfargs+=(
+                       --enable-shared
+                       $(use_enable static-libs static)
+               )
+       fi
+
        if [[ ${XORG_MULTILIB} == yes ]]; then
-               autotools-multilib_src_configure "$@"
+               multilib_src_configure() {
+                       ECONF_SOURCE="${S}" econf "${econfargs[@]}"
+               }
+               multilib-minimal_src_configure "$@"
        else
-               autotools-utils_src_configure "$@"
+               econf "${econfargs[@]}" "$@"
        fi
 }
 
@@ -468,9 +478,12 @@ xorg-2_src_compile() {
        debug-print-function ${FUNCNAME} "$@"
 
        if [[ ${XORG_MULTILIB} == yes ]]; then
-               autotools-multilib_src_compile "$@"
+               multilib_src_compile() {
+                       emake "$@" || die 'emake failed'
+               }
+               multilib-minimal_src_compile "$@"
        else
-               autotools-utils_src_compile "$@"
+               emake "$@" || die 'emake failed'
        fi
 }
 
@@ -484,9 +497,12 @@ xorg-2_src_install() {
        local install_args=( docdir="${EPREFIX}/usr/share/doc/${PF}" )
 
        if [[ ${XORG_MULTILIB} == yes ]]; then
-               autotools-multilib_src_install "${install_args[@]}"
+               multilib_src_install() {
+                       emake DESTDIR="${D}" "${install_args[@]}" "$@" install 
|| die "emake install failed"
+               }
+               multilib-minimal_src_install "$@"
        else
-               autotools-utils_src_install "${install_args[@]}"
+               emake DESTDIR="${D}" "${install_args[@]}" "$@" install || die 
"emake install failed"
        fi
 
        if [[ -n ${GIT_ECLASS} ]]; then
-- 
2.19.2


Reply via email to