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

Contents of /eclass/qt4.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.37 - (hide annotations) (download)
Wed Mar 5 23:03:24 2008 UTC (6 years, 4 months ago) by ingmar
Branch: MAIN
Changes since 1.36: +16 -11 lines
qt4.eclass: Added Qt 4.4.0_beta1, fix EAPI handling (EAPI is a string, not necessarily a number).

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

  ViewVC Help
Powered by ViewVC 1.1.20