| 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/qt4-r2.eclass,v 1.12 2011/08/22 04:46:32 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-r2.eclass,v 1.13 2011/11/12 18:26:59 pesa Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: qt4-r2.eclass |
5 | # @ECLASS: qt4-r2.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Ben de Groot <yngwin@gentoo.org>, |
7 | # Qt herd <qt@gentoo.org> |
| 8 | # Markos Chandras <hwoarang@gentoo.org>, |
|
|
| 9 | # Davide Pesavento <davidepesa@gmail.com>, |
|
|
| 10 | # Dominik Kapusta <ayoy@gentoo.org> |
|
|
| 11 | # @BLURB: Eclass for Qt4 packages, second edition |
8 | # @BLURB: Eclass for Qt4-based packages, second edition. |
| 12 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
| 13 | # This eclass contains various functions that may be useful when |
10 | # This eclass contains various functions that may be useful when |
| 14 | # dealing with packages using Qt4 libraries. Requires EAPI=2. |
11 | # dealing with packages using Qt4 libraries. Requires EAPI=2 or later. |
| 15 | |
12 | |
| 16 | case ${EAPI} in |
13 | case ${EAPI} in |
| 17 | 2|3|4) : ;; |
14 | 2|3|4) : ;; |
| 18 | *) die "EAPI=${EAPI} is not supported" ;; |
15 | *) die "EAPI=${EAPI} is not supported by ${ECLASS} eclass." ;; |
| 19 | esac |
16 | esac |
| 20 | |
17 | |
| 21 | inherit base eutils multilib toolchain-funcs |
18 | inherit base eutils multilib toolchain-funcs |
| 22 | |
19 | |
| 23 | export XDG_CONFIG_HOME="${T}" |
20 | export XDG_CONFIG_HOME="${T}" |
| … | |
… | |
| 46 | # Default src_unpack function for packages that depend on qt4. If you have to |
43 | # Default src_unpack function for packages that depend on qt4. If you have to |
| 47 | # override src_unpack in your ebuild (probably you don't need to), call |
44 | # override src_unpack in your ebuild (probably you don't need to), call |
| 48 | # qt4-r2_src_unpack in it. |
45 | # qt4-r2_src_unpack in it. |
| 49 | qt4-r2_src_unpack() { |
46 | qt4-r2_src_unpack() { |
| 50 | debug-print-function $FUNCNAME "$@" |
47 | debug-print-function $FUNCNAME "$@" |
|
|
48 | |
| 51 | base_src_unpack "$@" |
49 | base_src_unpack "$@" |
| 52 | |
|
|
| 53 | # Fallback to ${WORKDIR}/${MY_P} when ${WORKDIR}/${P} doesn't exist. |
|
|
| 54 | # Feel free to re-implement this |
|
|
| 55 | if [[ "${S}" == "${WORKDIR}/${P}" && ! -d ${S} && -d ${WORKDIR}/${MY_P} ]]; then |
|
|
| 56 | ewarn "Falling back to '${WORKDIR}/${MY_P}'" |
|
|
| 57 | S="${WORKDIR}/${MY_P}" |
|
|
| 58 | fi |
|
|
| 59 | } |
50 | } |
| 60 | |
51 | |
| 61 | # @ECLASS-VARIABLE: PATCHES |
52 | # @ECLASS-VARIABLE: PATCHES |
| 62 | # @DESCRIPTION: |
53 | # @DESCRIPTION: |
| 63 | # In case you have patches to apply, specify them in PATCHES variable. Make sure |
54 | # In case you have patches to apply, specify them in PATCHES variable. Make sure |
| … | |
… | |
| 123 | debug-print-function $FUNCNAME "$@" |
114 | debug-print-function $FUNCNAME "$@" |
| 124 | |
115 | |
| 125 | emake INSTALL_ROOT="${D}" DESTDIR="${D}" install || die "emake install failed" |
116 | emake INSTALL_ROOT="${D}" DESTDIR="${D}" install || die "emake install failed" |
| 126 | |
117 | |
| 127 | # install documentation |
118 | # install documentation |
| 128 | if [[ -n "${DOCS}" ]]; then |
119 | if [[ -n ${DOCS} ]]; then |
| 129 | local dir=${DOCSDIR:-${S}} |
120 | local dir=${DOCSDIR:-${S}} |
| 130 | for doc in ${DOCS}; do |
121 | for doc in ${DOCS}; do |
| 131 | dodoc "${dir}/${doc}" || die "dodoc failed" |
122 | dodoc "${dir}/${doc}" || die "dodoc failed" |
| 132 | done |
123 | done |
| 133 | fi |
124 | fi |
| … | |
… | |
| 151 | 1) |
142 | 1) |
| 152 | echo "${pro_files[0]}" |
143 | echo "${pro_files[0]}" |
| 153 | ;; |
144 | ;; |
| 154 | *) |
145 | *) |
| 155 | for pro_file in "${pro_files[@]}"; do |
146 | for pro_file in "${pro_files[@]}"; do |
| 156 | if [[ "${pro_file}" == "${dir_name}" || |
147 | if [[ ${pro_file} == "${dir_name}" || ${pro_file} == "${PN}.pro" ]]; then |
| 157 | "${pro_file}" == "${PN}.pro" ]]; then |
|
|
| 158 | echo "${pro_file}" |
148 | echo "${pro_file}" |
| 159 | break |
149 | break |
| 160 | fi |
150 | fi |
| 161 | done |
151 | done |
| 162 | ;; |
152 | ;; |
| … | |
… | |
| 183 | local qmake_args=("$@") |
173 | local qmake_args=("$@") |
| 184 | |
174 | |
| 185 | # check if project file was passed as a first argument |
175 | # check if project file was passed as a first argument |
| 186 | # if not, then search for it |
176 | # if not, then search for it |
| 187 | local regexp='.*\.pro' |
177 | local regexp='.*\.pro' |
| 188 | if ! [[ "${1}" =~ ${regexp} ]]; then |
178 | if ! [[ ${1} =~ ${regexp} ]]; then |
| 189 | local project_file="$(_find_project_file)" |
179 | local project_file="$(_find_project_file)" |
| 190 | if [[ -z "${project_file}" ]]; then |
180 | if [[ -z ${project_file} ]]; then |
| 191 | echo |
181 | echo |
| 192 | eerror "No project file found in ${S}!" |
182 | eerror "No project file found in ${S}!" |
| 193 | eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" |
183 | eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" |
| 194 | echo |
184 | echo |
| 195 | die "eqmake4 failed" |
185 | die "eqmake4 failed" |
| 196 | fi |
186 | fi |
| 197 | qmake_args+=("${project_file}") |
187 | qmake_args+=("${project_file}") |
| 198 | fi |
188 | fi |
| 199 | |
189 | |
| 200 | # make sure CONFIG variable is correctly set for both release and debug builds |
190 | # make sure CONFIG variable is correctly set |
|
|
191 | # for both release and debug builds |
| 201 | local CONFIG_ADD="release" |
192 | local CONFIG_ADD="release" |
| 202 | local CONFIG_REMOVE="debug" |
193 | local CONFIG_REMOVE="debug" |
| 203 | if has debug ${IUSE} && use debug; then |
194 | if has debug ${IUSE} && use debug; then |
| 204 | CONFIG_ADD="debug" |
195 | CONFIG_ADD="debug" |
| 205 | CONFIG_REMOVE="release" |
196 | CONFIG_REMOVE="release" |