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

Diff of /eclass/base.eclass

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

Revision 1.41 Revision 1.48
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 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.41 2010/01/11 16:57:46 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.48 2010/01/24 13:43:26 scarabeus 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#
14 14
15inherit eutils 15inherit eutils
16 16
17BASE_EXPF="src_unpack src_compile src_install" 17BASE_EXPF="src_unpack src_compile src_install"
18case "${EAPI:-0}" in 18case "${EAPI:-0}" in
19 2|3|4) BASE_EXPF="src_prepare src_configure" ;; 19 2|3|4) BASE_EXPF+=" src_prepare src_configure" ;;
20 *) ;; 20 *) ;;
21esac 21esac
22 22
23EXPORT_FUNCTIONS ${BASE_EXPF} 23EXPORT_FUNCTIONS ${BASE_EXPF}
24 24
25# @ECLASS-VARIABLE: DOCS 25# @ECLASS-VARIABLE: DOCS
26# @USAGE: DOCS=( "${S}/doc/document.txt" "${S}/doc/doc_folder/" )
27# @DESCRIPTION: 26# @DESCRIPTION:
28# Array containing documents passed to dodoc command. 27# Array containing documents passed to dodoc command.
28#
29# DOCS=( "${S}/doc/document.txt" "${S}/doc/doc_folder/" )
29 30
30# @ECLASS-VARIABLE: HTML_DOCS 31# @ECLASS-VARIABLE: HTML_DOCS
31# @USAGE: HTML_DOCS=( "${S}/doc/document.html" "${S}/doc/html_folder/" )
32# @DESCRIPTION: 32# @DESCRIPTION:
33# Array containing documents passed to dohtml command. 33# Array containing documents passed to dohtml command.
34#
35# HTML_DOCS=( "${S}/doc/document.html" "${S}/doc/html_folder/" )
34 36
35# @ECLASS-VARIABLE: PATCHES 37# @ECLASS-VARIABLE: PATCHES
36# @USAGE: PATCHES=( "${FILESDIR}/mypatch.patch" "${FILESDIR}/patches_folder/" )
37# @DESCRIPTION: 38# @DESCRIPTION:
38# PATCHES array variable containing all various patches to be applied. 39# PATCHES array variable containing all various patches to be applied.
39# This variable is expected to be defined in global scope of ebuild. 40# This variable is expected to be defined in global scope of ebuild.
40# Make sure to specify the full path. This variable is utilised in 41# Make sure to specify the full path. This variable is utilised in
41# src_unpack/src_prepare phase based on EAPI. 42# src_unpack/src_prepare phase based on EAPI.
43#
42# NOTE: if using patches folders with special file suffixes you have to 44# NOTE: if using patches folders with special file suffixes you have to
43# define one additional variable EPATCH_SUFFIX="something" 45# define one additional variable EPATCH_SUFFIX="something"
46#
47# PATCHES=( "${FILESDIR}/mypatch.patch" "${FILESDIR}/patches_folder/" )
44 48
45 49
46# @FUNCTION: base_src_unpack 50# @FUNCTION: base_src_unpack
47# @DESCRIPTION: 51# @DESCRIPTION:
48# The base src_unpack function, which is exported. 52# The base src_unpack function, which is exported.
64# EAPI is greater or equal to 2. 68# EAPI is greater or equal to 2.
65base_src_prepare() { 69base_src_prepare() {
66 debug-print-function $FUNCNAME "$@" 70 debug-print-function $FUNCNAME "$@"
67 debug-print "$FUNCNAME: PATCHES=$PATCHES" 71 debug-print "$FUNCNAME: PATCHES=$PATCHES"
68 72
73 local patches_failed=0
74
69 pushd "${S}" > /dev/null 75 pushd "${S}" > /dev/null
70 if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then 76 if [[ "$(declare -p PATCHES 2>/dev/null 2>&1)" == "declare -a"* ]]; then
71 for x in "${PATCHES[@]}"; do 77 for x in "${PATCHES[@]}"; do
72 debug-print "$FUNCNAME: applying patch from ${x}" 78 debug-print "$FUNCNAME: applying patch from ${x}"
73 [[ -f "${x}" ]] && epatch "${x}"
74 if [[ -d "${x}" ]]; then 79 if [[ -d "${x}" ]]; then
75 # Use standardized names and locations with bulk patching 80 # Use standardized names and locations with bulk patching
76 # Patch directory is ${WORKDIR}/patch 81 # Patch directory is ${WORKDIR}/patch
77 # See epatch() in eutils.eclass for more documentation 82 # See epatch() in eutils.eclass for more documentation
78 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} 83 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
82 # variable and restore later 87 # variable and restore later
83 oldval=${EPATCH_SOURCE} 88 oldval=${EPATCH_SOURCE}
84 EPATCH_SOURCE=${x} 89 EPATCH_SOURCE=${x}
85 epatch 90 epatch
86 EPATCH_SOURCE=${oldval} 91 EPATCH_SOURCE=${oldval}
92 elif [[ -f "${x}" ]]; then
93 epatch "${x}"
94 else
95 ewarn "QA: File or directory \"${x}\" does not exist."
96 ewarn "QA: Check your PATCHES array or add missing file/directory."
97 patches_failed=1
87 fi 98 fi
88 done 99 done
100 [[ ${patches_failed} -eq 1 ]] && die "Some patches failed. See above messages."
89 else 101 else
90 for x in ${PATCHES}; do 102 for x in ${PATCHES}; do
91 debug-print "$FUNCNAME: patching from ${x}" 103 debug-print "$FUNCNAME: patching from ${x}"
92 epatch "${x}" 104 epatch "${x}"
93 done 105 done
101} 113}
102 114
103# @FUNCTION: base_src_configure 115# @FUNCTION: base_src_configure
104# @DESCRIPTION: 116# @DESCRIPTION:
105# The base src_configure function, which is exported when 117# The base src_configure function, which is exported when
106# EAPI is greater or equal to 2. Runs basic econf. 118# EAPI is greater or equal to 2. Runs basic econf. Here the PATCHES array is
119# evaluated.
107base_src_configure() { 120base_src_configure() {
108 debug-print-function $FUNCNAME "$@" 121 debug-print-function $FUNCNAME "$@"
109 122
110 # there is no pushd ${S} so we can override its place where to run 123 # there is no pushd ${S} so we can override its place where to run
111 [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf 124 [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.48

  ViewVC Help
Powered by ViewVC 1.1.20