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

Contents of /eclass/base.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.39 - (hide annotations) (download)
Sun Jan 3 19:13:44 2010 UTC (4 years, 6 months ago) by scarabeus
Branch: MAIN
Changes since 1.38: +7 -1 lines
Add base_src_make call and make games eclass use it (In preparation for new base eclass that uses that call).

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 scarabeus 1.39 # $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.38 2009/05/17 09:25:55 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 scarabeus 1.39 # placeholder for future api so eclasses can be migrated now.
155     base_src_make() {
156     debug-print-fucntion $FUNCNAME "$@"
157     base_src_work make
158     }
159    
160 loki_val 1.35 # @FUNCTION: base_src_work
161     # @USAGE: [ configure ] [ make ] [ all ]
162     # @DESCRIPTION:
163     # The base_src_work function is the grunt function for base src_configure
164     # and base src_compile.
165     base_src_work() {
166    
167     debug-print-function $FUNCNAME "$@"
168 danarmak 1.6
169 betelgeuse 1.32 cd "${S}"
170 danarmak 1.12
171 danarmak 1.17 while [ "$1" ]; do
172 danarmak 1.6
173 danarmak 1.1 case $1 in
174 danarmak 1.17 configure)
175 george 1.30 debug-print-section configure
176 loki_val 1.37 if [[ -x ${ECONF_SOURCE:-.}/configure ]]
177     then
178     econf || die "died running econf, $FUNCNAME:configure"
179     fi
180 george 1.30 ;;
181 danarmak 1.17 make)
182 george 1.30 debug-print-section make
183 loki_val 1.37 if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]
184     then
185     emake || die "died running emake, $FUNCNAME:make"
186     fi
187 george 1.30 ;;
188 danarmak 1.17 all)
189 george 1.30 debug-print-section all
190 loki_val 1.35 base_src_work configure make
191 george 1.30 ;;
192 danarmak 1.1 esac
193 swegener 1.27
194 danarmak 1.17 shift
195     done
196 swegener 1.27
197 danarmak 1.1 }
198    
199 pva 1.34 # @FUNCTION: base_src_install
200     # @USAGE: [ make ] [ all ]
201     # @DESCRIPTION:
202     # The base src_install function, which is exported. If no argument is given,
203     # "all" is assumed.
204 danarmak 1.1 base_src_install() {
205    
206 loki_val 1.35 debug-print-function $FUNCNAME "$@"
207 danarmak 1.6 [ -z "$1" ] && base_src_install all
208    
209 betelgeuse 1.32 cd "${S}"
210 danarmak 1.12
211 danarmak 1.6 while [ "$1" ]; do
212 danarmak 1.4
213 danarmak 1.1 case $1 in
214 danarmak 1.17 make)
215 danarmak 1.6 debug-print-section make
216 betelgeuse 1.32 make DESTDIR="${D}" install || die "died running make install, $FUNCNAME:make"
217 danarmak 1.6 ;;
218 danarmak 1.17 all)
219 danarmak 1.11 debug-print-section all
220 danarmak 1.6 base_src_install make
221     ;;
222 danarmak 1.1 esac
223 danarmak 1.6
224     shift
225     done
226    
227 danarmak 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20