/[gentoo-x86]/eclass/qt4-r2.eclass
Gentoo

Diff of /eclass/qt4-r2.eclass

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

Revision 1.4 Revision 1.16
1# Copyright 1999-2010 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.4 2010/02/19 20:54:05 ayoy Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-r2.eclass,v 1.16 2011/12/28 10:57:38 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
16case ${EAPI} in 13case ${EAPI} in
17 2|3) : ;; 14 2|3|4) : ;;
18 *) DEPEND="EAPI-INCOMPATIBLE" ;; 15 *) die "EAPI=${EAPI} is not supported by ${ECLASS} eclass." ;;
19esac 16esac
20 17
21inherit base eutils multilib toolchain-funcs 18inherit base eutils multilib toolchain-funcs
22 19
23export XDG_CONFIG_HOME="${T}" 20export XDG_CONFIG_HOME="${T}"
24 21
25# @ECLASS-VARIABLE: LANGS 22# @ECLASS-VARIABLE: LANGS
23# @DEFAULT_UNSET
26# @DESCRIPTION: 24# @DESCRIPTION:
27# In case your Qt4 application provides various translations, use this variable 25# In case your Qt4 application provides various translations, use this variable
28# to specify them in order to populate "linguas_*" IUSE automatically. Make sure 26# to specify them in order to populate "linguas_*" IUSE automatically. Make sure
29# that you set this variable BEFORE inheriting qt4-r2 eclass. 27# that you set this variable before inheriting qt4-r2 eclass.
28# Example:
29# @CODE
30# example: LANGS="en el de" 30# LANGS="en el de"
31# @CODE
31for x in ${LANGS}; do 32for x in ${LANGS}; do
32 IUSE="${IUSE} linguas_${x}" 33 IUSE="${IUSE} linguas_${x}"
33done 34done
34 35
35# @ECLASS-VARIABLE: LANGSLONG 36# @ECLASS-VARIABLE: LANGSLONG
37# @DEFAULT_UNSET
36# @DESCRIPTION: 38# @DESCRIPTION:
37# Same as above, but this variable is for LINGUAS that must be in long format. 39# Same as above, but this variable is for LINGUAS that must be in long format.
38# Remember to set this variable BEFORE inheriting qt4-r2 eclass. 40# Remember to set this variable before inheriting qt4-r2 eclass.
39# Look at ${PORTDIR}/profiles/desc/linguas.desc for details. 41# Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
40for x in ${LANGSLONG}; do 42for x in ${LANGSLONG}; do
41 IUSE="${IUSE} linguas_${x%_*}" 43 IUSE="${IUSE} linguas_${x%_*}"
42done 44done
43 45
46# Default src_unpack function for packages that depend on qt4. If you have to 48# 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 49# override src_unpack in your ebuild (probably you don't need to), call
48# qt4-r2_src_unpack in it. 50# qt4-r2_src_unpack in it.
49qt4-r2_src_unpack() { 51qt4-r2_src_unpack() {
50 debug-print-function $FUNCNAME "$@" 52 debug-print-function $FUNCNAME "$@"
53
51 base_src_unpack "$@" 54 base_src_unpack "$@"
52 55
53 # Fallback to ${WORKDIR}/${MY_P} when ${WORKDIR}/${P} doesn't exist. 56 # Fallback to ${WORKDIR}/${MY_P} when ${WORKDIR}/${P} doesn't exist.
54 # Feel free to re-implement this 57 # This is a hack that was never meant to be used by ebuilds in tree.
55 if [[ "${S}" == "${WORKDIR}/${P}" && ! -d ${S} && -d ${WORKDIR}/${MY_P} ]]; then 58 if [[ ${S} == "${WORKDIR}/${P}" && ! -d ${S} && -d ${WORKDIR}/${MY_P} ]]; then
59 echo
60 eqawarn "*** DEPRECATION NOTICE ***"
61 eqawarn
62 eqawarn "\${S} fallback is deprecated and will be removed on 12/12/2011."
63 eqawarn "Please set the correct value for \${S} variable inside the ebuild."
64 echo
56 ewarn "Falling back to '${WORKDIR}/${MY_P}'" 65 einfo "Falling back to '${WORKDIR}/${MY_P}'"
57 S="${WORKDIR}/${MY_P}" 66 S="${WORKDIR}/${MY_P}"
58 fi 67 fi
59} 68}
60 69
61# @ECLASS-VARIABLE: PATCHES 70# @ECLASS-VARIABLE: PATCHES
71# @DEFAULT_UNSET
62# @DESCRIPTION: 72# @DESCRIPTION:
63# In case you have patches to apply, specify them in PATCHES variable. Make sure 73# In case you have patches to apply, specify them here. Make sure to
64# to specify the full path. This variable is used in src_prepare phase. 74# specify the full path. This variable is used in src_prepare phase.
65# example: 75# Example:
76# @CODE
66# PATCHES=( "${FILESDIR}"/mypatch.patch 77# PATCHES=( "${FILESDIR}"/mypatch.patch
67# "${FILESDIR}"/mypatch2.patch ) 78# "${FILESDIR}"/mypatch2.patch )
68# 79# @CODE
80
69# @FUNCTION: qt4-r2_src_prepare 81# @FUNCTION: qt4-r2_src_prepare
70# @DESCRIPTION: 82# @DESCRIPTION:
71# Default src_prepare function for packages that depend on qt4. If you have to 83# Default src_prepare function for packages that depend on qt4. If you have to
72# override src_prepare in your ebuild, you should call qt4-r2_src_prepare in it, 84# override src_prepare in your ebuild, you should call qt4-r2_src_prepare in it,
73# otherwise autopatcher will not work! 85# otherwise autopatcher will not work!
103 115
104 base_src_compile "$@" 116 base_src_compile "$@"
105} 117}
106 118
107# @ECLASS-VARIABLE: DOCS 119# @ECLASS-VARIABLE: DOCS
120# @DEFAULT_UNSET
108# @DESCRIPTION: 121# @DESCRIPTION:
109# Use this variable if you want to install any documentation. 122# Use this variable if you want to install any documentation.
123# Example:
124# @CODE
110# example: DOCS="README AUTHORS" 125# DOCS="README AUTHORS"
111# 126# @CODE
127
112# @ECLASS-VARIABLE: DOCSDIR 128# @ECLASS-VARIABLE: DOCSDIR
113# @DESCRIPTION: 129# @DESCRIPTION:
114# Directory containing documentation. If not specified, ${S} will be used 130# Directory containing documentation, defaults to ${S}.
115# instead. 131
116#
117# @FUNCTION: qt4-r2_src_install 132# @FUNCTION: qt4-r2_src_install
118# @DESCRIPTION: 133# @DESCRIPTION:
119# Default src_install function for qt4-based packages. Installs compiled code, 134# Default src_install function for qt4-based packages. Installs compiled code
120# documentation (via DOCS variable) and translations (via LANGS and 135# and misc documentation (via DOCS variable).
121# LANGSLONG variables).
122qt4-r2_src_install() { 136qt4-r2_src_install() {
123 debug-print-function $FUNCNAME "$@" 137 debug-print-function $FUNCNAME "$@"
124 138
125 emake INSTALL_ROOT="${D}" DESTDIR="${D}" install || die "emake install failed" 139 emake INSTALL_ROOT="${D}" DESTDIR="${D}" install || die "emake install failed"
126 140
127 # install documentation 141 # install documentation
128 if [[ -n "${DOCS}" ]]; then
129 local dir=${DOCSDIR:-${S}} 142 local doc dir="${DOCSDIR:-${S}}"
130 for doc in ${DOCS}; do 143 for doc in ${DOCS}; do
131 dodoc "${dir}/${doc}" || die "dodoc failed" 144 dodoc "${dir}/${doc}" || die "dodoc failed"
132 done 145 done
133 fi
134} 146}
135 147
136# Internal function, used by eqmake4 and qt4-r2_src_configure 148# Internal function, used by eqmake4 and qt4-r2_src_configure
137# Look for project files: 149# Look for project files:
138# 0 *.pro files found - output null string 150# 0 *.pro files found - output null string
151 1) 163 1)
152 echo "${pro_files[0]}" 164 echo "${pro_files[0]}"
153 ;; 165 ;;
154 *) 166 *)
155 for pro_file in "${pro_files[@]}"; do 167 for pro_file in "${pro_files[@]}"; do
156 if [[ "${pro_file}" == "${dir_name}" || 168 if [[ ${pro_file} == "${dir_name}" || ${pro_file} == "${PN}.pro" ]]; then
157 "${pro_file}" == "${PN}.pro" ]]; then
158 echo "${pro_file}" 169 echo "${pro_file}"
159 break 170 break
160 fi 171 fi
161 done 172 done
162 ;; 173 ;;
163 esac 174 esac
164} 175}
165 176
166# @FUNCTION: eqmake4 177# @FUNCTION: eqmake4
167# @USAGE: [project file] [parameters to qmake] 178# @USAGE: [project_file] [parameters to qmake]
168# @DESCRIPTION: 179# @DESCRIPTION:
169# Wrapper for Qt4's qmake. If project file isn't specified eqmake4 will 180# Wrapper for Qt4's qmake. If project_file isn't specified, eqmake4 will
170# look for it in current directory (${S}, non-recursively). If more than 181# look for it in the current directory (${S}, non-recursively). If more
171# one project file is found, the ${PN}.pro is processed, provided that it 182# than one project file are found, then ${PN}.pro is processed, provided
172# exists. Otherwise eqmake4 fails. 183# that it exists. Otherwise eqmake4 fails.
184#
173# All the arguments are appended unmodified to qmake command line. For 185# All other arguments are appended unmodified to qmake command line. For
174# recursive build systems, i.e. those based on the subdirs template, you 186# recursive build systems, i.e. those based on the subdirs template, you
175# should run eqmake4 on the top-level project file only, unless you have 187# should run eqmake4 on the top-level project file only, unless you have
176# strong reasons to do things differently. During the building, qmake 188# strong reasons to do things differently. During the building, qmake
177# will be automatically re-invoked with the right arguments on every 189# will be automatically re-invoked with the right arguments on every
178# directory specified inside the top-level project file by the SUBDIRS 190# directory specified inside the top-level project file.
179# variable.
180eqmake4() { 191eqmake4() {
181 ebegin "Running qmake" 192 ebegin "Running qmake"
182 193
183 local qmake_args="$@" 194 local qmake_args=("$@")
184 195
185 # check if project file was passed as a first argument 196 # check if project file was passed as a first argument
186 # if not, then search for it 197 # if not, then search for it
187 local regexp='.*\.pro' 198 local regexp='.*\.pro'
188 if ! [[ "${1}" =~ ${regexp} ]]; then 199 if ! [[ ${1} =~ ${regexp} ]]; then
189 local project_file="$(_find_project_file)" 200 local project_file="$(_find_project_file)"
190 if [[ -z "${project_file}" ]]; then 201 if [[ -z ${project_file} ]]; then
191 echo 202 echo
192 eerror "No project file found in ${S}!" 203 eerror "No project file found in ${S}!"
193 eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" 204 eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/"
194 echo 205 echo
195 die "eqmake4 failed" 206 die "eqmake4 failed"
196 fi 207 fi
197 qmake_args="${qmake_args} ${project_file}" 208 qmake_args+=("${project_file}")
198 fi 209 fi
199 210
200 # make sure CONFIG variable is correctly set for both release and debug builds 211 # make sure CONFIG variable is correctly set
212 # for both release and debug builds
201 local CONFIG_ADD="release" 213 local CONFIG_ADD="release"
202 local CONFIG_REMOVE="debug" 214 local CONFIG_REMOVE="debug"
203 if has debug ${IUSE} && use debug; then 215 if has debug ${IUSE} && use debug; then
204 CONFIG_ADD="debug" 216 CONFIG_ADD="debug"
205 CONFIG_REMOVE="release" 217 CONFIG_REMOVE="release"
242 fi 254 fi
243 done < <(find . -type f -name "*.pr[io]" -printf '%P\n' 2>/dev/null) 255 done < <(find . -type f -name "*.pr[io]" -printf '%P\n' 2>/dev/null)
244 256
245 [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX= 257 [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX=
246 258
247 "${EPREFIX}"/usr/bin/qmake -makefile -nocache \ 259 "${EPREFIX}"/usr/bin/qmake \
260 -makefile \
261 -config ${CONFIG_ADD} \
248 QTDIR="${EPREFIX}"/usr/$(get_libdir) \ 262 QTDIR="${EPREFIX}"/usr/$(get_libdir) \
249 QMAKE="${EPREFIX}"/usr/bin/qmake \ 263 QMAKE="${EPREFIX}"/usr/bin/qmake \
250 QMAKE_CC=$(tc-getCC) \ 264 QMAKE_CC="$(tc-getCC)" \
251 QMAKE_CXX=$(tc-getCXX) \ 265 QMAKE_CXX="$(tc-getCXX)" \
252 QMAKE_LINK=$(tc-getCXX) \ 266 QMAKE_LINK="$(tc-getCXX)" \
253 QMAKE_CFLAGS_RELEASE="${CFLAGS}" \ 267 QMAKE_CFLAGS_RELEASE="${CFLAGS}" \
254 QMAKE_CFLAGS_DEBUG="${CFLAGS}" \ 268 QMAKE_CFLAGS_DEBUG="${CFLAGS}" \
255 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ 269 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
256 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ 270 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
257 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ 271 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
258 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ 272 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
273 QMAKE_LIBDIR_QT="${EPREFIX}"/usr/$(get_libdir)/qt4 \
274 QMAKE_LIBDIR_X11="${EPREFIX}"/usr/$(get_libdir) \
275 QMAKE_LIBDIR_OPENGL="${EPREFIX}"/usr/$(get_libdir) \
259 QMAKE_STRIP= \ 276 QMAKE_STRIP= \
260 ${qmake_args} 277 "${qmake_args[@]}"
261 278
262 # was qmake successful? 279 # was qmake successful?
263 if ! eend $? ; then 280 if ! eend $? ; then
264 echo 281 echo
265 eerror "Running qmake has failed! (see above for details)" 282 eerror "Running qmake has failed! (see above for details)"

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.20