| 1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 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/base.eclass,v 1.22 2003/02/28 09:15:04 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.33 2008/02/16 20:12:58 betelgeuse Exp $ |
| 4 | # |
4 | # |
| 5 | # Author Dan Armak <danarmak@gentoo.org> |
5 | # Author Dan Armak <danarmak@gentoo.org> (nowadays retired) |
| 6 | # |
6 | # |
| 7 | # The base eclass defines some default functions and variables. Nearly everything |
7 | # The base eclass defines some default functions and variables. Nearly everything |
| 8 | # else inherits from here. |
8 | # else inherits from here. |
| 9 | |
9 | |
| 10 | ECLASS=base |
10 | inherit eutils |
| 11 | INHERITED="$INHERITED $ECLASS" |
11 | |
| 12 | S=${WORKDIR}/${P} |
|
|
| 13 | DESCRIPTION="Based on the $ECLASS eclass" |
12 | DESCRIPTION="Based on the $ECLASS eclass" |
| 14 | |
13 | |
| 15 | base_src_unpack() { |
14 | base_src_unpack() { |
| 16 | |
15 | |
| 17 | debug-print-function $FUNCNAME $* |
16 | debug-print-function $FUNCNAME $* |
| 18 | [ -z "$1" ] && base_src_unpack all |
17 | [ -z "$1" ] && base_src_unpack all |
| 19 | |
18 | |
| 20 | cd ${WORKDIR} |
19 | cd "${WORKDIR}" |
| 21 | |
20 | |
| 22 | while [ "$1" ]; do |
21 | while [ "$1" ]; do |
| 23 | |
22 | |
| 24 | case $1 in |
23 | case $1 in |
| 25 | unpack) |
24 | unpack) |
| 26 | debug-print-section unpack |
25 | debug-print-section unpack |
| 27 | unpack ${A} |
26 | unpack ${A} |
| 28 | ;; |
27 | ;; |
| 29 | patch) |
28 | patch) |
| 30 | debug-print-section patch |
29 | debug-print-section patch |
| 31 | cd ${S} |
30 | cd "${S}" |
| 32 | patch -p0 < ${FILESDIR}/${P}-gentoo.diff |
31 | epatch "${FILESDIR}/${P}-gentoo.diff" |
| 33 | ;; |
32 | ;; |
| 34 | autopatch) |
33 | autopatch) |
| 35 | debug-print-section autopatch |
34 | debug-print-section autopatch |
| 36 | debug-print "$FUNCNAME: autopatch: PATCHES=$PATCHES" |
35 | debug-print "$FUNCNAME: autopatch: PATCHES=$PATCHES, PATCHES1=$PATCHES1" |
| 37 | cd ${S} |
36 | cd "${S}" |
|
|
37 | if [[ ${#PATCHES[@]} -gt 1 ]]; then |
| 38 | for x in $PATCHES; do |
38 | for x in "${PATCHES[@]}"; do |
| 39 | debug-print "$FUNCNAME: autopatch: patching from ${x}" |
39 | debug-print "$FUNCNAME: autopatch: patching from ${x}" |
| 40 | patch -p0 < ${x} |
40 | epatch "${x}" |
| 41 | done |
41 | done |
|
|
42 | else |
|
|
43 | for x in ${PATCHES} ${PATCHES1}; do |
|
|
44 | debug-print "$FUNCNAME: autopatch: patching from ${x}" |
|
|
45 | epatch "${x}" |
|
|
46 | done |
|
|
47 | fi |
| 42 | ;; |
48 | ;; |
| 43 | all) |
49 | all) |
| 44 | debug-print-section all |
50 | debug-print-section all |
| 45 | base_src_unpack unpack autopatch |
51 | base_src_unpack unpack autopatch |
| 46 | ;; |
52 | ;; |
| 47 | esac |
53 | esac |
| 48 | |
54 | |
| 49 | shift |
55 | shift |
| 50 | done |
56 | done |
| 51 | |
57 | |
| 52 | } |
58 | } |
| 53 | |
59 | |
| 54 | base_src_compile() { |
60 | base_src_compile() { |
| 55 | |
61 | |
| 56 | debug-print-function $FUNCNAME $* |
62 | debug-print-function $FUNCNAME $* |
| 57 | [ -z "$1" ] && base_src_compile all |
63 | [ -z "$1" ] && base_src_compile all |
| 58 | |
64 | |
| 59 | cd ${S} |
65 | cd "${S}" |
| 60 | |
66 | |
| 61 | while [ "$1" ]; do |
67 | while [ "$1" ]; do |
| 62 | |
68 | |
| 63 | case $1 in |
69 | case $1 in |
| 64 | configure) |
70 | configure) |
| 65 | debug-print-section configure |
71 | debug-print-section configure |
| 66 | econf || die "died running econf, $FUNCNAME:configure" |
72 | econf || die "died running econf, $FUNCNAME:configure" |
| 67 | ;; |
73 | ;; |
| 68 | make) |
74 | make) |
| 69 | debug-print-section make |
75 | debug-print-section make |
| 70 | emake || die "died running emake, $FUNCNAME:make" |
76 | emake || die "died running emake, $FUNCNAME:make" |
| 71 | ;; |
77 | ;; |
| 72 | all) |
78 | all) |
| 73 | debug-print-section all |
79 | debug-print-section all |
| 74 | base_src_compile configure make |
80 | base_src_compile configure make |
| 75 | ;; |
81 | ;; |
| 76 | esac |
82 | esac |
| 77 | |
83 | |
| 78 | shift |
84 | shift |
| 79 | done |
85 | done |
| 80 | |
86 | |
| 81 | } |
87 | } |
| 82 | |
88 | |
| 83 | base_src_install() { |
89 | base_src_install() { |
| 84 | |
90 | |
| 85 | debug-print-function $FUNCNAME $* |
91 | debug-print-function $FUNCNAME $* |
| 86 | [ -z "$1" ] && base_src_install all |
92 | [ -z "$1" ] && base_src_install all |
| 87 | |
93 | |
| 88 | cd ${S} |
94 | cd "${S}" |
| 89 | |
95 | |
| 90 | while [ "$1" ]; do |
96 | while [ "$1" ]; do |
| 91 | |
97 | |
| 92 | case $1 in |
98 | case $1 in |
| 93 | make) |
99 | make) |
| 94 | debug-print-section make |
100 | debug-print-section make |
| 95 | make DESTDIR=${D} install || die "died running make install, $FUNCNAME:make" |
101 | make DESTDIR="${D}" install || die "died running make install, $FUNCNAME:make" |
| 96 | ;; |
102 | ;; |
| 97 | all) |
103 | all) |
| 98 | debug-print-section all |
104 | debug-print-section all |
| 99 | base_src_install make |
105 | base_src_install make |
| 100 | ;; |
106 | ;; |