/[gentoo-x86]/eclass/depend.apache.eclass
Gentoo

Diff of /eclass/depend.apache.eclass

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

Revision 1.25 Revision 1.39
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2007 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/depend.apache.eclass,v 1.25 2006/06/04 19:15:09 vericgar Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.39 2008/02/03 14:12:44 hollow Exp $
4
5# @ECLASS: depend.apache.eclass
6# @MAINTAINER: apache-devs@gentoo.org
7# @BLURB: Functions to allow ebuilds to depend on apache
8# @DESCRIPTION:
9# This eclass handles depending on apache in a sane way and providing
10# information about where certain interfaces are located.
11#
12# @NOTE: If you use this, be sure you use the need_* call after you have defined
13# DEPEND and RDEPEND. Also note that you can not rely on the automatic
14# RDEPEND=DEPEND that portage does if you use this eclass.
15#
16# See bug 107127 for more information.
4 17
5inherit multilib 18inherit multilib
6 19
7# This eclass handles depending on apache in a sane way and providing 20# ==============================================================================
8# information about where certain interfaces are located. 21# INTERNAL VARIABLES
22# ==============================================================================
9 23
10# NOTE: If you use this, be sure you use the need_* call after you have 24# @ECLASS-VARIABLE: APACHE_VERSION
11# defined DEPEND and RDEPEND. Also note that you can not rely on the 25# @DESCRIPTION:
12# automatic RDEPEND=DEPEND that portage does if you use this eclass. 26# Stores the version of apache we are going to be ebuilding. This variable is
13# See bug 107127 for more information. 27# set by the need_apache functions.
14 28
15###### 29# @ECLASS-VARIABLE: APXS
16## Apache Common Variables 30# @DESCRIPTION:
17## 31# Paths to the apxs tool
18## These are internal variables used by this, and other apache-related eclasses,
19## and thus should not need to be used by the ebuilds themselves (the ebuilds
20## should know what version of Apache they are building against).
21######
22 32
23#### 33# @ECLASS-VARIABLE: APACHECTL
24## APACHE_VERSION 34# @DESCRIPTION:
25## 35# Path to the apachectl tool
26## Stores the version of apache we are going to be ebuilding. This variable is
27## set by the need_apache{|1|2} functions.
28##
29## This needs to stay as '1' until apache2 is on by default -- although it
30## doesn't matter much as it's set by the need_apache functions.
31####
32APACHE_VERSION='1'
33 36
34#### 37# @ECLASS-VARIABLE: APACHE_BASEDIR
35## APXS1, APXS2 38# @DESCRIPTION:
36## 39# Path to the server root directory
37## Paths to the apxs tools
38####
39APXS1="/usr/sbin/apxs"
40APXS2="/usr/sbin/apxs2"
41 40
42#### 41# @ECLASS-VARIABLE: APACHE_CONFDIR
43## APACHECTL1, APACHECTL2 42# @DESCRIPTION:
44## 43# Path to the configuration file directory
45## Paths to the apachectl tools
46####
47APACHECTL1="/usr/sbin/apachectl"
48APACHECTL2="/usr/sbin/apache2ctl"
49 44
50#### 45# @ECLASS-VARIABLE: APACHE_MODULES_CONFDIR
51## APACHE1_BASEDIR, APACHE2_BASEDIR 46# @DESCRIPTION:
52## 47# Path where module configuration files are kept
53## Paths to the server root directories
54####
55APACHE1_BASEDIR="/usr/$(get_libdir)/apache"
56APACHE2_BASEDIR="/usr/$(get_libdir)/apache2"
57 48
58#### 49# @ECLASS-VARIABLE: APACHE_VHOSTS_CONFDIR
59## APACHE1_CONFDIR, APACHE2_CONFDIR 50# @DESCRIPTION:
60## 51# Path where virtual host configuration files are kept
61## Paths to the configuration file directories (usually under
62## $APACHE?_BASEDIR/conf)
63####
64APACHE1_CONFDIR="/etc/apache"
65APACHE2_CONFDIR="/etc/apache2"
66 52
67#### 53# @ECLASS-VARIABLE: APACHE_MODULESDIR
68## APACHE1_MODULES_CONFDIR, APACHE2_MODULES_CONFDIR 54# @DESCRIPTION:
69## 55# Path where we install modules
70## Paths where module configuration files are kept
71####
72APACHE1_MODULES_CONFDIR="${APACHE1_CONFDIR}/modules.d"
73APACHE2_MODULES_CONFDIR="${APACHE2_CONFDIR}/modules.d"
74 56
75#### 57# @ECLASS-VARIABLE: APACHE_DEPEND
76## APACHE1_VHOSTDIR, APACHE2_VHOSTDIR 58# @DESCRIPTION:
77## 59# Dependencies for Apache
78## Paths where virtual host configuration files are kept 60APACHE_DEPEND="www-servers/apache"
79####
80APACHE1_VHOSTDIR="${APACHE1_CONFDIR}/vhosts.d"
81APACHE2_VHOSTDIR="${APACHE2_CONFDIR}/vhosts.d"
82 61
83#### 62# @ECLASS-VARIABLE: APACHE2_DEPEND
84## APACHE1_MODULESDIR, APACHE2_MODULESDIR 63# @DESCRIPTION:
85## 64# Dependencies for Apache 2.x
86## Paths where we install modules 65APACHE2_DEPEND="=www-servers/apache-2*"
87####
88APACHE1_MODULESDIR="${APACHE1_BASEDIR}/modules"
89APACHE2_MODULESDIR="${APACHE2_BASEDIR}/modules"
90 66
91#### 67# @ECLASS-VARIABLE: APACHE2_2_DEPEND
92## APACHE1_DEPEND, APACHE2_DEPEND 68# @DESCRIPTION:
93##
94## Dependencies for apache 1.x and apache 2.x 69# Dependencies for Apache 2.2.x
95## - apache2 must be at least version 2.0.54-r30, this is lowest version 70APACHE2_2_DEPEND="=www-servers/apache-2.2*"
96## containing our new overall changes -- trapni (Jan 21 2005)
97## - apache1 must be at least version 1.3.33-r10, but how to
98## define the DEPEND here? (FIXME) -- trapni (Jan 21 2005)
99## - currently not possible - bug #4315 -- vericgar (Jan 21 2005)
100####
101APACHE1_DEPEND="=net-www/apache-1*"
102APACHE2_DEPEND=">=net-www/apache-2.0.54-r30"
103 71
104#### 72# ==============================================================================
105## APACHE_DEPEND 73# INTERNAL FUNCTIONS
106## 74# ==============================================================================
107## Dependency magic based on useflags to use the right DEPEND
108####
109 75
110NEED_APACHE_DEPEND="apache2? ( ${APACHE2_DEPEND} ) !apache2? ( ${APACHE1_DEPEND} )" 76_init_apache2() {
111WANT_APACHE_DEPEND="apache2? ( ${APACHE2_DEPEND} ) !apache2? ( apache? ( ${APACHE1_DEPEND} ) )" 77 debug-print-function $FUNCNAME $*
112 78
113#### 79 # WARNING: Do not use these variables with anything that is put
114# uses_apache1() 80 # into the dependency cache (DEPEND/RDEPEND/etc)
115#
116# sets up all of the environment variables required by an apache1 module
117####
118
119uses_apache1() {
120 APACHE_VERSION='1' 81 APACHE_VERSION="2"
121 APXS="$APXS1" 82 APXS="/usr/sbin/apxs2"
122 USE_APACHE2= 83 APACHE_BIN="/usr/sbin/apache2"
84 APACHE_CTL="/usr/sbin/apache2ctl"
85 # legacy alias
123 APACHECTL="${APACHECTL1}" 86 APACHECTL="${APACHE_CTL}"
124 APACHE_BASEDIR="${APACHE1_BASEDIR}" 87 APACHE_BASEDIR="/usr/$(get_libdir)/apache2"
125 APACHE_CONFDIR="${APACHE1_CONFDIR}" 88 APACHE_CONFDIR="/etc/apache2"
126 APACHE_MODULES_CONFDIR="${APACHE1_MODULES_CONFDIR}" 89 APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d"
127 APACHE_VHOSTSDIR="${APACHE1_VHOSTSDIR}" 90 APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d"
128 APACHE_MODULESDIR="${APACHE1_MODULESDIR}" 91 APACHE_MODULESDIR="${APACHE_BASEDIR}/modules"
129} 92}
130 93
131#### 94_init_no_apache() {
132# uses_apache2() 95 debug-print-function $FUNCNAME $*
133#
134# sets up all of the environment variables required by an apache2 module
135####
136
137uses_apache2() {
138 APACHE_VERSION='2' 96 APACHE_VERSION="0"
139 USE_APACHE2=2
140 APXS="$APXS2"
141 APACHECTL="${APACHECTL2}"
142 APACHE_BASEDIR="${APACHE2_BASEDIR}"
143 APACHE_CONFDIR="${APACHE2_CONFDIR}"
144 APACHE_MODULES_CONFDIR="${APACHE2_MODULES_CONFDIR}"
145 APACHE_VHOSTSDIR="${APACHE2_VHOSTSDIR}"
146 APACHE_MODULESDIR="${APACHE2_MODULESDIR}"
147} 97}
148 98
149doesnt_use_apache() { 99# ==============================================================================
150 APACHE_VERSION='0' 100# PUBLIC FUNCTIONS
151 USE_APACHE= 101# ==============================================================================
102
103# @FUNCTION: want_apache
104# @DESCRIPTION:
105# An ebuild calls this to get the dependency information for optional apache-2.x
106# support.
107want_apache2() {
108 debug-print-function $FUNCNAME $*
109
110 local myiuse=${1:-apache2}
111 IUSE="${IUSE} ${myiuse}"
112 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
113 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_DEPEND} )"
114
115 if use ${myiuse} ; then
116 _init_apache2
117 else
118 _init_no_apache
119 fi
152} 120}
153 121
154#### 122# @FUNCTION: want_apache
155## need_apache1 123# @DESCRIPTION:
156##
157## An ebuild calls this to get the dependency information 124# An ebuild calls this to get the dependency information for optional
158## for apache-1.x. An ebuild should use this in order for 125# apache-2.2.x support.
159## future changes to the build infrastructure to happen 126want_apache2_2() {
160## seamlessly. All an ebuild needs to do is include the 127 debug-print-function $FUNCNAME $*
161## line need_apache1 somewhere.
162####
163need_apache1() {
164 debug-print-function need_apache1
165 128
129 local myiuse=${1:-apache2}
130 IUSE="${IUSE} ${myiuse}"
166 DEPEND="${DEPEND} ${APACHE1_DEPEND}" 131 DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
167 RDEPEND="${RDEPEND} ${APACHE1_DEPEND}" 132 RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
168 APACHE_VERSION='1' 133
134 if use ${myiuse} ; then
135 _init_apache2
136 else
137 _init_no_apache
138 fi
169} 139}
170 140
171#### 141# @FUNCTION: want_apache
172## need_apache2 142# @DESCRIPTION:
173##
174## An ebuild calls this to get the dependency information 143# An ebuild calls this to get the dependency information for optional apache
175## for apache-2.x. An ebuild should use this in order for 144# support.
176## future changes to the build infrastructure to happen 145want_apache() {
177## seamlessly. All an ebuild needs to do is include the 146 debug-print-function $FUNCNAME $*
178## line need_apache1 somewhere. 147 want_apache2 "$@"
179#### 148}
149
150# @FUNCTION: need_apache2
151# @DESCRIPTION:
152# Works like need_apache, but its used by modules that only support
153# apache 2.x and do not work with other versions.
180need_apache2() { 154need_apache2() {
181 debug-print-function need_apache2 155 debug-print-function $FUNCNAME $*
182 156
183 DEPEND="${DEPEND} ${APACHE2_DEPEND}" 157 DEPEND="${DEPEND} ${APACHE2_DEPEND}"
184 RDEPEND="${RDEPEND} ${APACHE2_DEPEND}" 158 RDEPEND="${RDEPEND} ${APACHE2_DEPEND}"
185 APACHE_VERSION='2' 159 _init_apache2
186} 160}
187 161
188#### 162# @FUNCTION: need_apache2_2
189## DO NOT CHANGE THIS FUNCTION UNLESS YOU UNDERSTAND THE CONSEQUENCES IT 163# @DESCRIPTION:
190## WILL HAVE ON THE CACHE! There MUST be a apache2? () block in DEPEND for 164# Works like need_apache, but its used by modules that only support
191## things to work correct in the dependency calculation stage. 165# apache 2.2.x and do not work with other versions.
192####
193need_apache() { 166need_apache2_2() {
194 debug-print-function need_apache 167 debug-print-function $FUNCNAME $*
195 168
196 IUSE="${IUSE} apache2"
197 DEPEND="${DEPEND} ${NEED_APACHE_DEPEND}" 169 DEPEND="${DEPEND} ${APACHE2_2_DEPEND}"
198 RDEPEND="${RDEPEND} ${NEED_APACHE_DEPEND}" 170 RDEPEND="${RDEPEND} ${APACHE2_2_DEPEND}"
199 if useq apache2; then 171 _init_apache2
200 uses_apache2
201 else
202 uses_apache1
203 fi
204} 172}
205 173
174# @FUNCTION: need_apache
175# @DESCRIPTION:
176# An ebuild calls this to get the dependency information for apache. An
177# ebuild should use this in order for future changes to the build infrastructure
178# to happen seamlessly. All an ebuild needs to do is include the line
179# need_apache somewhere.
206want_apache() { 180need_apache() {
207 debug-print-function want_apache 181 debug-print-function $FUNCNAME $*
208 182 need_apache2
209 IUSE="${IUSE} apache apache2"
210 DEPEND="${DEPEND} ${WANT_APACHE_DEPEND}"
211 RDEPEND="${DEPEND} ${WANT_APACHE_DEPEND}"
212 if useq apache2 ; then
213 uses_apache2
214 elif useq apache ; then
215 uses_apache1
216 else
217 doesnt_use_apache
218 fi
219} 183}

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.39

  ViewVC Help
Powered by ViewVC 1.1.20