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.2 2006/05/08 11:13:57 caleb Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/Attic/qt4.eclass,v 1.25 2007/08/08 12:58:31 caleb Exp $ |
4 | # |
4 | # |
5 | # Author Caleb Tennis <caleb@gentoo.org> |
5 | # Author Caleb Tennis <caleb@gentoo.org> |
6 | # |
6 | # |
7 | # This eclass is simple. Inherit it, and in your depend, do something like this: |
7 | # This eclass is simple. Inherit it, and in your depend, do something like this: |
8 | # |
8 | # |
9 | # DEPEND="$(qt_min_version 4)" |
9 | # DEPEND="$(qt4_min_version 4)" |
10 | # |
10 | # |
11 | # and it handles the rest for you |
11 | # and it handles the rest for you |
12 | # |
12 | # |
|
|
13 | # 08.16.06 - Renamed qt_min_* to qt4_min_* to avoid conflicts with the qt3 eclass. |
|
|
14 | # - Caleb Tennis <caleb@gentoo.org> |
13 | |
15 | |
14 | inherit versionator |
16 | inherit eutils multilib toolchain-funcs versionator |
|
|
17 | |
|
|
18 | IUSE="${IUSE}" |
15 | |
19 | |
16 | QTPKG="x11-libs/qt-" |
20 | QTPKG="x11-libs/qt-" |
17 | QT4MAJORVERSIONS="4.1 4.0" |
21 | QT4MAJORVERSIONS="4.3 4.2 4.1 4.0" |
18 | QT4VERSIONS="4.1.2 4.1.1 4.1.0 4.0.1 4.0.0" |
22 | QT4VERSIONS="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" |
19 | |
23 | |
20 | qt_min_version() { |
24 | qt4_min_version() { |
21 | echo "|| (" |
25 | echo "|| (" |
22 | qt_min_version_list "$@" |
26 | qt4_min_version_list "$@" |
23 | echo ")" |
27 | echo ")" |
24 | } |
28 | } |
25 | |
29 | |
26 | qt_min_version_list() { |
30 | qt4_min_version_list() { |
27 | local MINVER="$1" |
31 | local MINVER="$1" |
28 | local VERSIONS="" |
32 | local VERSIONS="" |
29 | |
33 | |
30 | case "${MINVER}" in |
34 | case "${MINVER}" in |
31 | 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; |
35 | 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; |
32 | 4.1|4.1.0) |
36 | 4.1|4.1.0|4.2|4.2.0) |
33 | for x in ${QT4MAJORVERSIONS}; do |
37 | for x in ${QT4MAJORVERSIONS}; do |
34 | if $(version_is_at_least "${MINVER}" "${x}"); then |
38 | if $(version_is_at_least "${MINVER}" "${x}"); then |
35 | VERSIONS="${VERSIONS} =${QTPKG}${x}*" |
39 | VERSIONS="${VERSIONS} =${QTPKG}${x}*" |
36 | fi |
40 | fi |
37 | done |
41 | done |
… | |
… | |
46 | *) VERSIONS="=${QTPKG}4*";; |
50 | *) VERSIONS="=${QTPKG}4*";; |
47 | esac |
51 | esac |
48 | |
52 | |
49 | echo "${VERSIONS}" |
53 | echo "${VERSIONS}" |
50 | } |
54 | } |
|
|
55 | |
|
|
56 | qt4_pkg_setup() { |
|
|
57 | for x in ${QT4_BUILT_WITH_USE_CHECK}; do |
|
|
58 | if ! built_with_use =x11-libs/qt-4* $x; then |
|
|
59 | die "This package requires Qt4 to be built with the '${x}' use flag." |
|
|
60 | fi |
|
|
61 | done |
|
|
62 | } |
|
|
63 | |
|
|
64 | eqmake4() { |
|
|
65 | local LOGFILE="${T}/qmake-$$.out" |
|
|
66 | local projprofile="${1}" |
|
|
67 | [ -z ${projprofile} ] && projprofile="${PN}.pro" |
|
|
68 | shift 1 |
|
|
69 | |
|
|
70 | ebegin "Processing qmake ${projprofile}" |
|
|
71 | |
|
|
72 | # file exists? |
|
|
73 | if [ ! -f ${projprofile} ]; then |
|
|
74 | echo |
|
|
75 | eerror "Project .pro file \"${projprofile}\" does not exists" |
|
|
76 | eerror "qmake cannot handle non-existing .pro files" |
|
|
77 | echo |
|
|
78 | eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" |
|
|
79 | echo |
|
|
80 | die "Project file not found in ${PN} sources" |
|
|
81 | fi |
|
|
82 | |
|
|
83 | echo >> ${LOGFILE} |
|
|
84 | echo "****** qmake ${projprofile} ******" >> ${LOGFILE} |
|
|
85 | echo >> ${LOGFILE} |
|
|
86 | |
|
|
87 | # as a workaround for broken qmake, put everything into file |
|
|
88 | if has debug ${IUSE} && use debug; then |
|
|
89 | echo -e "$CONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile} |
|
|
90 | else |
|
|
91 | echo -e "$CONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile} |
|
|
92 | fi |
|
|
93 | |
|
|
94 | /usr/bin/qmake ${projprofile} \ |
|
|
95 | QTDIR=/usr/$(get_libdir) \ |
|
|
96 | QMAKE=/usr/bin/qmake \ |
|
|
97 | QMAKE_CC=$(tc-getCC) \ |
|
|
98 | QMAKE_CXX=$(tc-getCXX) \ |
|
|
99 | QMAKE_LINK=$(tc-getCXX) \ |
|
|
100 | QMAKE_CFLAGS_RELEASE="${CFLAGS}" \ |
|
|
101 | QMAKE_CFLAGS_DEBUG="${CFLAGS}" \ |
|
|
102 | QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ |
|
|
103 | QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ |
|
|
104 | QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ |
|
|
105 | QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
|
|
106 | QMAKE_RPATH= \ |
|
|
107 | ${@} >> ${LOGFILE} 2>&1 |
|
|
108 | |
|
|
109 | local result=$? |
|
|
110 | eend ${result} |
|
|
111 | |
|
|
112 | # was qmake successful? |
|
|
113 | if [ ${result} -ne 0 ]; then |
|
|
114 | echo |
|
|
115 | eerror "Running qmake on \"${projprofile}\" has failed" |
|
|
116 | echo |
|
|
117 | eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" |
|
|
118 | echo |
|
|
119 | die "qmake failed on ${projprofile}" |
|
|
120 | fi |
|
|
121 | |
|
|
122 | return ${result} |
|
|
123 | } |
|
|
124 | |
|
|
125 | EXPORT_FUNCTIONS pkg_setup |