| 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.32 2008/01/05 18:44:38 caleb Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/Attic/qt4.eclass,v 1.42 2008/07/08 16:02:03 gentoofan23 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_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" |
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" |
| 22 | |
21 | |
| 23 | # @FUNCTION: qt4_min_version |
22 | # @FUNCTION: qt4_min_version |
| 24 | # @USAGE: [minimum version] |
23 | # @USAGE: [minimum version] |
| 25 | # @DESCRIPTION: |
24 | # @DESCRIPTION: |
| 26 | # This function should be called in package DEPENDs whenever it depends on qt4. |
25 | # This function should be called in package DEPENDs whenever it depends on qt4. |
| 27 | # Simple example - in your depend, do something like this: |
26 | # Simple example - in your depend, do something like this: |
| 28 | # DEPEND="$(qt4_min_version 4.2)" |
27 | # DEPEND="$(qt4_min_version 4.2)" |
| 29 | # if package can be build with qt-4.2 or higher. |
28 | # if the package can be build with qt-4.2 or higher. |
|
|
29 | # |
|
|
30 | # For builds that use an EAPI with support for SLOT dependencies, this will |
|
|
31 | # return a SLOT dependency, rather than a list of versions. |
| 30 | qt4_min_version() { |
32 | qt4_min_version() { |
| 31 | # This is much simpler for EAPI 1, we can use a slot dependency |
33 | case ${EAPI:-0} in |
| 32 | if [[ "${EAPI}" -ge 1 ]]; then |
34 | # EAPIs without SLOT dependencies |
| 33 | echo ">=${QTPKG}${1}:4" |
|
|
| 34 | else |
|
|
| 35 | echo "|| (" |
35 | 0) echo "|| (" |
| 36 | qt4_min_version_list "$@" |
36 | qt4_min_version_list "$@" |
| 37 | echo ")" |
37 | echo ")" |
| 38 | fi |
38 | ;; |
|
|
39 | # EAPIS with SLOT dependencies. |
|
|
40 | *) echo ">=${QTPKG}${1}:4" |
|
|
41 | ;; |
|
|
42 | esac |
| 39 | } |
43 | } |
| 40 | |
44 | |
| 41 | qt4_min_version_list() { |
45 | qt4_min_version_list() { |
| 42 | local MINVER="$1" |
46 | local MINVER="$1" |
| 43 | local VERSIONS="" |
47 | local VERSIONS="" |
| 44 | |
48 | |
| 45 | case "${MINVER}" in |
49 | case "${MINVER}" in |
| 46 | 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; |
50 | 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; |
| 47 | 4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0) |
51 | 4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0) |
| 48 | for x in ${QT4MAJORVERSIONS}; do |
52 | for x in ${QT4MAJORVERSIONS}; do |
| 49 | if $(version_is_at_least "${MINVER}" "${x}"); then |
53 | if version_is_at_least "${MINVER}" "${x}"; then |
| 50 | VERSIONS="${VERSIONS} =${QTPKG}${x}*" |
54 | VERSIONS="${VERSIONS} =${QTPKG}${x}*" |
| 51 | fi |
55 | fi |
| 52 | done |
56 | done |
| 53 | ;; |
57 | ;; |
| 54 | 4*) |
58 | 4*) |
| 55 | for x in ${QT4VERSIONS}; do |
59 | for x in ${QT4VERSIONS}; do |
| 56 | if $(version_is_at_least "${MINVER}" "${x}"); then |
60 | if version_is_at_least "${MINVER}" "${x}"; then |
| 57 | VERSIONS="${VERSIONS} =${QTPKG}${x}" |
61 | VERSIONS="${VERSIONS} =${QTPKG}${x}" |
| 58 | fi |
62 | fi |
| 59 | done |
63 | done |
| 60 | ;; |
64 | ;; |
| 61 | *) VERSIONS="=${QTPKG}4*";; |
65 | *) VERSIONS="=${QTPKG}4*";; |
| … | |
… | |
| 89 | for x in ${QT4_BUILT_WITH_USE_CHECK}; do |
93 | for x in ${QT4_BUILT_WITH_USE_CHECK}; do |
| 90 | if [[ "${QT4_MINOR_VERSION}" -ge 4 ]]; then |
94 | if [[ "${QT4_MINOR_VERSION}" -ge 4 ]]; then |
| 91 | # The use flags are different in 4.4 and above, and it's a split package, so this is used to catch |
95 | # The use flags are different in 4.4 and above, and it's a split package, so this is used to catch |
| 92 | # the various use flag combos specified in the ebuilds to make sure we don't error out. |
96 | # the various use flag combos specified in the ebuilds to make sure we don't error out. |
| 93 | |
97 | |
| 94 | if [[ ${x} == zlib || ${x} == png ]]; then |
98 | |
|
|
99 | case ${x} in |
|
|
100 | zlib|png|gif) |
| 95 | # Qt 4.4+ is built with zlib and png by default, so the use flags aren't needed |
101 | # Qt 4.4+ is built with zlib, png, and gif by default, so the use flags aren't needed |
| 96 | continue; |
102 | ;; |
| 97 | elif [[ ${x} == opengl || ${x} == dbus || ${x} == qt3support ]]; then |
103 | opengl|dbus|qt3support) |
| 98 | # Make sure the qt-${x} package has been already installed |
104 | # Make sure the qt-${x} package has been already installed |
| 99 | |
|
|
| 100 | if ! has_version x11-libs/qt-${x}; then |
105 | if ! has_version x11-libs/qt-${x}; then |
| 101 | eerror "You must first install the x11-libs/qt-${x} package." |
106 | eerror "You must first install the x11-libs/qt-${x} package." |
| 102 | die "Install x11-libs/qt-${x}" |
107 | die "Install x11-libs/qt-${x}" |
| 103 | fi |
108 | fi |
| 104 | elif [[ ${x} == ssl ]]; then |
109 | ;; |
|
|
110 | ssl) |
| 105 | if ! has_version x11-libs/qt-core || ! built_with_use x11-libs/qt-core ssl; then |
111 | 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." |
112 | 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\"" |
113 | die "Install x11-libs/qt-core with USE=\"ssl\"" |
| 108 | fi |
114 | fi |
| 109 | elif [[ ${x} == sqlite3 ]]; then |
115 | ;; |
|
|
116 | sqlite3) |
| 110 | if ! has_version x11-libs/qt-sql || ! built_with_use x11-libs/qt-sql sqlite; then |
117 | 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." |
118 | 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\"" |
119 | die "Install x11-libs/qt-sql with USE=\"sqlite\"" |
| 113 | fi |
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}" |
| 114 | fi |
141 | fi |
| 115 | elif ! built_with_use =x11-libs/qt-4* ${x}; then |
|
|
| 116 | requiredflags="${requiredflags} ${x}" |
|
|
| 117 | fi |
142 | fi |
| 118 | done |
143 | done |
| 119 | |
144 | |
| 120 | local optionalflags="" |
145 | local optionalflags="" |
| 121 | for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do |
146 | for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do |
| … | |
… | |
| 199 | QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ |
224 | QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ |
| 200 | QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ |
225 | QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ |
| 201 | QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ |
226 | QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ |
| 202 | QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
227 | QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
| 203 | QMAKE_RPATH= \ |
228 | QMAKE_RPATH= \ |
| 204 | ${@} >> ${LOGFILE} 2>&1 |
229 | "${@}" >> ${LOGFILE} 2>&1 |
| 205 | |
230 | |
| 206 | local result=$? |
231 | local result=$? |
| 207 | eend ${result} |
232 | eend ${result} |
| 208 | |
233 | |
| 209 | # was qmake successful? |
234 | # was qmake successful? |