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

Contents of /eclass/qt4.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.47 - (hide annotations) (download)
Tue Jul 29 08:32:48 2008 UTC (6 years, 1 month ago) by carlo
Branch: MAIN
Changes since 1.46: +3 -3 lines
Uh, my bad...

1 caleb 1.1 # Copyright 2005 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 carlo 1.47 # $Header: /var/cvsroot/gentoo-x86/eclass/qt4.eclass,v 1.46 2008/07/28 22:10:16 carlo Exp $
4 troll 1.29
5     # @ECLASS: qt4.eclass
6     # @MAINTAINER:
7     # Caleb Tennis <caleb@gentoo.org>
8 ingmar 1.38 # @BLURB: Eclass for Qt4 packages
9 troll 1.29 # @DESCRIPTION:
10     # This eclass contains various functions that may be useful
11     # when dealing with packages using Qt4 libraries.
12    
13 caleb 1.4 # 08.16.06 - Renamed qt_min_* to qt4_min_* to avoid conflicts with the qt3 eclass.
14     # - Caleb Tennis <caleb@gentoo.org>
15 caleb 1.1
16 caleb 1.20 inherit eutils multilib toolchain-funcs versionator
17 caleb 1.1
18     QTPKG="x11-libs/qt-"
19 caleb 1.30 QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0"
20 zlin 1.44 QT4VERSIONS="4.4.0 4.4.0_beta1 4.4.0_rc1
21 carlo 1.45 4.3.4-r1 4.3.5 4.3.4 4.3.3 4.3.2-r1 4.3.2 4.3.1-r1 4.3.1
22 zlin 1.44 4.3.0-r2 4.3.0-r1 4.3.0 4.3.0_rc1 4.3.0_beta1
23     4.2.3-r1 4.2.3 4.2.2 4.2.1 4.2.0-r2 4.2.0-r1 4.2.0
24     4.1.4-r2 4.1.4-r1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0
25     4.0.1 4.0.0"
26 caleb 1.1
27 troll 1.29 # @FUNCTION: qt4_min_version
28     # @USAGE: [minimum version]
29     # @DESCRIPTION:
30 carlo 1.46 # This function is deprecated. Use slot dependencies instead.
31 caleb 1.4 qt4_min_version() {
32 carlo 1.47 local deps="$@"
33 carlo 1.46 ewarn "qt4_min_version() is deprecated. Use slot dependencies instead."
34 ingmar 1.37 case ${EAPI:-0} in
35     # EAPIs without SLOT dependencies
36     0) echo "|| ("
37 carlo 1.47 qt4_min_version_list "${deps}"
38 ingmar 1.37 echo ")"
39     ;;
40     # EAPIS with SLOT dependencies.
41     *) echo ">=${QTPKG}${1}:4"
42     ;;
43     esac
44 caleb 1.1 }
45    
46 caleb 1.4 qt4_min_version_list() {
47 caleb 1.1 local MINVER="$1"
48     local VERSIONS=""
49    
50     case "${MINVER}" in
51     4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";;
52 caleb 1.30 4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0)
53 caleb 1.1 for x in ${QT4MAJORVERSIONS}; do
54 swegener 1.41 if version_is_at_least "${MINVER}" "${x}"; then
55 caleb 1.1 VERSIONS="${VERSIONS} =${QTPKG}${x}*"
56     fi
57     done
58     ;;
59     4*)
60     for x in ${QT4VERSIONS}; do
61 swegener 1.41 if version_is_at_least "${MINVER}" "${x}"; then
62 caleb 1.1 VERSIONS="${VERSIONS} =${QTPKG}${x}"
63     fi
64     done
65     ;;
66     *) VERSIONS="=${QTPKG}4*";;
67     esac
68    
69     echo "${VERSIONS}"
70     }
71 caleb 1.16
72 zlin 1.44 qt4_monolithic_to_split_flag() {
73     case ${1} in
74     zlib)
75     # Qt 4.4+ is always built with zlib enabled, so this flag isn't needed
76     ;;
77     gif|jpeg|png)
78     # qt-gui always installs with these enabled
79     checkpkgs+=" x11-libs/qt-gui"
80     ;;
81     dbus|opengl)
82     # Make sure the qt-${1} package has been installed already
83     checkpkgs+=" x11-libs/qt-${1}"
84     ;;
85     qt3support)
86     checkpkgs+=" x11-libs/qt-${1}"
87     checkflags+=" x11-libs/qt-core:${1} x11-libs/qt-gui:${1} x11-libs/qt-sql:${1}"
88     ;;
89     ssl)
90     # qt-core controls this flag
91     checkflags+=" x11-libs/qt-core:${1}"
92     ;;
93     cups|mng|nas|nis|tiff|xinerama|input_devices_wacom)
94     # qt-gui controls these flags
95     checkflags+=" x11-libs/qt-gui:${1}"
96     ;;
97     firebird|mysql|odbc|postgres|sqlite3)
98     # qt-sql controls these flags. sqlite2 is no longer supported so it uses sqlite instead of sqlite3.
99     checkflags+=" x11-libs/qt-sql:${1%3}"
100     ;;
101     accessibility)
102     eerror "(QA message): Use guiaccessibility and/or qt3accessibility to specify which of qt-gui and qt-qt3support are relevant for this package."
103     # deal with this gracefully by checking the flag for what is available
104     for y in gui qt3support; do
105     has_version x11-libs/qt-${y} && checkflags+=" x11-libs/qt-${y}:${1}"
106     done
107     ;;
108     guiaccessibility)
109     checkflags+=" x11-libs/qt-gui:accessibility"
110     ;;
111     qt3accessibility)
112     checkflags+=" x11-libs/qt-qt3support:accessibility"
113     ;;
114     debug|doc|examples|glib|pch|sqlite|*)
115     # packages probably shouldn't be checking these flags so we don't handle them currently
116     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"
117     eerror "eclass bug or an ebuild bug. Please report it at http://bugs.gentoo.org/"
118     ((fatalerrors+=1))
119     ;;
120     esac
121     }
122    
123 troll 1.29 # @FUNCTION: qt4_pkg_setup
124     # @MAINTAINER:
125     # Caleb Tennis <caleb@gentoo.org>
126     # Przemyslaw Maciag <troll@gentoo.org>
127     # @DESCRIPTION:
128     # Default pkg_setup function for packages that depends on qt4. If you have to
129     # create ebuilds own pkg_setup in your ebuild, call qt4_pkg_setup in it.
130     # This function uses two global vars from ebuild:
131     # - QT4_BUILT_WITH_USE_CHECK - contains use flags that need to be turned on for
132     # =x11-libs/qt-4*
133     # - QT4_OPTIONAL_BUILT_WITH_USE_CHECK - qt4 flags that provides some
134     # functionality, but can alternatively be disabled in ${CATEGORY}/${PN}
135     # (so qt4 don't have to be recompiled)
136 caleb 1.31 #
137     # flags to watch for for Qt4.4:
138     # zlib png | opengl dbus qt3support | sqlite3 ssl
139 caleb 1.16 qt4_pkg_setup() {
140 zlin 1.44 local x y checkpkgs checkflags fatalerrors=0 requiredflags=""
141 caleb 1.31
142 zlin 1.44 # lots of has_version calls can be very expensive
143     if [[ -n ${QT4_BUILT_WITH_USE_CHECK}${QT4_OPTIONAL_BUILT_WITH_USE_CHECK} ]]; then
144     has_version x11-libs/qt-core && local QT44=true
145     fi
146 caleb 1.31
147 caleb 1.20 for x in ${QT4_BUILT_WITH_USE_CHECK}; do
148 zlin 1.44 if [[ -n ${QT44} ]]; then
149     # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch
150     # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason.
151     qt4_monolithic_to_split_flag ${x}
152 gentoofan23 1.42 else
153 zlin 1.44 [[ ${x} == *accessibility ]] && x=${x#gui} && x=${x#qt3}
154 gentoofan23 1.42 if ! built_with_use =x11-libs/qt-4* ${x}; then
155     requiredflags="${requiredflags} ${x}"
156 caleb 1.31 fi
157 troll 1.29 fi
158     done
159    
160     local optionalflags=""
161     for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do
162 zlin 1.44 if use ${x}; then
163     if [[ -n ${QT44} ]]; then
164     # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch
165     # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason.
166     qt4_monolithic_to_split_flag ${x}
167     elif ! built_with_use =x11-libs/qt-4* ${x}; then
168     optionalflags="${optionalflags} ${x}"
169     fi
170     fi
171     done
172    
173     # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch
174     # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason.
175     for y in ${checkpkgs}; do
176     if ! has_version ${y}; then
177     eerror "You must first install the ${y} package. It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161."
178     ((fatalerrors+=1))
179     fi
180     done
181     for y in ${checkflags}; do
182     if ! has_version ${y%:*}; then
183     eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled."
184     eerror "It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161."
185     ((fatalerrors+=1))
186     else
187     if ! built_with_use ${y%:*} ${y##*:}; then
188     eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled."
189     ((fatalerrors+=1))
190     fi
191 caleb 1.16 fi
192     done
193 troll 1.29
194     local diemessage=""
195 zlin 1.44 if [[ ${fatalerrors} -ne 0 ]]; then
196     diemessage="${fatalerrors} fatal errors were detected. Please read the above error messages and act accordingly."
197     fi
198     if [[ -n ${requiredflags} ]]; then
199 troll 1.29 eerror
200     eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build"
201     eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)"
202     eerror
203     diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; "
204     fi
205 zlin 1.44 if [[ -n ${optionalflags} ]]; then
206 troll 1.29 eerror
207     eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with"
208     eerror "USE=\"${optionalflags}\""
209     eerror "while qt4 is built without this particular flag(s): it will"
210     eerror "not work."
211     eerror
212     eerror "Possible solutions to this problem are:"
213     eerror "a) install package ${CATEGORY}/${PN} without \"${optionalflags}\" USE flag(s)"
214     eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)"
215     eerror
216     diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n"
217     fi
218    
219 zlin 1.44 [[ -n ${diemessage} ]] && die "can't install ${CATEGORY}/${PN}: ${diemessage}"
220 caleb 1.16 }
221 caleb 1.20
222 troll 1.29 # @FUNCTION: eqmake4
223     # @USAGE: [.pro file] [additional parameters to qmake]
224     # @MAINTAINER:
225     # Przemyslaw Maciag <troll@gentoo.org>
226     # Davide Pesavento <davidepesa@gmail.com>
227     # @DESCRIPTION:
228     # Runs qmake on the specified .pro file (defaults to
229     # ${PN}.pro if eqmake4 was called with no argument).
230     # Additional parameters are passed unmodified to qmake.
231 caleb 1.20 eqmake4() {
232     local LOGFILE="${T}/qmake-$$.out"
233     local projprofile="${1}"
234 troll 1.29 [[ -z ${projprofile} ]] && projprofile="${PN}.pro"
235 caleb 1.20 shift 1
236    
237     ebegin "Processing qmake ${projprofile}"
238    
239     # file exists?
240 troll 1.29 if [[ ! -f ${projprofile} ]]; then
241 caleb 1.20 echo
242     eerror "Project .pro file \"${projprofile}\" does not exists"
243     eerror "qmake cannot handle non-existing .pro files"
244     echo
245     eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
246     echo
247     die "Project file not found in ${PN} sources"
248     fi
249    
250     echo >> ${LOGFILE}
251     echo "****** qmake ${projprofile} ******" >> ${LOGFILE}
252     echo >> ${LOGFILE}
253    
254     # as a workaround for broken qmake, put everything into file
255 caleb 1.22 if has debug ${IUSE} && use debug; then
256 troll 1.29 echo -e "\nCONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile}
257 caleb 1.20 else
258 troll 1.29 echo -e "\nCONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile}
259 caleb 1.20 fi
260    
261     /usr/bin/qmake ${projprofile} \
262     QTDIR=/usr/$(get_libdir) \
263     QMAKE=/usr/bin/qmake \
264     QMAKE_CC=$(tc-getCC) \
265     QMAKE_CXX=$(tc-getCXX) \
266     QMAKE_LINK=$(tc-getCXX) \
267     QMAKE_CFLAGS_RELEASE="${CFLAGS}" \
268     QMAKE_CFLAGS_DEBUG="${CFLAGS}" \
269     QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
270     QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
271     QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
272     QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
273     QMAKE_RPATH= \
274 flameeyes 1.36 "${@}" >> ${LOGFILE} 2>&1
275 caleb 1.20
276     local result=$?
277     eend ${result}
278    
279     # was qmake successful?
280 troll 1.29 if [[ ${result} -ne 0 ]]; then
281 caleb 1.20 echo
282     eerror "Running qmake on \"${projprofile}\" has failed"
283     echo
284     eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
285     echo
286     die "qmake failed on ${projprofile}"
287     fi
288    
289     return ${result}
290     }
291    
292     EXPORT_FUNCTIONS pkg_setup

  ViewVC Help
Powered by ViewVC 1.1.20