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

Contents of /eclass/base.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.38 - (hide annotations) (download)
Sun May 17 09:25:55 2009 UTC (5 years, 5 months ago) by loki_val
Branch: MAIN
Changes since 1.37: +2 -1 lines
x should be declared local. Bug 264466. Thanks to Ulm for noticing and cattleprodding me.

1 pva 1.34 # Copyright 1999-2008 Gentoo Foundation
2 vapier 1.18 # Distributed under the terms of the GNU General Public License v2
3 loki_val 1.38 # $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.37 2009/01/18 18:21:08 loki_val Exp $
4 pva 1.34
5     # @ECLASS: base.eclass
6     # @MAINTAINER:
7 loki_val 1.35 # Peter Alfredsen <loki_val@gentoo.org>
8 vapier 1.20 #
9 pva 1.34 # Original author Dan Armak <danarmak@gentoo.org>
10     # @BLURB: The base eclass defines some default functions and variables.
11     # @DESCRIPTION:
12     # The base eclass defines some default functions and variables. Nearly
13     # everything else inherits from here.
14 loki_val 1.35 #
15     # NOTE: You must define EAPI before inheriting from base, or the wrong functions
16     # may be exported.
17 pva 1.34
18 vapier 1.18
19 flameeyes 1.29 inherit eutils
20    
21 loki_val 1.35 case "${EAPI:-0}" in
22     2)
23     EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
24     ;;
25     *)
26     EXPORT_FUNCTIONS src_unpack src_compile src_install
27     ;;
28     esac
29    
30 vapier 1.22 DESCRIPTION="Based on the $ECLASS eclass"
31 danarmak 1.1
32 pva 1.34 # @FUNCTION: base_src_unpack
33     # @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ]
34     # @DESCRIPTION:
35     # The base src_unpack function, which is exported. If no argument is given,
36 loki_val 1.35 # "all" is assumed if EAPI!=2, "unpack" if EAPI=2.
37 danarmak 1.1 base_src_unpack() {
38 danarmak 1.6
39 loki_val 1.35 debug-print-function $FUNCNAME "$@"
40    
41 mr_bones_ 1.36 if [ -z "$1" ] ; then
42 loki_val 1.35 case "${EAPI:-0}" in
43     2)
44     base_src_util unpack
45     ;;
46     *)
47     base_src_util all
48     ;;
49     esac
50     else
51     base_src_util $@
52     fi
53     }
54    
55     # @FUNCTION: base_src_prepare
56     # @DESCRIPTION:
57     # The base src_prepare function, which is exported when EAPI=2. Performs
58     # "base_src_util autopatch".
59     base_src_prepare() {
60    
61     debug-print-function $FUNCNAME "$@"
62    
63     base_src_util autopatch
64     }
65    
66     # @FUNCTION: base_src_util
67     # @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ]
68     # @DESCRIPTION:
69     # The base_src_util function is the grunt function for base src_unpack
70     # and base src_prepare.
71     base_src_util() {
72 loki_val 1.38 local x
73 loki_val 1.35
74     debug-print-function $FUNCNAME "$@"
75 danarmak 1.6
76 betelgeuse 1.32 cd "${WORKDIR}"
77 danarmak 1.12
78 danarmak 1.6 while [ "$1" ]; do
79    
80 danarmak 1.1 case $1 in
81 danarmak 1.17 unpack)
82 danarmak 1.6 debug-print-section unpack
83 mr_bones_ 1.36 if [ ! -z "$A" ] ; then
84     unpack ${A}
85     fi
86 danarmak 1.6 ;;
87 danarmak 1.17 patch)
88 danarmak 1.6 debug-print-section patch
89 betelgeuse 1.32 cd "${S}"
90     epatch "${FILESDIR}/${P}-gentoo.diff"
91 danarmak 1.6 ;;
92 danarmak 1.17 autopatch)
93 danarmak 1.15 debug-print-section autopatch
94 danarmak 1.23 debug-print "$FUNCNAME: autopatch: PATCHES=$PATCHES, PATCHES1=$PATCHES1"
95 betelgeuse 1.32 cd "${S}"
96 mr_bones_ 1.36 if [[ ${#PATCHES[@]} -gt 1 ]] ; then
97 betelgeuse 1.33 for x in "${PATCHES[@]}"; do
98     debug-print "$FUNCNAME: autopatch: patching from ${x}"
99     epatch "${x}"
100     done
101     else
102     for x in ${PATCHES} ${PATCHES1}; do
103     debug-print "$FUNCNAME: autopatch: patching from ${x}"
104     epatch "${x}"
105     done
106     fi
107 danarmak 1.15 ;;
108 george 1.30 all)
109 danarmak 1.6 debug-print-section all
110 loki_val 1.35 base_src_util unpack autopatch
111 danarmak 1.6 ;;
112 danarmak 1.17 esac
113 danarmak 1.6
114     shift
115     done
116 swegener 1.27
117 danarmak 1.1 }
118    
119 loki_val 1.35 # @FUNCTION: base_src_configure
120     # @DESCRIPTION:
121     # The base src_prepare function, which is exported when EAPI=2. Performs
122     # "base_src_work configure".
123     base_src_configure() {
124    
125     debug-print-function $FUNCNAME "$@"
126    
127     base_src_work configure
128     }
129    
130 pva 1.34 # @FUNCTION: base_src_compile
131     # @USAGE: [ configure ] [ make ] [ all ]
132     # @DESCRIPTION:
133     # The base src_compile function, which is exported. If no argument is given,
134 loki_val 1.35 # "all" is assumed if EAPI!=2, "make" if EAPI=2.
135 danarmak 1.1 base_src_compile() {
136 danarmak 1.4
137 loki_val 1.35 debug-print-function $FUNCNAME "$@"
138    
139     if [ -z "$1" ]
140     then
141     case "${EAPI:-0}" in
142     2)
143     base_src_work make
144     ;;
145     *)
146     base_src_work all
147     ;;
148     esac
149     else
150     base_src_work $@
151     fi
152     }
153    
154     # @FUNCTION: base_src_work
155     # @USAGE: [ configure ] [ make ] [ all ]
156     # @DESCRIPTION:
157     # The base_src_work function is the grunt function for base src_configure
158     # and base src_compile.
159     base_src_work() {
160    
161     debug-print-function $FUNCNAME "$@"
162 danarmak 1.6
163 betelgeuse 1.32 cd "${S}"
164 danarmak 1.12
165 danarmak 1.17 while [ "$1" ]; do
166 danarmak 1.6
167 danarmak 1.1 case $1 in
168 danarmak 1.17 configure)
169 george 1.30 debug-print-section configure
170 loki_val 1.37 if [[ -x ${ECONF_SOURCE:-.}/configure ]]
171     then
172     econf || die "died running econf, $FUNCNAME:configure"
173     fi
174 george 1.30 ;;
175 danarmak 1.17 make)
176 george 1.30 debug-print-section make
177 loki_val 1.37 if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]
178     then
179     emake || die "died running emake, $FUNCNAME:make"
180     fi
181 george 1.30 ;;
182 danarmak 1.17 all)
183 george 1.30 debug-print-section all
184 loki_val 1.35 base_src_work configure make
185 george 1.30 ;;
186 danarmak 1.1 esac
187 swegener 1.27
188 danarmak 1.17 shift
189     done
190 swegener 1.27
191 danarmak 1.1 }
192    
193 pva 1.34 # @FUNCTION: base_src_install
194     # @USAGE: [ make ] [ all ]
195     # @DESCRIPTION:
196     # The base src_install function, which is exported. If no argument is given,
197     # "all" is assumed.
198 danarmak 1.1 base_src_install() {
199    
200 loki_val 1.35 debug-print-function $FUNCNAME "$@"
201 danarmak 1.6 [ -z "$1" ] && base_src_install all
202    
203 betelgeuse 1.32 cd "${S}"
204 danarmak 1.12
205 danarmak 1.6 while [ "$1" ]; do
206 danarmak 1.4
207 danarmak 1.1 case $1 in
208 danarmak 1.17 make)
209 danarmak 1.6 debug-print-section make
210 betelgeuse 1.32 make DESTDIR="${D}" install || die "died running make install, $FUNCNAME:make"
211 danarmak 1.6 ;;
212 danarmak 1.17 all)
213 danarmak 1.11 debug-print-section all
214 danarmak 1.6 base_src_install make
215     ;;
216 danarmak 1.1 esac
217 danarmak 1.6
218     shift
219     done
220    
221 danarmak 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20