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

Diff of /eclass/base.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.42 Revision 1.55
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2011 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.42 2010/01/11 17:23:04 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.55 2011/12/14 23:38:09 vapier Exp $
4 4
5# @ECLASS: base.eclass 5# @ECLASS: base.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# QA Team <qa@gentoo.org> 7# QA Team <qa@gentoo.org>
8# 8# @AUTHOR:
9# Original author Dan Armak <danarmak@gentoo.org> 9# Original author: Dan Armak <danarmak@gentoo.org>
10# @BLURB: The base eclass defines some default functions and variables. 10# @BLURB: The base eclass defines some default functions and variables.
11# @DESCRIPTION: 11# @DESCRIPTION:
12# The base eclass defines some default functions and variables. Nearly 12# The base eclass defines some default functions and variables. Nearly
13# everything else inherits from here. 13# everything else inherits from here.
14 14
15if [[ ${___ECLASS_ONCE_BASE} != "recur -_+^+_- spank" ]] ; then
16___ECLASS_ONCE_BASE="recur -_+^+_- spank"
17
15inherit eutils 18inherit eutils
16 19
17BASE_EXPF="src_unpack src_compile src_install" 20BASE_EXPF="src_unpack src_compile src_install"
18case "${EAPI:-0}" in 21case "${EAPI:-0}" in
19 2|3|4) BASE_EXPF="src_prepare src_configure" ;; 22 2|3|4) BASE_EXPF+=" src_prepare src_configure" ;;
20 *) ;; 23 *) ;;
21esac 24esac
22 25
23EXPORT_FUNCTIONS ${BASE_EXPF} 26EXPORT_FUNCTIONS ${BASE_EXPF}
24 27
63} 66}
64 67
65# @FUNCTION: base_src_prepare 68# @FUNCTION: base_src_prepare
66# @DESCRIPTION: 69# @DESCRIPTION:
67# The base src_prepare function, which is exported 70# The base src_prepare function, which is exported
68# EAPI is greater or equal to 2. 71# EAPI is greater or equal to 2. Here the PATCHES array is evaluated.
69base_src_prepare() { 72base_src_prepare() {
70 debug-print-function $FUNCNAME "$@" 73 debug-print-function $FUNCNAME "$@"
71 debug-print "$FUNCNAME: PATCHES=$PATCHES" 74 debug-print "$FUNCNAME: PATCHES=$PATCHES"
75
76 local patches_failed=0
72 77
73 pushd "${S}" > /dev/null 78 pushd "${S}" > /dev/null
74 if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then 79 if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then
75 for x in "${PATCHES[@]}"; do 80 for x in "${PATCHES[@]}"; do
76 debug-print "$FUNCNAME: applying patch from ${x}" 81 debug-print "$FUNCNAME: applying patch from ${x}"
77 [[ -f "${x}" ]] && epatch "${x}"
78 if [[ -d "${x}" ]]; then 82 if [[ -d "${x}" ]]; then
79 # Use standardized names and locations with bulk patching 83 # Use standardized names and locations with bulk patching
80 # Patch directory is ${WORKDIR}/patch 84 # Patch directory is ${WORKDIR}/patch
81 # See epatch() in eutils.eclass for more documentation 85 # See epatch() in eutils.eclass for more documentation
82 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} 86 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
84 # in order to preserve normal EPATCH_SOURCE value that can 88 # in order to preserve normal EPATCH_SOURCE value that can
85 # be used other way than with base eclass store in local 89 # be used other way than with base eclass store in local
86 # variable and restore later 90 # variable and restore later
87 oldval=${EPATCH_SOURCE} 91 oldval=${EPATCH_SOURCE}
88 EPATCH_SOURCE=${x} 92 EPATCH_SOURCE=${x}
93 EPATCH_FORCE=yes
89 epatch 94 epatch
90 EPATCH_SOURCE=${oldval} 95 EPATCH_SOURCE=${oldval}
96 elif [[ -f "${x}" ]]; then
97 epatch "${x}"
98 else
99 ewarn "QA: File or directory \"${x}\" does not exist."
100 ewarn "QA: Check your PATCHES array or add missing file/directory."
101 patches_failed=1
91 fi 102 fi
92 done 103 done
104 [[ ${patches_failed} -eq 1 ]] && die "Some patches failed. See above messages."
93 else 105 else
94 for x in ${PATCHES}; do 106 for x in ${PATCHES}; do
95 debug-print "$FUNCNAME: patching from ${x}" 107 debug-print "$FUNCNAME: patching from ${x}"
96 epatch "${x}" 108 epatch "${x}"
97 done 109 done
105} 117}
106 118
107# @FUNCTION: base_src_configure 119# @FUNCTION: base_src_configure
108# @DESCRIPTION: 120# @DESCRIPTION:
109# The base src_configure function, which is exported when 121# The base src_configure function, which is exported when
110# EAPI is greater or equal to 2. Runs basic econf. Here the PATCHES array is 122# EAPI is greater or equal to 2. Runs basic econf.
111# evaluated.
112base_src_configure() { 123base_src_configure() {
113 debug-print-function $FUNCNAME "$@" 124 debug-print-function $FUNCNAME "$@"
114 125
115 # there is no pushd ${S} so we can override its place where to run 126 # there is no pushd ${S} so we can override its place where to run
116 [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf 127 [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf "$@"
117} 128}
118 129
119# @FUNCTION: base_src_compile 130# @FUNCTION: base_src_compile
120# @DESCRIPTION: 131# @DESCRIPTION:
121# The base src_compile function, calls src_configure with 132# The base src_compile function, calls src_configure with
122# EAPI older than 2. 133# EAPI older than 2.
123base_src_compile() { 134base_src_compile() {
124 debug-print-function $FUNCNAME "$@" 135 debug-print-function $FUNCNAME "$@"
125 136
126 has src_configure ${BASE_EXPF} || base_src_configure 137 has src_configure ${BASE_EXPF} || base_src_configure
127 base_src_make $@ 138 base_src_make "$@"
128} 139}
129 140
130# @FUNCTION: base_src_make 141# @FUNCTION: base_src_make
131# @DESCRIPTION: 142# @DESCRIPTION:
132# Actual function that runs emake command. 143# Actual function that runs emake command.
133base_src_make() { 144base_src_make() {
134 debug-print-function $FUNCNAME "$@" 145 debug-print-function $FUNCNAME "$@"
135 146
136 if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then 147 if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
137 emake $@ || die "died running emake, $FUNCNAME:make" 148 emake "$@" || die "died running emake, $FUNCNAME"
138 fi 149 fi
139} 150}
140 151
141# @FUNCTION: base_src_install 152# @FUNCTION: base_src_install
142# @DESCRIPTION: 153# @DESCRIPTION:
144# installs documents and html documents from DOCS and HTML_DOCS 155# installs documents and html documents from DOCS and HTML_DOCS
145# arrays. 156# arrays.
146base_src_install() { 157base_src_install() {
147 debug-print-function $FUNCNAME "$@" 158 debug-print-function $FUNCNAME "$@"
148 159
149 emake DESTDIR="${D}" $@ install || die "died running make install, $FUNCNAME:make" 160 emake DESTDIR="${D}" "$@" install || die "died running make install, $FUNCNAME"
150 base_src_install_docs 161 base_src_install_docs
151} 162}
152 163
153# @FUNCTION: base_src_install_docs 164# @FUNCTION: base_src_install_docs
154# @DESCRIPTION: 165# @DESCRIPTION:
162 pushd "${S}" > /dev/null 173 pushd "${S}" > /dev/null
163 174
164 if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then 175 if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
165 for x in "${DOCS[@]}"; do 176 for x in "${DOCS[@]}"; do
166 debug-print "$FUNCNAME: docs: creating document from ${x}" 177 debug-print "$FUNCNAME: docs: creating document from ${x}"
167 dodoc -r "${x}" || die "dodoc failed" 178 dodoc "${x}" || die "dodoc failed"
168 done 179 done
169 fi 180 fi
170 if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then 181 if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
171 for x in "${HTML_DOCS[@]}"; do 182 for x in "${HTML_DOCS[@]}"; do
172 debug-print "$FUNCNAME: docs: creating html document from ${x}" 183 debug-print "$FUNCNAME: docs: creating html document from ${x}"
174 done 185 done
175 fi 186 fi
176 187
177 popd > /dev/null 188 popd > /dev/null
178} 189}
190
191fi

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.55

  ViewVC Help
Powered by ViewVC 1.1.20