| 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.41 2008/06/21 15:12:48 swegener 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*";; |
| … | |
… | |
| 102 | die "Install x11-libs/qt-${x}" |
106 | die "Install x11-libs/qt-${x}" |
| 103 | fi |
107 | fi |
| 104 | elif [[ ${x} == ssl ]]; then |
108 | elif [[ ${x} == ssl ]]; then |
| 105 | if ! has_version x11-libs/qt-core || ! built_with_use x11-libs/qt-core ssl; then |
109 | 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." |
110 | 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\"" |
111 | die "Install x11-libs/qt-core with USE=\"ssl\"" |
| 108 | fi |
112 | fi |
| 109 | elif [[ ${x} == sqlite3 ]]; then |
113 | elif [[ ${x} == sqlite3 ]]; then |
| 110 | if ! has_version x11-libs/qt-sql || ! built_with_use x11-libs/qt-sql sqlite; then |
114 | 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." |
115 | 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\"" |
116 | die "Install x11-libs/qt-sql with USE=\"sqlite\"" |
| 113 | fi |
117 | fi |
| 114 | fi |
118 | fi |
| 115 | elif ! built_with_use =x11-libs/qt-4* ${x}; then |
119 | elif ! built_with_use =x11-libs/qt-4* ${x}; then |
| 116 | requiredflags="${requiredflags} ${x}" |
120 | requiredflags="${requiredflags} ${x}" |
| 117 | fi |
121 | fi |
| … | |
… | |
| 199 | QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ |
203 | QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ |
| 200 | QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ |
204 | QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ |
| 201 | QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ |
205 | QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ |
| 202 | QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
206 | QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
| 203 | QMAKE_RPATH= \ |
207 | QMAKE_RPATH= \ |
| 204 | ${@} >> ${LOGFILE} 2>&1 |
208 | "${@}" >> ${LOGFILE} 2>&1 |
| 205 | |
209 | |
| 206 | local result=$? |
210 | local result=$? |
| 207 | eend ${result} |
211 | eend ${result} |
| 208 | |
212 | |
| 209 | # was qmake successful? |
213 | # was qmake successful? |