/[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.18 Revision 1.19
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-functions.eclass,v 1.18 2009/05/09 13:23:15 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.19 2009/05/28 09:47:52 scarabeus Exp $
4 4
5# @ECLASS: kde4-functions.eclass 5# @ECLASS: kde4-functions.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kde@gentoo.org 7# kde@gentoo.org
8# @BLURB: Common ebuild functions for KDE 4 packages 8# @BLURB: Common ebuild functions for KDE 4 packages
14# @DESCRIPTION: 14# @DESCRIPTION:
15# By default kde4 eclasses wants eapi 2 which might be redefinable to newer 15# By default kde4 eclasses wants eapi 2 which might be redefinable to newer
16# versions. 16# versions.
17case ${EAPI:-0} in 17case ${EAPI:-0} in
18 2) : ;; 18 2) : ;;
19 *) die "No way! EAPI other than 2 is not supported for now." ;; 19 *) DEPEND="EAPI-TOO-OLD" ;;
20esac 20esac
21 21
22# @ECLASS-VARIABLE: KDEBASE 22# @ECLASS-VARIABLE: KDEBASE
23# @DESCRIPTION: 23# @DESCRIPTION:
24# This gets set to a non-zero value when a package is considered a kde or 24# This gets set to a non-zero value when a package is considered a kde or
50# @DESCRIPTION: 50# @DESCRIPTION:
51# Function to rebuild the KDE System Configuration Cache. 51# Function to rebuild the KDE System Configuration Cache.
52# All KDE ebuilds should run this in pkg_postinst and pkg_postrm. 52# All KDE ebuilds should run this in pkg_postinst and pkg_postrm.
53buildsycoca() { 53buildsycoca() {
54 debug-print-function ${FUNCNAME} "$@" 54 debug-print-function ${FUNCNAME} "$@"
55 55
56 if [[ -z ${ROOT%%/} && -x ${KDEDIR}/bin/kbuildsycoca4 ]]; then 56 if [[ -z ${ROOT%%/} && -x ${KDEDIR}/bin/kbuildsycoca4 ]]; then
57 # Make sure tha cache file exists, writable by root and readable by 57 # Make sure tha cache file exists, writable by root and readable by
58 # others. Otherwise kbuildsycoca4 will fail. 58 # others. Otherwise kbuildsycoca4 will fail.
59 touch "${KDEDIR}/share/kde4/services/ksycoca4" 59 touch "${KDEDIR}/share/kde4/services/ksycoca4"
60 chmod 644 "${KDEDIR}/share/kde4/services/ksycoca4" 60 chmod 644 "${KDEDIR}/share/kde4/services/ksycoca4"
64 # kbuildsycoca4 to hang. 64 # kbuildsycoca4 to hang.
65 65
66 ebegin "Running kbuildsycoca4 to build global database" 66 ebegin "Running kbuildsycoca4 to build global database"
67 # This is needed because we support multiple kde versions installed together. 67 # This is needed because we support multiple kde versions installed together.
68 # Lookup in order - local, KDEDIR, /usr, do not duplicate entries btw. 68 # Lookup in order - local, KDEDIR, /usr, do not duplicate entries btw.
69 local KDEDIRS="/usr/share" 69 local KDEDIRS="${ROOT}usr/share"
70 [[ ${KDEDIR} != "/usr" ]] && KDEDIRS="${KDEDIR}/share:${KDEDIRS}" 70 [[ ${KDEDIR} != "${ROOT}usr" ]] && KDEDIRS="${KDEDIR}/share:${KDEDIRS}"
71 XDG_DATA_DIRS="/usr/local/share:${KDEDIRS}" \ 71 XDG_DATA_DIRS="${ROOT}usr/local/share:${KDEDIRS}" \
72 DISPLAY="" DBUS_SESSION_BUS_ADDRESS="" \ 72 DISPLAY="" DBUS_SESSION_BUS_ADDRESS="" \
73 ${KDEDIR}/bin/kbuildsycoca4 --global --noincremental &> /dev/null 73 ${KDEDIR}/bin/kbuildsycoca4 --global --noincremental &> /dev/null
74 eend $? 74 eend $?
75 fi 75 fi
76 76
77 # fix permission for some directories 77 # fix permission for some directories
78 for x in share/config share/kde4; do 78 for x in share/config share/kde4; do
79 [[ ${KDEDIR} = /usr ]] && DIRS=/usr || DIRS="/usr ${KDEDIR}" 79 [[ ${KDEDIR} = ${ROOT}usr ]] && DIRS=${ROOT}usr || DIRS="${ROOT}usr ${KDEDIR}"
80 for y in ${DIRS}; do 80 for y in ${DIRS}; do
81 [[ -d "${y}/${x}" ]] || break # nothing to do if directory does not exist 81 [[ -d "${y}/${x}" ]] || break # nothing to do if directory does not exist
82 if [[ $(stat --format=%a "${y}/${x}") != 755 ]]; then 82 if [[ $(stat --format=%a "${y}/${x}") != 755 ]]; then
83 ewarn "QA Notice:" 83 ewarn "QA Notice:"
84 ewarn "Package ${PN} is breaking ${y}/${x} permissions." 84 ewarn "Package ${PN} is breaking ${y}/${x} permissions."
104# @ECLASS-VARIABLE: KDE_LINGUAS 104# @ECLASS-VARIABLE: KDE_LINGUAS
105# @DESCRIPTION: 105# @DESCRIPTION:
106# This is a whitespace-separated list of translations this ebuild supports. 106# This is a whitespace-separated list of translations this ebuild supports.
107# These translations are automatically added to IUSE. Therefore ebuilds must set 107# These translations are automatically added to IUSE. Therefore ebuilds must set
108# this variable before inheriting any eclasses. To enable only selected 108# this variable before inheriting any eclasses. To enable only selected
109# translations, ebuilds must call enable_selected_linguas(). kde4-base.eclass does 109# translations, ebuilds must call enable_selected_linguas(). kde4-{base,meta}.eclass does
110# this for you. 110# this for you.
111# 111#
112# Example: KDE_LINGUAS="en_GB de nl" 112# Example: KDE_LINGUAS="en_GB de nl"
113for _lingua in ${KDE_LINGUAS}; do 113for _lingua in ${KDE_LINGUAS}; do
114 IUSE="${IUSE} linguas_${_lingua}" 114 IUSE="${IUSE} linguas_${_lingua}"
120# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po 120# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po
121# but this default can be overridden by defining KDE_LINGUAS_DIR. 121# but this default can be overridden by defining KDE_LINGUAS_DIR.
122enable_selected_linguas() { 122enable_selected_linguas() {
123 local lingua sr_mess wp 123 local lingua sr_mess wp
124 124
125 ## This isn't working because it seems portage sets LINGUAS
126 ## even if you don't have it in make.conf
127 ## Im leaving the command that *should* work if LINGUAS was unset commented
128 # if there is no linguas defined we enable everything
129 # [[ ! ${LINGUAS+set} = set ]] && LINGUAS="*"
125 # ebuild overridable linguas directory definition 130 # ebuild overridable linguas directory definition
126 KDE_LINGUAS_DIR=${KDE_LINGUAS_DIR:="${S}/po"} 131 KDE_LINGUAS_DIR=${KDE_LINGUAS_DIR:="${S}/po"}
127 cd "${KDE_LINGUAS_DIR}" || die "wrong linguas dir specified" 132 cd "${KDE_LINGUAS_DIR}" || die "wrong linguas dir specified"
128 133
129 # fix all various crazy sr@Latn variations 134 # fix all various crazy sr@Latn variations
145 if [[ -e "${lingua}.po" ]]; then 150 if [[ -e "${lingua}.po" ]]; then
146 mv "${lingua}.po" "${lingua}.po.old" 151 mv "${lingua}.po" "${lingua}.po.old"
147 fi 152 fi
148 done 153 done
149 comment_all_add_subdirectory "${KDE_LINGUAS_DIR}" 154 comment_all_add_subdirectory "${KDE_LINGUAS_DIR}"
150 for lingua in ${LINGUAS}; do 155 for lingua in ${KDE_LINGUAS}; do
156 if use linguas_${lingua} ; then
151 ebegin "Enabling LANGUAGE: ${lingua}" 157 ebegin "Enabling LANGUAGE: ${lingua}"
152 if [[ -d "${lingua}" ]]; then 158 if [[ -d "${lingua}" ]]; then
153 sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \ 159 sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
154 -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \ 160 -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
155 -i CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed." 161 -i CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
156 fi 162 fi
157 if [[ -e "${lingua}.po.old" ]]; then 163 if [[ -e "${lingua}.po.old" ]]; then
158 mv "${lingua}.po.old" "${lingua}.po" 164 mv "${lingua}.po.old" "${lingua}.po"
159 fi 165 fi
160 eend $? 166 eend $?
167 fi
161 done 168 done
162} 169}
163 170
164# @FUNCTION: get_build_type 171# @FUNCTION: get_build_type
165# @DESCRIPTION: 172# @DESCRIPTION:
241# Install generated CMake library dependencies to /var/lib/kde 248# Install generated CMake library dependencies to /var/lib/kde
242install_library_dependencies() { 249install_library_dependencies() {
243 local depsfile="${T}/${PN}:${SLOT}" 250 local depsfile="${T}/${PN}:${SLOT}"
244 251
245 ebegin "Installing library dependencies as ${depsfile##*/}" 252 ebegin "Installing library dependencies as ${depsfile##*/}"
246 insinto /var/lib/kde 253 insinto ${ROOT}var/lib/kde
247 doins "${depsfile}" || die "Failed to install library dependencies." 254 doins "${depsfile}" || die "Failed to install library dependencies."
248 eend $? 255 eend $?
249} 256}
250 257
251# @FUNCTION: load_library_dependencies 258# @FUNCTION: load_library_dependencies
256 ebegin "Injecting library dependencies from '${KMLOADLIBS}'" 263 ebegin "Injecting library dependencies from '${KMLOADLIBS}'"
257 264
258 i=0 265 i=0
259 for pn in ${KMLOADLIBS} ; do 266 for pn in ${KMLOADLIBS} ; do
260 ((i++)) 267 ((i++))
261 depsfile="/var/lib/kde/${pn}:${SLOT}" 268 depsfile="${ROOT}var/lib/kde/${pn}:${SLOT}"
262 [[ -r "${depsfile}" ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}." 269 [[ -r "${depsfile}" ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}."
263 sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \ 270 sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \
264 die "Failed to include library dependencies for ${pn}" 271 die "Failed to include library dependencies for ${pn}"
265 done 272 done
266 eend $? 273 eend $?

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20