| 1 |
caleb |
1.1 |
# Copyright 2005 Gentoo Foundation
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
carlo |
1.45 |
# $Header: /var/cvsroot/gentoo-x86/eclass/qt4.eclass,v 1.44 2008/07/17 00:03:33 zlin Exp $
|
| 4 |
troll |
1.29 |
|
| 5 |
|
|
# @ECLASS: qt4.eclass
|
| 6 |
|
|
# @MAINTAINER:
|
| 7 |
|
|
# Caleb Tennis <caleb@gentoo.org>
|
| 8 |
ingmar |
1.38 |
# @BLURB: Eclass for Qt4 packages
|
| 9 |
troll |
1.29 |
# @DESCRIPTION:
|
| 10 |
|
|
# This eclass contains various functions that may be useful
|
| 11 |
|
|
# when dealing with packages using Qt4 libraries.
|
| 12 |
|
|
|
| 13 |
caleb |
1.4 |
# 08.16.06 - Renamed qt_min_* to qt4_min_* to avoid conflicts with the qt3 eclass.
|
| 14 |
|
|
# - Caleb Tennis <caleb@gentoo.org>
|
| 15 |
caleb |
1.1 |
|
| 16 |
caleb |
1.20 |
inherit eutils multilib toolchain-funcs versionator
|
| 17 |
caleb |
1.1 |
|
| 18 |
|
|
QTPKG="x11-libs/qt-"
|
| 19 |
caleb |
1.30 |
QT4MAJORVERSIONS="4.4 4.3 4.2 4.1 4.0"
|
| 20 |
zlin |
1.44 |
QT4VERSIONS="4.4.0 4.4.0_beta1 4.4.0_rc1
|
| 21 |
carlo |
1.45 |
4.3.4-r1 4.3.5 4.3.4 4.3.3 4.3.2-r1 4.3.2 4.3.1-r1 4.3.1
|
| 22 |
zlin |
1.44 |
4.3.0-r2 4.3.0-r1 4.3.0 4.3.0_rc1 4.3.0_beta1
|
| 23 |
|
|
4.2.3-r1 4.2.3 4.2.2 4.2.1 4.2.0-r2 4.2.0-r1 4.2.0
|
| 24 |
|
|
4.1.4-r2 4.1.4-r1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0
|
| 25 |
|
|
4.0.1 4.0.0"
|
| 26 |
caleb |
1.1 |
|
| 27 |
troll |
1.29 |
# @FUNCTION: qt4_min_version
|
| 28 |
|
|
# @USAGE: [minimum version]
|
| 29 |
|
|
# @DESCRIPTION:
|
| 30 |
|
|
# This function should be called in package DEPENDs whenever it depends on qt4.
|
| 31 |
|
|
# Simple example - in your depend, do something like this:
|
| 32 |
|
|
# DEPEND="$(qt4_min_version 4.2)"
|
| 33 |
ingmar |
1.37 |
# if the package can be build with qt-4.2 or higher.
|
| 34 |
|
|
#
|
| 35 |
|
|
# For builds that use an EAPI with support for SLOT dependencies, this will
|
| 36 |
|
|
# return a SLOT dependency, rather than a list of versions.
|
| 37 |
caleb |
1.4 |
qt4_min_version() {
|
| 38 |
ingmar |
1.37 |
case ${EAPI:-0} in
|
| 39 |
|
|
# EAPIs without SLOT dependencies
|
| 40 |
|
|
0) echo "|| ("
|
| 41 |
|
|
qt4_min_version_list "$@"
|
| 42 |
|
|
echo ")"
|
| 43 |
|
|
;;
|
| 44 |
|
|
# EAPIS with SLOT dependencies.
|
| 45 |
|
|
*) echo ">=${QTPKG}${1}:4"
|
| 46 |
|
|
;;
|
| 47 |
|
|
esac
|
| 48 |
caleb |
1.1 |
}
|
| 49 |
|
|
|
| 50 |
caleb |
1.4 |
qt4_min_version_list() {
|
| 51 |
caleb |
1.1 |
local MINVER="$1"
|
| 52 |
|
|
local VERSIONS=""
|
| 53 |
|
|
|
| 54 |
|
|
case "${MINVER}" in
|
| 55 |
|
|
4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";;
|
| 56 |
caleb |
1.30 |
4.1|4.1.0|4.2|4.2.0|4.3|4.3.0|4.4|4.4.0)
|
| 57 |
caleb |
1.1 |
for x in ${QT4MAJORVERSIONS}; do
|
| 58 |
swegener |
1.41 |
if version_is_at_least "${MINVER}" "${x}"; then
|
| 59 |
caleb |
1.1 |
VERSIONS="${VERSIONS} =${QTPKG}${x}*"
|
| 60 |
|
|
fi
|
| 61 |
|
|
done
|
| 62 |
|
|
;;
|
| 63 |
|
|
4*)
|
| 64 |
|
|
for x in ${QT4VERSIONS}; do
|
| 65 |
swegener |
1.41 |
if version_is_at_least "${MINVER}" "${x}"; then
|
| 66 |
caleb |
1.1 |
VERSIONS="${VERSIONS} =${QTPKG}${x}"
|
| 67 |
|
|
fi
|
| 68 |
|
|
done
|
| 69 |
|
|
;;
|
| 70 |
|
|
*) VERSIONS="=${QTPKG}4*";;
|
| 71 |
|
|
esac
|
| 72 |
|
|
|
| 73 |
|
|
echo "${VERSIONS}"
|
| 74 |
|
|
}
|
| 75 |
caleb |
1.16 |
|
| 76 |
zlin |
1.44 |
qt4_monolithic_to_split_flag() {
|
| 77 |
|
|
case ${1} in
|
| 78 |
|
|
zlib)
|
| 79 |
|
|
# Qt 4.4+ is always built with zlib enabled, so this flag isn't needed
|
| 80 |
|
|
;;
|
| 81 |
|
|
gif|jpeg|png)
|
| 82 |
|
|
# qt-gui always installs with these enabled
|
| 83 |
|
|
checkpkgs+=" x11-libs/qt-gui"
|
| 84 |
|
|
;;
|
| 85 |
|
|
dbus|opengl)
|
| 86 |
|
|
# Make sure the qt-${1} package has been installed already
|
| 87 |
|
|
checkpkgs+=" x11-libs/qt-${1}"
|
| 88 |
|
|
;;
|
| 89 |
|
|
qt3support)
|
| 90 |
|
|
checkpkgs+=" x11-libs/qt-${1}"
|
| 91 |
|
|
checkflags+=" x11-libs/qt-core:${1} x11-libs/qt-gui:${1} x11-libs/qt-sql:${1}"
|
| 92 |
|
|
;;
|
| 93 |
|
|
ssl)
|
| 94 |
|
|
# qt-core controls this flag
|
| 95 |
|
|
checkflags+=" x11-libs/qt-core:${1}"
|
| 96 |
|
|
;;
|
| 97 |
|
|
cups|mng|nas|nis|tiff|xinerama|input_devices_wacom)
|
| 98 |
|
|
# qt-gui controls these flags
|
| 99 |
|
|
checkflags+=" x11-libs/qt-gui:${1}"
|
| 100 |
|
|
;;
|
| 101 |
|
|
firebird|mysql|odbc|postgres|sqlite3)
|
| 102 |
|
|
# qt-sql controls these flags. sqlite2 is no longer supported so it uses sqlite instead of sqlite3.
|
| 103 |
|
|
checkflags+=" x11-libs/qt-sql:${1%3}"
|
| 104 |
|
|
;;
|
| 105 |
|
|
accessibility)
|
| 106 |
|
|
eerror "(QA message): Use guiaccessibility and/or qt3accessibility to specify which of qt-gui and qt-qt3support are relevant for this package."
|
| 107 |
|
|
# deal with this gracefully by checking the flag for what is available
|
| 108 |
|
|
for y in gui qt3support; do
|
| 109 |
|
|
has_version x11-libs/qt-${y} && checkflags+=" x11-libs/qt-${y}:${1}"
|
| 110 |
|
|
done
|
| 111 |
|
|
;;
|
| 112 |
|
|
guiaccessibility)
|
| 113 |
|
|
checkflags+=" x11-libs/qt-gui:accessibility"
|
| 114 |
|
|
;;
|
| 115 |
|
|
qt3accessibility)
|
| 116 |
|
|
checkflags+=" x11-libs/qt-qt3support:accessibility"
|
| 117 |
|
|
;;
|
| 118 |
|
|
debug|doc|examples|glib|pch|sqlite|*)
|
| 119 |
|
|
# packages probably shouldn't be checking these flags so we don't handle them currently
|
| 120 |
|
|
eerror "qt4.eclass currently doesn't handle the use flag ${1} in QT4_BUILT_WITH_USE_CHECK for qt-4.4. This is either an"
|
| 121 |
|
|
eerror "eclass bug or an ebuild bug. Please report it at http://bugs.gentoo.org/"
|
| 122 |
|
|
((fatalerrors+=1))
|
| 123 |
|
|
;;
|
| 124 |
|
|
esac
|
| 125 |
|
|
}
|
| 126 |
|
|
|
| 127 |
troll |
1.29 |
# @FUNCTION: qt4_pkg_setup
|
| 128 |
|
|
# @MAINTAINER:
|
| 129 |
|
|
# Caleb Tennis <caleb@gentoo.org>
|
| 130 |
|
|
# Przemyslaw Maciag <troll@gentoo.org>
|
| 131 |
|
|
# @DESCRIPTION:
|
| 132 |
|
|
# Default pkg_setup function for packages that depends on qt4. If you have to
|
| 133 |
|
|
# create ebuilds own pkg_setup in your ebuild, call qt4_pkg_setup in it.
|
| 134 |
|
|
# This function uses two global vars from ebuild:
|
| 135 |
|
|
# - QT4_BUILT_WITH_USE_CHECK - contains use flags that need to be turned on for
|
| 136 |
|
|
# =x11-libs/qt-4*
|
| 137 |
|
|
# - QT4_OPTIONAL_BUILT_WITH_USE_CHECK - qt4 flags that provides some
|
| 138 |
|
|
# functionality, but can alternatively be disabled in ${CATEGORY}/${PN}
|
| 139 |
|
|
# (so qt4 don't have to be recompiled)
|
| 140 |
caleb |
1.31 |
#
|
| 141 |
|
|
# flags to watch for for Qt4.4:
|
| 142 |
|
|
# zlib png | opengl dbus qt3support | sqlite3 ssl
|
| 143 |
caleb |
1.16 |
qt4_pkg_setup() {
|
| 144 |
zlin |
1.44 |
local x y checkpkgs checkflags fatalerrors=0 requiredflags=""
|
| 145 |
caleb |
1.31 |
|
| 146 |
zlin |
1.44 |
# lots of has_version calls can be very expensive
|
| 147 |
|
|
if [[ -n ${QT4_BUILT_WITH_USE_CHECK}${QT4_OPTIONAL_BUILT_WITH_USE_CHECK} ]]; then
|
| 148 |
|
|
has_version x11-libs/qt-core && local QT44=true
|
| 149 |
|
|
fi
|
| 150 |
caleb |
1.31 |
|
| 151 |
caleb |
1.20 |
for x in ${QT4_BUILT_WITH_USE_CHECK}; do
|
| 152 |
zlin |
1.44 |
if [[ -n ${QT44} ]]; then
|
| 153 |
|
|
# The use flags are different in 4.4 and above, and it's split packages, so this is used to catch
|
| 154 |
|
|
# the various use flag combos specified in the ebuilds to make sure we don't error out for no reason.
|
| 155 |
|
|
qt4_monolithic_to_split_flag ${x}
|
| 156 |
gentoofan23 |
1.42 |
else
|
| 157 |
zlin |
1.44 |
[[ ${x} == *accessibility ]] && x=${x#gui} && x=${x#qt3}
|
| 158 |
gentoofan23 |
1.42 |
if ! built_with_use =x11-libs/qt-4* ${x}; then
|
| 159 |
|
|
requiredflags="${requiredflags} ${x}"
|
| 160 |
caleb |
1.31 |
fi
|
| 161 |
troll |
1.29 |
fi
|
| 162 |
|
|
done
|
| 163 |
|
|
|
| 164 |
|
|
local optionalflags=""
|
| 165 |
|
|
for x in ${QT4_OPTIONAL_BUILT_WITH_USE_CHECK}; do
|
| 166 |
zlin |
1.44 |
if use ${x}; then
|
| 167 |
|
|
if [[ -n ${QT44} ]]; then
|
| 168 |
|
|
# The use flags are different in 4.4 and above, and it's split packages, so this is used to catch
|
| 169 |
|
|
# the various use flag combos specified in the ebuilds to make sure we don't error out for no reason.
|
| 170 |
|
|
qt4_monolithic_to_split_flag ${x}
|
| 171 |
|
|
elif ! built_with_use =x11-libs/qt-4* ${x}; then
|
| 172 |
|
|
optionalflags="${optionalflags} ${x}"
|
| 173 |
|
|
fi
|
| 174 |
|
|
fi
|
| 175 |
|
|
done
|
| 176 |
|
|
|
| 177 |
|
|
# The use flags are different in 4.4 and above, and it's split packages, so this is used to catch
|
| 178 |
|
|
# the various use flag combos specified in the ebuilds to make sure we don't error out for no reason.
|
| 179 |
|
|
for y in ${checkpkgs}; do
|
| 180 |
|
|
if ! has_version ${y}; then
|
| 181 |
|
|
eerror "You must first install the ${y} package. It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161."
|
| 182 |
|
|
((fatalerrors+=1))
|
| 183 |
|
|
fi
|
| 184 |
|
|
done
|
| 185 |
|
|
for y in ${checkflags}; do
|
| 186 |
|
|
if ! has_version ${y%:*}; then
|
| 187 |
|
|
eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled."
|
| 188 |
|
|
eerror "It should be added to the dependencies for this package (${CATEGORY}/${PN}). See bug #217161."
|
| 189 |
|
|
((fatalerrors+=1))
|
| 190 |
|
|
else
|
| 191 |
|
|
if ! built_with_use ${y%:*} ${y##*:}; then
|
| 192 |
|
|
eerror "You must first install the ${y%:*} package with the ${y##*:} flag enabled."
|
| 193 |
|
|
((fatalerrors+=1))
|
| 194 |
|
|
fi
|
| 195 |
caleb |
1.16 |
fi
|
| 196 |
|
|
done
|
| 197 |
troll |
1.29 |
|
| 198 |
|
|
local diemessage=""
|
| 199 |
zlin |
1.44 |
if [[ ${fatalerrors} -ne 0 ]]; then
|
| 200 |
|
|
diemessage="${fatalerrors} fatal errors were detected. Please read the above error messages and act accordingly."
|
| 201 |
|
|
fi
|
| 202 |
|
|
if [[ -n ${requiredflags} ]]; then
|
| 203 |
troll |
1.29 |
eerror
|
| 204 |
|
|
eerror "(1) In order to compile ${CATEGORY}/${PN} first you need to build"
|
| 205 |
|
|
eerror "=x11-libs/qt-4* with USE=\"${requiredflags}\" flag(s)"
|
| 206 |
|
|
eerror
|
| 207 |
|
|
diemessage="(1) recompile qt4 with \"${requiredflags}\" USE flag(s) ; "
|
| 208 |
|
|
fi
|
| 209 |
zlin |
1.44 |
if [[ -n ${optionalflags} ]]; then
|
| 210 |
troll |
1.29 |
eerror
|
| 211 |
|
|
eerror "(2) You are trying to compile ${CATEGORY}/${PN} package with"
|
| 212 |
|
|
eerror "USE=\"${optionalflags}\""
|
| 213 |
|
|
eerror "while qt4 is built without this particular flag(s): it will"
|
| 214 |
|
|
eerror "not work."
|
| 215 |
|
|
eerror
|
| 216 |
|
|
eerror "Possible solutions to this problem are:"
|
| 217 |
|
|
eerror "a) install package ${CATEGORY}/${PN} without \"${optionalflags}\" USE flag(s)"
|
| 218 |
|
|
eerror "b) re-emerge qt4 with \"${optionalflags}\" USE flag(s)"
|
| 219 |
|
|
eerror
|
| 220 |
|
|
diemessage="${diemessage}(2) recompile qt4 with \"${optionalflags}\" USE flag(s) or disable them for ${PN} package\n"
|
| 221 |
|
|
fi
|
| 222 |
|
|
|
| 223 |
zlin |
1.44 |
[[ -n ${diemessage} ]] && die "can't install ${CATEGORY}/${PN}: ${diemessage}"
|
| 224 |
caleb |
1.16 |
}
|
| 225 |
caleb |
1.20 |
|
| 226 |
troll |
1.29 |
# @FUNCTION: eqmake4
|
| 227 |
|
|
# @USAGE: [.pro file] [additional parameters to qmake]
|
| 228 |
|
|
# @MAINTAINER:
|
| 229 |
|
|
# Przemyslaw Maciag <troll@gentoo.org>
|
| 230 |
|
|
# Davide Pesavento <davidepesa@gmail.com>
|
| 231 |
|
|
# @DESCRIPTION:
|
| 232 |
|
|
# Runs qmake on the specified .pro file (defaults to
|
| 233 |
|
|
# ${PN}.pro if eqmake4 was called with no argument).
|
| 234 |
|
|
# Additional parameters are passed unmodified to qmake.
|
| 235 |
caleb |
1.20 |
eqmake4() {
|
| 236 |
|
|
local LOGFILE="${T}/qmake-$$.out"
|
| 237 |
|
|
local projprofile="${1}"
|
| 238 |
troll |
1.29 |
[[ -z ${projprofile} ]] && projprofile="${PN}.pro"
|
| 239 |
caleb |
1.20 |
shift 1
|
| 240 |
|
|
|
| 241 |
|
|
ebegin "Processing qmake ${projprofile}"
|
| 242 |
|
|
|
| 243 |
|
|
# file exists?
|
| 244 |
troll |
1.29 |
if [[ ! -f ${projprofile} ]]; then
|
| 245 |
caleb |
1.20 |
echo
|
| 246 |
|
|
eerror "Project .pro file \"${projprofile}\" does not exists"
|
| 247 |
|
|
eerror "qmake cannot handle non-existing .pro files"
|
| 248 |
|
|
echo
|
| 249 |
|
|
eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
|
| 250 |
|
|
echo
|
| 251 |
|
|
die "Project file not found in ${PN} sources"
|
| 252 |
|
|
fi
|
| 253 |
|
|
|
| 254 |
|
|
echo >> ${LOGFILE}
|
| 255 |
|
|
echo "****** qmake ${projprofile} ******" >> ${LOGFILE}
|
| 256 |
|
|
echo >> ${LOGFILE}
|
| 257 |
|
|
|
| 258 |
|
|
# as a workaround for broken qmake, put everything into file
|
| 259 |
caleb |
1.22 |
if has debug ${IUSE} && use debug; then
|
| 260 |
troll |
1.29 |
echo -e "\nCONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile}
|
| 261 |
caleb |
1.20 |
else
|
| 262 |
troll |
1.29 |
echo -e "\nCONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile}
|
| 263 |
caleb |
1.20 |
fi
|
| 264 |
|
|
|
| 265 |
|
|
/usr/bin/qmake ${projprofile} \
|
| 266 |
|
|
QTDIR=/usr/$(get_libdir) \
|
| 267 |
|
|
QMAKE=/usr/bin/qmake \
|
| 268 |
|
|
QMAKE_CC=$(tc-getCC) \
|
| 269 |
|
|
QMAKE_CXX=$(tc-getCXX) \
|
| 270 |
|
|
QMAKE_LINK=$(tc-getCXX) \
|
| 271 |
|
|
QMAKE_CFLAGS_RELEASE="${CFLAGS}" \
|
| 272 |
|
|
QMAKE_CFLAGS_DEBUG="${CFLAGS}" \
|
| 273 |
|
|
QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
|
| 274 |
|
|
QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
|
| 275 |
|
|
QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
|
| 276 |
|
|
QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
|
| 277 |
|
|
QMAKE_RPATH= \
|
| 278 |
flameeyes |
1.36 |
"${@}" >> ${LOGFILE} 2>&1
|
| 279 |
caleb |
1.20 |
|
| 280 |
|
|
local result=$?
|
| 281 |
|
|
eend ${result}
|
| 282 |
|
|
|
| 283 |
|
|
# was qmake successful?
|
| 284 |
troll |
1.29 |
if [[ ${result} -ne 0 ]]; then
|
| 285 |
caleb |
1.20 |
echo
|
| 286 |
|
|
eerror "Running qmake on \"${projprofile}\" has failed"
|
| 287 |
|
|
echo
|
| 288 |
|
|
eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
|
| 289 |
|
|
echo
|
| 290 |
|
|
die "qmake failed on ${projprofile}"
|
| 291 |
|
|
fi
|
| 292 |
|
|
|
| 293 |
|
|
return ${result}
|
| 294 |
|
|
}
|
| 295 |
|
|
|
| 296 |
|
|
EXPORT_FUNCTIONS pkg_setup
|