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

Diff of /eclass/kde4-functions.eclass

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

Revision 1.36 Revision 1.37
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 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-functions.eclass,v 1.36 2010/10/24 15:56:03 tampakrap Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.37 2010/12/02 21:49:54 alexxy Exp $
4 4
5inherit versionator 5inherit versionator
6 6
7# @ECLASS: kde4-functions.eclass 7# @ECLASS: kde4-functions.eclass
8# @MAINTAINER: 8# @MAINTAINER:
134# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po 134# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po
135# but this default can be overridden by defining KDE_LINGUAS_DIR. 135# but this default can be overridden by defining KDE_LINGUAS_DIR.
136enable_selected_linguas() { 136enable_selected_linguas() {
137 debug-print-function ${FUNCNAME} "$@" 137 debug-print-function ${FUNCNAME} "$@"
138 138
139 local lingua linguas sr_mess wp 139 local x
140 140
141 # if there is no linguas defined we enable everything 141 # if there is no linguas defined we enable everything
142 if ! $(env | grep -q "^LINGUAS="); then 142 if ! $(env | grep -q "^LINGUAS="); then
143 return 0 143 return 0
144 fi 144 fi
145 145
146 # @ECLASS-VARIABLE: KDE_LINGUAS_DIR 146 # @ECLASS-VARIABLE: KDE_LINGUAS_DIR
147 # @DESCRIPTION: 147 # @DESCRIPTION:
148 # Specified folder where application translations are located. 148 # Specified folder where application translations are located.
149 # Can be defined as array of folders where translations are located.
150 # Note that space separated list of dirs is not supported.
151 # Default value is set to "po".
152 if [[ "$(declare -p KDE_LINGUAS_DIR 2>/dev/null 2>&1)" == "declare -a"* ]]; then
153 debug-print "$FUNCNAME: we have these subfolders defined: ${KDE_LINGUAS_DIR}"
154 for x in "${KDE_LINGUAS_DIR[@]}"; do
155 _enable_selected_linguas_dir ${x}
156 done
157 else
149 KDE_LINGUAS_DIR=${KDE_LINGUAS_DIR:="po"} 158 KDE_LINGUAS_DIR=${KDE_LINGUAS_DIR:="po"}
150 [[ -d "${KDE_LINGUAS_DIR}" ]] || die "wrong linguas dir specified" 159 _enable_selected_linguas_dir ${KDE_LINGUAS_DIR}
151 comment_all_add_subdirectory "${KDE_LINGUAS_DIR}"
152 pushd "${KDE_LINGUAS_DIR}" > /dev/null
153
154 # fix all various crazy sr@Latn variations
155 # this part is only ease for ebuilds, so there wont be any die when this
156 # fail at any point
157 sr_mess="sr@latn sr@latin sr@Latin"
158 for wp in ${sr_mess}; do
159 [[ -e "${wp}.po" ]] && mv "${wp}.po" "sr@Latn.po"
160 if [[ -d "${wp}" ]]; then
161 # move dir and fix cmakelists
162 mv "${wp}" "sr@Latn"
163 sed -i \
164 -e "s:${wp}:sr@Latin:g" \
165 CMakeLists.txt
166 fi 160 fi
167 done
168
169 for lingua in ${KDE_LINGUAS}; do
170 if [[ -e "${lingua}.po" ]]; then
171 mv "${lingua}.po" "${lingua}.po.old"
172 fi
173 done
174
175 for lingua in ${KDE_LINGUAS}; do
176 if use linguas_${lingua} ; then
177 if [[ -d "${lingua}" ]]; then
178 linguas="${linguas} ${lingua}"
179 sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
180 -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
181 -i CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
182 fi
183 if [[ -e "${lingua}.po.old" ]]; then
184 linguas="${linguas} ${lingua}"
185 mv "${lingua}.po.old" "${lingua}.po"
186 fi
187 fi
188 done
189 [[ -n "${linguas}" ]] && einfo "Enabling languages: ${linguas}"
190
191 popd > /dev/null
192} 161}
193 162
194# @FUNCTION: enable_selected_doc_linguas 163# @FUNCTION: enable_selected_doc_linguas
195# @DESCRIPTION: 164# @DESCRIPTION:
196# Enable only selected linguas enabled doc folders. 165# Enable only selected linguas enabled doc folders.
386 debug-print-function ${FUNCNAME} "$@" 355 debug-print-function ${FUNCNAME} "$@"
387 356
388 RDEPEND+=" $(_do_blocker "$@")" 357 RDEPEND+=" $(_do_blocker "$@")"
389} 358}
390 359
360# @FUNCTION: add_kdebase_dep
361# @DESCRIPTION:
362# Create proper dependency for kde-base/ dependencies,
363# adding SLOT when needed (and *only* when needed).
364# This takes 1 or 2 arguments. The first being the package
365# name, the optional second, is additional USE flags to append.
366# The output of this should be added directly to DEPEND/RDEPEND, and
367# may be wrapped in a USE conditional (but not an || conditional
368# without an extra set of parentheses).
369add_kdebase_dep() {
370 debug-print-function ${FUNCNAME} "$@"
371
372 [[ -z ${1} ]] && die "Missing parameter"
373
374 local use=${2:+,${2}}
375
376 if [[ ${KDEBASE} = kde-base ]]; then
377 # FIXME remove hack when kdepim-4.4.{6,7} is gone
378 local FIXME_PV
379 if [[ ${KMNAME} = kdepim || ${PN} = kdepim-runtime ]] && [[ ${PV} = 4.4.6* || ${PV} = 4.4.7* ]] && [[ ${1} = kdelibs || ${1} = kdepimlibs ]]; then
380 FIXME_PV=4.4.5
381 else
382 FIXME_PV=${PV}
383 fi
384
385 # if building stable-live version depend just on slot
386 # to allow merging packages against more stable basic stuff
387 case ${PV} in
388 *.9999*)
389 echo " !kdeprefix? ( >=kde-base/${1}-${SLOT}[aqua=,-kdeprefix${use}] )"
390 echo " kdeprefix? ( >=kde-base/${1}-${SLOT}:${SLOT}[aqua=,kdeprefix${use}] )"
391 ;;
392 *)
393 echo " !kdeprefix? ( >=kde-base/${1}-${FIXME_PV}[aqua=,-kdeprefix${use}] )"
394 echo " kdeprefix? ( >=kde-base/${1}-${FIXME_PV}:${SLOT}[aqua=,kdeprefix${use}] )"
395 ;;
396 esac
397 else
398 if [[ ${KDE_MINIMAL} = live ]]; then
399 echo " kde-base/${1}:${KDE_MINIMAL}[aqua=${use}]"
400 else
401 echo " >=kde-base/${1}-${KDE_MINIMAL}[aqua=${use}]"
402 fi
403 fi
404}
405
391# _greater_max_in_slot ver slot 406# _greater_max_in_slot ver slot
392# slot must be 4.x or live 407# slot must be 4.x or live
393# returns true if ver is >= the maximum possibile version in slot 408# returns true if ver is >= the maximum possibile version in slot
394_greater_max_in_slot() { 409_greater_max_in_slot() {
395 local ver=$1 410 local ver=$1
499 fi 514 fi
500 echo " !${atom}:3.5" 515 echo " !${atom}:3.5"
501 fi 516 fi
502} 517}
503 518
504# @FUNCTION: add_kdebase_dep 519# local function to enable specified translations for specified directory
505# @DESCRIPTION: 520# used from kde4-functions_enable_selected_linguas function
506# Create proper dependency for kde-base/ dependencies, 521_enable_selected_linguas_dir() {
507# adding SLOT when needed (and *only* when needed). 522 local lingua linguas sr_mess wp
508# This takes 1 or 2 arguments. The first being the package 523 local dir=${1}
509# name, the optional second, is additional USE flags to append.
510# The output of this should be added directly to DEPEND/RDEPEND, and
511# may be wrapped in a USE conditional (but not an || conditional
512# without an extra set of parentheses).
513add_kdebase_dep() {
514 debug-print-function ${FUNCNAME} "$@"
515 524
516 [[ -z ${1} ]] && die "Missing parameter" 525 [[ -d "${dir}" ]] || die "linguas dir \"${dir}\" does not exist"
526 comment_all_add_subdirectory "${dir}"
527 pushd "${dir}" > /dev/null
517 528
518 local use=${2:+,${2}} 529 # fix all various crazy sr@Latn variations
530 # this part is only ease for ebuilds, so there wont be any die when this
531 # fail at any point
532 sr_mess="sr@latn sr@latin sr@Latin"
533 for wp in ${sr_mess}; do
534 [[ -e "${wp}.po" ]] && mv "${wp}.po" "sr@Latn.po"
535 if [[ -d "${wp}" ]]; then
536 # move dir and fix cmakelists
537 mv "${wp}" "sr@Latn"
538 sed -i \
539 -e "s:${wp}:sr@Latin:g" \
540 CMakeLists.txt
541 fi
542 done
519 543
520 if [[ ${KDEBASE} = kde-base ]]; then 544 for lingua in ${KDE_LINGUAS}; do
521 # FIXME remove hack when kdepim-4.4.{6,7} is gone 545 if [[ -e "${lingua}.po" ]]; then
522 local FIXME_PV 546 mv "${lingua}.po" "${lingua}.po.old"
523 if [[ ${KMNAME} = kdepim || ${PN} = kdepim-runtime ]] && [[ ${PV} = 4.4.6* || ${PV} = 4.4.7* ]] && [[ ${1} = kdelibs || ${1} = kdepimlibs ]]; then 547 fi
524 FIXME_PV=4.4.5 548 done
525 else 549
526 FIXME_PV=${PV} 550 for lingua in ${KDE_LINGUAS}; do
551 if use linguas_${lingua} ; then
552 if [[ -d "${lingua}" ]]; then
553 linguas="${linguas} ${lingua}"
554 sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
555 -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
556 -i CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
527 fi 557 fi
528 echo " !kdeprefix? ( >=kde-base/${1}-${FIXME_PV}[aqua=,-kdeprefix${use}] )" 558 if [[ -e "${lingua}.po.old" ]]; then
529 echo " kdeprefix? ( >=kde-base/${1}-${FIXME_PV}:${SLOT}[aqua=,kdeprefix${use}] )" 559 linguas="${linguas} ${lingua}"
530 else 560 mv "${lingua}.po.old" "${lingua}.po"
531 if [[ ${KDE_MINIMAL} = live ]]; then
532 echo " kde-base/${1}:${KDE_MINIMAL}[aqua=${use}]"
533 else
534 echo " >=kde-base/${1}-${KDE_MINIMAL}[aqua=${use}]"
535 fi 561 fi
536 fi 562 fi
563 done
564 [[ -n "${linguas}" ]] && echo ">>> Enabling languages: ${linguas}"
565
566 popd > /dev/null
537} 567}

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

  ViewVC Help
Powered by ViewVC 1.1.20