| 1 | # Copyright 1999-2011 Gentoo Foundation |
1 | # Copyright 1999-2012 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.54 2011/06/15 22:03:13 abcd Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.62 2012/09/27 16:35:41 axs Exp $ |
| 4 | |
4 | |
| 5 | inherit versionator |
5 | inherit versionator |
| 6 | |
6 | |
| 7 | # @ECLASS: kde4-functions.eclass |
7 | # @ECLASS: kde4-functions.eclass |
| 8 | # @MAINTAINER: |
8 | # @MAINTAINER: |
| … | |
… | |
| 14 | |
14 | |
| 15 | # @ECLASS-VARIABLE: EAPI |
15 | # @ECLASS-VARIABLE: EAPI |
| 16 | # @DESCRIPTION: |
16 | # @DESCRIPTION: |
| 17 | # Currently kde4 eclasses support EAPI 3 and 4. |
17 | # Currently kde4 eclasses support EAPI 3 and 4. |
| 18 | case ${EAPI:-0} in |
18 | case ${EAPI:-0} in |
| 19 | 4|3) : ;; |
19 | 3|4|5) : ;; |
| 20 | *) die "EAPI=${EAPI} is not supported" ;; |
20 | *) die "EAPI=${EAPI} is not supported" ;; |
| 21 | esac |
21 | esac |
| 22 | |
22 | |
| 23 | # @ECLASS-VARIABLE: KDE_OVERRIDE_MINIMAL |
23 | # @ECLASS-VARIABLE: KDE_OVERRIDE_MINIMAL |
| 24 | # @DESCRIPTION: |
24 | # @DESCRIPTION: |
| … | |
… | |
| 30 | # Warning- may lead to general instability and kill your pet targh. |
30 | # Warning- may lead to general instability and kill your pet targh. |
| 31 | |
31 | |
| 32 | # @ECLASS-VARIABLE: KDEBASE |
32 | # @ECLASS-VARIABLE: KDEBASE |
| 33 | # @DESCRIPTION: |
33 | # @DESCRIPTION: |
| 34 | # This gets set to a non-zero value when a package is considered a kde or |
34 | # This gets set to a non-zero value when a package is considered a kde or |
| 35 | # koffice ebuild. |
35 | # kdevelop ebuild. |
| 36 | if [[ ${CATEGORY} = kde-base ]]; then |
36 | if [[ ${CATEGORY} = kde-base ]]; then |
| 37 | debug-print "${ECLASS}: KDEBASE ebuild recognized" |
37 | debug-print "${ECLASS}: KDEBASE ebuild recognized" |
| 38 | KDEBASE=kde-base |
38 | KDEBASE=kde-base |
| 39 | elif [[ ${KMNAME-${PN}} = koffice ]]; then |
|
|
| 40 | debug-print "${ECLASS}: KOFFICE ebuild recognized" |
|
|
| 41 | KDEBASE=koffice |
|
|
| 42 | elif [[ ${KMNAME-${PN}} = kdevelop ]]; then |
39 | elif [[ ${KMNAME-${PN}} = kdevelop ]]; then |
| 43 | debug-print "${ECLASS}: KDEVELOP ebuild recognized" |
40 | debug-print "${ECLASS}: KDEVELOP ebuild recognized" |
| 44 | KDEBASE=kdevelop |
41 | KDEBASE=kdevelop |
| 45 | fi |
42 | fi |
| 46 | |
43 | |
| 47 | # determine the build type |
44 | # determine the build type |
| 48 | if [[ ${PV} = *9999* ]]; then |
45 | if [[ ${PV} = *9999* ]]; then |
| 49 | BUILD_TYPE="live" |
46 | KDE_BUILD_TYPE="live" |
| 50 | else |
47 | else |
| 51 | BUILD_TYPE="release" |
48 | KDE_BUILD_TYPE="release" |
| 52 | fi |
49 | fi |
| 53 | export BUILD_TYPE |
50 | export KDE_BUILD_TYPE |
| 54 | |
51 | |
| 55 | # Set reponame and SCM for moduleses that have fully migrated to git |
52 | # Set reponame and SCM for modules that have fully migrated to git |
| 56 | # (hack - it's here because it needs to be before SCM inherits from kde4-base) |
53 | # (hack - it's here because it needs to be before SCM inherits from kde4-base) |
| 57 | if [[ ${BUILD_TYPE} == live ]]; then |
54 | if [[ ${KDE_BUILD_TYPE} == live ]]; then |
| 58 | case "${KMNAME}" in |
55 | case "${KMNAME}" in |
| 59 | kdebase-workspace) |
56 | kdebase-workspace) |
| 60 | KDE_SCM="git" |
57 | KDE_SCM="git" |
| 61 | EGIT_REPONAME=${EGIT_REPONAME:=kde-workspace} |
58 | EGIT_REPONAME=${EGIT_REPONAME:=kde-workspace} |
| 62 | ;; |
59 | ;; |
| … | |
… | |
| 90 | # These translations are automatically added to IUSE. Therefore ebuilds must set |
87 | # These translations are automatically added to IUSE. Therefore ebuilds must set |
| 91 | # this variable before inheriting any eclasses. To enable only selected |
88 | # this variable before inheriting any eclasses. To enable only selected |
| 92 | # translations, ebuilds must call enable_selected_linguas(). kde4-{base,meta}.eclass does |
89 | # translations, ebuilds must call enable_selected_linguas(). kde4-{base,meta}.eclass does |
| 93 | # this for you. |
90 | # this for you. |
| 94 | # |
91 | # |
| 95 | # Example: KDE_LINGUAS="en_GB de nl" |
92 | # Example: KDE_LINGUAS="de en_GB nl" |
| 96 | if [[ ${BUILD_TYPE} != live || -n ${KDE_LINGUAS_LIVE_OVERRIDE} ]]; then |
93 | if [[ ${KDE_BUILD_TYPE} != live || -n ${KDE_LINGUAS_LIVE_OVERRIDE} ]]; then |
| 97 | for _lingua in ${KDE_LINGUAS}; do |
94 | for _lingua in ${KDE_LINGUAS}; do |
| 98 | IUSE="${IUSE} linguas_${_lingua}" |
95 | IUSE="${IUSE} linguas_${_lingua}" |
| 99 | done |
96 | done |
| 100 | fi |
97 | fi |
| 101 | |
98 | |
| … | |
… | |
| 181 | # @DESCRIPTION: |
178 | # @DESCRIPTION: |
| 182 | # Enable only selected linguas enabled doc folders. |
179 | # Enable only selected linguas enabled doc folders. |
| 183 | enable_selected_doc_linguas() { |
180 | enable_selected_doc_linguas() { |
| 184 | debug-print-function ${FUNCNAME} "$@" |
181 | debug-print-function ${FUNCNAME} "$@" |
| 185 | |
182 | |
| 186 | # if there is no linguas defined we enable everything |
|
|
| 187 | if ! $(env | grep -q "^LINGUAS="); then |
|
|
| 188 | return 0 |
|
|
| 189 | fi |
|
|
| 190 | |
|
|
| 191 | # @ECLASS-VARIABLE: KDE_DOC_DIRS |
183 | # @ECLASS-VARIABLE: KDE_DOC_DIRS |
| 192 | # @DESCRIPTION: |
184 | # @DESCRIPTION: |
| 193 | # Variable specifying whitespace separated patterns for documentation locations. |
185 | # Variable specifying whitespace separated patterns for documentation locations. |
| 194 | # Default is "doc/%lingua" |
186 | # Default is "doc/%lingua" |
| 195 | KDE_DOC_DIRS=${KDE_DOC_DIRS:='doc/%lingua'} |
187 | KDE_DOC_DIRS=${KDE_DOC_DIRS:='doc/%lingua'} |
| … | |
… | |
| 206 | # Disable whole directory |
198 | # Disable whole directory |
| 207 | sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \ |
199 | sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \ |
| 208 | -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \ |
200 | -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \ |
| 209 | -i CMakeLists.txt || die 'failed to comment out all handbooks' |
201 | -i CMakeLists.txt || die 'failed to comment out all handbooks' |
| 210 | else |
202 | else |
|
|
203 | # if there is no linguas defined we enable everything (i.e. comment out nothing) |
|
|
204 | if ! $(env | grep -q "^LINGUAS="); then |
|
|
205 | return 0 |
|
|
206 | fi |
|
|
207 | |
| 211 | # Disable subdirectories recursively |
208 | # Disable subdirectories recursively |
| 212 | comment_all_add_subdirectory "${handbookdir}" |
209 | comment_all_add_subdirectory "${handbookdir}" |
| 213 | # Add requested translations |
210 | # Add requested translations |
| 214 | local lingua |
211 | local lingua |
| 215 | for lingua in en ${KDE_LINGUAS}; do |
212 | for lingua in en ${KDE_LINGUAS}; do |
| … | |
… | |
| 260 | mv -f "${pkg}" "${ESVN_STORE_DIR}"/ || eerror "Failed to move '${pkg}'" |
257 | mv -f "${pkg}" "${ESVN_STORE_DIR}"/ || eerror "Failed to move '${pkg}'" |
| 261 | done |
258 | done |
| 262 | rmdir "${cleandir}" || die "Could not move obsolete KDE store dir. Please move '${cleandir}' contents to appropriate location (possibly ${ESVN_STORE_DIR}) and manually remove '${cleandir}' in order to continue." |
259 | rmdir "${cleandir}" || die "Could not move obsolete KDE store dir. Please move '${cleandir}' contents to appropriate location (possibly ${ESVN_STORE_DIR}) and manually remove '${cleandir}' in order to continue." |
| 263 | fi |
260 | fi |
| 264 | |
261 | |
| 265 | if ! hasq kde4-meta ${INHERITED}; then |
262 | if ! has kde4-meta ${INHERITED}; then |
| 266 | case ${KMNAME} in |
263 | case ${KMNAME} in |
| 267 | extragear*|playground*) |
264 | extragear*|playground*) |
| 268 | local scmlocalpath="${ESVN_STORE_DIR}"/"${KMNAME}"/"${PN}" |
265 | local scmlocalpath="${ESVN_STORE_DIR}"/"${KMNAME}"/"${PN}" |
| 269 | if [[ -d "${scmlocalpath}" ]]; then |
266 | if [[ -d "${scmlocalpath}" ]]; then |
| 270 | local destdir="${ESVN_STORE_DIR}"/"${ESVN_PROJECT}"/"`basename "${ESVN_REPO_URI}"`" |
267 | local destdir="${ESVN_STORE_DIR}"/"${ESVN_PROJECT}"/"`basename "${ESVN_REPO_URI}"`" |
| … | |
… | |
| 470 | |
467 | |
| 471 | popd > /dev/null |
468 | popd > /dev/null |
| 472 | } |
469 | } |
| 473 | |
470 | |
| 474 | # @FUNCTION: get_kde_version |
471 | # @FUNCTION: get_kde_version |
|
|
472 | # @DESCRIPTION: |
| 475 | # Translates an ebuild version into a major.minor KDE SC |
473 | # Translates an ebuild version into a major.minor KDE SC |
| 476 | # release version. If no version is specified, ${PV} is used. |
474 | # release version. If no version is specified, ${PV} is used. |
| 477 | get_kde_version() { |
475 | get_kde_version() { |
| 478 | local ver=${1:-${PV}} |
476 | local ver=${1:-${PV}} |
| 479 | local major=$(get_major_version ${ver}) |
477 | local major=$(get_major_version ${ver}) |