| 1 |
# Copyright 1999-2008 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: $
|
| 4 |
|
| 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 |
|
| 18 |
DESCRIPTION="Based on the $ECLASS eclass"
|
| 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.
|
| 25 |
base_src_unpack() {
|
| 26 |
|
| 27 |
debug-print-function $FUNCNAME $*
|
| 28 |
[ -z "$1" ] && base_src_unpack all
|
| 29 |
|
| 30 |
cd "${WORKDIR}"
|
| 31 |
|
| 32 |
while [ "$1" ]; do
|
| 33 |
|
| 34 |
case $1 in
|
| 35 |
unpack)
|
| 36 |
debug-print-section unpack
|
| 37 |
unpack ${A}
|
| 38 |
;;
|
| 39 |
patch)
|
| 40 |
debug-print-section patch
|
| 41 |
cd "${S}"
|
| 42 |
epatch "${FILESDIR}/${P}-gentoo.diff"
|
| 43 |
;;
|
| 44 |
autopatch)
|
| 45 |
debug-print-section autopatch
|
| 46 |
debug-print "$FUNCNAME: autopatch: PATCHES=$PATCHES, PATCHES1=$PATCHES1"
|
| 47 |
cd "${S}"
|
| 48 |
if [[ ${#PATCHES[@]} -gt 1 ]]; then
|
| 49 |
for x in "${PATCHES[@]}"; do
|
| 50 |
debug-print "$FUNCNAME: autopatch: patching from ${x}"
|
| 51 |
epatch "${x}"
|
| 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
|
| 59 |
;;
|
| 60 |
all)
|
| 61 |
debug-print-section all
|
| 62 |
base_src_unpack unpack autopatch
|
| 63 |
;;
|
| 64 |
esac
|
| 65 |
|
| 66 |
shift
|
| 67 |
done
|
| 68 |
|
| 69 |
}
|
| 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.
|
| 76 |
base_src_compile() {
|
| 77 |
|
| 78 |
debug-print-function $FUNCNAME $*
|
| 79 |
[ -z "$1" ] && base_src_compile all
|
| 80 |
|
| 81 |
cd "${S}"
|
| 82 |
|
| 83 |
while [ "$1" ]; do
|
| 84 |
|
| 85 |
case $1 in
|
| 86 |
configure)
|
| 87 |
debug-print-section configure
|
| 88 |
econf || die "died running econf, $FUNCNAME:configure"
|
| 89 |
;;
|
| 90 |
make)
|
| 91 |
debug-print-section make
|
| 92 |
emake || die "died running emake, $FUNCNAME:make"
|
| 93 |
;;
|
| 94 |
all)
|
| 95 |
debug-print-section all
|
| 96 |
base_src_compile configure make
|
| 97 |
;;
|
| 98 |
esac
|
| 99 |
|
| 100 |
shift
|
| 101 |
done
|
| 102 |
|
| 103 |
}
|
| 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.
|
| 110 |
base_src_install() {
|
| 111 |
|
| 112 |
debug-print-function $FUNCNAME $*
|
| 113 |
[ -z "$1" ] && base_src_install all
|
| 114 |
|
| 115 |
cd "${S}"
|
| 116 |
|
| 117 |
while [ "$1" ]; do
|
| 118 |
|
| 119 |
case $1 in
|
| 120 |
make)
|
| 121 |
debug-print-section make
|
| 122 |
make DESTDIR="${D}" install || die "died running make install, $FUNCNAME:make"
|
| 123 |
;;
|
| 124 |
all)
|
| 125 |
debug-print-section all
|
| 126 |
base_src_install make
|
| 127 |
;;
|
| 128 |
esac
|
| 129 |
|
| 130 |
shift
|
| 131 |
done
|
| 132 |
|
| 133 |
}
|
| 134 |
|
| 135 |
EXPORT_FUNCTIONS src_unpack src_compile src_install
|