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

Contents of /eclass/virtualx.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Sun May 5 16:47:04 2002 UTC (12 years, 2 months ago) by azarah
Branch: MAIN
Changes since 1.3: +11 -4 lines
hopefull chroot fixup

1 azarah 1.1 # Copyright 1999-2002 Gentoo Technologies, Inc.
2     # Distributed under the terms of the GNU General Public License, v2 or later
3     # Author: Martin Schlemmer <azarah@gentoo.org>
4 azarah 1.4 # $Header: /home/cvsroot/gentoo-x86/eclass/virtualx.eclass,v 1.3 2002/04/15 03:33:50 azarah Exp $
5 azarah 1.1 # This eclass can be used for packages that needs a working X environment to build
6     ECLASS=virtualx
7     newdepend virtual/x11
8    
9     DESCRIPTION="Based on the $ECLASS eclass"
10    
11     virtualmake() {
12     local retval=0
13    
14     #If $DISPLAY is not set, or xhost cannot connect to an X
15     #display, then do the Xvfb hack.
16     if [ -z "$DISPLAY" ] || ! /usr/X11R6/bin/xhost
17     then
18 azarah 1.3 export XAUTHORITY=
19 azarah 1.4 # The following is derived from Mandrake's hack to allow
20     # compiling without the X display
21    
22     # Only start at :1, as the default display is usually :0,
23     # and Xvfb cannot start if X is already running. This
24     # is mainly to fix chroot issues where this wont detect
25     # a running X, as we dont have /tmp mounted (--bind) in
26     # the chroot. (Azarah - 5 May 2002)
27     local i=1
28     XDISPLAY=$(i=1; while [ -f /tmp/.X${i}-lock ] ; do i=$((${i}+1));done; echo ${i})
29 azarah 1.1 /usr/X11R6/bin/Xvfb :${XDISPLAY} -screen 0 800x600x32 &>/dev/null &
30    
31     export DISPLAY=:${XDISPLAY}
32     #Do not break on error, but setup $retval, as we need
33     #to kill Xvfb
34     ${maketype} $*
35     retval=$?
36    
37     #Now kill Xvfb
38     kill $(cat /tmp/.X${XDISPLAY}-lock)
39     else
40     #Normal make if we can connect to an X display
41     ${maketype} $*
42     retval=$?
43     fi
44     return $retval
45     }
46    
47     #Same as "make", but setup the Xvfb hack if needed
48 azarah 1.2 Xmake() {
49 azarah 1.1 export maketype="make"
50     virtualmake "$*"
51     }
52    
53     #Same as "emake", but setup the Xvfb hack if needed
54 azarah 1.2 Xemake() {
55 azarah 1.1 export maketype="emake"
56     virtualmake "$*"
57     }

  ViewVC Help
Powered by ViewVC 1.1.20