| 1 | # Copyright 1999-2000 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2008 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License, v2 or later |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # Author Dan Armak <danarmak@gentoo.org> |
|
|
| 4 | # $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.15 2002/06/05 19:09:21 danarmak Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.34 2008/07/17 09:49:14 pva Exp $ |
| 5 | # The base eclass defines some default functions and variables. Nearly everything |
|
|
| 6 | # else inherits from here. |
|
|
| 7 | ECLASS=base |
|
|
| 8 | |
4 | |
| 9 | S=${WORKDIR}/${P} |
5 | # @ECLASS: base.eclass |
|
|
6 | # @MAINTAINER: |
|
|
7 | # ??? |
|
|
8 | # |
|
|
9 | # 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 | |
|
|
15 | |
|
|
16 | inherit eutils |
|
|
17 | |
| 10 | DESCRIPTION="Based on the $ECLASS eclass" |
18 | DESCRIPTION="Based on the $ECLASS eclass" |
| 11 | |
19 | |
|
|
20 | # @FUNCTION: base_src_unpack |
|
|
21 | # @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ] |
|
|
22 | # @DESCRIPTION: |
|
|
23 | # The base src_unpack function, which is exported. If no argument is given, |
|
|
24 | # "all" is assumed. |
| 12 | base_src_unpack() { |
25 | base_src_unpack() { |
| 13 | |
26 | |
| 14 | debug-print-function $FUNCNAME $* |
27 | debug-print-function $FUNCNAME $* |
| 15 | [ -z "$1" ] && base_src_unpack all |
28 | [ -z "$1" ] && base_src_unpack all |
| 16 | |
29 | |
| 17 | cd ${WORKDIR} |
30 | cd "${WORKDIR}" |
| 18 | |
31 | |
| 19 | while [ "$1" ]; do |
32 | while [ "$1" ]; do |
| 20 | |
33 | |
| 21 | case $1 in |
34 | case $1 in |
| 22 | unpack) |
35 | unpack) |
| 23 | debug-print-section unpack |
36 | debug-print-section unpack |
| 24 | # rather ugly fix - check for usage of kde-patch.eclass |
|
|
| 25 | [ -n "$PATCH" -a -n "$ORIGPV" -a -n "$DATE" -a -n "$OLDIFS" ] && \ |
|
|
| 26 | A="`echo $A | sed -e s:${PATCH}::g --`" |
|
|
| 27 | unpack ${A} |
37 | unpack ${A} |
| 28 | ;; |
38 | ;; |
| 29 | patch) |
39 | patch) |
| 30 | debug-print-section patch |
40 | debug-print-section patch |
| 31 | cd ${S} |
41 | cd "${S}" |
| 32 | patch -p0 < ${FILESDIR}/${P}-gentoo.diff |
42 | epatch "${FILESDIR}/${P}-gentoo.diff" |
| 33 | ;; |
43 | ;; |
| 34 | autopatch) |
44 | autopatch) |
| 35 | debug-print-section autopatch |
45 | debug-print-section autopatch |
| 36 | debug-print "$FUNCNAME: autopatch: PATCHES=$PATCHES" |
46 | debug-print "$FUNCNAME: autopatch: PATCHES=$PATCHES, PATCHES1=$PATCHES1" |
| 37 | cd ${S} |
47 | cd "${S}" |
|
|
48 | if [[ ${#PATCHES[@]} -gt 1 ]]; then |
| 38 | for x in $PATCHES; do |
49 | for x in "${PATCHES[@]}"; do |
| 39 | debug-print "$FUNCNAME: autopatch: patching from ${x}" |
50 | debug-print "$FUNCNAME: autopatch: patching from ${x}" |
| 40 | patch -p0 < ${x} |
51 | epatch "${x}" |
| 41 | done |
52 | done |
|
|
53 | else |
|
|
54 | for x in ${PATCHES} ${PATCHES1}; do |
|
|
55 | debug-print "$FUNCNAME: autopatch: patching from ${x}" |
|
|
56 | epatch "${x}" |
|
|
57 | done |
|
|
58 | fi |
| 42 | ;; |
59 | ;; |
| 43 | all) |
60 | all) |
| 44 | debug-print-section all |
61 | debug-print-section all |
| 45 | base_src_unpack unpack autopatch |
62 | base_src_unpack unpack autopatch |
| 46 | ;; |
63 | ;; |
| 47 | esac |
64 | esac |
| 48 | |
65 | |
| 49 | shift |
66 | shift |
| 50 | done |
67 | done |
| 51 | |
68 | |
| 52 | } |
69 | } |
| 53 | |
70 | |
|
|
71 | # @FUNCTION: base_src_compile |
|
|
72 | # @USAGE: [ configure ] [ make ] [ all ] |
|
|
73 | # @DESCRIPTION: |
|
|
74 | # The base src_compile function, which is exported. If no argument is given, |
|
|
75 | # "all" is asasumed. |
| 54 | base_src_compile() { |
76 | base_src_compile() { |
| 55 | |
77 | |
| 56 | debug-print-function $FUNCNAME $* |
78 | debug-print-function $FUNCNAME $* |
| 57 | [ -z "$1" ] && base_src_compile all |
79 | [ -z "$1" ] && base_src_compile all |
| 58 | |
80 | |
| 59 | cd ${S} |
81 | cd "${S}" |
| 60 | |
82 | |
| 61 | while [ "$1" ]; do |
83 | while [ "$1" ]; do |
| 62 | |
84 | |
| 63 | case $1 in |
85 | case $1 in |
| 64 | configure) |
86 | configure) |
| 65 | debug-print-section configure |
87 | debug-print-section configure |
| 66 | econf || die "died running econf, $FUNCNAME:configure" |
88 | econf || die "died running econf, $FUNCNAME:configure" |
| 67 | ;; |
89 | ;; |
| 68 | make) |
90 | make) |
| 69 | debug-print-section make |
91 | debug-print-section make |
| 70 | emake || die "died running emake, $FUNCNAME:make" |
92 | emake || die "died running emake, $FUNCNAME:make" |
| 71 | ;; |
93 | ;; |
| 72 | all) |
94 | all) |
| 73 | debug-print-section all |
95 | debug-print-section all |
| 74 | base_src_compile configure make |
96 | base_src_compile configure make |
| 75 | ;; |
97 | ;; |
| 76 | esac |
98 | esac |
| 77 | |
99 | |
| 78 | shift |
100 | shift |
| 79 | done |
101 | done |
| 80 | |
102 | |
| 81 | } |
103 | } |
| 82 | |
104 | |
|
|
105 | # @FUNCTION: base_src_install |
|
|
106 | # @USAGE: [ make ] [ all ] |
|
|
107 | # @DESCRIPTION: |
|
|
108 | # The base src_install function, which is exported. If no argument is given, |
|
|
109 | # "all" is assumed. |
| 83 | base_src_install() { |
110 | base_src_install() { |
| 84 | |
111 | |
| 85 | debug-print-function $FUNCNAME $* |
112 | debug-print-function $FUNCNAME $* |
| 86 | [ -z "$1" ] && base_src_install all |
113 | [ -z "$1" ] && base_src_install all |
| 87 | |
114 | |
| 88 | cd ${S} |
115 | cd "${S}" |
| 89 | |
116 | |
| 90 | while [ "$1" ]; do |
117 | while [ "$1" ]; do |
| 91 | |
118 | |
| 92 | case $1 in |
119 | case $1 in |
| 93 | make) |
120 | make) |
| 94 | debug-print-section make |
121 | debug-print-section make |
| 95 | make DESTDIR=${D} install || die "died running make install, $FUNCNAME:make" |
122 | make DESTDIR="${D}" install || die "died running make install, $FUNCNAME:make" |
| 96 | ;; |
123 | ;; |
| 97 | all) |
124 | all) |
| 98 | debug-print-section all |
125 | debug-print-section all |
| 99 | base_src_install make |
126 | base_src_install make |
| 100 | ;; |
127 | ;; |
| 101 | esac |
128 | esac |
| 102 | |
129 | |