/[gentoo-x86]/eclass/kde4-base.eclass
Gentoo

Diff of /eclass/kde4-base.eclass

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

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

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.20