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

Diff of /eclass/virtualx.eclass

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

Revision 1.30 Revision 1.33
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 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.30 2009/10/19 21:12:07 abcd Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/virtualx.eclass,v 1.33 2009/12/21 17:27:28 abcd Exp $
4# 4#
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# Author: Martin Schlemmer <azarah@gentoo.org>
6# 6#
7# This eclass can be used for packages that needs a working X environment to build 7# This eclass can be used for packages that needs a working X environment to build
8 8
9# Is a dependency on xorg-server and xhost needed? 9# Is a dependency on xorg-server and xhost needed?
10# Valid values are "always", "tests", and "manual" 10# Valid values are "always", "optional", and "manual"
11VIRTUALX_REQUIRED="${VIRTUALX_REQUIRED:-tests}" 11# "tests" is treated as a synonym for "optional"
12: ${VIRTUALX_REQUIRED:=optional}
13
14# If VIRTUALX_REQUIRED=optional, what use flag should control
15# the dependency? Default is "test"
16: ${VIRTUALX_USE:=test}
12 17
13# Dep string available for use outside of eclass, in case a more 18# Dep string available for use outside of eclass, in case a more
14# complicated dep is needed 19# complicated dep is needed
15VIRTUALX_DEPEND="x11-base/xorg-server 20VIRTUALX_DEPEND="x11-base/xorg-server
16 x11-apps/xhost" 21 x11-apps/xhost"
18case ${VIRTUALX_REQUIRED} in 23case ${VIRTUALX_REQUIRED} in
19 always) 24 always)
20 DEPEND="${VIRTUALX_DEPEND}" 25 DEPEND="${VIRTUALX_DEPEND}"
21 RDEPEND="" 26 RDEPEND=""
22 ;; 27 ;;
23 tests) 28 optional|tests)
24 DEPEND="test? ( ${VIRTUAX_DEPEND} )" 29 DEPEND="${VIRTUALX_USE}? ( ${VIRTUALX_DEPEND} )"
25 RDEPEND="" 30 RDEPEND=""
26 IUSE="test" 31 IUSE="${VIRTUALX_USE}"
27 ;; 32 ;;
28 manual) 33 manual)
29 ;; 34 ;;
30 *) 35 *)
31 eerror "Invalid value (${VIRTUALX_REQUIRED}) for VIRTUALX_REQUIRED" 36 eerror "Invalid value (${VIRTUALX_REQUIRED}) for VIRTUALX_REQUIRED"
32 eerror "Valid values are:" 37 eerror "Valid values are:"
33 eerror " always" 38 eerror " always"
34 eerror " tests" 39 eerror " optional (default if unset)"
35 eerror " manual" 40 eerror " manual"
36 die "Invalid value (${VIRTUALX_REQUIRED}) for VIRTUALX_REQUIRED" 41 die "Invalid value (${VIRTUALX_REQUIRED}) for VIRTUALX_REQUIRED"
37 ;; 42 ;;
38esac 43esac
39 44
40DESCRIPTION="Based on the $ECLASS eclass" 45DESCRIPTION="Based on the $ECLASS eclass"
41 46
42#
43# Brian Harring <ferringb@gentoo.org> 11/04/2004
44# do not disable the sandbox during the depend phase.
45# ebuilds shouldn't touch the fs during depend phase, nor screw with the sandbox.
46#
47if [[ ${EBUILD_PHASE/depend} == "${EBUILD_PHASE}" ]] ; then
48 [[ -z ${SANDBOX_DISABLED} ]] && export SANDBOX_DISABLED="0" || :
49fi
50
51virtualmake() { 47virtualmake() {
52 local retval=0 48 local retval=0
53 local OLD_SANDBOX_DISABLED="${SANDBOX_DISABLED}" 49 local OLD_SANDBOX_ON="${SANDBOX_ON}"
54 local XVFB=$(type -p Xvfb) 50 local XVFB=$(type -p Xvfb)
55 local XHOST=$(type -p xhost) 51 local XHOST=$(type -p xhost)
56 52
57 # If $DISPLAY is not set, or xhost cannot connect to an X 53 # If $DISPLAY is not set, or xhost cannot connect to an X
58 # display, then do the Xvfb hack. 54 # display, then do the Xvfb hack.
63 # compiling without the X display 59 # compiling without the X display
64 60
65 einfo "Scanning for an open DISPLAY to start Xvfb ..." 61 einfo "Scanning for an open DISPLAY to start Xvfb ..."
66 62
67 # We really do not want SANDBOX enabled here 63 # We really do not want SANDBOX enabled here
68 export SANDBOX_DISABLED="1" 64 export SANDBOX_ON="0"
69 65
70 local i=0 66 local i=0
71 XDISPLAY=$(i=0; while [[ -f /tmp/.X${i}-lock ]] ; do ((i++));done; echo ${i}) 67 XDISPLAY=$(i=0; while [[ -f /tmp/.X${i}-lock ]] ; do ((i++));done; echo ${i})
72 68
73 # If we are in a chrooted environment, and there is already a 69 # If we are in a chrooted environment, and there is already a
112 ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null & 108 ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null &
113 sleep 2 109 sleep 2
114 done 110 done
115 111
116 # Now enable SANDBOX again if needed. 112 # Now enable SANDBOX again if needed.
117 export SANDBOX_DISABLED="${OLD_SANDBOX_DISABLED}" 113 export SANDBOX_ON="${OLD_SANDBOX_ON}"
118 114
119 einfo "Starting Xvfb on \$DISPLAY=${XDISPLAY} ..." 115 einfo "Starting Xvfb on \$DISPLAY=${XDISPLAY} ..."
120 116
121 export DISPLAY=:${XDISPLAY} 117 export DISPLAY=:${XDISPLAY}
122 #Do not break on error, but setup $retval, as we need 118 #Do not break on error, but setup $retval, as we need

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.33

  ViewVC Help
Powered by ViewVC 1.1.20