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

Diff of /eclass/qt4.eclass

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

Revision 1.2 Revision 1.43
1# Copyright 2005 Gentoo Foundation 1# Copyright 2005 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.2 2006/05/08 11:13:57 caleb Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/qt4.eclass,v 1.43 2008/07/11 21:09:39 gentoofan23 Exp $
4
5# @ECLASS: qt4.eclass
6# @MAINTAINER:
7# Caleb Tennis <caleb@gentoo.org>
8# @BLURB: Eclass for Qt4 packages
9# @DESCRIPTION:
10# This eclass contains various functions that may be useful
11# when dealing with packages using Qt4 libraries.
12
13# 08.16.06 - Renamed qt_min_* to qt4_min_* to avoid conflicts with the qt3 eclass.
14# - Caleb Tennis <caleb@gentoo.org>
15
16inherit eutils multilib toolchain-funcs versionator
17
18QTPKG="x11-libs/qt-"
19QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0"
20QT4VERSIONS="4.4.0 4.4.0_beta1 4.4.0_rc1 4.3.4-r1 4.3.4 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
22# @FUNCTION: qt4_min_version
23# @USAGE: [minimum version]
24# @DESCRIPTION:
25# This function should be called in package DEPENDs whenever it depends on qt4.
26# Simple example - in your depend, do something like this:
27# DEPEND="$(qt4_min_version 4.2)"
28# if the package can be build with qt-4.2 or higher.
4# 29#
5# Author Caleb Tennis <caleb@gentoo.org> 30# For builds that use an EAPI with support for SLOT dependencies, this will
6# 31# return a SLOT dependency, rather than a list of versions.
7# This eclass is simple. Inherit it, and in your depend, do something like this:
8#
9# DEPEND="$(qt_min_version 4)"
10#
11# and it handles the rest for you
12#
13
14inherit versionator
15
16QTPKG="x11-libs/qt-"
17QT4MAJORVERSIONS="4.1 4.0"
18QT4VERSIONS="4.1.2 4.1.1 4.1.0 4.0.1 4.0.0"
19
20qt_min_version() { 32qt4_min_version() {
33 case ${EAPI:-0} in
34 # EAPIs without SLOT dependencies
21 echo "|| (" 35 0) echo "|| ("
22 qt_min_version_list "$@" 36 qt4_min_version_list "$@"
23 echo ")" 37 echo ")"
38 ;;
39 # EAPIS with SLOT dependencies.
40 *) echo ">=${QTPKG}${1}:4"
41 ;;
42 esac
24} 43}
25 44
26qt_min_version_list() { 45qt4_min_version_list() {
27 local MINVER="$1" 46 local MINVER="$1"
28 local VERSIONS="" 47 local VERSIONS=""
29 48
30 case "${MINVER}" in 49 case "${MINVER}" in
31 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; 50 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";;
32 4.1|4.1.0) 51 4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0)
33 for x in ${QT4MAJORVERSIONS}; do 52 for x in ${QT4MAJORVERSIONS}; do
34 if $(version_is_at_least "${MINVER}" "${x}"); then 53 if version_is_at_least "${MINVER}" "${x}"; then
35 VERSIONS="${VERSIONS} =${QTPKG}${x}*" 54 VERSIONS="${VERSIONS} =${QTPKG}${x}*"
36 fi 55 fi
37 done 56 done
38 ;; 57 ;;
39 4*) 58 4*)
40 for x in ${QT4VERSIONS}; do 59 for x in ${QT4VERSIONS}; do
41 if $(version_is_at_least "${MINVER}" "${x}"); then 60 if version_is_at_least "${MINVER}" "${x}"; then
42 VERSIONS="${VERSIONS} =${QTPKG}${x}" 61 VERSIONS="${VERSIONS} =${QTPKG}${x}"
43 fi 62 fi
44 done 63 done
45 ;; 64 ;;
46 *) VERSIONS="=${QTPKG}4*";; 65 *) VERSIONS="=${QTPKG}4*";;
47 esac 66 esac
48 67
49 echo "${VERSIONS}" 68 echo "${VERSIONS}"
50} 69}
70
71# @FUNCTION: qt4_pkg_setup
72# @MAINTAINER:
73# Caleb Tennis <caleb@gentoo.org>
74# Przemyslaw Maciag <troll@gentoo.org>
75# @DESCRIPTION:
76# Default pkg_setup function for packages that depends on qt4. If you have to
77# create ebuilds own pkg_setup in your ebuild, call qt4_pkg_setup in it.
78# This function uses two global vars from ebuild:
79# - QT4_BUILT_WITH_USE_CHECK - contains use flags that need to be turned on for
80# =x11-libs/qt-4*
81# - QT4_OPTIONAL_BUILT_WITH_USE_CHECK - qt4 flags that provides some
82# functionality, but can alternatively be disabled in ${CATEGORY}/${PN}
83# (so qt4 don't have to be recompiled)
84#
85# flags to watch for for Qt4.4:
86# zlib png | opengl dbus qt3support | sqlite3 ssl
87qt4_pkg_setup() {
88
89 QT4_BEST_VERSION="$(best_version =x11-libs/qt-4*)"
90 QT4_MINOR_VERSION="$(get_version_component_range 2 ${QT4_BEST_VERSION/*qt-/})"
91
92 local requiredflags=""
93 for x in ${QT4_BUILT_WITH_USE_CHECK}; do
94 if [[ "${QT4_MINOR_VERSION}" -ge 4 ]]; then
95 # The use flags are different in 4.4 and above, and it's a split package, so this is used to catch
96 # the various use flag combos specified in the ebuilds to make sure we don't error out.
97
98
99 case ${x} in
100 zlib|png|gif)
101 # Qt 4.4+ is built with zlib, png, and gif by default, so the use flags aren't needed
102 ;;
103 opengl|dbus|qt3support)
104 # Make sure the qt-${x} package has been already installed
105 if ! has_version x11-libs/qt-${x}; then
106 eerror "You must first install the x11-libs/qt-${x} package."
107 die "Install x11-libs/qt-${x}"
108 fi
109 ;;
110 ssl)
111 if ! has_version x11-libs/qt-core || ! built_with_use x11-libs/qt-core ssl; then
112 eerror "You must first install the x11-libs/qt-core package with the ssl flag enabled."
113 die "Install x11-libs/qt-core with USE=\"ssl\""
114 fi
115 ;;
116 sqlite3)
117 if ! has_version x11-libs/qt-sql || ! built_with_use x11-libs/qt-sql sqlite; then
118 eerror "You must first install the x11-libs/qt-sql package with the sqlite flag enabled."
119 die "Install x11-libs/qt-sql with USE=\"sqlite\""
120 fi
121 ;;
122 guiaccessibility)
123 if ! has_version x11-libs/qt-gui || ! built_with_use x11-libs/qt-gui accessibility; then
124 eerror "You must first install the x11-libs/qt-gui package with the accessibility flag enabled."
125 die "Install x11-libs/qt-gui with USE=\"accessibility\""
126 fi
127 ;;
128
129 qt3accessibility)
130 if ! has_version x11-libs/qt-qt3support || ! built_with_use x11-libs/qt-qt3support accessibility; then
131 eerror "You must first install the x11-libs/qt-qt3support package with the accessibility flag enabled."
132 die "Install x11-libs/qt-qt3support with USE=\"accessibility\""
133 fi
134 ;;
135 esac
136 else
137 [[ ${x} == guiaccessibility ]] && x=${x#gui}
138 [[ ${x} == qt3accessibility ]] && x=${x#qt3}
139 if ! built_with_use =x11-libs/qt-4* ${x}; then
140 requiredflags="${requiredflags} ${x}"
141 fi
142 fi
143 done
144
145 local optionalflags=""
146 for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do
147 if use ${x} && ! built_with_use =x11-libs/qt-4* ${x}; then
148 optionalflags="${optionalflags} ${x}"
149 fi
150 done
151
152 local diemessage=""
153 if [[ ${requiredflags} != "" ]]; then
154 eerror
155 eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build"
156 eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)"
157 eerror
158 diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; "
159 fi
160 if [[ ${optionalflags} != "" ]]; then
161 eerror
162 eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with"
163 eerror "USE=\"${optionalflags}\""
164 eerror "while qt4 is built without this particular flag(s): it will"
165 eerror "not work."
166 eerror
167 eerror "Possible solutions to this problem are:"
168 eerror "a) install package ${CATEGORY}/${PN} without \"${optionalflags}\" USE flag(s)"
169 eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)"
170 eerror
171 diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n"
172 fi
173
174 [[ ${diemessage} != "" ]] && die "can't emerge ${CATEGORY}/${PN}: ${diemessage}"
175}
176
177# @FUNCTION: eqmake4
178# @USAGE: [.pro file] [additional parameters to qmake]
179# @MAINTAINER:
180# Przemyslaw Maciag <troll@gentoo.org>
181# Davide Pesavento <davidepesa@gmail.com>
182# @DESCRIPTION:
183# Runs qmake on the specified .pro file (defaults to
184# ${PN}.pro if eqmake4 was called with no argument).
185# Additional parameters are passed unmodified to qmake.
186eqmake4() {
187 local LOGFILE="${T}/qmake-$$.out"
188 local projprofile="${1}"
189 [[ -z ${projprofile} ]] && projprofile="${PN}.pro"
190 shift 1
191
192 ebegin "Processing qmake ${projprofile}"
193
194 # file exists?
195 if [[ ! -f ${projprofile} ]]; then
196 echo
197 eerror "Project .pro file \"${projprofile}\" does not exists"
198 eerror "qmake cannot handle non-existing .pro files"
199 echo
200 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
201 echo
202 die "Project file not found in ${PN} sources"
203 fi
204
205 echo >> ${LOGFILE}
206 echo "****** qmake ${projprofile} ******" >> ${LOGFILE}
207 echo >> ${LOGFILE}
208
209 # as a workaround for broken qmake, put everything into file
210 if has debug ${IUSE} && use debug; then
211 echo -e "\nCONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile}
212 else
213 echo -e "\nCONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile}
214 fi
215
216 /usr/bin/qmake ${projprofile} \
217 QTDIR=/usr/$(get_libdir) \
218 QMAKE=/usr/bin/qmake \
219 QMAKE_CC=$(tc-getCC) \
220 QMAKE_CXX=$(tc-getCXX) \
221 QMAKE_LINK=$(tc-getCXX) \
222 QMAKE_CFLAGS_RELEASE="${CFLAGS}" \
223 QMAKE_CFLAGS_DEBUG="${CFLAGS}" \
224 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
225 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
226 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
227 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
228 QMAKE_RPATH= \
229 "${@}" >> ${LOGFILE} 2>&1
230
231 local result=$?
232 eend ${result}
233
234 # was qmake successful?
235 if [[ ${result} -ne 0 ]]; then
236 echo
237 eerror "Running qmake on \"${projprofile}\" has failed"
238 echo
239 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
240 echo
241 die "qmake failed on ${projprofile}"
242 fi
243
244 return ${result}
245}
246
247EXPORT_FUNCTIONS pkg_setup

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.43

  ViewVC Help
Powered by ViewVC 1.1.20