/[gentoo-x86]/eclass/virtualx.eclass
Gentoo

Diff of /eclass/virtualx.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.38 Revision 1.43
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/virtualx.eclass,v 1.38 2011/03/13 19:37:28 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/virtualx.eclass,v 1.43 2012/10/03 22:47:12 chithanh Exp $
4
5# Original author: Martin Schlemmer <azarah@gentoo.org>
6 4
7# @ECLASS: virtualx.eclass 5# @ECLASS: virtualx.eclass
8# @MAINTAINER: 6# @MAINTAINER:
9# x11@gentoo.org 7# x11@gentoo.org
8# @AUTHOR:
9# Original author: Martin Schlemmer <azarah@gentoo.org>
10# @BLURB: This eclass can be used for packages that needs a working X environment to build. 10# @BLURB: This eclass can be used for packages that needs a working X environment to build.
11 11
12# @ECLASS-VARIABLE: VIRTUALX_REQUIRED 12# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
13# @DESCRIPTION: 13# @DESCRIPTION:
14# Variable specifying the dependency on xorg-server and xhost. 14# Variable specifying the dependency on xorg-server and xhost.
23# @DESCRIPTION: 23# @DESCRIPTION:
24# Dep string available for use outside of eclass, in case a more 24# Dep string available for use outside of eclass, in case a more
25# complicated dep is needed. 25# complicated dep is needed.
26# You can specify the variable BEFORE inherit to add more dependencies. 26# You can specify the variable BEFORE inherit to add more dependencies.
27VIRTUALX_DEPEND="${VIRTUALX_DEPEND} 27VIRTUALX_DEPEND="${VIRTUALX_DEPEND}
28 !prefix? ( x11-base/xorg-server[-minimal] ) 28 !prefix? ( x11-base/xorg-server[xvfb] )
29 x11-apps/xhost 29 x11-apps/xhost
30" 30"
31 31
32# @ECLASS-VARIABLE: VIRTUALX_COMMAND 32# @ECLASS-VARIABLE: VIRTUALX_COMMAND
33# @DESCRIPTION: 33# @DESCRIPTION:
68 IUSE="${VIRTUALX_REQUIRED}" 68 IUSE="${VIRTUALX_REQUIRED}"
69 ;; 69 ;;
70esac 70esac
71 71
72# @FUNCTION: virtualmake 72# @FUNCTION: virtualmake
73# @DESCRIPTION: 73# @DESCRIPTION:
74# Function which attach to running X session or start new Xvfb session 74# Function which attach to running X session or start new Xvfb session
75# where the VIRTUALX_COMMAND variable content gets executed. 75# where the VIRTUALX_COMMAND variable content gets executed.
76virtualmake() { 76virtualmake() {
77 debug-print-function ${FUNCNAME} "$@" 77 debug-print-function ${FUNCNAME} "$@"
78 78
79 local i=0 79 local i=0
80 local retval=0 80 local retval=0
81 local OLD_SANDBOX_ON="${SANDBOX_ON}" 81 local OLD_SANDBOX_ON="${SANDBOX_ON}"
82 local XVFB=$(type -p Xvfb) 82 local XVFB=$(type -p Xvfb)
83 local XHOST=$(type -p xhost) 83 local XHOST=$(type -p xhost)
84 local xvfbargs="-screen 0 800x600x24" 84 local xvfbargs="-screen 0 1280x1024x24"
85 85
86 # backcompat for maketype 86 # backcompat for maketype
87 if [[ -n ${maketype} ]]; then 87 if [[ -n ${maketype} ]]; then
88 ewarn "QA: ebuild is exporting \$maketype=${maketype}" 88 ewarn "QA: ebuild is exporting \$maketype=${maketype}"
89 ewarn "QA: Ebuild should be migrated to use VIRTUALX_COMMAND=${maketype} instead." 89 ewarn "QA: Ebuild should be migrated to use VIRTUALX_COMMAND=${maketype} instead."
142 142
143 export DISPLAY=:${XDISPLAY} 143 export DISPLAY=:${XDISPLAY}
144 # Do not break on error, but setup $retval, as we need 144 # Do not break on error, but setup $retval, as we need
145 # to kill Xvfb 145 # to kill Xvfb
146 debug-print "${FUNCNAME}: ${VIRTUALX_COMMAND} \"$@\"" 146 debug-print "${FUNCNAME}: ${VIRTUALX_COMMAND} \"$@\""
147 if has "${EAPI}" 2 3; then
147 ${VIRTUALX_COMMAND} "$@" 148 ${VIRTUALX_COMMAND} "$@"
148 retval=$? 149 retval=$?
150 else
151 nonfatal ${VIRTUALX_COMMAND} "$@"
152 retval=$?
153 fi
149 154
150 # Now kill Xvfb 155 # Now kill Xvfb
151 kill $(cat /tmp/.X${XDISPLAY}-lock) 156 kill $(cat /tmp/.X${XDISPLAY}-lock)
152 else 157 else
153 debug-print "${FUNCNAME}: attaching to running X display" 158 debug-print "${FUNCNAME}: attaching to running X display"
162 167
163 return 0 # always return 0, it can be altered by failed kill for Xvfb 168 return 0 # always return 0, it can be altered by failed kill for Xvfb
164} 169}
165 170
166# @FUNCTION: Xmake 171# @FUNCTION: Xmake
167# @DESCRIPTION: 172# @DESCRIPTION:
168# Same as "make", but set up the Xvfb hack if needed. 173# Same as "make", but set up the Xvfb hack if needed.
169# Deprecated call. 174# Deprecated call.
170Xmake() { 175Xmake() {
171 debug-print-function ${FUNCNAME} "$@" 176 debug-print-function ${FUNCNAME} "$@"
172 177
174 ewarn "QA: rather execute Xemake -j1 if you have issues with parallel make" 179 ewarn "QA: rather execute Xemake -j1 if you have issues with parallel make"
175 VIRTUALX_COMMAND="emake -j1" virtualmake "$@" 180 VIRTUALX_COMMAND="emake -j1" virtualmake "$@"
176} 181}
177 182
178# @FUNCTION: Xemake 183# @FUNCTION: Xemake
179# @DESCRIPTION: 184# @DESCRIPTION:
180# Same as "emake", but set up the Xvfb hack if needed. 185# Same as "emake", but set up the Xvfb hack if needed.
181Xemake() { 186Xemake() {
182 debug-print-function ${FUNCNAME} "$@" 187 debug-print-function ${FUNCNAME} "$@"
183 188
184 VIRTUALX_COMMAND="emake" virtualmake "$@" 189 VIRTUALX_COMMAND="emake" virtualmake "$@"
185} 190}
186 191
187# @FUNCTION: Xeconf 192# @FUNCTION: Xeconf
188# @DESCRIPTION: 193# @DESCRIPTION:
189# Same as "econf", but set up the Xvfb hack if needed. 194# Same as "econf", but set up the Xvfb hack if needed.
190Xeconf() { 195Xeconf() {
191 debug-print-function ${FUNCNAME} "$@" 196 debug-print-function ${FUNCNAME} "$@"
192 197
193 VIRTUALX_COMMAND="econf" virtualmake "$@" 198 VIRTUALX_COMMAND="econf" virtualmake "$@"
194} 199}

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.43

  ViewVC Help
Powered by ViewVC 1.1.20