/[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.52
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.52 2010/05/25 21:16:54 reavertm 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.
59} 63}
60 64
61# @FUNCTION: base_src_prepare 65# @FUNCTION: base_src_prepare
62# @DESCRIPTION: 66# @DESCRIPTION:
63# The base src_prepare function, which is exported 67# The base src_prepare function, which is exported
64# EAPI is greater or equal to 2. 68# EAPI is greater or equal to 2. Here the PATCHES array is evaluated.
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"
72
73 local patches_failed=0
68 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}
80 # in order to preserve normal EPATCH_SOURCE value that can 85 # in order to preserve normal EPATCH_SOURCE value that can
81 # be used other way than with base eclass store in local 86 # be used other way than with base eclass store in local
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}
90 EPATCH_FORCE=yes
85 epatch 91 epatch
86 EPATCH_SOURCE=${oldval} 92 EPATCH_SOURCE=${oldval}
93 elif [[ -f "${x}" ]]; then
94 epatch "${x}"
95 else
96 ewarn "QA: File or directory \"${x}\" does not exist."
97 ewarn "QA: Check your PATCHES array or add missing file/directory."
98 patches_failed=1
87 fi 99 fi
88 done 100 done
101 [[ ${patches_failed} -eq 1 ]] && die "Some patches failed. See above messages."
89 else 102 else
90 for x in ${PATCHES}; do 103 for x in ${PATCHES}; do
91 debug-print "$FUNCNAME: patching from ${x}" 104 debug-print "$FUNCNAME: patching from ${x}"
92 epatch "${x}" 105 epatch "${x}"
93 done 106 done
106# EAPI is greater or equal to 2. Runs basic econf. 119# EAPI is greater or equal to 2. Runs basic econf.
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 "$@"
112} 125}
113 126
114# @FUNCTION: base_src_compile 127# @FUNCTION: base_src_compile
115# @DESCRIPTION: 128# @DESCRIPTION:
116# The base src_compile function, calls src_configure with 129# The base src_compile function, calls src_configure with
117# EAPI older than 2. 130# EAPI older than 2.
118base_src_compile() { 131base_src_compile() {
119 debug-print-function $FUNCNAME "$@" 132 debug-print-function $FUNCNAME "$@"
120 133
121 has src_configure ${BASE_EXPF} || base_src_configure 134 has src_configure ${BASE_EXPF} || base_src_configure
122 base_src_make $@ 135 base_src_make "$@"
123} 136}
124 137
125# @FUNCTION: base_src_make 138# @FUNCTION: base_src_make
126# @DESCRIPTION: 139# @DESCRIPTION:
127# Actual function that runs emake command. 140# Actual function that runs emake command.
128base_src_make() { 141base_src_make() {
129 debug-print-function $FUNCNAME "$@" 142 debug-print-function $FUNCNAME "$@"
130 143
131 if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then 144 if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
132 emake $@ || die "died running emake, $FUNCNAME:make" 145 emake "$@" || die "died running emake, $FUNCNAME:make"
133 fi 146 fi
134} 147}
135 148
136# @FUNCTION: base_src_install 149# @FUNCTION: base_src_install
137# @DESCRIPTION: 150# @DESCRIPTION:
139# installs documents and html documents from DOCS and HTML_DOCS 152# installs documents and html documents from DOCS and HTML_DOCS
140# arrays. 153# arrays.
141base_src_install() { 154base_src_install() {
142 debug-print-function $FUNCNAME "$@" 155 debug-print-function $FUNCNAME "$@"
143 156
144 emake DESTDIR="${D}" $@ install || die "died running make install, $FUNCNAME:make" 157 emake DESTDIR="${D}" "$@" install || die "died running make install, $FUNCNAME:make"
145 base_src_install_docs 158 base_src_install_docs
146} 159}
147 160
148# @FUNCTION: base_src_install_docs 161# @FUNCTION: base_src_install_docs
149# @DESCRIPTION: 162# @DESCRIPTION:
157 pushd "${S}" > /dev/null 170 pushd "${S}" > /dev/null
158 171
159 if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then 172 if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
160 for x in "${DOCS[@]}"; do 173 for x in "${DOCS[@]}"; do
161 debug-print "$FUNCNAME: docs: creating document from ${x}" 174 debug-print "$FUNCNAME: docs: creating document from ${x}"
162 dodoc -r "${x}" || die "dodoc failed" 175 dodoc "${x}" || die "dodoc failed"
163 done 176 done
164 fi 177 fi
165 if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then 178 if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then
166 for x in "${HTML_DOCS[@]}"; do 179 for x in "${HTML_DOCS[@]}"; do
167 debug-print "$FUNCNAME: docs: creating html document from ${x}" 180 debug-print "$FUNCNAME: docs: creating html document from ${x}"

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

  ViewVC Help
Powered by ViewVC 1.1.20