1 | # Copyright 1999-2011 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/autotools-utils.eclass,v 1.29 2011/11/27 09:57:20 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.30 2011/12/14 14:55:03 mgorny Exp $ |
4 | |
4 | |
5 | # @ECLASS: autotools-utils.eclass |
5 | # @ECLASS: autotools-utils.eclass |
6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
7 | # Maciej Mrozowski <reavertm@gentoo.org> |
7 | # Maciej Mrozowski <reavertm@gentoo.org> |
8 | # Michał Górny <mgorny@gentoo.org> |
8 | # Michał Górny <mgorny@gentoo.org> |
… | |
… | |
91 | case ${EAPI:-0} in |
91 | case ${EAPI:-0} in |
92 | 2|3|4) ;; |
92 | 2|3|4) ;; |
93 | *) die "EAPI=${EAPI} is not supported" ;; |
93 | *) die "EAPI=${EAPI} is not supported" ;; |
94 | esac |
94 | esac |
95 | |
95 | |
96 | inherit autotools base eutils libtool |
96 | inherit autotools eutils libtool |
97 | |
97 | |
98 | EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test |
98 | EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test |
99 | |
99 | |
100 | # @ECLASS-VARIABLE: AUTOTOOLS_BUILD_DIR |
100 | # @ECLASS-VARIABLE: AUTOTOOLS_BUILD_DIR |
|
|
101 | # @DEFAULT_UNSET |
101 | # @DESCRIPTION: |
102 | # @DESCRIPTION: |
102 | # Build directory, location where all autotools generated files should be |
103 | # Build directory, location where all autotools generated files should be |
103 | # placed. For out of source builds it defaults to ${WORKDIR}/${P}_build. |
104 | # placed. For out of source builds it defaults to ${WORKDIR}/${P}_build. |
104 | |
105 | |
105 | # @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD |
106 | # @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD |
|
|
107 | # @DEFAULT_UNSET |
106 | # @DESCRIPTION: |
108 | # @DESCRIPTION: |
107 | # Set to enable in-source build. |
109 | # Set to enable in-source build. |
108 | |
110 | |
109 | # @ECLASS-VARIABLE: ECONF_SOURCE |
111 | # @ECLASS-VARIABLE: ECONF_SOURCE |
|
|
112 | # @DEFAULT_UNSET |
110 | # @DESCRIPTION: |
113 | # @DESCRIPTION: |
111 | # Specify location of autotools' configure script. By default it uses ${S}. |
114 | # Specify location of autotools' configure script. By default it uses ${S}. |
112 | |
115 | |
113 | # @ECLASS-VARIABLE: myeconfargs |
116 | # @ECLASS-VARIABLE: myeconfargs |
|
|
117 | # @DEFAULT_UNSET |
114 | # @DESCRIPTION: |
118 | # @DESCRIPTION: |
115 | # Optional econf arguments as Bash array. Should be defined before calling src_configure. |
119 | # Optional econf arguments as Bash array. Should be defined before calling src_configure. |
116 | # @CODE |
120 | # @CODE |
117 | # src_configure() { |
121 | # src_configure() { |
118 | # local myeconfargs=( |
122 | # local myeconfargs=( |
… | |
… | |
121 | # $(use_enable debug cnddebug) |
125 | # $(use_enable debug cnddebug) |
122 | # $(use_enable threads multithreading) |
126 | # $(use_enable threads multithreading) |
123 | # ) |
127 | # ) |
124 | # autotools-utils_src_configure |
128 | # autotools-utils_src_configure |
125 | # } |
129 | # } |
|
|
130 | # @CODE |
|
|
131 | |
|
|
132 | # @ECLASS-VARIABLE: DOCS |
|
|
133 | # @DEFAULT_UNSET |
|
|
134 | # @DESCRIPTION: |
|
|
135 | # Array containing documents passed to dodoc command. |
|
|
136 | # |
|
|
137 | # Example: |
|
|
138 | # @CODE |
|
|
139 | # DOCS=( NEWS README ) |
|
|
140 | # @CODE |
|
|
141 | |
|
|
142 | # @ECLASS-VARIABLE: HTML_DOCS |
|
|
143 | # @DEFAULT_UNSET |
|
|
144 | # @DESCRIPTION: |
|
|
145 | # Array containing documents passed to dohtml command. |
|
|
146 | # |
|
|
147 | # Example: |
|
|
148 | # @CODE |
|
|
149 | # HTML_DOCS=( doc/html/ ) |
|
|
150 | # @CODE |
|
|
151 | |
|
|
152 | # @ECLASS-VARIABLE: PATCHES |
|
|
153 | # @DEFAULT_UNSET |
|
|
154 | # @DESCRIPTION: |
|
|
155 | # PATCHES array variable containing all various patches to be applied. |
|
|
156 | # |
|
|
157 | # Example: |
|
|
158 | # @CODE |
|
|
159 | # PATCHES=( "${FILESDIR}"/${P}-mypatch.patch ) |
126 | # @CODE |
160 | # @CODE |
127 | |
161 | |
128 | # Determine using IN or OUT source build |
162 | # Determine using IN or OUT source build |
129 | _check_build_dir() { |
163 | _check_build_dir() { |
130 | : ${ECONF_SOURCE:=${S}} |
164 | : ${ECONF_SOURCE:=${S}} |
… | |
… | |
222 | # |
256 | # |
223 | # Supporting PATCHES array and user patches. See base.eclass(5) for reference. |
257 | # Supporting PATCHES array and user patches. See base.eclass(5) for reference. |
224 | autotools-utils_src_prepare() { |
258 | autotools-utils_src_prepare() { |
225 | debug-print-function ${FUNCNAME} "$@" |
259 | debug-print-function ${FUNCNAME} "$@" |
226 | |
260 | |
227 | base_src_prepare |
261 | [[ ${PATCHES} ]] && epatch "${PATCHES[@]}" |
|
|
262 | epatch_user |
|
|
263 | |
228 | elibtoolize --patch-only |
264 | elibtoolize --patch-only |
229 | } |
265 | } |
230 | |
266 | |
231 | # @FUNCTION: autotools-utils_src_configure |
267 | # @FUNCTION: autotools-utils_src_configure |
232 | # @DESCRIPTION: |
268 | # @DESCRIPTION: |
… | |
… | |
258 | econfargs+=("${myeconfargs[@]}") |
294 | econfargs+=("${myeconfargs[@]}") |
259 | |
295 | |
260 | _check_build_dir |
296 | _check_build_dir |
261 | mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed" |
297 | mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed" |
262 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
298 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
263 | base_src_configure "${econfargs[@]}" "$@" |
299 | econf "${econfargs[@]}" "$@" |
264 | popd > /dev/null |
300 | popd > /dev/null |
265 | } |
301 | } |
266 | |
302 | |
267 | # @FUNCTION: autotools-utils_src_compile |
303 | # @FUNCTION: autotools-utils_src_compile |
268 | # @DESCRIPTION: |
304 | # @DESCRIPTION: |
… | |
… | |
270 | autotools-utils_src_compile() { |
306 | autotools-utils_src_compile() { |
271 | debug-print-function ${FUNCNAME} "$@" |
307 | debug-print-function ${FUNCNAME} "$@" |
272 | |
308 | |
273 | _check_build_dir |
309 | _check_build_dir |
274 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
310 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
275 | base_src_compile "$@" |
311 | emake "$@" || die 'emake failed' |
276 | popd > /dev/null |
312 | popd > /dev/null |
277 | } |
313 | } |
278 | |
314 | |
279 | # @FUNCTION: autotools-utils_src_install |
315 | # @FUNCTION: autotools-utils_src_install |
280 | # @DESCRIPTION: |
316 | # @DESCRIPTION: |
… | |
… | |
287 | autotools-utils_src_install() { |
323 | autotools-utils_src_install() { |
288 | debug-print-function ${FUNCNAME} "$@" |
324 | debug-print-function ${FUNCNAME} "$@" |
289 | |
325 | |
290 | _check_build_dir |
326 | _check_build_dir |
291 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
327 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
292 | base_src_install "$@" |
328 | emake DESTDIR="${D}" "$@" install || die "emake install failed" |
293 | popd > /dev/null |
329 | popd > /dev/null |
|
|
330 | |
|
|
331 | # XXX: support installing them from builddir as well? |
|
|
332 | if [[ ${DOCS} ]]; then |
|
|
333 | dodoc "${DOCS[@]}" || die "dodoc failed" |
|
|
334 | fi |
|
|
335 | if [[ ${HTML_DOCS} ]]; then |
|
|
336 | dohtml -r "${HTML_DOCS[@]}" || die "dohtml failed" |
|
|
337 | fi |
294 | |
338 | |
295 | # Remove libtool files and unnecessary static libs |
339 | # Remove libtool files and unnecessary static libs |
296 | remove_libtool_files |
340 | remove_libtool_files |
297 | } |
341 | } |
298 | |
342 | |