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

Contents of /eclass/depend.apache.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Fri Jul 16 11:22:57 2004 UTC (9 years, 9 months ago) by stuart
Branch: MAIN
Changes since 1.1: +3 -1 lines
Added basic dependencies

1 stuart 1.1 # Copyright 1999-2004 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 stuart 1.2 # $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.1 2004/07/16 10:48:22 stuart Exp $
4 stuart 1.1
5     ECLASS="depend.apache"
6     INHERITED="$INHERITED $ECLASS"
7     IUSE="apache apache2"
8    
9 stuart 1.2 DEPEND="$DEPEND apache? ( =net-www/apache-1* ) apache2? ( =net-www/apache-2* )"
10    
11 stuart 1.1 # call this function to work out which version of the apache web server
12     # your ebuild should be installing itself to use
13    
14     detect_apache_useflags() {
15     USE_APACHE1=
16     USE_APACHE2=
17     USE_APACHE_MULTIPLE=
18    
19     useq apache2 && USE_APACHE2=1
20     useq apache && USE_APACHE1=1
21    
22     [ -n "$USE_APACHE1" ] && [ -n "$USE_APACHE2" ] && USE_APACHE_MULTIPLE=1
23     }
24    
25     detect_apache_installed() {
26     HAS_APACHE1=
27     HAS_APACHE2=
28     HAS_APACHE_MULTIPLE=
29     HAS_APACHE_ANY=
30    
31     has_version '=net-www/apache-1*' && HAS_APACHE1=1 && HAS_APACHE_ANY=1
32     has_version '=net-www/apache-2*' && HAS_APACHE2=1 && HAS_APACHE_ANY=1
33    
34     [ -n "${HAVE_APACHE1}" ] && [ -n "${HAVE_APACHE2}" && HAVE_APACHE_MULTIPLE=1
35     }
36    
37     # call this function from your pkg_setup
38    
39     depend_apache() {
40     detect_apache_installed
41     detect_apache_useflags
42    
43     # deal with the multiple cases first - much easier
44     if [ -n "$USE_APACHE_MULTIPLE" ]; then
45     echo
46     eerror "You have both the apache and apache2 USE flags set"
47     eerror
48     eerror "Please set only ONE of these USE flags, and try again"
49     echo
50     die "Multiple Apache USE flags set - you can only have one set at a time"
51     fi
52    
53     if [ -n "$USE_APACHE2" ] ; then
54     if [ -z "$HAS_APACHE2" -a -n "$HAS_APACHE_ANY" ] ; then
55     echo
56     eerror "You have the 'apache2' USE flag set, but only have Apache v1 installed"
57     eerror "If you really meant to upgrade to Apache v2, please install Apache v2"
58     eerror "before installing $CATEGORY/${PN}-${PVR}"
59     echo
60     die "Automatic upgrade of Apache would be forced; avoiding"
61     else
62     einfo "Apache 2 support enabled"
63     DETECT_APACHE=2
64     return
65     fi
66     fi
67    
68     if [ -n "$USE_APACHE1" ]; then
69     if [ -z "$HAS_APACHE1" -a -n "$HAS_APACHE_ANY" ]; then
70     echo
71     eerror "You have the 'apache' USE flag set, but only have a later version of"
72     eerror "Apache installed on your computer. Please use the 'apache2' USE flag"
73     eerror "or downgrade to Apache v1 before installing $CATEGORY/${PN}-${PVR}"
74     echo
75     die "Avoiding installing older version of Apache"
76     else
77     einfo "Apache 1 support enabled"
78     DETECT_APACHE=1
79     return
80     fi
81     fi
82     }

  ViewVC Help
Powered by ViewVC 1.1.20