Hello lads,
I would like you to review following patches we kept hidden from you in
x11 overlay up till now.

xorg-2:
autotools-utils usage
        - out of tree build by default
        - killing all .la files
added doc dependencies
        - it is same for all pkgs and easier to keep it in eclass
        (ebuilds will be updated as bumped, live versions in overlay
        are already prepared for this)
updated font disable calls
        - with new fonts the disable call is much much easier so we
        just need to reflect that

virtualx:
Pretty much add eclass-debug info everywhere and fix formatting.

migrate from "export maketype" to more reliable VIRTUALX_COMMAND global
variable (can be set anytime).

deprecate Xmake in favor of Xemake -j1 or VIRTUALX_COMMAND="emake -j1"

Change the VIRTUALX_REQUIRED and VIRTUALX_USE to be bit saner and merged
into one variable with qa deprecation warnings and fallback in place.
New usage described in eclassdoc pretty well.

So any comments? suggestions?

Cheers

Tom
--- /home/scarab/gentoo/gentoo-x86/eclass/virtualx.eclass       2010-11-12 
15:43:12.000000000 +0100
+++ virtualx.eclass     2011-02-21 20:46:14.000000000 +0100
@@ -6,113 +6,132 @@
 
 # @ECLASS: virtualx.eclass
 # @MAINTAINER:
-#  x...@gentoo.org
+# x...@gentoo.org
 # @BLURB: This eclass can be used for packages that needs a working X 
environment to build.
 
 # @ECLASS-VARIABLE: VIRTUALX_REQUIRED
 # @DESCRIPTION:
-#  Is a dependency on xorg-server and xhost needed?
-#  Valid values are "always", "optional", and "manual".
-#  "tests" is a synonym for "optional".
-: ${VIRTUALX_REQUIRED:=optional}
+# Variable specifying the dependency on xorg-server and xhost.
+# Possible special values are "always" and "manual", which specify
+# the dependency to be set unconditionaly or not at all.
+# Any other value is taken as useflag desired to be in control of
+# the dependency (eg. VIRTUALX_REQUIRED="kde" will add the dependency
+# into "kde? ( )" and add kde into IUSE.
+: ${VIRTUALX_REQUIRED:=test}
 
-# @ECLASS-VARIABLE: VIRTUALX_USE
+# @ECLASS-VARIABLE: VIRTUALX_DEPEND
 # @DESCRIPTION:
-#  If VIRTUALX_REQUIRED=optional, what USE flag should control
-#  the dependency?
-: ${VIRTUALX_USE:=test}
+# Dep string available for use outside of eclass, in case a more
+# complicated dep is needed.
+# You can specify the variable BEFORE inherit to add more dependencies.
+VIRTUALX_DEPEND="${VIRTUALX_DEPEND}
+       !prefix? ( x11-base/xorg-server[-minimal] )
+       x11-apps/xhost
+"
 
-# @ECLASS-VARIABLE: VIRTUALX_DEPEND
+# @ECLASS-VARIABLE: VIRTUALX_COMMAND
 # @DESCRIPTION:
-#  Dep string available for use outside of eclass, in case a more
-#  complicated dep is needed.
-VIRTUALX_DEPEND="!prefix? ( x11-base/xorg-server )
-       x11-apps/xhost"
+# Command (or eclass function call) to be run in the X11 environment
+# (within virtualmake function).
+: ${VIRTUALX_COMMAND:="emake"}
+
+has "${EAPI:-0}" 0 1 && die "virtualx eclass require EAPI=2 or newer."
 
 case ${VIRTUALX_REQUIRED} in
+       manual)
+               ;;
        always)
                DEPEND="${VIRTUALX_DEPEND}"
                RDEPEND=""
                ;;
        optional|tests)
+               # deprecated section YAY.
+               ewarn "QA: VIRTUALX_REQUIRED=optional and 
VIRTUALX_REQUIRED=tests are deprecated."
+               ewarn "QA: You can drop the variable definition completely from 
ebuild,"
+               ewarn "QA: because it is default behaviour."
+
+               if [[ -n ${VIRTUALX_USE} ]]; then
+                       # so they like to specify the useflag
+                       ewarn "QA: VIRTUALX_USE variable is deprecated."
+                       ewarn "QA: Please read eclass manpage to find out how 
to use VIRTUALX_REQUIRED"
+                       ewarn "QA: to achieve the same behaviour."
+               fi
+
+               [[ -z ${VIRTUALX_USE} ]] && VIRTUALX_USE="test"
                DEPEND="${VIRTUALX_USE}? ( ${VIRTUALX_DEPEND} )"
                RDEPEND=""
                IUSE="${VIRTUALX_USE}"
                ;;
-       manual)
-               ;;
        *)
-               eerror "Invalid value (${VIRTUALX_REQUIRED}) for 
VIRTUALX_REQUIRED"
-               eerror "Valid values are:"
-               eerror "  always"
-               eerror "  optional (default if unset)"
-               eerror "  manual"
-               die "Invalid value (${VIRTUALX_REQUIRED}) for VIRTUALX_REQUIRED"
+               DEPEND="${VIRTUALX_REQUIRED}? ( ${VIRTUALX_DEPEND} )"
+               RDEPEND=""
+               IUSE="${VIRTUALX_REQUIRED}"
                ;;
 esac
 
+# @FUNCTION: virtualmake
+# @DESCRIPTION: 
+# Function which attach to running X session or start new Xvfb session
+# where the VIRTUALX_COMMAND variable content gets executed.
 virtualmake() {
+       debug-print-function ${FUNCNAME} "$@"
+
+       local i=0
        local retval=0
        local OLD_SANDBOX_ON="${SANDBOX_ON}"
        local XVFB=$(type -p Xvfb)
        local XHOST=$(type -p xhost)
+       local xvfbargs="-screen 0 800x600x24"
+
+       # backcompat for maketype
+       if [[ -n ${maketype} ]]; then
+               ewarn "QA: ebuild is exporting \$maketype=${maketype}"
+               ewarn "QA: Ebuild should be migrated to use 
VIRTUALX_COMMAND=${maketype} instead."
+               ewarn "QA: Setting VIRTUALX_COMMAND to \$maketype conveniently 
for now."
+               VIRTUALX_COMMAND=${maketype}
+       fi
 
        # If $DISPLAY is not set, or xhost cannot connect to an X
        # display, then do the Xvfb hack.
        if [[ -n ${XVFB} && -n ${XHOST} ]] && \
-          ( [[ -z ${DISPLAY} ]] || ! (${XHOST} &>/dev/null) ) ; then
+                       ( [[ -z ${DISPLAY} ]] || ! (${XHOST} &>/dev/null) ) ; 
then
+               debug-print "${FUNCNAME}: running Xvfb hack"
                export XAUTHORITY=
                # The following is derived from Mandrake's hack to allow
                # compiling without the X display
 
                einfo "Scanning for an open DISPLAY to start Xvfb ..."
-
-               # We really do not want SANDBOX enabled here
-               export SANDBOX_ON="0"
-
-               local i=0
-               XDISPLAY=$(i=0; while [[ -f /tmp/.X${i}-lock ]] ; do 
((i++));done; echo ${i})
-
                # If we are in a chrooted environment, and there is already a
                # X server started outside of the chroot, Xvfb will fail to 
start
                # on the same display (most cases this is :0 ), so make sure
                # Xvfb is started, else bump the display number
                #
                # Azarah - 5 May 2002
-               #
-               # Changed the mode from 800x600x32 to 800x600x24 because the mfb
-               # support has been dropped in Xvfb in the xorg-x11 pre-releases.
-               # For now only depths up to 24-bit are supported.
-               #
-               # Sven Wegener <swege...@gentoo.org> - 22 Aug 2004
-               #
-               # Use "-fp built-ins" because it's only part of the default 
font path
-               # for Xorg but not the other DDXs (Xvfb, Kdrive, etc). 
Temporarily fixes
-               # bug 278487 until xorg-server is properly patched
-               #
-               # Rémi Cardona <r...@gentoo.org> (10 Aug 2009)
-               ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 
&>/dev/null &
+               XDISPLAY=$(i=0; while [[ -f /tmp/.X${i}-lock ]] ; do 
((i++));done; echo ${i})
+               debug-print "${FUNCNAME}: XDISPLAY=${XDISPLAY}"
+
+               # We really do not want SANDBOX enabled here
+               export SANDBOX_ON="0"
+
+               debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}"
+               ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null &
                sleep 2
 
                local start=${XDISPLAY}
-               while [[ ! -f /tmp/.X${XDISPLAY}-lock ]] ; do
+               while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do
                        # Stop trying after 15 tries
                        if ((XDISPLAY - start > 15)) ; then
-
-                               eerror ""
-                               eerror "Unable to start Xvfb."
-                               eerror ""
-                               eerror "'${XVFB} :${XDISPLAY} -fp built-ins 
-screen 0 800x600x24' returns:"
-                               eerror ""
-                               ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 
800x600x24
-                               eerror ""
+                               eerror "'${XVFB} :${XDISPLAY} ${xvfbargs}' 
returns:"
+                               echo
+                               ${XVFB} :${XDISPLAY} ${xvfbargs}
+                               echo
                                eerror "If possible, correct the above error 
and try your emerge again."
-                               eerror ""
-                               die
+                               die "Unable to start Xvfb"
                        fi
 
                        ((XDISPLAY++))
-                       ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 
&>/dev/null &
+                       debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} 
${xvfbargs}"
+                       ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null &
                        sleep 2
                done
 
@@ -122,42 +141,52 @@
                einfo "Starting Xvfb on \$DISPLAY=${XDISPLAY} ..."
 
                export DISPLAY=:${XDISPLAY}
-               #Do not break on error, but setup $retval, as we need
-               #to kill Xvfb
-               ${maketype} "$@"
+               # Do not break on error, but setup $retval, as we need
+               # to kill Xvfb
+               debug-print "${FUNCNAME}: ${VIRTUALX_COMMAND} \"$@\""
+               ${VIRTUALX_COMMAND} "$@"
                retval=$?
 
-               #Now kill Xvfb
+               # Now kill Xvfb
                kill $(cat /tmp/.X${XDISPLAY}-lock)
        else
-               #Normal make if we can connect to an X display
-               ${maketype} "$@"
+               debug-print "${FUNCNAME}: attaching to running X display"
+               # Normal make if we can connect to an X display
+               debug-print "${FUNCNAME}: ${VIRTUALX_COMMAND} \"$@\""
+               ${VIRTUALX_COMMAND} "$@"
                retval=$?
        fi
 
-       return ${retval}
+       # die if our command failed
+       [[ $? -ne 0 ]] && die "${FUNCNAME}: the ${VIRTALX_COMMAND} failed."
 }
 
 # @FUNCTION: Xmake
 # @DESCRIPTION: 
-#  Same as "make", but set up the Xvfb hack if needed.
+# Same as "make", but set up the Xvfb hack if needed.
+# Deprecated call.
 Xmake() {
-       export maketype="make"
-       virtualmake "$@"
+       debug-print-function ${FUNCNAME} "$@"
+
+       ewarn "QA: you should not execute make directly"
+       ewarn "QA: rather execute Xemake -j1 if you have issues with parallel 
make"
+       VIRTUALX_COMMAND="emake" virtualmake "$@"
 }
 
 # @FUNCTION: Xemake
 # @DESCRIPTION: 
-#  Same as "emake", but set up the Xvfb hack if needed.
+# Same as "emake", but set up the Xvfb hack if needed.
 Xemake() {
-       export maketype="emake"
-       virtualmake "$@"
+       debug-print-function ${FUNCNAME} "$@"
+
+       VIRTUALX_COMMAND="make" virtualmake "$@"
 }
 
 # @FUNCTION: Xeconf
 # @DESCRIPTION: 
 #  Same as "econf", but set up the Xvfb hack if needed.
 Xeconf() {
-       export maketype="econf"
-       virtualmake "$@"
+       debug-print-function ${FUNCNAME} "$@"
+
+       VIRTUALX_COMMAND="econf" virtualmake "$@"
 }
--- /home/scarab/gentoo/gentoo-x86/eclass/xorg-2.eclass 2011-02-15 
22:48:00.000000000 +0100
+++ xorg-2.eclass       2011-02-19 14:45:25.000000000 +0100
@@ -1,6 +1,6 @@
 # Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.23 2011/02/15 
12:13:58 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.22 2011/01/15 
17:55:21 scarabeus Exp $
 #
 # @ECLASS: xorg-2.eclass
 # @MAINTAINER:
@@ -38,7 +38,7 @@
        FONT_ECLASS="font"
 fi
 
-inherit eutils base libtool multilib toolchain-funcs flag-o-matic autotools \
+inherit autotools-utils eutils libtool multilib toolchain-funcs flag-o-matic 
autotools \
        ${FONT_ECLASS} ${GIT_ECLASS}
 
 EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm"
@@ -68,28 +68,28 @@
 # inherit to override the default autoconfigured module.
 if [[ -z ${MODULE} ]]; then
        case ${CATEGORY} in
-               app-doc)             MODULE="doc"     ;;
-               media-fonts)         MODULE="font"    ;;
-               x11-apps|x11-wm)     MODULE="app"     ;;
-               x11-misc|x11-themes) MODULE="util"    ;;
-               x11-drivers)         MODULE="driver"  ;;
-               x11-base)            MODULE="xserver" ;;
-               x11-proto)           MODULE="proto"   ;;
-               x11-libs)            MODULE="lib"     ;;
-               *)                   MODULE=""        ;;
+               app-doc)             MODULE=doc/     ;;
+               media-fonts)         MODULE=font/    ;;
+               x11-apps|x11-wm)     MODULE=app/     ;;
+               x11-misc|x11-themes) MODULE=util/    ;;
+               x11-base)            MODULE=xserver/ ;;
+               x11-drivers)         MODULE=driver/  ;;
+               x11-proto)           MODULE=proto/   ;;
+               x11-libs)            MODULE=lib/     ;;
+               *)                   MODULE=         ;;
        esac
 fi
 
 # @ECLASS-VARIABLE: PACKAGE_NAME
 # @DESCRIPTION:
-# For git checkout the git repository migth differ from package name.
+# For git checkout the git repository might differ from package name.
 # This variable can be used for proper directory specification
 : ${PACKAGE_NAME:=${PN}}
 
 if [[ -n ${GIT_ECLASS} ]]; then
-       
EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PACKAGE_NAME}"
+       
EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}${PACKAGE_NAME}"
 else
-       SRC_URI+=" ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2"
+       SRC_URI+=" ${BASE_INDIVIDUAL_URI}/${MODULE}${P}.tar.bz2"
 fi
 
 : ${SLOT:=0}
@@ -178,6 +178,19 @@
 has dri ${IUSE//+} && DEPEND+=" dri? ( 
>=x11-base/xorg-server-1.6.3.901-r2[-minimal] )"
 [[ -n "${DRIVER}" ]] && DEPEND+=" x11-base/xorg-server[xorg]"
 
+# Add deps on documentation
+# Most docbooks use dtd version 4.2 and 4.3 add more when found
+if has doc ${IUSE//+}; then
+       DEPEND+="
+               doc? (
+                       app-text/xmlto
+                       app-doc/doxygen
+                       app-text/docbook-xml-dtd:4.2
+                       app-text/docbook-xml-dtd:4.3
+               )
+       "
+fi
+
 # @FUNCTION: xorg-2_pkg_setup
 # @DESCRIPTION:
 # Setup prefix compat
@@ -214,7 +227,7 @@
        EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
 
        [[ -d "${EPATCH_SOURCE}" ]] && epatch
-       base_src_prepare "$@"
+       autotools-utils_src_prepare "$@"
 }
 
 # @FUNCTION: xorg-2_reconf_source
@@ -253,24 +266,29 @@
        debug-print-function ${FUNCNAME} "$@"
 
        if has nls ${IUSE//+} && ! use nls; then
-               FONT_OPTIONS+="
-                       --disable-iso8859-2
-                       --disable-iso8859-3
-                       --disable-iso8859-4
-                       --disable-iso8859-5
-                       --disable-iso8859-6
-                       --disable-iso8859-7
-                       --disable-iso8859-8
-                       --disable-iso8859-9
-                       --disable-iso8859-10
-                       --disable-iso8859-11
-                       --disable-iso8859-12
-                       --disable-iso8859-13
-                       --disable-iso8859-14
-                       --disable-iso8859-15
-                       --disable-iso8859-16
-                       --disable-jisx0201
-                       --disable-koi8-r"
+               if grep -q -s "disable-all-encodings" 
${ECONF_SOURCE:-.}/configure; then
+                       FONT_OPTIONS+="
+                               --disable-all-encodings"
+               else
+                       FONT_OPTIONS+="
+                               --disable-iso8859-2
+                               --disable-iso8859-3
+                               --disable-iso8859-4
+                               --disable-iso8859-5
+                               --disable-iso8859-6
+                               --disable-iso8859-7
+                               --disable-iso8859-8
+                               --disable-iso8859-9
+                               --disable-iso8859-10
+                               --disable-iso8859-11
+                               --disable-iso8859-12
+                               --disable-iso8859-13
+                               --disable-iso8859-14
+                               --disable-iso8859-15
+                               --disable-iso8859-16
+                               --disable-jisx0201
+                               --disable-koi8-r"
+               fi
        fi
 }
 
@@ -298,25 +316,23 @@
 # Perform any necessary pre-configuration steps, then run configure
 xorg-2_src_configure() {
        debug-print-function ${FUNCNAME} "$@"
-       local myopts=""
 
        xorg-2_flags_setup
-       [[ -n "${FONT}" ]] && xorg-2_font_configure
 
        # @VARIABLE: CONFIGURE_OPTIONS
        # @DESCRIPTION:
        # Any options to pass to configure
        # @DEFAULT_UNSET
        CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:=""}
-       if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
-               if has static-libs ${IUSE//+}; then
-                       myopts+=" $(use_enable static-libs static)"
-               fi
-               econf \
-                       ${FONT_OPTIONS} \
-                       ${CONFIGURE_OPTIONS} \
-                       ${myopts}
-       fi
+
+       [[ -n "${FONT}" ]] && xorg-2_font_configure
+       local myeconfargs=(
+               --disable-dependency-tracking
+               ${CONFIGURE_OPTIONS}
+               ${FONT_OPTIONS}
+       )
+
+       autotools-utils_src_configure "$@"
 }
 
 # @FUNCTION: xorg-2_src_compile
@@ -325,7 +341,7 @@
 xorg-2_src_compile() {
        debug-print-function ${FUNCNAME} "$@"
 
-       base_src_compile "$@"
+       autotools-utils_src_compile "$@"
 }
 
 # @FUNCTION: xorg-2_src_install
@@ -336,16 +352,12 @@
        debug-print-function ${FUNCNAME} "$@"
 
        if [[ ${CATEGORY} == x11-proto ]]; then
-               emake \
+               autotools-utils_src_install \
                        ${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \
-                       docdir=${EPREFIX}/usr/share/doc/${PF} \
-                       DESTDIR="${D}" \
-                       install || die "emake install failed"
+                       docdir=${EPREFIX}/usr/share/doc/${PF}
        else
-               emake \
-                       docdir=${EPREFIX}/usr/share/doc/${PF} \
-                       DESTDIR="${D}" \
-                       install || die "emake install failed"
+               autotools-utils_src_install \
+                       docdir=${EPREFIX}/usr/share/doc/${PF}
        fi
 
        if [[ -n ${GIT_ECLASS} ]]; then
@@ -357,19 +369,9 @@
        if [[ -e "${S}"/ChangeLog ]]; then
                dodoc "${S}"/ChangeLog || die "dodoc failed"
        fi
-       # @VARIABLE: DOCS
-       # @DESCRIPTION:
-       # Any documentation to install
-       # @DEFAULT_UNSET
-       if [[ -n ${DOCS} ]]; then
-               dodoc ${DOCS} || die "dodoc failed"
-       fi
 
-       # Don't install libtool archives for server modules
-       if [[ -e "${D%/}${EPREFIX}/usr/$(get_libdir)/xorg/modules" ]]; then
-               find "${D%/}${EPREFIX}/usr/$(get_libdir)/xorg/modules" -name 
'*.la' \
-                       -exec rm -f {} ';'
-       fi
+       # Don't install libtool archives (even with static-libs)
+       remove_libtool_files all
 
        [[ -n ${FONT} ]] && remove_font_metadata
 }

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to