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

Diff of /eclass/qt4.eclass

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

Revision 1.2 Revision 1.30
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.30 2007/12/19 18:07:47 caleb Exp $
4#
5# Author Caleb Tennis <caleb@gentoo.org>
6#
7# This eclass is simple. Inherit it, and in your depend, do something like this:
8#
9# DEPEND="$(qt_min_version 4)"
10#
11# and it handles the rest for you
12#
13 4
14inherit versionator 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# 08.16.06 - Renamed qt_min_* to qt4_min_* to avoid conflicts with the qt3 eclass.
15# - Caleb Tennis <caleb@gentoo.org>
16
17inherit eutils multilib toolchain-funcs versionator
15 18
16QTPKG="x11-libs/qt-" 19QTPKG="x11-libs/qt-"
17QT4MAJORVERSIONS="4.1 4.0" 20QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0"
18QT4VERSIONS="4.1.2 4.1.1 4.1.0 4.0.1 4.0.0" 21QT4VERSIONS="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"
19 22
23# @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# if package can be build with qt-4.2 or higher.
20qt_min_version() { 30qt4_min_version() {
21 echo "|| (" 31 echo "|| ("
22 qt_min_version_list "$@" 32 qt4_min_version_list "$@"
23 echo ")" 33 echo ")"
24} 34}
25 35
26qt_min_version_list() { 36qt4_min_version_list() {
27 local MINVER="$1" 37 local MINVER="$1"
28 local VERSIONS="" 38 local VERSIONS=""
29 39
30 case "${MINVER}" in 40 case "${MINVER}" in
31 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; 41 4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";;
32 4.1|4.1.0) 42 4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0)
33 for x in ${QT4MAJORVERSIONS}; do 43 for x in ${QT4MAJORVERSIONS}; do
34 if $(version_is_at_least "${MINVER}" "${x}"); then 44 if $(version_is_at_least "${MINVER}" "${x}"); then
35 VERSIONS="${VERSIONS} =${QTPKG}${x}*" 45 VERSIONS="${VERSIONS} =${QTPKG}${x}*"
36 fi 46 fi
37 done 47 done
46 *) VERSIONS="=${QTPKG}4*";; 56 *) VERSIONS="=${QTPKG}4*";;
47 esac 57 esac
48 58
49 echo "${VERSIONS}" 59 echo "${VERSIONS}"
50} 60}
61
62# @FUNCTION: qt4_pkg_setup
63# @MAINTAINER:
64# Caleb Tennis <caleb@gentoo.org>
65# Przemyslaw Maciag <troll@gentoo.org>
66# @DESCRIPTION:
67# Default pkg_setup function for packages that depends on qt4. If you have to
68# create ebuilds own pkg_setup in your ebuild, call qt4_pkg_setup in it.
69# This function uses two global vars from ebuild:
70# - QT4_BUILT_WITH_USE_CHECK - contains use flags that need to be turned on for
71# =x11-libs/qt-4*
72# - QT4_OPTIONAL_BUILT_WITH_USE_CHECK - qt4 flags that provides some
73# functionality, but can alternatively be disabled in ${CATEGORY}/${PN}
74# (so qt4 don't have to be recompiled)
75qt4_pkg_setup() {
76 local requiredflags=""
77 for x in ${QT4_BUILT_WITH_USE_CHECK}; do
78 if ! built_with_use =x11-libs/qt-4* ${x}; then
79 requiredflags="${requiredflags} ${x}"
80 fi
81 done
82
83 local optionalflags=""
84 for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do
85 if use ${x} && ! built_with_use =x11-libs/qt-4* ${x}; then
86 optionalflags="${optionalflags} ${x}"
87 fi
88 done
89
90 local diemessage=""
91 if [[ ${requiredflags} != "" ]]; then
92 eerror
93 eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build"
94 eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)"
95 eerror
96 diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; "
97 fi
98 if [[ ${optionalflags} != "" ]]; then
99 eerror
100 eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with"
101 eerror "USE=\"${optionalflags}\""
102 eerror "while qt4 is built without this particular flag(s): it will"
103 eerror "not work."
104 eerror
105 eerror "Possible solutions to this problem are:"
106 eerror "a) install package ${CATEGORY}/${PN} without \"${optionalflags}\" USE flag(s)"
107 eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)"
108 eerror
109 diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n"
110 fi
111
112 [[ ${diemessage} != "" ]] && die "can't emerge ${CATEGORY}/${PN}: ${diemessage}"
113}
114
115# @FUNCTION: eqmake4
116# @USAGE: [.pro file] [additional parameters to qmake]
117# @MAINTAINER:
118# Przemyslaw Maciag <troll@gentoo.org>
119# Davide Pesavento <davidepesa@gmail.com>
120# @DESCRIPTION:
121# Runs qmake on the specified .pro file (defaults to
122# ${PN}.pro if eqmake4 was called with no argument).
123# Additional parameters are passed unmodified to qmake.
124eqmake4() {
125 local LOGFILE="${T}/qmake-$$.out"
126 local projprofile="${1}"
127 [[ -z ${projprofile} ]] && projprofile="${PN}.pro"
128 shift 1
129
130 ebegin "Processing qmake ${projprofile}"
131
132 # file exists?
133 if [[ ! -f ${projprofile} ]]; then
134 echo
135 eerror "Project .pro file \"${projprofile}\" does not exists"
136 eerror "qmake cannot handle non-existing .pro files"
137 echo
138 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
139 echo
140 die "Project file not found in ${PN} sources"
141 fi
142
143 echo >> ${LOGFILE}
144 echo "****** qmake ${projprofile} ******" >> ${LOGFILE}
145 echo >> ${LOGFILE}
146
147 # as a workaround for broken qmake, put everything into file
148 if has debug ${IUSE} && use debug; then
149 echo -e "\nCONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile}
150 else
151 echo -e "\nCONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile}
152 fi
153
154 /usr/bin/qmake ${projprofile} \
155 QTDIR=/usr/$(get_libdir) \
156 QMAKE=/usr/bin/qmake \
157 QMAKE_CC=$(tc-getCC) \
158 QMAKE_CXX=$(tc-getCXX) \
159 QMAKE_LINK=$(tc-getCXX) \
160 QMAKE_CFLAGS_RELEASE="${CFLAGS}" \
161 QMAKE_CFLAGS_DEBUG="${CFLAGS}" \
162 QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
163 QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
164 QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
165 QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
166 QMAKE_RPATH= \
167 ${@} >> ${LOGFILE} 2>&1
168
169 local result=$?
170 eend ${result}
171
172 # was qmake successful?
173 if [[ ${result} -ne 0 ]]; then
174 echo
175 eerror "Running qmake on \"${projprofile}\" has failed"
176 echo
177 eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
178 echo
179 die "qmake failed on ${projprofile}"
180 fi
181
182 return ${result}
183}
184
185EXPORT_FUNCTIONS pkg_setup

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.30

  ViewVC Help
Powered by ViewVC 1.1.20