/[gentoo-x86]/eclass/qt4.eclass
Gentoo

Diff of /eclass/qt4.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.22 Revision 1.39
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.22 2007/08/02 11:22:40 caleb Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/qt4.eclass,v 1.39 2008/03/19 12:19:51 ingmar Exp $
4# 4
5# @ECLASS: qt4.eclass
6# @MAINTAINER:
5# Author Caleb Tennis <caleb@gentoo.org> 7# Caleb Tennis <caleb@gentoo.org>
6# 8# @BLURB: Eclass for Qt4 packages
7# This eclass is simple. Inherit it, and in your depend, do something like this: 9# @DESCRIPTION:
8# 10# This eclass contains various functions that may be useful
9# DEPEND="$(qt4_min_version 4)" 11# when dealing with packages using Qt4 libraries.
10# 12
11# and it handles the rest for you
12#
13# 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.
14# - Caleb Tennis <caleb@gentoo.org> 14# - Caleb Tennis <caleb@gentoo.org>
15 15
16inherit eutils multilib toolchain-funcs versionator 16inherit eutils multilib toolchain-funcs versionator
17 17
18IUSE="${IUSE}"
19
20QTPKG="x11-libs/qt-" 18QTPKG="x11-libs/qt-"
21QT4MAJORVERSIONS="4.3 4.2 4.1 4.0" 19QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0"
22QT4VERSIONS="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" 20QT4VERSIONS="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"
23 21
22# @FUNCTION: qt4_min_version
23# @USAGE: [minimum version]
24# @DESCRIPTION:
25# This function should be called in package DEPENDs whenever it depends on qt4.
26# Simple example - in your depend, do something like this:
27# DEPEND="$(qt4_min_version 4.2)"
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.
24qt4_min_version() { 32qt4_min_version() {
33 case ${EAPI:-0} in
34 # EAPIs without SLOT dependencies
25 echo "|| (" 35 0) echo "|| ("
26 qt4_min_version_list "$@" 36 qt4_min_version_list "$@"
27 echo ")" 37 echo ")"
38 ;;
39 # EAPIS with SLOT dependencies.
40 *) echo ">=${QTPKG}${1}:4"
41 ;;
42 esac
28} 43}
29 44
30qt4_min_version_list() { 45qt4_min_version_list() {
31 local MINVER="$1" 46 local MINVER="$1"
32 local VERSIONS="" 47 local VERSIONS=""
33 48
34 case "${MINVER}" in 49 case "${MINVER}" in
35 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; 50 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";;
36 4.1|4.1.0|4.2|4.2.0) 51 4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0)
37 for x in ${QT4MAJORVERSIONS}; do 52 for x in ${QT4MAJORVERSIONS}; do
38 if $(version_is_at_least "${MINVER}" "${x}"); then 53 if $(version_is_at_least "${MINVER}" "${x}"); then
39 VERSIONS="${VERSIONS} =${QTPKG}${x}*" 54 VERSIONS="${VERSIONS} =${QTPKG}${x}*"
40 fi 55 fi
41 done 56 done
51 esac 66 esac
52 67
53 echo "${VERSIONS}" 68 echo "${VERSIONS}"
54} 69}
55 70
71# @FUNCTION: qt4_pkg_setup
72# @MAINTAINER:
73# Caleb Tennis <caleb@gentoo.org>
74# Przemyslaw Maciag <troll@gentoo.org>
75# @DESCRIPTION:
76# Default pkg_setup function for packages that depends on qt4. If you have to
77# create ebuilds own pkg_setup in your ebuild, call qt4_pkg_setup in it.
78# This function uses two global vars from ebuild:
79# - QT4_BUILT_WITH_USE_CHECK - contains use flags that need to be turned on for
80# =x11-libs/qt-4*
81# - QT4_OPTIONAL_BUILT_WITH_USE_CHECK - qt4 flags that provides some
82# functionality, but can alternatively be disabled in ${CATEGORY}/${PN}
83# (so qt4 don't have to be recompiled)
84#
85# flags to watch for for Qt4.4:
86# zlib png | opengl dbus qt3support | sqlite3 ssl
56qt4_pkg_setup() { 87qt4_pkg_setup() {
88
89 QT4_BEST_VERSION="$(best_version =x11-libs/qt-4*)"
90 QT4_MINOR_VERSION="$(get_version_component_range 2 ${QT4_BEST_VERSION/*qt-/})"
91
92 local requiredflags=""
57 for x in ${QT4_BUILT_WITH_USE_CHECK}; do 93 for x in ${QT4_BUILT_WITH_USE_CHECK}; do
94 if [[ "${QT4_MINOR_VERSION}" -ge 4 ]]; then
95 # The use flags are different in 4.4 and above, and it's a split package, so this is used to catch
96 # the various use flag combos specified in the ebuilds to make sure we don't error out.
97
98 if [[ ${x} == zlib || ${x} == png ]]; then
99 # Qt 4.4+ is built with zlib and png by default, so the use flags aren't needed
100 continue;
101 elif [[ ${x} == opengl || ${x} == dbus || ${x} == qt3support ]]; then
102 # Make sure the qt-${x} package has been already installed
103
104 if ! has_version x11-libs/qt-${x}; then
105 eerror "You must first install the x11-libs/qt-${x} package."
106 die "Install x11-libs/qt-${x}"
107 fi
108 elif [[ ${x} == ssl ]]; then
109 if ! has_version x11-libs/qt-core || ! built_with_use x11-libs/qt-core ssl; then
110 eerror "You must first install the x11-libs/qt-core package with the ssl flag enabled."
111 die "Install x11-libs/qt-core with USE=\"ssl\""
112 fi
113 elif [[ ${x} == sqlite3 ]]; then
114 if ! has_version x11-libs/qt-sql || ! built_with_use x11-libs/qt-sql sqlite; then
115 eerror "You must first install the x11-libs/qt-sql package with the sqlite flag enabled."
116 die "Install x11-libs/qt-sql with USE=\"sqlite\""
117 fi
118 fi
58 if ! built_with_use =x11-libs/qt-4* $x; then 119 elif ! built_with_use =x11-libs/qt-4* ${x}; then
59 die "This package requires Qt4 to be built with the '${x}' use flag." 120 requiredflags="${requiredflags} ${x}"
60 fi 121 fi
61 done 122 done
62}
63 123
124 local optionalflags=""
125 for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do
126 if use ${x} && ! built_with_use =x11-libs/qt-4* ${x}; then
127 optionalflags="${optionalflags} ${x}"
128 fi
129 done
130
131 local diemessage=""
132 if [[ ${requiredflags} != "" ]]; then
133 eerror
134 eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build"
135 eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)"
136 eerror
137 diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; "
138 fi
139 if [[ ${optionalflags} != "" ]]; then
140 eerror
141 eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with"
142 eerror "USE=\"${optionalflags}\""
143 eerror "while qt4 is built without this particular flag(s): it will"
144 eerror "not work."
145 eerror
146 eerror "Possible solutions to this problem are:"
147 eerror "a) install package ${CATEGORY}/${PN} without \"${optionalflags}\" USE flag(s)"
148 eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)"
149 eerror
150 diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n"
151 fi
152
153 [[ ${diemessage} != "" ]] && die "can't emerge ${CATEGORY}/${PN}: ${diemessage}"
154}
155
156# @FUNCTION: eqmake4
157# @USAGE: [.pro file] [additional parameters to qmake]
158# @MAINTAINER:
159# Przemyslaw Maciag <troll@gentoo.org>
160# Davide Pesavento <davidepesa@gmail.com>
161# @DESCRIPTION:
162# Runs qmake on the specified .pro file (defaults to
163# ${PN}.pro if eqmake4 was called with no argument).
164# Additional parameters are passed unmodified to qmake.
64eqmake4() { 165eqmake4() {
65 local LOGFILE="${T}/qmake-$$.out" 166 local LOGFILE="${T}/qmake-$$.out"
66 local projprofile="${1}" 167 local projprofile="${1}"
67 [ -z ${projprofile} ] && projprofile="${PN}.pro" 168 [[ -z ${projprofile} ]] && projprofile="${PN}.pro"
68 shift 1 169 shift 1
69 170
70 ebegin "Processing qmake ${projprofile}" 171 ebegin "Processing qmake ${projprofile}"
71 172
72 # file exists? 173 # file exists?
73 if [ ! -f ${projprofile} ]; then 174 if [[ ! -f ${projprofile} ]]; then
74 echo 175 echo
75 eerror "Project .pro file \"${projprofile}\" does not exists" 176 eerror "Project .pro file \"${projprofile}\" does not exists"
76 eerror "qmake cannot handle non-existing .pro files" 177 eerror "qmake cannot handle non-existing .pro files"
77 echo 178 echo
78 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" 179 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
84 echo "****** qmake ${projprofile} ******" >> ${LOGFILE} 185 echo "****** qmake ${projprofile} ******" >> ${LOGFILE}
85 echo >> ${LOGFILE} 186 echo >> ${LOGFILE}
86 187
87 # as a workaround for broken qmake, put everything into file 188 # as a workaround for broken qmake, put everything into file
88 if has debug ${IUSE} && use debug; then 189 if has debug ${IUSE} && use debug; then
89 echo -e "$CONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile} 190 echo -e "\nCONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile}
90 else 191 else
91 echo -e "$CONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile} 192 echo -e "\nCONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile}
92 fi 193 fi
93 194
94 /usr/bin/qmake ${projprofile} \ 195 /usr/bin/qmake ${projprofile} \
95 QTDIR=/usr/$(get_libdir) \ 196 QTDIR=/usr/$(get_libdir) \
96 QMAKE=/usr/bin/qmake \ 197 QMAKE=/usr/bin/qmake \
102 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ 203 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
103 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ 204 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
104 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ 205 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
105 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ 206 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
106 QMAKE_RPATH= \ 207 QMAKE_RPATH= \
107 ${@} >> ${LOGFILE} 2>&1 208 "${@}" >> ${LOGFILE} 2>&1
108 209
109 local result=$? 210 local result=$?
110 eend ${result} 211 eend ${result}
111 212
112 # was qmake successful? 213 # was qmake successful?
113 if [ ${result} -ne 0 ]; then 214 if [[ ${result} -ne 0 ]]; then
114 echo 215 echo
115 eerror "Running qmake on \"${projprofile}\" has failed" 216 eerror "Running qmake on \"${projprofile}\" has failed"
116 echo 217 echo
117 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" 218 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
118 echo 219 echo

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.39

  ViewVC Help
Powered by ViewVC 1.1.20