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

Contents of /eclass/depend.apache.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Sat Jul 24 08:39:33 2004 UTC (10 years, 5 months ago) by stuart
Branch: MAIN
Changes since 1.2: +7 -2 lines
Added experimental SLOT syntax

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

  ViewVC Help
Powered by ViewVC 1.1.20