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

Diff of /eclass/kde4-meta.eclass

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

Revision 1.5 Revision 1.6
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-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-meta.eclass,v 1.5 2008/03/13 17:57:51 ingmar Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-meta.eclass,v 1.6 2008/05/15 19:49:32 ingmar Exp $
4# 4#
5# @ECLASS: kde4-meta.eclass 5# @ECLASS: kde4-meta.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kde@gentoo.org 7# kde@gentoo.org
8# @BLURB: Eclass for writing "split" KDE packages. 8# @BLURB: Eclass for writing "split" KDE packages.
26case ${KDEBASE} in 26case ${KDEBASE} in
27 kde-base) HOMEPAGE="http://www.kde.org/" 27 kde-base) HOMEPAGE="http://www.kde.org/"
28 LICENSE="GPL-2" ;; 28 LICENSE="GPL-2" ;;
29 koffice) HOMEPAGE="http://www.koffice.org/" 29 koffice) HOMEPAGE="http://www.koffice.org/"
30 LICENSE="GPL-2" ;; 30 LICENSE="GPL-2" ;;
31 *) die "KDEBASE=${KDEBASE} is unsupported." ;;
32esac 31esac
33 32
34debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - before blockers" 33debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - before blockers"
35debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - before blockers" 34debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - before blockers"
36 35
37# Add a blocker on the package we're derived from 36# Add a blocker on the package we're derived from
37if [[ -n ${KDEBASE} ]]; then
38DEPEND="${DEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}" 38 DEPEND="${DEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}"
39RDEPEND="${RDEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}" 39 RDEPEND="${RDEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}"
40fi
40 41
41debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after blockers" 42debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after blockers"
42debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after blockers" 43debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after blockers"
43 44
44# Add dependencies that all packages in a certain module share. 45# Add dependencies that all packages in a certain module share.
46 kdebase|kdebase-workspace|kdebase-runtime) 47 kdebase|kdebase-workspace|kdebase-runtime)
47 DEPEND="${DEPEND} >=kde-base/qimageblitz-0.0.4" 48 DEPEND="${DEPEND} >=kde-base/qimageblitz-0.0.4"
48 RDEPEND="${RDEPEND} >=kde-base/qimageblitz-0.0.4" 49 RDEPEND="${RDEPEND} >=kde-base/qimageblitz-0.0.4"
49 ;; 50 ;;
50 kdepim) 51 kdepim)
52 DEPEND="${DEPEND} dev-libs/boost"
53 RDEPEND="${RDEPEND} dev-libs/boost"
51 if [[ ${PN} != kode ]]; then 54 if [[ ${PN} != kode ]]; then
52 DEPEND="${DEPEND} >=kde-base/kode-${PV}:${SLOT}" 55 DEPEND="${DEPEND} >=kde-base/kode-${PV}:${SLOT}"
53 RDEPEND="${RDEPEND} >=kde-base/kode-${PV}:${SLOT}" 56 RDEPEND="${RDEPEND} >=kde-base/kode-${PV}:${SLOT}"
54 fi 57 fi
55 case ${PN} in 58 case ${PN} in
139# This function unpacks the source for split ebuilds. See also 142# This function unpacks the source for split ebuilds. See also
140# kde4-meta-src_extract. 143# kde4-meta-src_extract.
141kde4-meta_src_unpack() { 144kde4-meta_src_unpack() {
142 debug-print-function ${FUNCNAME} "$@" 145 debug-print-function ${FUNCNAME} "$@"
143 146
144 if [[ ${KMNAME} = kdepim ]] && \
145 has kontact ${IUSE//+} && \
146 use kontact; then
147 KMEXTRA="${KMEXTRA} kontact/plugins/${PLUGINNAME:-${PN}}"
148 KMEXTRACTONLY="${KMEXTRACTONLY} kontact/interfaces/"
149 fi
150
151 kde4-meta_src_extract 147 kde4-meta_src_extract
152 kde4-meta_change_cmakelists 148 kde4-meta_change_cmakelists
153} 149}
154 150
155# @FUNCTION: kde4-meta_src_extract 151# @FUNCTION: kde4-meta_src_extract
229 ;; 225 ;;
230 kdegames) 226 kdegames)
231 if [[ ${PN} != "libkdegames" ]]; then 227 if [[ ${PN} != "libkdegames" ]]; then
232 KMEXTRACTONLY="${KMEXTRACTONLY} 228 KMEXTRACTONLY="${KMEXTRACTONLY}
233 libkdegames" 229 libkdegames"
230 fi
231 ;;
232 kdepim)
233 KMEXTRACTONLY="${KMEXTRACTONLY}
234 kleopatra/ConfigureChecks.cmake"
235 if has kontact ${IUSE//+} && use kontact; then
236 KMEXTRA="${KMEXTRA} kontact/plugins/${PLUGINNAME:-${PN}}"
237 KMEXTRACTONLY="${KMEXTRACTONLY} kontact/interfaces/"
234 fi 238 fi
235 ;; 239 ;;
236 koffice) 240 koffice)
237 KMEXTRACTONLY="${KMEXTRACTONLY} 241 KMEXTRACTONLY="${KMEXTRACTONLY}
238 config-endian.h.cmake 242 config-endian.h.cmake
296 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}" 300 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}"
297 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded: ${kmmodule_expanded}" 301 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded: ${kmmodule_expanded}"
298 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}" 302 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}"
299 303
300 304
301 case ${NEED_KDE} in 305 case ${PV} in
302 svn) : ;; 306 scm|9999.4) : ;;
303 *) topdir="${KMNAME}-${PV}/" ;; 307 *) topdir="${KMNAME}-${PV}/" ;;
304 esac 308 esac
305 309
306 # Create final list of stuff to extract 310 # Create final list of stuff to extract
307 for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \ 311 for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \
311 done 315 done
312 316
313 echo ${extractlist} 317 echo ${extractlist}
314} 318}
315 319
320save_library_dependencies() {
321 local depsfile="${T}/${PN}:${SLOT}"
322
323 echo "Saving library dependendencies in ${depsfile##*/}"
324 echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" || \
325 die "Failed to save the library dependencies."
326}
327
328install_library_dependencies() {
329 local depsfile="${T}/${PN}:${SLOT}"
330 echo "Installing library dependendencies as ${depsfile##*/}"
331 insinto /var/lib/kde
332 doins "${depsfile}" || die "Failed to install library dependencies."
333}
334
335load_library_dependencies() {
336 local pn i depsfile
337 echo "Injecting library dependendencies from '${KMLOADLIBS}'"
338
339 i=0
340 for pn in ${KMLOADLIBS} ; do
341 ((i++))
342 depsfile="/var/lib/kde/${pn}:${SLOT}"
343 [[ -r "${depsfile}" ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}."
344 sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \
345 die "Failed to include library dependencies for ${pn}"
346 done
347}
348
316# @FUNCTION: kde4-meta_src_compile 349# @FUNCTION: kde4-meta_src_compile
317# @DESCRIPTION: 350# @DESCRIPTION:
318# General function for compiling split KDE4 applications. 351# General function for compiling split KDE4 applications.
319kde4-meta_src_compile() { 352kde4-meta_src_compile() {
320 debug-print-function ${FUNCNAME} "$@" 353 debug-print-function ${FUNCNAME} "$@"
327 debug-print-function ${FUNCNAME} "$@" 360 debug-print-function ${FUNCNAME} "$@"
328 361
329 local _olddir _dir 362 local _olddir _dir
330 _dir="${S}"/${1} 363 _dir="${S}"/${1}
331 until [[ ${_dir} == "${S}" ]]; do 364 until [[ ${_dir} == "${S}" ]]; do
332 _olddir=$(basename ${_dir}) 365 _olddir=$(basename "${_dir}")
333 _dir=$(dirname ${_dir}) 366 _dir=$(dirname "${_dir}")
334 debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}" 367 debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}"
335 if [[ -f ${_dir}/CMakeLists.txt ]]; then 368 if [[ -f ${_dir}/CMakeLists.txt ]]; then
336 sed -i -e "/[[:space:]]*${_olddir}[[:space:]]*/s/^#DONOTCOMPILE //" ${_dir}/CMakeLists.txt || \ 369 sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
370 -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
337 die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}" 371 -i ${_dir}/CMakeLists.txt || die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}"
338 fi 372 fi
339 done 373 done
340} 374}
341 375
342kde4-meta_change_cmakelists() { 376kde4-meta_change_cmakelists() {
343 debug-print-function ${FUNCNAME} "$@" 377 debug-print-function ${FUNCNAME} "$@"
344 378
345 pushd "${S}" > /dev/null 379 pushd "${S}" > /dev/null
346 380
381 if [[ -n ${KMSAVELIBS} ]] ; then
382 save_library_dependencies
383 fi
384
385 if [[ -n ${KMLOADLIBS} ]] ; then
386 load_library_dependencies
387 fi
388
347 comment_all_add_subdirectory ./ 389 comment_all_add_subdirectory ./
348 390
349 # Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt 391 # Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt
350 if [[ -f "${S}"/CMakeLists.txt ]]; then 392 if [[ -f "${S}"/CMakeLists.txt ]]; then
351 sed -i -e '/ *cmake */s/^#DONOTCOMPILE //' "${S}"/CMakeLists.txt || die "${LINENO}: cmake sed died" 393 sed -e '/add_subdirectory[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
394 -e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
395 -i "${S}"/CMakeLists.txt || die "${LINENO}: cmake sed died"
352 fi 396 fi
353 397
354 if [[ -z ${KMNOMODULE} ]]; then 398 if [[ -z ${KMNOMODULE} ]]; then
355 # Restore "add_subdirectory" in $KMMODULE subdirectories 399 # Restore "add_subdirectory" in $KMMODULE subdirectories
356 find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ 400 find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
389 die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}" 433 die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}"
390 _change_cmakelists_parent_dirs ${i} 434 _change_cmakelists_parent_dirs ${i}
391 fi 435 fi
392 done 436 done
393 437
394 # Documentation section
395 if [[ -n ${docs} ]]; then
396 sed -i -e '/ *doc */s/^#DONOTCOMPILE //g' "${S}"/CMakeLists.txt || \
397 die "${LINENO}: sed died while uncommenting doc dir"
398
399 if [[ -f "${S}"/doc/CMakeLists.txt ]]; then
400 sed -i -e "/( *${KMMODULE##*/} *)/s/^#DONOTCOMPILE //g" "${S}"/doc/CMakeLists.txt \
401 || die "${LINENO}: sed died while uncommenting apps documentation in doc subdir "
402 fi
403 fi
404
405 # KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY 438 # KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY
406 for i in ${KMEXTRACTONLY}; do 439 for i in ${KMEXTRACTONLY}; do
407 if [[ -d "${S}"/${i} && -f "${S}"/${i}/../CMakeLists.txt ]]; then 440 if [[ -d "${S}"/${i} && -f "${S}"/${i}/../CMakeLists.txt ]]; then
408 sed -i -e "/( *$(basename $i) *)/s/^/#DONOTCOMPILE /" "${S}"/${i}/../CMakeLists.txt || \ 441 sed -i -e "/([[:space:]]*$(basename $i)[[:space:]]*)/s/^/#DONOTCOMPILE /" "${S}"/${i}/../CMakeLists.txt || \
409 die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}" 442 die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}"
410 fi 443 fi
411 done 444 done
412 445
413 # COLLISION PROTECT section
414 # Only install the startkde script as part of kde-base/kdebase-startkde,
415 # instead of with every package.
416 case ${KMNAME} in 446 case ${KMNAME} in
417 kdebase-workspace) 447 kdebase-workspace)
448 # COLLISION PROTECT section
449 # Only install the startkde script as part of kde-base/kdebase-startkde,
450 # instead of with every package.
418 if [[ ${PN} != "kdebase-startkde" && -f "${S}"/CMakeLists.txt ]]; then 451 if [[ ${PN} != "kdebase-startkde" && -f "${S}"/CMakeLists.txt ]]; then
419 case ${PV} in 452 case ${PV} in
420 *) # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0. 453 *) # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0.
421 sed -i -e '/startkde/s/^/#DONOTINSTALL /' "${S}"/CMakeLists.txt || \ 454 sed -i -e '/startkde/s/^/#DONOTINSTALL /' "${S}"/CMakeLists.txt || \
422 die "${LINENO}: sed died in the kdebase-startkde collision prevention section" 455 die "${LINENO}: sed died in the kdebase-startkde collision prevention section"
423 ;; 456 ;;
424 esac 457 esac
425 fi 458 fi
426 ;; 459 ;;
460 kdebase-runtime)
461 # COLLISION PROTECT section
462 # Only install the kde4 script as part of kde-base/kdebase-data
463 if [[ ${PN} != "kdebase-data" && -f "${S}"/CMakeLists.txt ]]; then
464 sed -i -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \
465 "${S}"/CMakeLists.txt || die "Sed to exclude bin/kde4 failed"
466 fi
467 ;;
468 kdepim)
469 case ${PN} in
470 kaddressbook|kmailcvt|kontact|korganizer)
471 sed -i -n -e '/qt4_generate_dbus_interface(.*org\.kde\.kmail\.\(kmail\|mailcomposer\)\.xml/p' \
472 -e '/add_custom_target(kmail_xml /,/)/p' "${S}"/kmail/CMakeLists.txt || die "uncommenting xml failed"
473 _change_cmakelists_parent_dirs kmail
474 ;;
475 esac
476 ;;
477 kdeutils)
427 # This is sort of a hack to avoid patching 16 kdeutils packages with 478 # This is sort of a hack to avoid patching 16 kdeutils packages with
428 # r775410 from upstream trunk which makes blitz optional so superkaramba 479 # r775410 from upstream trunk which makes blitz optional so superkaramba
429 # only gets compiled when it is found. Bug #209324. Remove this no later 480 # only gets compiled when it is found. Bug #209324. Remove this no later
430 # than 4.1. 481 # than 4.1.
431 kdeutils)
432 if [[ ${PN} != superkaramba && ${SLOT} == kde-4 ]]; then 482 if [[ ${PN} != superkaramba && ${SLOT} == kde-4 ]]; then
433 sed -i -e '/find_package(Blitz REQUIRED)/d' "${S}"/CMakeLists.txt \ 483 sed -i -e '/find_package(Blitz REQUIRED)/d' "${S}"/CMakeLists.txt \
434 || die "${LINENO}: sed to remove dependency on Blitz failed." 484 || die "${LINENO}: sed to remove dependency on Blitz failed."
435 fi 485 fi
436 ;; 486 ;;
482kde4-meta_src_install() { 532kde4-meta_src_install() {
483 debug-print-function $FUNCNAME "$@" 533 debug-print-function $FUNCNAME "$@"
484 534
485 kde4-meta_src_make_doc 535 kde4-meta_src_make_doc
486 cmake-utils_src_install 536 cmake-utils_src_install
537
538 if [[ -n ${KMSAVELIBS} ]] ; then
539 install_library_dependencies
540 fi
487} 541}
488 542
489# @FUNCTION: kde4-meta_src_make_doc 543# @FUNCTION: kde4-meta_src_make_doc
490# @DESCRIPTION: 544# @DESCRIPTION:
491# This function searches under ${S}/${KMMODULE}, 545# This function searches under ${S}/${KMMODULE},

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20