| 1 | # Copyright 1999-2010 Gentoo Foundation |
1 | # Copyright 1999-2010 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.34 2010/03/04 21:18:27 abcd Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/virtualx.eclass,v 1.35 2010/05/15 05:40:46 dirtyepic Exp $ |
| 4 | # |
|
|
| 5 | # Author: Martin Schlemmer <azarah@gentoo.org> |
|
|
| 6 | # |
|
|
| 7 | # This eclass can be used for packages that needs a working X environment to build |
|
|
| 8 | |
4 | |
|
|
5 | # Original author: Martin Schlemmer <azarah@gentoo.org> |
|
|
6 | |
|
|
7 | # @ECLASS: virtualx.eclass |
|
|
8 | # @MAINTAINER: |
|
|
9 | # x11@gentoo.org |
|
|
10 | # @BLURB: This eclass can be used for packages that needs a working X environment to build. |
|
|
11 | |
|
|
12 | # @ECLASS-VARIABLE: VIRTUALX_REQUIRED |
|
|
13 | # @DESCRIPTION: |
| 9 | # Is a dependency on xorg-server and xhost needed? |
14 | # Is a dependency on xorg-server and xhost needed? |
| 10 | # Valid values are "always", "optional", and "manual" |
15 | # Valid values are "always", "optional", and "manual". |
| 11 | # "tests" is treated as a synonym for "optional" |
16 | # "tests" is a synonym for "optional". |
| 12 | : ${VIRTUALX_REQUIRED:=optional} |
17 | : ${VIRTUALX_REQUIRED:=optional} |
| 13 | |
18 | |
|
|
19 | # @ECLASS-VARIABLE: VIRTUALX_USE |
|
|
20 | # @DESCRIPTION: |
| 14 | # If VIRTUALX_REQUIRED=optional, what use flag should control |
21 | # If VIRTUALX_REQUIRED=optional, what USE flag should control |
| 15 | # the dependency? Default is "test" |
22 | # the dependency? |
| 16 | : ${VIRTUALX_USE:=test} |
23 | : ${VIRTUALX_USE:=test} |
| 17 | |
24 | |
|
|
25 | # @ECLASS-VARIABLE: VIRTUALX_DEPEND |
|
|
26 | # @DESCRIPTION: |
| 18 | # Dep string available for use outside of eclass, in case a more |
27 | # Dep string available for use outside of eclass, in case a more |
| 19 | # complicated dep is needed |
28 | # complicated dep is needed. |
| 20 | VIRTUALX_DEPEND="!prefix? ( x11-base/xorg-server ) |
29 | VIRTUALX_DEPEND="!prefix? ( x11-base/xorg-server ) |
| 21 | x11-apps/xhost" |
30 | x11-apps/xhost" |
| 22 | |
31 | |
| 23 | case ${VIRTUALX_REQUIRED} in |
32 | case ${VIRTUALX_REQUIRED} in |
| 24 | always) |
33 | always) |
| … | |
… | |
| 39 | eerror " optional (default if unset)" |
48 | eerror " optional (default if unset)" |
| 40 | eerror " manual" |
49 | eerror " manual" |
| 41 | die "Invalid value (${VIRTUALX_REQUIRED}) for VIRTUALX_REQUIRED" |
50 | die "Invalid value (${VIRTUALX_REQUIRED}) for VIRTUALX_REQUIRED" |
| 42 | ;; |
51 | ;; |
| 43 | esac |
52 | esac |
| 44 | |
|
|
| 45 | DESCRIPTION="Based on the $ECLASS eclass" |
|
|
| 46 | |
53 | |
| 47 | virtualmake() { |
54 | virtualmake() { |
| 48 | local retval=0 |
55 | local retval=0 |
| 49 | local OLD_SANDBOX_ON="${SANDBOX_ON}" |
56 | local OLD_SANDBOX_ON="${SANDBOX_ON}" |
| 50 | local XVFB=$(type -p Xvfb) |
57 | local XVFB=$(type -p Xvfb) |
| … | |
… | |
| 129 | fi |
136 | fi |
| 130 | |
137 | |
| 131 | return ${retval} |
138 | return ${retval} |
| 132 | } |
139 | } |
| 133 | |
140 | |
|
|
141 | # @FUNCTION: Xmake |
|
|
142 | # @DESCRIPTION: |
| 134 | #Same as "make", but setup the Xvfb hack if needed |
143 | # Same as "make", but set up the Xvfb hack if needed. |
| 135 | Xmake() { |
144 | Xmake() { |
| 136 | export maketype="make" |
145 | export maketype="make" |
| 137 | virtualmake "$@" |
146 | virtualmake "$@" |
| 138 | } |
147 | } |
| 139 | |
148 | |
|
|
149 | # @FUNCTION: Xemake |
|
|
150 | # @DESCRIPTION: |
| 140 | #Same as "emake", but setup the Xvfb hack if needed |
151 | # Same as "emake", but set up the Xvfb hack if needed. |
| 141 | Xemake() { |
152 | Xemake() { |
| 142 | export maketype="emake" |
153 | export maketype="emake" |
| 143 | virtualmake "$@" |
154 | virtualmake "$@" |
| 144 | } |
155 | } |
| 145 | |
156 | |
|
|
157 | # @FUNCTION: Xeconf |
|
|
158 | # @DESCRIPTION: |
| 146 | #Same as "econf", but setup the Xvfb hack if needed |
159 | # Same as "econf", but set up the Xvfb hack if needed. |
| 147 | Xeconf() { |
160 | Xeconf() { |
| 148 | export maketype="econf" |
161 | export maketype="econf" |
| 149 | virtualmake "$@" |
162 | virtualmake "$@" |
| 150 | } |
163 | } |