/[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.1 Revision 1.14
1# Copyright 2009 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.1 2009/12/15 16:32:43 ayoy Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-r2.eclass,v 1.14 2011/11/12 20:46:39 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) : ;; 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}"
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.
49qt4-r2_src_unpack() { 46qt4-r2_src_unpack() {
50 debug-print-function $FUNCNAME "$@" 47 debug-print-function $FUNCNAME "$@"
48
51 base_src_unpack "$@" 49 base_src_unpack "$@"
52 50
53 # Fallback to ${WORKDIR}/${MY_P} when ${WORKDIR}/${P} doesn't exist. 51 # Fallback to ${WORKDIR}/${MY_P} when ${WORKDIR}/${P} doesn't exist.
54 # Feel free to re-implement this 52 # 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 53 if [[ ${S} == "${WORKDIR}/${P}" && ! -d ${S} && -d ${WORKDIR}/${MY_P} ]]; then
54 echo
55 eqawarn "*** DEPRECATION NOTICE ***"
56 eqawarn
57 eqawarn "\${S} fallback is deprecated and will be removed on 12/12/2011."
58 eqawarn "Please set the correct value for \${S} variable inside the ebuild."
59 echo
56 ewarn "Falling back to '${WORKDIR}/${MY_P}'" 60 einfo "Falling back to '${WORKDIR}/${MY_P}'"
57 S="${WORKDIR}/${MY_P}" 61 S="${WORKDIR}/${MY_P}"
58 fi 62 fi
59} 63}
60 64
61# @ECLASS-VARIABLE: PATCHES 65# @ECLASS-VARIABLE: PATCHES
63# In case you have patches to apply, specify them in PATCHES variable. Make sure 67# In case you have patches to apply, specify them in PATCHES variable. Make sure
64# to specify the full path. This variable is used in src_prepare phase. 68# to specify the full path. This variable is used in src_prepare phase.
65# example: 69# example:
66# PATCHES=( "${FILESDIR}"/mypatch.patch 70# PATCHES=( "${FILESDIR}"/mypatch.patch
67# "${FILESDIR}"/mypatch2.patch ) 71# "${FILESDIR}"/mypatch2.patch )
68# 72
69# @FUNCTION: qt4-r2_src_prepare 73# @FUNCTION: qt4-r2_src_prepare
70# @DESCRIPTION: 74# @DESCRIPTION:
71# Default src_prepare function for packages that depend on qt4. If you have to 75# 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, 76# override src_prepare in your ebuild, you should call qt4-r2_src_prepare in it,
73# otherwise autopatcher will not work! 77# otherwise autopatcher will not work!
106 110
107# @ECLASS-VARIABLE: DOCS 111# @ECLASS-VARIABLE: DOCS
108# @DESCRIPTION: 112# @DESCRIPTION:
109# Use this variable if you want to install any documentation. 113# Use this variable if you want to install any documentation.
110# example: DOCS="README AUTHORS" 114# example: DOCS="README AUTHORS"
111# 115
112# @ECLASS-VARIABLE: DOCSDIR 116# @ECLASS-VARIABLE: DOCSDIR
113# @DESCRIPTION: 117# @DESCRIPTION:
114# Directory containing documentation. If not specified, ${S} will be used 118# Directory containing documentation. If not specified, ${S} will be used
115# instead. 119# instead.
116# 120
117# @FUNCTION: qt4-r2_src_install 121# @FUNCTION: qt4-r2_src_install
118# @DESCRIPTION: 122# @DESCRIPTION:
119# Default src_install function for qt4-based packages. Installs compiled code, 123# Default src_install function for qt4-based packages. Installs compiled code,
120# documentation (via DOCS variable) and translations (via LANGS and 124# documentation (via DOCS variable) and translations (via LANGS and
121# LANGSLONG variables). 125# LANGSLONG variables).
123 debug-print-function $FUNCNAME "$@" 127 debug-print-function $FUNCNAME "$@"
124 128
125 emake INSTALL_ROOT="${D}" DESTDIR="${D}" install || die "emake install failed" 129 emake INSTALL_ROOT="${D}" DESTDIR="${D}" install || die "emake install failed"
126 130
127 # install documentation 131 # install documentation
128 if [[ -n "${DOCS}" ]]; then 132 if [[ -n ${DOCS} ]]; then
129 local dir=${DOCSDIR:-${S}} 133 local dir=${DOCSDIR:-${S}}
130 for doc in ${DOCS}; do 134 for doc in ${DOCS}; do
131 dodoc "${dir}/${doc}" || die "dodoc failed" 135 dodoc "${dir}/${doc}" || die "dodoc failed"
132 done 136 done
133 fi 137 fi
151 1) 155 1)
152 echo "${pro_files[0]}" 156 echo "${pro_files[0]}"
153 ;; 157 ;;
154 *) 158 *)
155 for pro_file in "${pro_files[@]}"; do 159 for pro_file in "${pro_files[@]}"; do
156 if [[ "${pro_file}" == "${dir_name}" || 160 if [[ ${pro_file} == "${dir_name}" || ${pro_file} == "${PN}.pro" ]]; then
157 "${pro_file}" == "${PN}.pro" ]]; then
158 echo "${pro_file}" 161 echo "${pro_file}"
159 break 162 break
160 fi 163 fi
161 done 164 done
162 ;; 165 ;;
178# directory specified inside the top-level project file by the SUBDIRS 181# directory specified inside the top-level project file by the SUBDIRS
179# variable. 182# variable.
180eqmake4() { 183eqmake4() {
181 ebegin "Running qmake" 184 ebegin "Running qmake"
182 185
183 local qmake_args="$@" 186 local qmake_args=("$@")
184 187
185 # check if project file was passed as a first argument 188 # check if project file was passed as a first argument
186 # if not, then search for it 189 # if not, then search for it
187 local regexp='.*\.pro' 190 local regexp='.*\.pro'
188 if ! [[ "${1}" =~ ${regexp} ]]; then 191 if ! [[ ${1} =~ ${regexp} ]]; then
189 local project_file="$(_find_project_file)" 192 local project_file="$(_find_project_file)"
190 if [[ -z "${project_file}" ]]; then 193 if [[ -z ${project_file} ]]; then
191 echo 194 echo
192 eerror "No project file found in ${S}!" 195 eerror "No project file found in ${S}!"
193 eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" 196 eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/"
194 echo 197 echo
195 die "eqmake4 failed" 198 die "eqmake4 failed"
196 fi 199 fi
197 qmake_args="${qmake_args} ${project_file}" 200 qmake_args+=("${project_file}")
198 fi 201 fi
199 202
200 # make sure CONFIG variable is correctly set for both release and debug builds 203 # make sure CONFIG variable is correctly set
204 # for both release and debug builds
201 local CONFIG_ADD="release" 205 local CONFIG_ADD="release"
202 local CONFIG_REMOVE="debug" 206 local CONFIG_REMOVE="debug"
203 if has debug ${IUSE} && use debug; then 207 if has debug ${IUSE} && use debug; then
204 CONFIG_ADD="debug" 208 CONFIG_ADD="debug"
205 CONFIG_REMOVE="release" 209 CONFIG_REMOVE="release"
240 eerror "An error occurred while processing ${file}" 244 eerror "An error occurred while processing ${file}"
241 die "eqmake4 failed to process '${file}'" 245 die "eqmake4 failed to process '${file}'"
242 fi 246 fi
243 done < <(find . -type f -name "*.pr[io]" -printf '%P\n' 2>/dev/null) 247 done < <(find . -type f -name "*.pr[io]" -printf '%P\n' 2>/dev/null)
244 248
245 /usr/bin/qmake -makefile -nocache \ 249 [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX=
250
251 "${EPREFIX}"/usr/bin/qmake \
252 -makefile \
253 -config ${CONFIG_ADD} \
246 QTDIR=/usr/$(get_libdir) \ 254 QTDIR="${EPREFIX}"/usr/$(get_libdir) \
247 QMAKE=/usr/bin/qmake \ 255 QMAKE="${EPREFIX}"/usr/bin/qmake \
248 QMAKE_CC=$(tc-getCC) \ 256 QMAKE_CC="$(tc-getCC)" \
249 QMAKE_CXX=$(tc-getCXX) \ 257 QMAKE_CXX="$(tc-getCXX)" \
250 QMAKE_LINK=$(tc-getCXX) \ 258 QMAKE_LINK="$(tc-getCXX)" \
251 QMAKE_CFLAGS_RELEASE="${CFLAGS}" \ 259 QMAKE_CFLAGS_RELEASE="${CFLAGS}" \
252 QMAKE_CFLAGS_DEBUG="${CFLAGS}" \ 260 QMAKE_CFLAGS_DEBUG="${CFLAGS}" \
253 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ 261 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
254 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ 262 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
255 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ 263 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
256 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ 264 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
257 QMAKE_RPATH= \ 265 QMAKE_LIBDIR_QT="${EPREFIX}"/usr/$(get_libdir)/qt4 \
266 QMAKE_LIBDIR_X11="${EPREFIX}"/usr/$(get_libdir) \
267 QMAKE_LIBDIR_OPENGL="${EPREFIX}"/usr/$(get_libdir) \
258 QMAKE_STRIP= \ 268 QMAKE_STRIP= \
259 ${qmake_args} 269 "${qmake_args[@]}"
260 270
261 # was qmake successful? 271 # was qmake successful?
262 if ! eend $? ; then 272 if ! eend $? ; then
263 echo 273 echo
264 eerror "Running qmake has failed! (see above for details)" 274 eerror "Running qmake has failed! (see above for details)"

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.20