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

Diff of /eclass/base.eclass

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

Revision 1.44 Revision 1.56
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.44 2010/01/13 09:51:53 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.56 2012/02/06 21:33:59 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
15if [[ ${___ECLASS_ONCE_BASE} != "recur -_+^+_- spank" ]] ; then
16___ECLASS_ONCE_BASE="recur -_+^+_- spank"
14 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
54base_src_unpack() { 57base_src_unpack() {
55 debug-print-function $FUNCNAME "$@" 58 debug-print-function $FUNCNAME "$@"
56 59
57 pushd "${WORKDIR}" > /dev/null 60 pushd "${WORKDIR}" > /dev/null
58 61
59 [[ -n "${A}" ]] && unpack ${A} 62 if [[ $(type -t unpacker_src_unpack) == "function" ]] ; then
63 unpacker_src_unpack
64 elif [[ -n ${A} ]] ; then
65 unpack ${A}
66 fi
60 has src_prepare ${BASE_EXPF} || base_src_prepare 67 has src_prepare ${BASE_EXPF} || base_src_prepare
61 68
62 popd > /dev/null 69 popd > /dev/null
63} 70}
64 71
65# @FUNCTION: base_src_prepare 72# @FUNCTION: base_src_prepare
66# @DESCRIPTION: 73# @DESCRIPTION:
67# The base src_prepare function, which is exported 74# The base src_prepare function, which is exported
68# EAPI is greater or equal to 2. 75# EAPI is greater or equal to 2. Here the PATCHES array is evaluated.
69base_src_prepare() { 76base_src_prepare() {
70 debug-print-function $FUNCNAME "$@" 77 debug-print-function $FUNCNAME "$@"
71 debug-print "$FUNCNAME: PATCHES=$PATCHES" 78 debug-print "$FUNCNAME: PATCHES=$PATCHES"
79
80 local patches_failed=0
72 81
73 pushd "${S}" > /dev/null 82 pushd "${S}" > /dev/null
74 if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then 83 if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then
75 for x in "${PATCHES[@]}"; do 84 for x in "${PATCHES[@]}"; do
76 debug-print "$FUNCNAME: applying patch from ${x}" 85 debug-print "$FUNCNAME: applying patch from ${x}"
77 [[ -f "${x}" ]] && epatch "${x}"
78 if [[ -d "${x}" ]]; then 86 if [[ -d "${x}" ]]; then
79 # Use standardized names and locations with bulk patching 87 # Use standardized names and locations with bulk patching
80 # Patch directory is ${WORKDIR}/patch 88 # Patch directory is ${WORKDIR}/patch
81 # See epatch() in eutils.eclass for more documentation 89 # See epatch() in eutils.eclass for more documentation
82 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} 90 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
84 # in order to preserve normal EPATCH_SOURCE value that can 92 # in order to preserve normal EPATCH_SOURCE value that can
85 # be used other way than with base eclass store in local 93 # be used other way than with base eclass store in local
86 # variable and restore later 94 # variable and restore later
87 oldval=${EPATCH_SOURCE} 95 oldval=${EPATCH_SOURCE}
88 EPATCH_SOURCE=${x} 96 EPATCH_SOURCE=${x}
97 EPATCH_FORCE=yes
89 epatch 98 epatch
90 EPATCH_SOURCE=${oldval} 99 EPATCH_SOURCE=${oldval}
100 elif [[ -f "${x}" ]]; then
101 epatch "${x}"
102 else
103 ewarn "QA: File or directory \"${x}\" does not exist."
104 ewarn "QA: Check your PATCHES array or add missing file/directory."
105 patches_failed=1
91 fi 106 fi
92 done 107 done
108 [[ ${patches_failed} -eq 1 ]] && die "Some patches failed. See above messages."
93 else 109 else
94 for x in ${PATCHES}; do 110 for x in ${PATCHES}; do
95 debug-print "$FUNCNAME: patching from ${x}" 111 debug-print "$FUNCNAME: patching from ${x}"
96 epatch "${x}" 112 epatch "${x}"
97 done 113 done
105} 121}
106 122
107# @FUNCTION: base_src_configure 123# @FUNCTION: base_src_configure
108# @DESCRIPTION: 124# @DESCRIPTION:
109# The base src_configure function, which is exported when 125# 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 126# EAPI is greater or equal to 2. Runs basic econf.
111# evaluated.
112base_src_configure() { 127base_src_configure() {
113 debug-print-function $FUNCNAME "$@" 128 debug-print-function $FUNCNAME "$@"
114 129
115 # there is no pushd ${S} so we can override its place where to run 130 # there is no pushd ${S} so we can override its place where to run
116 [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf 131 [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf "$@"
117} 132}
118 133
119# @FUNCTION: base_src_compile 134# @FUNCTION: base_src_compile
120# @DESCRIPTION: 135# @DESCRIPTION:
121# The base src_compile function, calls src_configure with 136# The base src_compile function, calls src_configure with
122# EAPI older than 2. 137# EAPI older than 2.
123base_src_compile() { 138base_src_compile() {
124 debug-print-function $FUNCNAME "$@" 139 debug-print-function $FUNCNAME "$@"
125 140
126 has src_configure ${BASE_EXPF} || base_src_configure 141 has src_configure ${BASE_EXPF} || base_src_configure
127 base_src_make $@ 142 base_src_make "$@"
128} 143}
129 144
130# @FUNCTION: base_src_make 145# @FUNCTION: base_src_make
131# @DESCRIPTION: 146# @DESCRIPTION:
132# Actual function that runs emake command. 147# Actual function that runs emake command.
133base_src_make() { 148base_src_make() {
134 debug-print-function $FUNCNAME "$@" 149 debug-print-function $FUNCNAME "$@"
135 150
136 if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then 151 if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
137 emake $@ || die "died running emake, $FUNCNAME:make" 152 emake "$@" || die "died running emake, $FUNCNAME"
138 fi 153 fi
139} 154}
140 155
141# @FUNCTION: base_src_install 156# @FUNCTION: base_src_install
142# @DESCRIPTION: 157# @DESCRIPTION:
144# installs documents and html documents from DOCS and HTML_DOCS 159# installs documents and html documents from DOCS and HTML_DOCS
145# arrays. 160# arrays.
146base_src_install() { 161base_src_install() {
147 debug-print-function $FUNCNAME "$@" 162 debug-print-function $FUNCNAME "$@"
148 163
149 emake DESTDIR="${D}" $@ install || die "died running make install, $FUNCNAME:make" 164 emake DESTDIR="${D}" "$@" install || die "died running make install, $FUNCNAME"
150 base_src_install_docs 165 base_src_install_docs
151} 166}
152 167
153# @FUNCTION: base_src_install_docs 168# @FUNCTION: base_src_install_docs
154# @DESCRIPTION: 169# @DESCRIPTION:
162 pushd "${S}" > /dev/null 177 pushd "${S}" > /dev/null
163 178
164 if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then 179 if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
165 for x in "${DOCS[@]}"; do 180 for x in "${DOCS[@]}"; do
166 debug-print "$FUNCNAME: docs: creating document from ${x}" 181 debug-print "$FUNCNAME: docs: creating document from ${x}"
167 dodoc -r "${x}" || die "dodoc failed" 182 dodoc "${x}" || die "dodoc failed"
168 done 183 done
169 fi 184 fi
170 if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then 185 if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
171 for x in "${HTML_DOCS[@]}"; do 186 for x in "${HTML_DOCS[@]}"; do
172 debug-print "$FUNCNAME: docs: creating html document from ${x}" 187 debug-print "$FUNCNAME: docs: creating html document from ${x}"
174 done 189 done
175 fi 190 fi
176 191
177 popd > /dev/null 192 popd > /dev/null
178} 193}
194
195fi

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.56

  ViewVC Help
Powered by ViewVC 1.1.20