summaryrefslogtreecommitdiff
blob: 2d62c33b4189e93d00fd59ed150514cf8f956d60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.33 2008/02/16 20:12:58 betelgeuse Exp $
#
# Author Dan Armak <danarmak@gentoo.org> (nowadays retired)
#
# The base eclass defines some default functions and variables. Nearly everything
# else inherits from here.

inherit eutils

DESCRIPTION="Based on the $ECLASS eclass"

base_src_unpack() {

	debug-print-function $FUNCNAME $*
	[ -z "$1" ] && base_src_unpack all

	cd "${WORKDIR}"

	while [ "$1" ]; do

	case $1 in
		unpack)
			debug-print-section unpack
			unpack ${A}
			;;
		patch)
			debug-print-section patch
			cd "${S}"
			epatch "${FILESDIR}/${P}-gentoo.diff"
			;;
		autopatch)
			debug-print-section autopatch
			debug-print "$FUNCNAME: autopatch: PATCHES=$PATCHES, PATCHES1=$PATCHES1"
			cd "${S}"
			if [[ ${#PATCHES[@]} -gt 1 ]]; then
				for x in "${PATCHES[@]}"; do
					debug-print "$FUNCNAME: autopatch: patching from ${x}"
					epatch "${x}"
				done
			else
				for x in ${PATCHES} ${PATCHES1}; do
					debug-print "$FUNCNAME: autopatch: patching from ${x}"
					epatch "${x}"
				done
			fi
			;;
		all)
			debug-print-section all
			base_src_unpack unpack autopatch
			;;
		esac

	shift
	done

}

base_src_compile() {

	debug-print-function $FUNCNAME $*
	[ -z "$1" ] && base_src_compile all

	cd "${S}"

	while [ "$1" ]; do

	case $1 in
		configure)
			debug-print-section configure
			econf || die "died running econf, $FUNCNAME:configure"
			;;
		make)
			debug-print-section make
			emake || die "died running emake, $FUNCNAME:make"
			;;
		all)
			debug-print-section all
			base_src_compile configure make
			;;
	esac

	shift
	done

}

base_src_install() {

	debug-print-function $FUNCNAME $*
	[ -z "$1" ] && base_src_install all

	cd "${S}"

	while [ "$1" ]; do

	case $1 in
		make)
			debug-print-section make
			make DESTDIR="${D}" install || die "died running make install, $FUNCNAME:make"
			;;
		all)
			debug-print-section all
			base_src_install make
			;;
	esac

	shift
	done

}

EXPORT_FUNCTIONS src_unpack src_compile src_install