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

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

  ViewVC Help
Powered by ViewVC 1.1.20