| 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.43 2008/07/11 21:09:39 gentoofan23 Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/Attic/qt4.eclass,v 1.44 2008/07/17 00:03:33 zlin Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: qt4.eclass |
5 | # @ECLASS: qt4.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Caleb Tennis <caleb@gentoo.org> |
7 | # Caleb Tennis <caleb@gentoo.org> |
| 8 | # @BLURB: Eclass for Qt4 packages |
8 | # @BLURB: Eclass for Qt4 packages |
| … | |
… | |
| 15 | |
15 | |
| 16 | inherit eutils multilib toolchain-funcs versionator |
16 | inherit eutils multilib toolchain-funcs versionator |
| 17 | |
17 | |
| 18 | QTPKG="x11-libs/qt-" |
18 | QTPKG="x11-libs/qt-" |
| 19 | QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0" |
19 | QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0" |
| 20 | QT4VERSIONS="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" |
20 | QT4VERSIONS="4.4.0 4.4.0_beta1 4.4.0_rc1 |
|
|
21 | 4.3.4-r1 4.3.4 4.3.3 4.3.2-r1 4.3.2 4.3.1-r1 4.3.1 |
|
|
22 | 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" |
| 21 | |
26 | |
| 22 | # @FUNCTION: qt4_min_version |
27 | # @FUNCTION: qt4_min_version |
| 23 | # @USAGE: [minimum version] |
28 | # @USAGE: [minimum version] |
| 24 | # @DESCRIPTION: |
29 | # @DESCRIPTION: |
| 25 | # This function should be called in package DEPENDs whenever it depends on qt4. |
30 | # This function should be called in package DEPENDs whenever it depends on qt4. |
| … | |
… | |
| 66 | esac |
71 | esac |
| 67 | |
72 | |
| 68 | echo "${VERSIONS}" |
73 | echo "${VERSIONS}" |
| 69 | } |
74 | } |
| 70 | |
75 | |
|
|
76 | qt4_monolithic_to_split_flag() { |
|
|
77 | case ${1} in |
|
|
78 | zlib) |
|
|
79 | # Qt 4.4+ is always built with zlib enabled, so this flag isn't needed |
|
|
80 | ;; |
|
|
81 | gif|jpeg|png) |
|
|
82 | # qt-gui always installs with these enabled |
|
|
83 | checkpkgs+=" x11-libs/qt-gui" |
|
|
84 | ;; |
|
|
85 | dbus|opengl) |
|
|
86 | # Make sure the qt-${1} package has been installed already |
|
|
87 | checkpkgs+=" x11-libs/qt-${1}" |
|
|
88 | ;; |
|
|
89 | qt3support) |
|
|
90 | checkpkgs+=" x11-libs/qt-${1}" |
|
|
91 | checkflags+=" x11-libs/qt-core:${1} x11-libs/qt-gui:${1} x11-libs/qt-sql:${1}" |
|
|
92 | ;; |
|
|
93 | ssl) |
|
|
94 | # qt-core controls this flag |
|
|
95 | checkflags+=" x11-libs/qt-core:${1}" |
|
|
96 | ;; |
|
|
97 | cups|mng|nas|nis|tiff|xinerama|input_devices_wacom) |
|
|
98 | # qt-gui controls these flags |
|
|
99 | checkflags+=" x11-libs/qt-gui:${1}" |
|
|
100 | ;; |
|
|
101 | firebird|mysql|odbc|postgres|sqlite3) |
|
|
102 | # qt-sql controls these flags. sqlite2 is no longer supported so it uses sqlite instead of sqlite3. |
|
|
103 | checkflags+=" x11-libs/qt-sql:${1%3}" |
|
|
104 | ;; |
|
|
105 | accessibility) |
|
|
106 | eerror "(QA message): Use guiaccessibility and/or qt3accessibility to specify which of qt-gui and qt-qt3support are relevant for this package." |
|
|
107 | # deal with this gracefully by checking the flag for what is available |
|
|
108 | for y in gui qt3support; do |
|
|
109 | has_version x11-libs/qt-${y} && checkflags+=" x11-libs/qt-${y}:${1}" |
|
|
110 | done |
|
|
111 | ;; |
|
|
112 | guiaccessibility) |
|
|
113 | checkflags+=" x11-libs/qt-gui:accessibility" |
|
|
114 | ;; |
|
|
115 | qt3accessibility) |
|
|
116 | checkflags+=" x11-libs/qt-qt3support:accessibility" |
|
|
117 | ;; |
|
|
118 | debug|doc|examples|glib|pch|sqlite|*) |
|
|
119 | # packages probably shouldn't be checking these flags so we don't handle them currently |
|
|
120 | 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" |
|
|
121 | eerror "eclass bug or an ebuild bug. Please report it at http://bugs.gentoo.org/" |
|
|
122 | ((fatalerrors+=1)) |
|
|
123 | ;; |
|
|
124 | esac |
|
|
125 | } |
|
|
126 | |
| 71 | # @FUNCTION: qt4_pkg_setup |
127 | # @FUNCTION: qt4_pkg_setup |
| 72 | # @MAINTAINER: |
128 | # @MAINTAINER: |
| 73 | # Caleb Tennis <caleb@gentoo.org> |
129 | # Caleb Tennis <caleb@gentoo.org> |
| 74 | # Przemyslaw Maciag <troll@gentoo.org> |
130 | # Przemyslaw Maciag <troll@gentoo.org> |
| 75 | # @DESCRIPTION: |
131 | # @DESCRIPTION: |
| … | |
… | |
| 83 | # (so qt4 don't have to be recompiled) |
139 | # (so qt4 don't have to be recompiled) |
| 84 | # |
140 | # |
| 85 | # flags to watch for for Qt4.4: |
141 | # flags to watch for for Qt4.4: |
| 86 | # zlib png | opengl dbus qt3support | sqlite3 ssl |
142 | # zlib png | opengl dbus qt3support | sqlite3 ssl |
| 87 | qt4_pkg_setup() { |
143 | qt4_pkg_setup() { |
|
|
144 | local x y checkpkgs checkflags fatalerrors=0 requiredflags="" |
| 88 | |
145 | |
| 89 | QT4_BEST_VERSION="$(best_version =x11-libs/qt-4*)" |
146 | # lots of has_version calls can be very expensive |
| 90 | QT4_MINOR_VERSION="$(get_version_component_range 2 ${QT4_BEST_VERSION/*qt-/})" |
147 | if [[ -n ${QT4_BUILT_WITH_USE_CHECK}${QT4_OPTIONAL_BUILT_WITH_USE_CHECK} ]]; then |
|
|
148 | has_version x11-libs/qt-core && local QT44=true |
|
|
149 | fi |
| 91 | |
150 | |
| 92 | local requiredflags="" |
|
|
| 93 | for x in ${QT4_BUILT_WITH_USE_CHECK}; do |
151 | for x in ${QT4_BUILT_WITH_USE_CHECK}; do |
| 94 | if [[ "${QT4_MINOR_VERSION}" -ge 4 ]]; then |
152 | if [[ -n ${QT44} ]]; then |
| 95 | # The use flags are different in 4.4 and above, and it's a split package, so this is used to catch |
153 | # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch |
| 96 | # the various use flag combos specified in the ebuilds to make sure we don't error out. |
154 | # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason. |
| 97 | |
155 | qt4_monolithic_to_split_flag ${x} |
| 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 |
156 | else |
| 137 | [[ ${x} == guiaccessibility ]] && x=${x#gui} |
157 | [[ ${x} == *accessibility ]] && x=${x#gui} && x=${x#qt3} |
| 138 | [[ ${x} == qt3accessibility ]] && x=${x#qt3} |
|
|
| 139 | if ! built_with_use =x11-libs/qt-4* ${x}; then |
158 | if ! built_with_use =x11-libs/qt-4* ${x}; then |
| 140 | requiredflags="${requiredflags} ${x}" |
159 | requiredflags="${requiredflags} ${x}" |
| 141 | fi |
160 | fi |
| 142 | fi |
161 | fi |
| 143 | done |
162 | done |
| 144 | |
163 | |
| 145 | local optionalflags="" |
164 | local optionalflags="" |
| 146 | for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do |
165 | for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do |
|
|
166 | if use ${x}; then |
|
|
167 | if [[ -n ${QT44} ]]; then |
|
|
168 | # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch |
|
|
169 | # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason. |
|
|
170 | qt4_monolithic_to_split_flag ${x} |
| 147 | if use ${x} && ! built_with_use =x11-libs/qt-4* ${x}; then |
171 | elif ! built_with_use =x11-libs/qt-4* ${x}; then |
| 148 | optionalflags="${optionalflags} ${x}" |
172 | optionalflags="${optionalflags} ${x}" |
|
|
173 | fi |
|
|
174 | fi |
|
|
175 | done |
|
|
176 | |
|
|
177 | # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch |
|
|
178 | # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason. |
|
|
179 | for y in ${checkpkgs}; do |
|
|
180 | if ! has_version ${y}; then |
|
|
181 | eerror "You must first install the ${y} package. It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161." |
|
|
182 | ((fatalerrors+=1)) |
|
|
183 | fi |
|
|
184 | done |
|
|
185 | for y in ${checkflags}; do |
|
|
186 | if ! has_version ${y%:*}; then |
|
|
187 | eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled." |
|
|
188 | eerror "It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161." |
|
|
189 | ((fatalerrors+=1)) |
|
|
190 | else |
|
|
191 | if ! built_with_use ${y%:*} ${y##*:}; then |
|
|
192 | eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled." |
|
|
193 | ((fatalerrors+=1)) |
|
|
194 | fi |
| 149 | fi |
195 | fi |
| 150 | done |
196 | done |
| 151 | |
197 | |
| 152 | local diemessage="" |
198 | local diemessage="" |
|
|
199 | if [[ ${fatalerrors} -ne 0 ]]; then |
|
|
200 | diemessage="${fatalerrors} fatal errors were detected. Please read the above error messages and act accordingly." |
|
|
201 | fi |
| 153 | if [[ ${requiredflags} != "" ]]; then |
202 | if [[ -n ${requiredflags} ]]; then |
| 154 | eerror |
203 | eerror |
| 155 | eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build" |
204 | eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build" |
| 156 | eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)" |
205 | eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)" |
| 157 | eerror |
206 | eerror |
| 158 | diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; " |
207 | diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; " |
| 159 | fi |
208 | fi |
| 160 | if [[ ${optionalflags} != "" ]]; then |
209 | if [[ -n ${optionalflags} ]]; then |
| 161 | eerror |
210 | eerror |
| 162 | eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with" |
211 | eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with" |
| 163 | eerror "USE=\"${optionalflags}\"" |
212 | eerror "USE=\"${optionalflags}\"" |
| 164 | eerror "while qt4 is built without this particular flag(s): it will" |
213 | eerror "while qt4 is built without this particular flag(s): it will" |
| 165 | eerror "not work." |
214 | eerror "not work." |
| … | |
… | |
| 169 | eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)" |
218 | eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)" |
| 170 | eerror |
219 | eerror |
| 171 | diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n" |
220 | diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n" |
| 172 | fi |
221 | fi |
| 173 | |
222 | |
| 174 | [[ ${diemessage} != "" ]] && die "can't emerge ${CATEGORY}/${PN}: ${diemessage}" |
223 | [[ -n ${diemessage} ]] && die "can't install ${CATEGORY}/${PN}: ${diemessage}" |
| 175 | } |
224 | } |
| 176 | |
225 | |
| 177 | # @FUNCTION: eqmake4 |
226 | # @FUNCTION: eqmake4 |
| 178 | # @USAGE: [.pro file] [additional parameters to qmake] |
227 | # @USAGE: [.pro file] [additional parameters to qmake] |
| 179 | # @MAINTAINER: |
228 | # @MAINTAINER: |