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

Diff of /eclass/qt4.eclass

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

Revision 1.32 Revision 1.51
1# Copyright 2005 Gentoo Foundation 1# Copyright 2005-2009 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/Attic/qt4.eclass,v 1.32 2008/01/05 18:44:38 caleb Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/qt4.eclass,v 1.51 2009/03/14 15:31:28 yngwin Exp $
4 4
5# @ECLASS: qt4.eclass 5# @ECLASS: qt4.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Ben de Groot <yngwin@gentoo.org>,
8# Markos Chandras <hwoarang@gentoo.org>,
7# Caleb Tennis <caleb@gentoo.org> 9# Caleb Tennis <caleb@gentoo.org>,
8# @BLURB: 10# Przemyslaw Maciag <troll@gentoo.org>,
11# Davide Pesavento <davidepesa@gmail.com>
9# Eclass for Qt4 packages 12# @BLURB: Eclass for Qt4 packages
10# @DESCRIPTION: 13# @DESCRIPTION:
11# This eclass contains various functions that may be useful 14# This eclass contains various functions that may be useful
12# when dealing with packages using Qt4 libraries. 15# when dealing with packages using Qt4 libraries.
13 16
14# 08.16.06 - Renamed qt_min_* to qt4_min_* to avoid conflicts with the qt3 eclass.
15# - Caleb Tennis <caleb@gentoo.org>
16
17inherit eutils multilib toolchain-funcs versionator 17inherit base eutils multilib toolchain-funcs versionator
18 18
19QTPKG="x11-libs/qt-" 19qt4_monolithic_to_split_flag() {
20QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0" 20 case ${1} in
21QT4VERSIONS="4.4.0_rc1 4.3.3 4.3.2-r1 4.3.2 4.3.1-r1 4.3.1 4.3.0-r2 4.3.0-r1 4.3.0 4.3.0_rc1 4.3.0_beta1 4.2.3-r1 4.2.3 4.2.2 4.2.1 4.2.0-r2 4.2.0-r1 4.2.0 4.1.4-r2 4.1.4-r1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.0.1 4.0.0" 21 zlib)
22 22 # Qt 4.4+ is always built with zlib enabled, so this flag isn't needed
23# @FUNCTION: qt4_min_version 23 ;;
24# @USAGE: [minimum version] 24 gif|jpeg|png)
25# @DESCRIPTION: 25 # qt-gui always installs with these enabled
26# This function should be called in package DEPENDs whenever it depends on qt4. 26 checkpkgs+=" x11-libs/qt-gui"
27# Simple example - in your depend, do something like this: 27 ;;
28# DEPEND="$(qt4_min_version 4.2)" 28 dbus|opengl)
29# if package can be build with qt-4.2 or higher. 29 # Make sure the qt-${1} package has been installed already
30qt4_min_version() { 30 checkpkgs+=" x11-libs/qt-${1}"
31 # This is much simpler for EAPI 1, we can use a slot dependency 31 ;;
32 if [[ "${EAPI}" -ge 1 ]]; then 32 qt3support)
33 echo ">=${QTPKG}${1}:4" 33 checkpkgs+=" x11-libs/qt-${1}"
34 else 34 checkflags+=" x11-libs/qt-core:${1} x11-libs/qt-gui:${1} x11-libs/qt-sql:${1}"
35 echo "|| (" 35 ;;
36 qt4_min_version_list "$@" 36 ssl)
37 echo ")" 37 # qt-core controls this flag
38 fi 38 checkflags+=" x11-libs/qt-core:${1}"
39} 39 ;;
40 40 cups|mng|nas|nis|tiff|xinerama|input_devices_wacom)
41qt4_min_version_list() { 41 # qt-gui controls these flags
42 local MINVER="$1" 42 checkflags+=" x11-libs/qt-gui:${1}"
43 local VERSIONS="" 43 ;;
44 44 firebird|mysql|odbc|postgres|sqlite3)
45 case "${MINVER}" in 45 # qt-sql controls these flags. sqlite2 is no longer supported so it uses sqlite instead of sqlite3.
46 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; 46 checkflags+=" x11-libs/qt-sql:${1%3}"
47 4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0) 47 ;;
48 for x in ${QT4MAJORVERSIONS}; do 48 accessibility)
49 if $(version_is_at_least "${MINVER}" "${x}"); then 49 eerror "(QA message): Use guiaccessibility and/or qt3accessibility to specify which of qt-gui and qt-qt3support are relevant for this package."
50 VERSIONS="${VERSIONS} =${QTPKG}${x}*" 50 # deal with this gracefully by checking the flag for what is available
51 fi 51 for y in gui qt3support; do
52 has_version x11-libs/qt-${y} && checkflags+=" x11-libs/qt-${y}:${1}"
52 done 53 done
53 ;; 54 ;;
54 4*) 55 guiaccessibility)
55 for x in ${QT4VERSIONS}; do 56 checkflags+=" x11-libs/qt-gui:accessibility"
56 if $(version_is_at_least "${MINVER}" "${x}"); then
57 VERSIONS="${VERSIONS} =${QTPKG}${x}"
58 fi
59 done
60 ;; 57 ;;
61 *) VERSIONS="=${QTPKG}4*";; 58 qt3accessibility)
59 checkflags+=" x11-libs/qt-qt3support:accessibility"
60 ;;
61 debug|doc|examples|glib|pch|sqlite|*)
62 # packages probably shouldn't be checking these flags so we don't handle them currently
63 eerror "qt4.eclass currently doesn't handle the use flag ${1} in QT4_BUILT_WITH_USE_CHECK for qt-4.4. This is either an"
64 eerror "eclass bug or an ebuild bug. Please report it at http://bugs.gentoo.org/"
65 ((fatalerrors+=1))
66 ;;
62 esac 67 esac
63
64 echo "${VERSIONS}"
65} 68}
66 69
67# @FUNCTION: qt4_pkg_setup 70# @FUNCTION: qt4_pkg_setup
68# @MAINTAINER:
69# Caleb Tennis <caleb@gentoo.org>
70# Przemyslaw Maciag <troll@gentoo.org>
71# @DESCRIPTION: 71# @DESCRIPTION:
72# Default pkg_setup function for packages that depends on qt4. If you have to 72# Default pkg_setup function for packages that depends on qt4. If you have to
73# create ebuilds own pkg_setup in your ebuild, call qt4_pkg_setup in it. 73# create ebuilds own pkg_setup in your ebuild, call qt4_pkg_setup in it.
74# This function uses two global vars from ebuild: 74# This function uses two global vars from ebuild:
75# - QT4_BUILT_WITH_USE_CHECK - contains use flags that need to be turned on for 75# - QT4_BUILT_WITH_USE_CHECK - contains use flags that need to be turned on for
76# =x11-libs/qt-4* 76# =x11-libs/qt-4*
77# - QT4_OPTIONAL_BUILT_WITH_USE_CHECK - qt4 flags that provides some 77# - QT4_OPTIONAL_BUILT_WITH_USE_CHECK - qt4 flags that provides some
78# functionality, but can alternatively be disabled in ${CATEGORY}/${PN} 78# functionality, but can alternatively be disabled in ${CATEGORY}/${PN}
79# (so qt4 don't have to be recompiled) 79# (so qt4 don't have to be recompiled)
80# 80#
81# NOTE: Using the above vars is now deprecated in favor of eapi-2 use deps
82#
81# flags to watch for for Qt4.4: 83# flags to watch for for Qt4.4:
82# zlib png | opengl dbus qt3support | sqlite3 ssl 84# zlib png | opengl dbus qt3support | sqlite3 ssl
83qt4_pkg_setup() { 85qt4_pkg_setup() {
86 local x y checkpkgs checkflags fatalerrors=0 requiredflags=""
84 87
85 QT4_BEST_VERSION="$(best_version =x11-libs/qt-4*)" 88 # lots of has_version calls can be very expensive
86 QT4_MINOR_VERSION="$(get_version_component_range 2 ${QT4_BEST_VERSION/*qt-/})" 89 if [[ -n ${QT4_BUILT_WITH_USE_CHECK}${QT4_OPTIONAL_BUILT_WITH_USE_CHECK} ]]; then
90 ewarn "QA notice: The QT4_BUILT_WITH_USE functionality is deprecated and"
91 ewarn "will be removed from future versions of qt4.eclass. Please update"
92 ewarn "the ebuild to use eapi-2 use dependencies instead."
93 has_version x11-libs/qt-core && local QT44=true
94 fi
87 95
88 local requiredflags=""
89 for x in ${QT4_BUILT_WITH_USE_CHECK}; do 96 for x in ${QT4_BUILT_WITH_USE_CHECK}; do
90 if [[ "${QT4_MINOR_VERSION}" -ge 4 ]]; then 97 if [[ -n ${QT44} ]]; then
91 # The use flags are different in 4.4 and above, and it's a split package, so this is used to catch 98 # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch
92 # the various use flag combos specified in the ebuilds to make sure we don't error out. 99 # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason.
93 100 qt4_monolithic_to_split_flag ${x}
94 if [[ ${x} == zlib || ${x} == png ]]; then 101 else
95 # Qt 4.4+ is built with zlib and png by default, so the use flags aren't needed 102 [[ ${x} == *accessibility ]] && x=${x#gui} && x=${x#qt3}
96 continue; 103 if ! built_with_use =x11-libs/qt-4* ${x}; then
97 elif [[ ${x} == opengl || ${x} == dbus || ${x} == qt3support ]]; then 104 requiredflags="${requiredflags} ${x}"
98 # Make sure the qt-${x} package has been already installed
99
100 if ! has_version x11-libs/qt-${x}; then
101 eerror "You must first install the x11-libs/qt-${x} package."
102 die "Install x11-libs/qt-${x}"
103 fi
104 elif [[ ${x} == ssl ]]; then
105 if ! has_version x11-libs/qt-core || ! built_with_use x11-libs/qt-core ssl; then
106 eerror "You must first install the x11-libs/qt-core package with the ssl flag enabled."
107 die "Install x1-libs/qt-core with USE=\"ssl\""
108 fi
109 elif [[ ${x} == sqlite3 ]]; then
110 if ! has_version x11-libs/qt-sql || ! built_with_use x11-libs/qt-sql sqlite; then
111 eerror "You must first install the x11-libs/qt-sql package with the sqlite flag enabled."
112 die "Install x11-libs/qt-sql with USE="\sqlite\""
113 fi
114 fi 105 fi
115 elif ! built_with_use =x11-libs/qt-4* ${x}; then
116 requiredflags="${requiredflags} ${x}"
117 fi 106 fi
118 done 107 done
119 108
120 local optionalflags="" 109 local optionalflags=""
121 for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do 110 for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do
111 if use ${x}; then
112 if [[ -n ${QT44} ]]; then
113 # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch
114 # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason.
115 qt4_monolithic_to_split_flag ${x}
122 if use ${x} && ! built_with_use =x11-libs/qt-4* ${x}; then 116 elif ! built_with_use =x11-libs/qt-4* ${x}; then
123 optionalflags="${optionalflags} ${x}" 117 optionalflags="${optionalflags} ${x}"
118 fi
119 fi
120 done
121
122 # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch
123 # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason.
124 for y in ${checkpkgs}; do
125 if ! has_version ${y}; then
126 eerror "You must first install the ${y} package. It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161."
127 ((fatalerrors+=1))
128 fi
129 done
130 for y in ${checkflags}; do
131 if ! has_version ${y%:*}; then
132 eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled."
133 eerror "It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161."
134 ((fatalerrors+=1))
135 else
136 if ! built_with_use ${y%:*} ${y##*:}; then
137 eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled."
138 ((fatalerrors+=1))
139 fi
124 fi 140 fi
125 done 141 done
126 142
127 local diemessage="" 143 local diemessage=""
144 if [[ ${fatalerrors} -ne 0 ]]; then
145 diemessage="${fatalerrors} fatal errors were detected. Please read the above error messages and act accordingly."
146 fi
128 if [[ ${requiredflags} != "" ]]; then 147 if [[ -n ${requiredflags} ]]; then
129 eerror 148 eerror
130 eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build" 149 eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build"
131 eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)" 150 eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)"
132 eerror 151 eerror
133 diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; " 152 diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; "
134 fi 153 fi
135 if [[ ${optionalflags} != "" ]]; then 154 if [[ -n ${optionalflags} ]]; then
136 eerror 155 eerror
137 eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with" 156 eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with"
138 eerror "USE=\"${optionalflags}\"" 157 eerror "USE=\"${optionalflags}\""
139 eerror "while qt4 is built without this particular flag(s): it will" 158 eerror "while qt4 is built without this particular flag(s): it will"
140 eerror "not work." 159 eerror "not work."
144 eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)" 163 eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)"
145 eerror 164 eerror
146 diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n" 165 diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n"
147 fi 166 fi
148 167
149 [[ ${diemessage} != "" ]] && die "can't emerge ${CATEGORY}/${PN}: ${diemessage}" 168 [[ -n ${diemessage} ]] && die "can't install ${CATEGORY}/${PN}: ${diemessage}"
169}
170
171# @ECLASS-VARIABLE: PATCHES
172# @DESCRIPTION:
173# In case you have patches to apply, specify them in the PATCHES variable.
174# Make sure to specify the full path. This variable is necessary for the
175# src_prepare phase.
176# example:
177# PATCHES="${FILESDIR}/mypatch.patch
178# ${FILESDIR}/mypatch2.patch"
179#
180# @FUNCTION: qt4_src_prepare
181# @DESCRIPTION:
182# Default src_prepare function for packages that depend on qt4. If you have to
183# override src_prepare in your ebuild, you should call qt4_src_prepare in it,
184# otherwise autopatcher will not work!
185qt4_src_prepare() {
186 debug-print-function $FUNCNAME "$@"
187 base_src_prepare
188}
189
190# @FUNCTION: qt4_src_configure
191# @DESCRIPTION:
192# Default src_configure function for packages that depend on qt4. If you have to
193# override src_configure in your ebuild, call qt4_src_configure in it.
194qt4_src_configure() {
195 debug-print-function $FUNCNAME "$@"
196 eqmake4
197}
198
199# @FUNCTION: qt4_src_compile
200# @DESCRIPTION:
201# Default src_compile function for packages that depend on qt4. If you have to
202# override src_compile in your ebuild (probably you don't need to), call
203# qt4_src_compile in it.
204qt4_src_compile() {
205 debug-print-function $FUNCNAME "$@"
206 case "${EAPI:-0}" in
207 2)
208 emake || die "emake failed"
209 ;;
210 0|1)
211 qt4_src_prepare
212 qt4_src_configure
213 emake || die "emake failed"
214 ;;
215 esac
150} 216}
151 217
152# @FUNCTION: eqmake4 218# @FUNCTION: eqmake4
153# @USAGE: [.pro file] [additional parameters to qmake] 219# @USAGE: [.pro file] [additional parameters to qmake]
154# @MAINTAINER:
155# Przemyslaw Maciag <troll@gentoo.org>
156# Davide Pesavento <davidepesa@gmail.com>
157# @DESCRIPTION: 220# @DESCRIPTION:
158# Runs qmake on the specified .pro file (defaults to 221# Runs qmake on the specified .pro file (defaults to
159# ${PN}.pro if eqmake4 was called with no argument). 222# ${PN}.pro if eqmake4 was called with no argument).
160# Additional parameters are passed unmodified to qmake. 223# Additional parameters are passed unmodified to qmake.
161eqmake4() { 224eqmake4() {
199 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ 262 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
200 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ 263 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
201 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ 264 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
202 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ 265 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
203 QMAKE_RPATH= \ 266 QMAKE_RPATH= \
267 QMAKE_STRIP= \
204 ${@} >> ${LOGFILE} 2>&1 268 "${@}" >> ${LOGFILE} 2>&1
205 269
206 local result=$? 270 local result=$?
207 eend ${result} 271 eend ${result}
208 272
209 # was qmake successful? 273 # was qmake successful?
217 fi 281 fi
218 282
219 return ${result} 283 return ${result}
220} 284}
221 285
286case ${EAPI:-0} in
287 2)
288 EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile
289 ;;
290 0|1)
222EXPORT_FUNCTIONS pkg_setup 291 EXPORT_FUNCTIONS pkg_setup src_compile
292 ;;
293esac

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.51

  ViewVC Help
Powered by ViewVC 1.1.20