| 1 |
# Copyright 2007-2008 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.19 2008/12/07 11:39:32 jmbsvicetto Exp $
|
| 4 |
|
| 5 |
# @ECLASS: kde4-base.eclass
|
| 6 |
# @MAINTAINER:
|
| 7 |
# kde@gentoo.org
|
| 8 |
# @BLURB: This eclass provides functions for kde 4.X ebuilds
|
| 9 |
# @DESCRIPTION:
|
| 10 |
# The kde4-base.eclass provides support for building KDE4 monolithic ebuilds
|
| 11 |
# and KDE4 applications.
|
| 12 |
#
|
| 13 |
# NOTE: This eclass uses the SLOT dependencies from EAPI="1" or compatible,
|
| 14 |
# and use deps from EAPI="2", hence you must define EAPI="2" in the ebuild,
|
| 15 |
# before inheriting any eclasses.
|
| 16 |
|
| 17 |
inherit base cmake-utils eutils kde4-functions multilib
|
| 18 |
|
| 19 |
case "${EAPI}" in
|
| 20 |
2)
|
| 21 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm
|
| 22 |
;;
|
| 23 |
*)
|
| 24 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm
|
| 25 |
;;
|
| 26 |
esac
|
| 27 |
|
| 28 |
# Set the qt dependencies
|
| 29 |
kde4-base_set_qt_dependencies() {
|
| 30 |
local qt qtcore qtgui qt3support qtdepend qtopengldepend
|
| 31 |
|
| 32 |
# use dependencies
|
| 33 |
case "${EAPI}" in
|
| 34 |
2 | 2_pre3 | 2_pre2 | 2_pre1)
|
| 35 |
|
| 36 |
qt="["
|
| 37 |
case "${OPENGL_REQUIRED}" in
|
| 38 |
always)
|
| 39 |
qt="${qt}opengl,"
|
| 40 |
;;
|
| 41 |
optional)
|
| 42 |
qt="${qt}opengl?,"
|
| 43 |
;;
|
| 44 |
esac
|
| 45 |
qt="${qt}accessibility,dbus,gif,jpeg,png,qt3support,ssl,zlib]"
|
| 46 |
qtcore="[qt3support,ssl]"
|
| 47 |
qtgui="[accessibility,dbus]"
|
| 48 |
qt3support="[accessibility]"
|
| 49 |
;;
|
| 50 |
esac
|
| 51 |
|
| 52 |
# split qt
|
| 53 |
qtdepend="
|
| 54 |
x11-libs/qt-core:4${qtcore}
|
| 55 |
x11-libs/qt-gui:4${qtgui}
|
| 56 |
x11-libs/qt-qt3support:4${qt3support}
|
| 57 |
x11-libs/qt-script:4
|
| 58 |
x11-libs/qt-svg:4
|
| 59 |
x11-libs/qt-test:4"
|
| 60 |
qtopengldepend="x11-libs/qt-opengl:4"
|
| 61 |
|
| 62 |
# allow monolithic qt for PV < 4.1
|
| 63 |
case "${PV}" in
|
| 64 |
scm|9999*|4.1*|4.0.9*|4.0.8*) : ;;
|
| 65 |
*)
|
| 66 |
qtdepend="|| ( ( ${qtdepend} ) >=x11-libs/qt-4.3.3:4${qt} )"
|
| 67 |
qtopengldepend="|| ( ${qtopengldepend} >=x11-libs/qt-4.3.3:4 )"
|
| 68 |
;;
|
| 69 |
esac
|
| 70 |
|
| 71 |
# opengl dependencies
|
| 72 |
case "${OPENGL_REQUIRED}" in
|
| 73 |
always)
|
| 74 |
qtdepend="${qtdepend}
|
| 75 |
${qtopengldepend}"
|
| 76 |
;;
|
| 77 |
optional)
|
| 78 |
IUSE="${IUSE} opengl"
|
| 79 |
qtdepend="${qtdepend}
|
| 80 |
opengl? ( ${qtopengldepend} )"
|
| 81 |
;;
|
| 82 |
*)
|
| 83 |
OPENGL_REQUIRED="never"
|
| 84 |
;;
|
| 85 |
esac
|
| 86 |
|
| 87 |
COMMONDEPEND="${COMMONDEPEND} ${qtdepend} !x11-libs/qt-phonon"
|
| 88 |
}
|
| 89 |
kde4-base_set_qt_dependencies
|
| 90 |
|
| 91 |
# Set the cmake dependencies
|
| 92 |
case "${PV}" in
|
| 93 |
9999*)
|
| 94 |
CMAKEDEPEND=">=dev-util/cmake-2.6"
|
| 95 |
;;
|
| 96 |
*)
|
| 97 |
CMAKEDEPEND=">=dev-util/cmake-2.4.7-r1"
|
| 98 |
;;
|
| 99 |
esac
|
| 100 |
|
| 101 |
# Set the common dependencies
|
| 102 |
DEPEND="${DEPEND} ${COMMONDEPEND} ${CMAKEDEPEND}
|
| 103 |
dev-util/pkgconfig
|
| 104 |
kde-base/automoc
|
| 105 |
x11-libs/libXt
|
| 106 |
x11-proto/xf86vidmodeproto"
|
| 107 |
RDEPEND="${RDEPEND} ${COMMONDEPEND}"
|
| 108 |
|
| 109 |
# Add the kdeprefix use flag
|
| 110 |
case "${EAPI}" in
|
| 111 |
2 | 2_pre3 | 2_pre2 | 2_pre1)
|
| 112 |
IUSE="${IUSE} kdeprefix"
|
| 113 |
;;
|
| 114 |
esac
|
| 115 |
|
| 116 |
# @ECLASS-VARIABLE: OPENGL_REQUIRED
|
| 117 |
# @DESCRIPTION:
|
| 118 |
# Is qt-opengl required? Possible values are 'always', 'optional' and 'never'.
|
| 119 |
# This variable must be set before inheriting any eclasses. Defaults to 'never'.
|
| 120 |
OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}"
|
| 121 |
|
| 122 |
# @ECLASS-VARIABLE: CPPUNIT_REQUIRED
|
| 123 |
# @DESCRIPTION:
|
| 124 |
# Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'.
|
| 125 |
# This variable must be set before inheriting any eclasses. Defaults to 'never'.
|
| 126 |
CPPUNIT_REQUIRED="${CPPUNIT_REQUIRED:-never}"
|
| 127 |
|
| 128 |
case "${CPPUNIT_REQUIRED}" in
|
| 129 |
always)
|
| 130 |
DEPEND="${DEPEND} dev-util/cppunit"
|
| 131 |
;;
|
| 132 |
optional)
|
| 133 |
IUSE="${IUSE} test"
|
| 134 |
DEPEND="${DEPEND}
|
| 135 |
test? ( dev-util/cppunit )"
|
| 136 |
;;
|
| 137 |
*)
|
| 138 |
CPPUNIT_REQUIRED="never"
|
| 139 |
;;
|
| 140 |
esac
|
| 141 |
|
| 142 |
# @ECLASS-VARIABLE: NEED_KDE
|
| 143 |
# @DESCRIPTION:
|
| 144 |
# This variable sets the version of KDE4 which will be used by the eclass.
|
| 145 |
# This variable must be set by the ebuild, for all categories except for "kde-base".
|
| 146 |
# For kde-base packages, if it is not set by the ebuild,
|
| 147 |
# it's assumed that the required KDE4 version is the latest, non-live, available.
|
| 148 |
#
|
| 149 |
# @CODE
|
| 150 |
# Acceptable values are:
|
| 151 |
# - latest - Use latest version in the portage tree
|
| 152 |
# Default for kde-base ebuilds. Banned for ebuilds not part of kde or koffice.
|
| 153 |
# - svn - Use svn release (live ebuilds)
|
| 154 |
# - :SLOT - Use any version in the SLOT specified in the NEED_KDE value.
|
| 155 |
# - VERSION_NUMBER - Use the minimum KDE4 version specified in the NEED_KDE value.
|
| 156 |
# - VERSION_NUMBER:SLOT - Use the minimum KDE4 version and the SLOT specified in the NEED_KDE value.
|
| 157 |
# - none - Let the ebuild handle SLOT, kde dependencies, KDEDIR, ...
|
| 158 |
# @CODE
|
| 159 |
#
|
| 160 |
# Note: There is no default NEED_KDE for ebuilds not in kde-base or part of
|
| 161 |
# koffice, so you must set it explicitly in the ebuild, in all other cases.
|
| 162 |
if [[ -z ${NEED_KDE} ]]; then
|
| 163 |
if [[ -n ${KDEBASE} ]]; then
|
| 164 |
NEED_KDE="latest"
|
| 165 |
else
|
| 166 |
die "kde4-base.eclass inherited but NEED_KDE not defined - broken ebuild"
|
| 167 |
fi
|
| 168 |
fi
|
| 169 |
export NEED_KDE
|
| 170 |
|
| 171 |
case ${NEED_KDE} in
|
| 172 |
latest)
|
| 173 |
# Should only be used by 'kde-base'-ebuilds
|
| 174 |
if [[ "${KDEBASE}" == "kde-base" ]]; then
|
| 175 |
case ${PV} in
|
| 176 |
4.1*| 4.0.9* | 4.0.8*)
|
| 177 |
_kdedir="4.1"
|
| 178 |
_pv="-${PV}:4.1" ;;
|
| 179 |
4.0*)
|
| 180 |
_kdedir="4.0"
|
| 181 |
_pv="-${PV}:kde-4" ;;
|
| 182 |
3.9*)
|
| 183 |
_kdedir="3.9"
|
| 184 |
_pv="-${PV}:kde-4" ;;
|
| 185 |
*)
|
| 186 |
die "NEED_KDE=latest not supported for PV=${PV}" ;;
|
| 187 |
esac
|
| 188 |
_operator=">="
|
| 189 |
else
|
| 190 |
case ${PV} in
|
| 191 |
4.1 | 4.0.9* | 4.0.8*) _kdedir="4.1" ;;
|
| 192 |
4.0*) _kdedir="4.0" ;;
|
| 193 |
3.9*) _kdedir="3.9" ;;
|
| 194 |
*) die "NEED_KDE=latest not supported for PV=${PV}" ;;
|
| 195 |
esac
|
| 196 |
fi
|
| 197 |
;;
|
| 198 |
|
| 199 |
# NEED_KDE=":${SLOT}"
|
| 200 |
:kde-svn)
|
| 201 |
_kdedir="svn"
|
| 202 |
_pv="-${NEED_KDE}"
|
| 203 |
export NEED_KDE="svn"
|
| 204 |
;;
|
| 205 |
:4.1)
|
| 206 |
_kdedir="4.1"
|
| 207 |
_pv="${NEED_KDE}"
|
| 208 |
;;
|
| 209 |
:kde-4)
|
| 210 |
_kdedir="4.0"
|
| 211 |
_pv="${NEED_KDE}"
|
| 212 |
;;
|
| 213 |
|
| 214 |
# NEED_KDE="${PV}:${SLOT}"
|
| 215 |
*:kde-svn)
|
| 216 |
_kdedir="svn"
|
| 217 |
_operator=">="
|
| 218 |
_pv="-${NEED_KDE}"
|
| 219 |
export NEED_KDE="svn"
|
| 220 |
;;
|
| 221 |
*:4.1)
|
| 222 |
_kdedir="4.1"
|
| 223 |
_operator=">="
|
| 224 |
_pv="-${NEED_KDE}"
|
| 225 |
;;
|
| 226 |
*:kde-4)
|
| 227 |
_kdedir="4.0"
|
| 228 |
_operator=">="
|
| 229 |
_pv="-${NEED_KDE}"
|
| 230 |
;;
|
| 231 |
|
| 232 |
# NEED_KDE="${PV}"
|
| 233 |
scm|svn|9999*)
|
| 234 |
_kdedir="svn"
|
| 235 |
_operator=">="
|
| 236 |
_pv="-${NEED_KDE}:kde-svn"
|
| 237 |
export NEED_KDE="svn"
|
| 238 |
;;
|
| 239 |
4.1 | 4.0.9* | 4.0.8*)
|
| 240 |
_kdedir="4.1"
|
| 241 |
_operator=">="
|
| 242 |
_pv="-${NEED_KDE}:4.1"
|
| 243 |
;;
|
| 244 |
4.0* | 4)
|
| 245 |
_kdedir="4.0"
|
| 246 |
_operator=">="
|
| 247 |
_pv="-${NEED_KDE}:kde-4"
|
| 248 |
;;
|
| 249 |
3.9*)
|
| 250 |
_kdedir="3.9"
|
| 251 |
_operator=">="
|
| 252 |
_pv="-${NEED_KDE}:kde-4"
|
| 253 |
;;
|
| 254 |
|
| 255 |
# The ebuild handles dependencies, KDEDIR, SLOT.
|
| 256 |
none)
|
| 257 |
:
|
| 258 |
;;
|
| 259 |
|
| 260 |
*)
|
| 261 |
die "NEED_KDE=${NEED_KDE} currently not supported."
|
| 262 |
;;
|
| 263 |
esac
|
| 264 |
|
| 265 |
if [[ ${NEED_KDE} != none ]]; then
|
| 266 |
|
| 267 |
#Set the SLOT
|
| 268 |
if [[ -n ${KDEBASE} ]]; then
|
| 269 |
if [[ ${NEED_KDE} = svn ]]; then
|
| 270 |
SLOT="kde-svn"
|
| 271 |
else
|
| 272 |
case ${PV} in
|
| 273 |
4.1* | 4.0.9* | 4.0.8*) SLOT="4.1" ;;
|
| 274 |
*) SLOT="kde-4" ;;
|
| 275 |
esac
|
| 276 |
fi
|
| 277 |
fi
|
| 278 |
|
| 279 |
# Block install of other SLOTS unless kdeprefix
|
| 280 |
case "${EAPI}" in
|
| 281 |
2 | 2_pre3 | 2_pre2 | 2_pre1)
|
| 282 |
for KDE_SLOT in ${KDE_SLOTS[@]}; do
|
| 283 |
# block non kdeprefix ${PN} on other slots
|
| 284 |
if [[ ${SLOT} != ${KDE_SLOT} ]]; then
|
| 285 |
DEPEND="${DEPEND}
|
| 286 |
!kdeprefix? ( !kde-base/${PN}:${KDE_SLOT}[-kdeprefix] )"
|
| 287 |
RDEPEND="${RDEPEND}
|
| 288 |
!kdeprefix? ( !kde-base/${PN}:${KDE_SLOT}[-kdeprefix] )"
|
| 289 |
fi
|
| 290 |
done
|
| 291 |
;;
|
| 292 |
esac
|
| 293 |
|
| 294 |
# Adding kdelibs, kdepimlibs and kdebase-data deps to all other packages.
|
| 295 |
# We only need to add the dependencies if ${PN} is not "kdelibs" or "kdepimlibs"
|
| 296 |
if [[ ${PN} != "kdelibs" ]]; then
|
| 297 |
case "${EAPI}" in
|
| 298 |
2 | 2_pre3 | 2_pre2 | 2_pre1)
|
| 299 |
DEPEND="${DEPEND} ${_operator}kde-base/kdelibs${_pv}[kdeprefix=]"
|
| 300 |
RDEPEND="${RDEPEND} ${_operator}kde-base/kdelibs${_pv}[kdeprefix=]"
|
| 301 |
;;
|
| 302 |
*)
|
| 303 |
DEPEND="${DEPEND} ${_operator}kde-base/kdelibs${_pv}"
|
| 304 |
RDEPEND="${RDEPEND} ${_operator}kde-base/kdelibs${_pv}"
|
| 305 |
;;
|
| 306 |
esac
|
| 307 |
if [[ ${PN} != "kdepimlibs" ]]; then
|
| 308 |
case "${EAPI}" in
|
| 309 |
2 | 2_pre3 | 2_pre2 | 2_pre1)
|
| 310 |
DEPEND="${DEPEND} ${_operator}kde-base/kdepimlibs${_pv}[kdeprefix=]"
|
| 311 |
RDEPEND="${RDEPEND} ${_operator}kde-base/kdepimlibs${_pv}[kdeprefix=]"
|
| 312 |
;;
|
| 313 |
*)
|
| 314 |
DEPEND="${DEPEND} ${_operator}kde-base/kdepimlibs${_pv}"
|
| 315 |
RDEPEND="${RDEPEND} ${_operator}kde-base/kdepimlibs${_pv}"
|
| 316 |
esac
|
| 317 |
if [[ ${PN} != "kdebase-data" ]]; then
|
| 318 |
case "${EAPI}" in
|
| 319 |
2)
|
| 320 |
RDEPEND="${RDEPEND} ${_operator}kde-base/kdebase-data${_pv}[kdeprefix=]"
|
| 321 |
;;
|
| 322 |
*)
|
| 323 |
RDEPEND="${RDEPEND} ${_operator}kde-base/kdebase-data${_pv}"
|
| 324 |
;;
|
| 325 |
esac
|
| 326 |
fi
|
| 327 |
fi
|
| 328 |
fi
|
| 329 |
|
| 330 |
unset _operator _pv
|
| 331 |
fi
|
| 332 |
|
| 333 |
# Fetch section - If the ebuild's category is not 'kde-base' and if it is not a
|
| 334 |
# koffice ebuild, the URI should be set in the ebuild itself
|
| 335 |
if [[ -n ${KDEBASE} ]]; then
|
| 336 |
if [[ -n ${KMNAME} ]]; then
|
| 337 |
_kmname=${KMNAME}
|
| 338 |
else
|
| 339 |
_kmname=${PN}
|
| 340 |
fi
|
| 341 |
_kmname_pv="${_kmname}-${PV}"
|
| 342 |
if [[ ${NEED_KDE} != "svn" ]]; then
|
| 343 |
case ${KDEBASE} in
|
| 344 |
kde-base)
|
| 345 |
case ${PV} in
|
| 346 |
4.0.9* | 4.0.8*)
|
| 347 |
SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
|
| 348 |
*) SRC_URI="mirror://kde/stable/${PV}/src/${_kmname_pv}.tar.bz2";;
|
| 349 |
esac
|
| 350 |
;;
|
| 351 |
koffice)
|
| 352 |
SRC_URI="mirror://kde/unstable/${_kmname_pv}/src/${_kmname_pv}.tar.bz2"
|
| 353 |
;;
|
| 354 |
esac
|
| 355 |
fi
|
| 356 |
unset _kmname _kmname_pv
|
| 357 |
fi
|
| 358 |
|
| 359 |
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
|
| 360 |
|
| 361 |
# @ECLASS-VARIABLE: PREFIX
|
| 362 |
# @DESCRIPTION:
|
| 363 |
# Set the installation PREFIX. All kde-base ebuilds go into the KDE4 installation directory.
|
| 364 |
# Applications installed by the other ebuilds go into /usr/ by default, this value
|
| 365 |
# can be superseded by defining PREFIX before inheriting kde4-base.
|
| 366 |
# This value is set on pkg_setup
|
| 367 |
PREFIX=""
|
| 368 |
|
| 369 |
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SLOT ${SLOT} - NEED_KDE ${NEED_KDE}"
|
| 370 |
|
| 371 |
# @FUNCTION: kde4-base_pkg_setup
|
| 372 |
# @DESCRIPTION:
|
| 373 |
# Adds flags needed by all of KDE 4 to $QT4_BUILT_WITH_USE_CHECK. Uses
|
| 374 |
# kde4-functions_check_use from kde4-functions.eclass to print appropriate
|
| 375 |
# errors and die if any required flags listed in $QT4_BUILT_WITH_USE_CHECK or
|
| 376 |
# $KDE4_BUILT_WITH_USE_CHECK are missing.
|
| 377 |
kde4-base_pkg_setup() {
|
| 378 |
debug-print-function $FUNCNAME "$@"
|
| 379 |
|
| 380 |
# Don't set KDEHOME during compile, it will cause access violations
|
| 381 |
unset KDEHOME
|
| 382 |
|
| 383 |
if [[ ${NEED_KDE} != none ]]; then
|
| 384 |
|
| 385 |
# Set PREFIX
|
| 386 |
case "${EAPI}" in
|
| 387 |
2 | 2_pre3 | 2_pre2 | 2_pre1)
|
| 388 |
if use kdeprefix; then
|
| 389 |
KDEDIR="/usr/kde/${_kdedir}"
|
| 390 |
KDEDIRS="/usr:/usr/local:${KDEDIR}"
|
| 391 |
else
|
| 392 |
KDEDIR="/usr"
|
| 393 |
KDEDIRS="/usr:/usr/local"
|
| 394 |
fi
|
| 395 |
;;
|
| 396 |
*)
|
| 397 |
KDEDIR="/usr"
|
| 398 |
KDEDIRS="/usr:/usr/local"
|
| 399 |
;;
|
| 400 |
esac
|
| 401 |
fi
|
| 402 |
|
| 403 |
# Set the prefix based on KDEDIR
|
| 404 |
# Make it a consequence of kdeprefix
|
| 405 |
PREFIX=${KDEDIR}
|
| 406 |
|
| 407 |
unset _kdedir
|
| 408 |
|
| 409 |
case "${EAPI}" in
|
| 410 |
2 | 2_pre3 | 2_pre2 | 2_pre1)
|
| 411 |
[[ -n ${QT4_BUILT_WITH_USE_CHECK} || -n ${KDE4_BUILT_WITH_USE_CHECK[@]} ]] && \
|
| 412 |
die "built_with_use illegal in this EAPI!"
|
| 413 |
;;
|
| 414 |
*)
|
| 415 |
# Make KDE4_BUILT_WITH_USE_CHECK an array if it isn't already
|
| 416 |
local line kde4_built_with_use_check=()
|
| 417 |
if [[ -n ${KDE4_BUILT_WITH_USE_CHECK[@]} && $(declare -p KDE4_BUILT_WITH_USE_CHECK) != 'declare -a '* ]]; then
|
| 418 |
while read line; do
|
| 419 |
[[ -z ${line} ]] && continue
|
| 420 |
kde4_built_with_use_check+=("${line}")
|
| 421 |
done <<< "${KDE4_BUILT_WITH_USE_CHECK}"
|
| 422 |
KDE4_BUILT_WITH_USE_CHECK=("${kde4_built_with_use_check[@]}")
|
| 423 |
fi
|
| 424 |
|
| 425 |
# KDE4 applications require qt4 compiled with USE="accessibility dbus gif jpeg png qt3support ssl zlib".
|
| 426 |
if has_version '<x11-libs/qt-4.4_alpha:4'; then
|
| 427 |
QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus gif jpeg png qt3support ssl zlib"
|
| 428 |
else
|
| 429 |
KDE4_BUILT_WITH_USE_CHECK=("${KDE4_BUILT_WITH_USE_CHECK[@]}"
|
| 430 |
"x11-libs/qt-core qt3support ssl"
|
| 431 |
"x11-libs/qt-gui accessibility dbus"
|
| 432 |
"x11-libs/qt-qt3support accessibility")
|
| 433 |
fi
|
| 434 |
|
| 435 |
if has opengl ${IUSE//+} && use opengl || [[ ${OPENGL_REQUIRED} == always ]]; then
|
| 436 |
if has_version '<x11-libs/qt-4.4.0_alpha:4'; then
|
| 437 |
QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl"
|
| 438 |
fi
|
| 439 |
fi
|
| 440 |
kde4-functions_check_use
|
| 441 |
;;
|
| 442 |
esac
|
| 443 |
}
|
| 444 |
|
| 445 |
# @FUNCTION: kde4-base_apply_patches
|
| 446 |
# @DESCRIPTION:
|
| 447 |
# This function applies patches.
|
| 448 |
#
|
| 449 |
# If the directory ${WORKDIR}/patches/ exists, we apply all patches in that
|
| 450 |
# directory, provided they follow this format:
|
| 451 |
# @CODE
|
| 452 |
# - Monolithic ebuilds, (from kde-base)
|
| 453 |
# - $CATEGORY=kde-base:
|
| 454 |
# Apply ${CHILD_EBUILD_NAME}-${SLOT}-*{diff,patch}
|
| 455 |
# - $CATEGORY=!kde-base:
|
| 456 |
# Apply ${CHILD_EBUILD_NAME}-${PV}-*{diff,patch}
|
| 457 |
# - Split ebuilds:
|
| 458 |
# - $CATEGORY=kde-base:
|
| 459 |
# Apply ${PN}-${SLOT}-*{diff,patch}
|
| 460 |
# - $CATEGORY!=kde-base:
|
| 461 |
# Apply ${PN}-${PV}-*{diff,patch}
|
| 462 |
# @CODE
|
| 463 |
#
|
| 464 |
# If ${PATCHES} is non-zero all patches in it get applied. If there is more
|
| 465 |
# than one patch please make ${PATCHES} an array for proper quoting.
|
| 466 |
kde4-base_apply_patches() {
|
| 467 |
local _patchdir _packages _p _f
|
| 468 |
_patchdir="${WORKDIR}/patches/"
|
| 469 |
if [[ -d "${_patchdir}" ]]; then
|
| 470 |
if is-parent-package ${CATEGORY}/${PN} ; then
|
| 471 |
_packages="$(get-child-packages ${CATEGORY}/${PN})"
|
| 472 |
_packages="${_packages//${CATEGORY}\//} ${PN}"
|
| 473 |
else
|
| 474 |
_packages="${PN}"
|
| 475 |
fi
|
| 476 |
if [[ $(declare -p PATCHES) != 'declare -a '* ]]; then
|
| 477 |
die "PATCHES needs to be an array!"
|
| 478 |
fi
|
| 479 |
for _p in ${_packages}; do
|
| 480 |
for _f in "${_patchdir}"/${_p}-${PV}-*{diff,patch}; do
|
| 481 |
[[ -e ${_f} ]] && PATCHES+=("${_f}")
|
| 482 |
done
|
| 483 |
if [[ -n "${KDEBASE}" ]]; then
|
| 484 |
for _f in "${_patchdir}"/${_p}-${SLOT}-*{diff,patch}; do
|
| 485 |
[[ -e ${_f} ]] && PATCHES+=("${_f}")
|
| 486 |
done
|
| 487 |
fi
|
| 488 |
done
|
| 489 |
fi
|
| 490 |
[[ -n ${PATCHES[@]} ]] && base_src_unpack autopatch
|
| 491 |
}
|
| 492 |
|
| 493 |
# @FUNCTION: kde4-base_src_unpack
|
| 494 |
# @DESCRIPTION:
|
| 495 |
# This function unpacks the source tarballs for KDE4 applications.
|
| 496 |
#
|
| 497 |
# If no argument is passed to this function, then standard src_unpack is
|
| 498 |
# executed. Otherwise options are passed to base_src_unpack.
|
| 499 |
#
|
| 500 |
# In addition it calls kde4-base_apply_patches when no arguments are passed to
|
| 501 |
# this function.
|
| 502 |
#
|
| 503 |
# It also handles translations if KDE_LINGUAS is defined. See KDE_LINGUAS and
|
| 504 |
# enable_selected_linguas() in kde4-functions.eclass(5) for further details.
|
| 505 |
kde4-base_src_unpack() {
|
| 506 |
debug-print-function $FUNCNAME "$@"
|
| 507 |
|
| 508 |
[[ -z "${KDE_S}" ]] && KDE_S="${S}"
|
| 509 |
|
| 510 |
if [[ -z $* ]]; then
|
| 511 |
# Unpack first and deal with KDE patches after examing possible patch sets.
|
| 512 |
# To be picked up, patches need to conform to the guidelines stated before.
|
| 513 |
# Monolithic ebuilds will use the split ebuild patches.
|
| 514 |
[[ -d "${KDE_S}" ]] || unpack ${A}
|
| 515 |
base_src_unpack $*
|
| 516 |
else
|
| 517 |
# Call base_src_unpack, which unpacks and patches
|
| 518 |
# step by step transparently as defined in the ebuild.
|
| 519 |
base_src_unpack $*
|
| 520 |
fi
|
| 521 |
|
| 522 |
# Updated cmake dir
|
| 523 |
if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then
|
| 524 |
ebegin "Updating cmake/ directory..."
|
| 525 |
rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory"
|
| 526 |
ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory"
|
| 527 |
eend 0
|
| 528 |
fi
|
| 529 |
|
| 530 |
# Only enable selected languages, used for KDE extragear apps.
|
| 531 |
if [[ -n ${KDE_LINGUAS} ]]; then
|
| 532 |
enable_selected_linguas
|
| 533 |
fi
|
| 534 |
}
|
| 535 |
|
| 536 |
|
| 537 |
# transition function so we will be compatible with soon to come eclasses
|
| 538 |
kde4-base_src_prepare() {
|
| 539 |
echo
|
| 540 |
}
|
| 541 |
|
| 542 |
# @FUNCTION: kde4-base_src_compile
|
| 543 |
# @DESCRIPTION:
|
| 544 |
# General function for compiling KDE4 applications.
|
| 545 |
kde4-base_src_compile() {
|
| 546 |
debug-print-function ${FUNCNAME} "$@"
|
| 547 |
case "${EAPI}" in
|
| 548 |
2)
|
| 549 |
;;
|
| 550 |
*)
|
| 551 |
kde4-base_src_configure
|
| 552 |
;;
|
| 553 |
esac
|
| 554 |
if [[ -d ${WORKDIR}/${PN}_build ]]; then
|
| 555 |
pushd "${WORKDIR}"/${PN}_build > /dev/null
|
| 556 |
fi
|
| 557 |
[ -e [Mm]akefile ] && kde4-base_src_make
|
| 558 |
}
|
| 559 |
|
| 560 |
# @FUNCTION: kde4-base_src_configure
|
| 561 |
# @DESCRIPTION:
|
| 562 |
# Function for configuring the build of KDE4 applications.
|
| 563 |
kde4-base_src_configure() {
|
| 564 |
debug-print-function ${FUNCNAME} "$@"
|
| 565 |
|
| 566 |
# Final flag handling
|
| 567 |
if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then
|
| 568 |
echo "Activating enable-final flag"
|
| 569 |
mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON"
|
| 570 |
fi
|
| 571 |
|
| 572 |
# Enable generation of HTML handbook
|
| 573 |
if has htmlhandbook ${IUSE//+} && use htmlhandbook; then
|
| 574 |
echo "Enabling building of HTML handbook"
|
| 575 |
mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON"
|
| 576 |
fi
|
| 577 |
|
| 578 |
# Build tests in src_test only, where we override this value
|
| 579 |
mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF"
|
| 580 |
|
| 581 |
# Set distribution name
|
| 582 |
[[ ${PN} == "kdelibs" ]] && mycmakeargs="${mycmakeargs} -DKDE_DISTRIBUTION_TEXT=Gentoo"
|
| 583 |
|
| 584 |
# runpath linking
|
| 585 |
mycmakeargs="${mycmakeargs} -DKDE4_USE_ALWAYS_FULL_RPATH=ON"
|
| 586 |
|
| 587 |
# Here we set the install prefix
|
| 588 |
mycmakeargs="${mycmakeargs} -DCMAKE_INSTALL_PREFIX=${PREFIX}"
|
| 589 |
|
| 590 |
# If prefix is /usr, sysconf needs to be /etc, not /usr/etc
|
| 591 |
[[ "${PREFIX}" == "/usr" ]] && mycmakeargs="${mycmakeargs} -DSYSCONF_INSTALL_DIR=/etc"
|
| 592 |
|
| 593 |
# Set environment
|
| 594 |
QTEST_COLORED=1
|
| 595 |
QT_PLUGIN_PATH=${KDEDIR}/$(get_libdir)/kde4/plugins/
|
| 596 |
|
| 597 |
# hardcode path to *.cmake KDE files
|
| 598 |
PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+${PKG_CONFIG_PATH}:}${KDEDIR}/$(get_libdir)/pkgconfig"
|
| 599 |
|
| 600 |
[ -e CMakeLists.txt ] && cmake-utils_src_configureout
|
| 601 |
}
|
| 602 |
|
| 603 |
# @FUNCTION: kde4-base_src_make
|
| 604 |
# @DESCRIPTION:
|
| 605 |
# Function for building KDE4 applications.
|
| 606 |
# Options are passed to cmake-utils_src_make.
|
| 607 |
kde4-base_src_make() {
|
| 608 |
debug-print-function ${FUNCNAME} "$@"
|
| 609 |
|
| 610 |
cmake-utils_src_make "$@"
|
| 611 |
}
|
| 612 |
|
| 613 |
# @FUNCTION: kde4-base_src_test
|
| 614 |
# @DESCRIPTION:
|
| 615 |
# Function for testing KDE4 applications.
|
| 616 |
kde4-base_src_test() {
|
| 617 |
debug-print-function ${FUNCNAME} "$@"
|
| 618 |
|
| 619 |
# Override this value, set in kde4-base_src_configure()
|
| 620 |
mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=ON"
|
| 621 |
cmake-utils_src_compile
|
| 622 |
|
| 623 |
cmake-utils_src_test
|
| 624 |
}
|
| 625 |
|
| 626 |
# @FUNCTION: kde4-base_src_install
|
| 627 |
# @DESCRIPTION:
|
| 628 |
# Function for installing KDE4 applications.
|
| 629 |
kde4-base_src_install() {
|
| 630 |
debug-print-function ${FUNCNAME} "$@"
|
| 631 |
|
| 632 |
kde4-base_src_make_doc
|
| 633 |
if [[ -d ${WORKDIR}/${PN}_build ]]; then
|
| 634 |
pushd "${WORKDIR}"/${PN}_build > /dev/null
|
| 635 |
fi
|
| 636 |
[ -e [Mm]akefile ] && cmake-utils_src_install
|
| 637 |
}
|
| 638 |
|
| 639 |
# @FUNCTION: kde4-base_src_make_doc
|
| 640 |
# @DESCRIPTION:
|
| 641 |
# Function for installing the documentation of KDE4 applications.
|
| 642 |
kde4-base_src_make_doc() {
|
| 643 |
debug-print-function ${FUNCNAME} "$@"
|
| 644 |
|
| 645 |
local doc
|
| 646 |
for doc in AUTHORS ChangeLog* README* NEWS TODO; do
|
| 647 |
[[ -s $doc ]] && dodoc ${doc}
|
| 648 |
done
|
| 649 |
|
| 650 |
if [[ -z ${KMNAME} ]]; then
|
| 651 |
for doc in {apps,runtime,workspace,.}/*/{AUTHORS,README*}; do
|
| 652 |
if [[ -s $doc ]]; then
|
| 653 |
local doc_complete=${doc}
|
| 654 |
doc="${doc#*/}"
|
| 655 |
newdoc "$doc_complete" "${doc%/*}.${doc##*/}"
|
| 656 |
fi
|
| 657 |
done
|
| 658 |
fi
|
| 659 |
|
| 660 |
if [[ -n ${KDEBASE} && -d "${D}"/usr/share/doc/${PF} ]]; then
|
| 661 |
# work around bug #97196
|
| 662 |
dodir /usr/share/doc/kde && \
|
| 663 |
mv "${D}"/usr/share/doc/${PF} "${D}"/usr/share/doc/kde/ || \
|
| 664 |
die "Failed to move docs to kde/ failed."
|
| 665 |
fi
|
| 666 |
}
|
| 667 |
|
| 668 |
# @FUNCTION: kde4-base_pkg_postinst
|
| 669 |
# @DESCRIPTION:
|
| 670 |
# Function to rebuild the KDE System Configuration Cache after an application has been installed.
|
| 671 |
kde4-base_pkg_postinst() {
|
| 672 |
buildsycoca
|
| 673 |
}
|
| 674 |
|
| 675 |
# @FUNCTION: kde4-base_pkg_postrm
|
| 676 |
# @DESCRIPTION:
|
| 677 |
# Function to rebuild the KDE System Configuration Cache after an application has been removed.
|
| 678 |
kde4-base_pkg_postrm() {
|
| 679 |
buildsycoca
|
| 680 |
}
|