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.37 2008/03/05 23:03:24 ingmar Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/Attic/qt4.eclass,v 1.48 2008/08/03 20:47:27 carlo 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: |
|
|
9 | # Eclass for Qt4 packages |
8 | # @BLURB: Eclass for Qt4 packages |
10 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
11 | # This eclass contains various functions that may be useful |
10 | # This eclass contains various functions that may be useful |
12 | # when dealing with packages using Qt4 libraries. |
11 | # when dealing with packages using Qt4 libraries. |
13 | |
12 | |
14 | # 08.16.06 - Renamed qt_min_* to qt4_min_* to avoid conflicts with the qt3 eclass. |
13 | # 08.16.06 - Renamed qt_min_* to qt4_min_* to avoid conflicts with the qt3 eclass. |
… | |
… | |
16 | |
15 | |
17 | inherit eutils multilib toolchain-funcs versionator |
16 | inherit eutils multilib toolchain-funcs versionator |
18 | |
17 | |
19 | QTPKG="x11-libs/qt-" |
18 | QTPKG="x11-libs/qt-" |
20 | QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0" |
19 | QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0" |
21 | QT4VERSIONS="4.4.0_beta1 4.4.0_rc1 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.1 4.4.0 4.4.0_beta1 4.4.0_rc1 |
|
|
21 | 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 | 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" |
22 | |
26 | |
23 | # @FUNCTION: qt4_min_version |
27 | # @FUNCTION: qt4_min_version |
24 | # @USAGE: [minimum version] |
28 | # @USAGE: [minimum version] |
25 | # @DESCRIPTION: |
29 | # @DESCRIPTION: |
26 | # This function should be called in package DEPENDs whenever it depends on qt4. |
30 | # This function is deprecated. Use slot dependencies instead. |
27 | # Simple example - in your depend, do something like this: |
|
|
28 | # DEPEND="$(qt4_min_version 4.2)" |
|
|
29 | # if the package can be build with qt-4.2 or higher. |
|
|
30 | # |
|
|
31 | # For builds that use an EAPI with support for SLOT dependencies, this will |
|
|
32 | # return a SLOT dependency, rather than a list of versions. |
|
|
33 | qt4_min_version() { |
31 | qt4_min_version() { |
|
|
32 | local deps="$@" |
|
|
33 | ewarn "${CATEGORY}/${PF}: qt4_min_version() is deprecated. Use slot dependencies instead." |
34 | case ${EAPI:-0} in |
34 | case ${EAPI:-0} in |
35 | # EAPIs without SLOT dependencies |
35 | # EAPIs without SLOT dependencies |
36 | 0) echo "|| (" |
36 | 0) echo "|| (" |
37 | qt4_min_version_list "$@" |
37 | qt4_min_version_list "${deps}" |
38 | echo ")" |
38 | echo ")" |
39 | ;; |
39 | ;; |
40 | # EAPIS with SLOT dependencies. |
40 | # EAPIS with SLOT dependencies. |
41 | *) echo ">=${QTPKG}${1}:4" |
41 | *) echo ">=${QTPKG}${1}:4" |
42 | ;; |
42 | ;; |
… | |
… | |
49 | |
49 | |
50 | case "${MINVER}" in |
50 | case "${MINVER}" in |
51 | 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; |
51 | 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; |
52 | 4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0) |
52 | 4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0) |
53 | for x in ${QT4MAJORVERSIONS}; do |
53 | for x in ${QT4MAJORVERSIONS}; do |
54 | if $(version_is_at_least "${MINVER}" "${x}"); then |
54 | if version_is_at_least "${MINVER}" "${x}"; then |
55 | VERSIONS="${VERSIONS} =${QTPKG}${x}*" |
55 | VERSIONS="${VERSIONS} =${QTPKG}${x}*" |
56 | fi |
56 | fi |
57 | done |
57 | done |
58 | ;; |
58 | ;; |
59 | 4*) |
59 | 4*) |
60 | for x in ${QT4VERSIONS}; do |
60 | for x in ${QT4VERSIONS}; do |
61 | if $(version_is_at_least "${MINVER}" "${x}"); then |
61 | if version_is_at_least "${MINVER}" "${x}"; then |
62 | VERSIONS="${VERSIONS} =${QTPKG}${x}" |
62 | VERSIONS="${VERSIONS} =${QTPKG}${x}" |
63 | fi |
63 | fi |
64 | done |
64 | done |
65 | ;; |
65 | ;; |
66 | *) VERSIONS="=${QTPKG}4*";; |
66 | *) VERSIONS="=${QTPKG}4*";; |
67 | esac |
67 | esac |
68 | |
68 | |
69 | echo "${VERSIONS}" |
69 | echo "${VERSIONS}" |
|
|
70 | } |
|
|
71 | |
|
|
72 | 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 |
70 | } |
121 | } |
71 | |
122 | |
72 | # @FUNCTION: qt4_pkg_setup |
123 | # @FUNCTION: qt4_pkg_setup |
73 | # @MAINTAINER: |
124 | # @MAINTAINER: |
74 | # Caleb Tennis <caleb@gentoo.org> |
125 | # Caleb Tennis <caleb@gentoo.org> |
… | |
… | |
84 | # (so qt4 don't have to be recompiled) |
135 | # (so qt4 don't have to be recompiled) |
85 | # |
136 | # |
86 | # flags to watch for for Qt4.4: |
137 | # flags to watch for for Qt4.4: |
87 | # zlib png | opengl dbus qt3support | sqlite3 ssl |
138 | # zlib png | opengl dbus qt3support | sqlite3 ssl |
88 | qt4_pkg_setup() { |
139 | qt4_pkg_setup() { |
|
|
140 | local x y checkpkgs checkflags fatalerrors=0 requiredflags="" |
89 | |
141 | |
90 | QT4_BEST_VERSION="$(best_version =x11-libs/qt-4*)" |
142 | # lots of has_version calls can be very expensive |
91 | QT4_MINOR_VERSION="$(get_version_component_range 2 ${QT4_BEST_VERSION/*qt-/})" |
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 |
92 | |
146 | |
93 | local requiredflags="" |
|
|
94 | for x in ${QT4_BUILT_WITH_USE_CHECK}; do |
147 | for x in ${QT4_BUILT_WITH_USE_CHECK}; do |
95 | if [[ "${QT4_MINOR_VERSION}" -ge 4 ]]; then |
148 | if [[ -n ${QT44} ]]; then |
96 | # The use flags are different in 4.4 and above, and it's a split package, so this is used to catch |
149 | # The use flags are different in 4.4 and above, and it's split packages, so this is used to catch |
97 | # the various use flag combos specified in the ebuilds to make sure we don't error out. |
150 | # the various use flag combos specified in the ebuilds to make sure we don't error out for no reason. |
98 | |
151 | qt4_monolithic_to_split_flag ${x} |
99 | if [[ ${x} == zlib || ${x} == png ]]; then |
152 | else |
100 | # Qt 4.4+ is built with zlib and png by default, so the use flags aren't needed |
153 | [[ ${x} == *accessibility ]] && x=${x#gui} && x=${x#qt3} |
101 | continue; |
154 | if ! built_with_use =x11-libs/qt-4* ${x}; then |
102 | elif [[ ${x} == opengl || ${x} == dbus || ${x} == qt3support ]]; then |
155 | requiredflags="${requiredflags} ${x}" |
103 | # Make sure the qt-${x} package has been already installed |
|
|
104 | |
|
|
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 | elif [[ ${x} == ssl ]]; then |
|
|
110 | if ! has_version x11-libs/qt-core || ! built_with_use x11-libs/qt-core ssl; then |
|
|
111 | eerror "You must first install the x11-libs/qt-core package with the ssl flag enabled." |
|
|
112 | die "Install x11-libs/qt-core with USE=\"ssl\"" |
|
|
113 | fi |
|
|
114 | elif [[ ${x} == sqlite3 ]]; then |
|
|
115 | if ! has_version x11-libs/qt-sql || ! built_with_use x11-libs/qt-sql sqlite; then |
|
|
116 | eerror "You must first install the x11-libs/qt-sql package with the sqlite flag enabled." |
|
|
117 | die "Install x11-libs/qt-sql with USE=\"sqlite\"" |
|
|
118 | fi |
|
|
119 | fi |
156 | fi |
120 | elif ! built_with_use =x11-libs/qt-4* ${x}; then |
|
|
121 | requiredflags="${requiredflags} ${x}" |
|
|
122 | fi |
157 | fi |
123 | done |
158 | done |
124 | |
159 | |
125 | local optionalflags="" |
160 | local optionalflags="" |
126 | for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do |
161 | for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do |
|
|
162 | 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} |
127 | if use ${x} && ! built_with_use =x11-libs/qt-4* ${x}; then |
167 | elif ! built_with_use =x11-libs/qt-4* ${x}; then |
128 | optionalflags="${optionalflags} ${x}" |
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 |
129 | fi |
191 | fi |
130 | done |
192 | done |
131 | |
193 | |
132 | local diemessage="" |
194 | local diemessage="" |
|
|
195 | if [[ ${fatalerrors} -ne 0 ]]; then |
|
|
196 | diemessage="${fatalerrors} fatal errors were detected. Please read the above error messages and act accordingly." |
|
|
197 | fi |
133 | if [[ ${requiredflags} != "" ]]; then |
198 | if [[ -n ${requiredflags} ]]; then |
134 | eerror |
199 | eerror |
135 | eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build" |
200 | eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build" |
136 | eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)" |
201 | eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)" |
137 | eerror |
202 | eerror |
138 | diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; " |
203 | diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; " |
139 | fi |
204 | fi |
140 | if [[ ${optionalflags} != "" ]]; then |
205 | if [[ -n ${optionalflags} ]]; then |
141 | eerror |
206 | eerror |
142 | eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with" |
207 | eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with" |
143 | eerror "USE=\"${optionalflags}\"" |
208 | eerror "USE=\"${optionalflags}\"" |
144 | eerror "while qt4 is built without this particular flag(s): it will" |
209 | eerror "while qt4 is built without this particular flag(s): it will" |
145 | eerror "not work." |
210 | eerror "not work." |
… | |
… | |
149 | eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)" |
214 | eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)" |
150 | eerror |
215 | eerror |
151 | diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n" |
216 | diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n" |
152 | fi |
217 | fi |
153 | |
218 | |
154 | [[ ${diemessage} != "" ]] && die "can't emerge ${CATEGORY}/${PN}: ${diemessage}" |
219 | [[ -n ${diemessage} ]] && die "can't install ${CATEGORY}/${PN}: ${diemessage}" |
155 | } |
220 | } |
156 | |
221 | |
157 | # @FUNCTION: eqmake4 |
222 | # @FUNCTION: eqmake4 |
158 | # @USAGE: [.pro file] [additional parameters to qmake] |
223 | # @USAGE: [.pro file] [additional parameters to qmake] |
159 | # @MAINTAINER: |
224 | # @MAINTAINER: |