1 |
# Copyright 1999-2009 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-meta.eclass,v 1.12 2009/03/09 19:41:26 scarabeus Exp $ |
4 |
# |
5 |
# @ECLASS: kde4-meta.eclass |
6 |
# @MAINTAINER: |
7 |
# kde@gentoo.org |
8 |
# @BLURB: Eclass for writing "split" KDE packages. |
9 |
# @DESCRIPTION: |
10 |
# This eclass provides all necessary functions for writing split KDE ebuilds. |
11 |
# |
12 |
# You must define KMNAME to use this eclass, and do so before inheriting it. All other variables are optional. |
13 |
# Do not include the same item in more than one of KMMODULE, KMMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY. |
14 |
|
15 |
inherit kde4-base versionator |
16 |
|
17 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm |
18 |
|
19 |
if [[ -z ${KMNAME} ]]; then |
20 |
die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild" |
21 |
fi |
22 |
|
23 |
case ${KDEBASE} in |
24 |
kde-base) |
25 |
HOMEPAGE="http://www.kde.org/" |
26 |
LICENSE="GPL-2" |
27 |
;; |
28 |
koffice) |
29 |
HOMEPAGE="http://www.koffice.org/" |
30 |
LICENSE="GPL-2" |
31 |
;; |
32 |
esac |
33 |
|
34 |
# Add dependencies that all packages in a certain module share. |
35 |
case ${KMNAME} in |
36 |
kdebase|kdebase-{apps,workspace,runtime}) |
37 |
DEPEND="${DEPEND} |
38 |
>=kde-base/qimageblitz-0.0.4 |
39 |
" |
40 |
RDEPEND="${RDEPEND} |
41 |
>=kde-base/qimageblitz-0.0.4 |
42 |
" |
43 |
;; |
44 |
kdenetwork) |
45 |
DEPEND="${DEPEND} |
46 |
>=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=] |
47 |
" |
48 |
RDEPEND="${RDEPEND} |
49 |
>=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=] |
50 |
" |
51 |
;; |
52 |
kdepim) |
53 |
DEPEND="${DEPEND} |
54 |
dev-libs/boost |
55 |
>=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=] |
56 |
" |
57 |
RDEPEND="${RDEPEND} |
58 |
dev-libs/boost |
59 |
>=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=] |
60 |
" |
61 |
case ${PN} in |
62 |
akregator|kaddressbook|kjots|kmail|kmobiletools|knode|knotes|korganizer|ktimetracker) |
63 |
IUSE="+kontact" |
64 |
RDEPEND="${RDEPEND} |
65 |
kontact? ( >=kde-base/kontactinterfaces-${PV}:${SLOT}[kdeprefix=] ) |
66 |
" |
67 |
;; |
68 |
esac |
69 |
;; |
70 |
kdegames) |
71 |
if [[ ${PN} != libkdegames ]]; then |
72 |
DEPEND="${DEPEND} |
73 |
>=kde-base/libkdegames-${PV}:${SLOT}[kdeprefix=] |
74 |
" |
75 |
RDEPEND="${RDEPEND} |
76 |
>=kde-base/libkdegames-${PV}:${SLOT}[kdeprefix=] |
77 |
" |
78 |
fi |
79 |
;; |
80 |
koffice) |
81 |
[[ ${PN} != koffice-data ]] && IUSE="debug" |
82 |
case ${PV} in |
83 |
9999*) |
84 |
DEPEND="${DEPEND} |
85 |
!app-office/${PN}:2 |
86 |
" |
87 |
;; |
88 |
1.9*|2*) |
89 |
DEPEND="${DEPEND} |
90 |
!app-office/${PN}:live |
91 |
" |
92 |
;; |
93 |
esac |
94 |
DEPEND="${DEPEND} |
95 |
!app-office/${PN}:0 |
96 |
!app-office/koffice:0 |
97 |
!app-office/koffice-meta:0 |
98 |
" |
99 |
case ${PN} in |
100 |
koffice-data) |
101 |
DEPEND="${DEPEND} |
102 |
media-libs/lcms |
103 |
" |
104 |
RDEPEND="${RDEPEND} |
105 |
media-libs/lcms |
106 |
" |
107 |
;; |
108 |
*) |
109 |
COMMON_DEPEND=" |
110 |
dev-cpp/eigen:2 |
111 |
media-gfx/imagemagick[openexr?] |
112 |
media-libs/fontconfig |
113 |
media-libs/freetype:2 |
114 |
" |
115 |
DEPEND="${DEPEND} ${COMMON_DEPEND}" |
116 |
RDEPEND="${RDEPEND} ${COMMON_DEPEND}" |
117 |
unset COMMON_DEPEND |
118 |
if [[ ${PN} != koffice-libs && ${PN} != koffice-data ]]; then |
119 |
DEPEND="${DEPEND} |
120 |
>=app-office/koffice-libs-${PV}:${SLOT}[kdeprefix=] |
121 |
" |
122 |
RDEPEND="${RDEPEND} |
123 |
>=app-office/koffice-libs-${PV}:${SLOT}[kdeprefix=] |
124 |
" |
125 |
fi |
126 |
;; |
127 |
esac |
128 |
;; |
129 |
esac |
130 |
|
131 |
debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after metapackage-specific dependencies" |
132 |
debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after metapackage-specific dependencies" |
133 |
|
134 |
# Useful to build kde4-meta style stuff from extragear/playground (plasmoids etc) |
135 |
case ${SLOT} in |
136 |
live) |
137 |
case ${KMNAME} in |
138 |
extragear*|playground*) |
139 |
ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}" |
140 |
;; |
141 |
esac |
142 |
;; |
143 |
esac |
144 |
|
145 |
# @ECLASS-VARIABLE: KMNAME |
146 |
# @DESCRIPTION: |
147 |
# Name of the parent-module (e.g. kdebase, kdepim, ...). You _must_ set it |
148 |
# _before_ inheriting this eclass, (unlike the other parameters), since it's |
149 |
# used to set $SRC_URI. |
150 |
|
151 |
# @ECLASS-VARIABLE: KMMODULE |
152 |
# @DESCRIPTION: |
153 |
# Specify exactly one subdirectory of $KMNAME here. Defaults to $PN. |
154 |
# The subdirectory listed here is treated exactly like items in $KMEXTRA. |
155 |
# |
156 |
# Example: The ebuild name of "kdebase/l10n" is kde-base/kdebase-l10n, because |
157 |
# just 'l10n' would be too confusing. Hence it sets KMMODULE="l10n". |
158 |
|
159 |
# @ECLASS-VARIABLE: KMNOMODULE |
160 |
# @DESCRIPTION: |
161 |
# If set to "true", $KMMODULE doesn't have to be defined. |
162 |
# |
163 |
# Example usage: If you're installing subdirectories of a package, like plugins, |
164 |
# you mark the top subdirectory (containing the package) as $KMEXTRACTONLY, and |
165 |
# set KMNOMODULE="true". |
166 |
if [[ -z ${KMMODULE} && ${KMNOMODULE} != true ]]; then |
167 |
KMMODULE=${PN} |
168 |
fi |
169 |
|
170 |
# @ECLASS-VARIABLE: KMEXTRA |
171 |
# @DESCRIPTION: |
172 |
# All subdirectories listed here will be extracted, compiled & installed. |
173 |
# $KMMODULE is always added to $KMEXTRA. |
174 |
# If the htmlhandbook USE-flag is set, and if this directory exists, |
175 |
# then "doc/$KMMODULE" is added to $KMEXTRA. In other cases, this should be |
176 |
# handled in the ebuild. |
177 |
# If the documentation is in a different subdirectory, you should add it to KMEXTRA. |
178 |
|
179 |
# @ECLASS-VARIABLE: KMCOMPILEONLY |
180 |
# @DESCRIPTION: |
181 |
# All subdirectories listed here will be extracted & compiled, but not installed. |
182 |
|
183 |
# TODO: better formulation may be needed |
184 |
# @ECLASS-VARIABLE: KMEXTRACTONLY |
185 |
# @DESCRIPTION: |
186 |
# All subdirectories listed here will be extracted, but neither compiled nor installed. |
187 |
# This can be used to avoid compilation in a subdirectory of a directory in $KMMODULE or $KMEXTRA |
188 |
|
189 |
# @ECLASS-VARIABLE: KMTARPARAMS |
190 |
# @DESCRIPTION: |
191 |
# Specify extra parameters to pass to tar, in kde4-meta_src_extract. |
192 |
# '-xpf -j' are passed to tar by default. |
193 |
|
194 |
# @FUNCTION: kde4-meta_pkg_setup |
195 |
# @DESCRIPTION: |
196 |
# Currently just calls its equivalent in kde4-base.eclass(5). Use this one in |
197 |
# split ebuilds. |
198 |
kde4-meta_pkg_setup() { |
199 |
debug-print-function ${FUNCNAME} "$@" |
200 |
|
201 |
kde4-base_pkg_setup |
202 |
} |
203 |
|
204 |
# @FUNCTION: kde4-meta_src_unpack |
205 |
# @DESCRIPTION: |
206 |
# This function unpacks the source for split ebuilds. See also |
207 |
# kde4-meta-src_extract. |
208 |
kde4-meta_src_unpack() { |
209 |
debug-print-function ${FUNCNAME} "$@" |
210 |
|
211 |
if [[ ${BUILD_TYPE} = live ]]; then |
212 |
migrate_store_dir |
213 |
S="${WORKDIR}/${P}" |
214 |
mkdir -p "${S}" |
215 |
ESVN_RESTRICT="export" subversion_src_unpack |
216 |
subversion_wc_info |
217 |
subversion_bootstrap |
218 |
kde4-meta_src_extract |
219 |
else |
220 |
kde4-meta_src_extract |
221 |
fi |
222 |
} |
223 |
|
224 |
# FIXME: the difference between kde4-meta_src_extract and kde4-meta_src_unpack? |
225 |
|
226 |
# @FUNCTION: kde4-meta_src_extract |
227 |
# @DESCRIPTION: |
228 |
# A function to unpack the source for a split KDE ebuild. |
229 |
# Also see KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY and |
230 |
# KMTARPARAMS. |
231 |
kde4-meta_src_extract() { |
232 |
debug-print-function ${FUNCNAME} "$@" |
233 |
|
234 |
if [[ ${BUILD_TYPE} = live ]]; then |
235 |
local rsync_options subdir kmnamedir targetdir |
236 |
# Export working copy to ${S} |
237 |
einfo "Exporting parts of working copy to ${S}" |
238 |
kde4-meta_create_extractlists |
239 |
|
240 |
rsync_options="--group --links --owner --perms --quiet --exclude=.svn/" |
241 |
|
242 |
# Copy ${KMNAME} non-recursively (toplevel files) |
243 |
rsync ${rsync_options} "${ESVN_WC_PATH}"/${kmnamedir}* "${S}" \ |
244 |
|| die "${ESVN}: can't export toplevel files to '${S}'." |
245 |
# Copy cmake directory |
246 |
if [[ -d "${ESVN_WC_PATH}/${kmnamedir}cmake" ]]; then |
247 |
rsync --recursive ${rsync_options} "${ESVN_WC_PATH}/${kmnamedir}cmake" "${S}" \ |
248 |
|| die "${ESVN}: can't export cmake files to '${S}'." |
249 |
fi |
250 |
# Copy all subdirectories |
251 |
for subdir in $(__list_needed_subdirectories); do |
252 |
targetdir="" |
253 |
if [[ $subdir = doc/* && ! -e "$ESVN_WC_PATH/$kmnamedir$subdir" ]]; then |
254 |
continue |
255 |
fi |
256 |
|
257 |
[[ ${subdir%/} = */* ]] && targetdir=${subdir%/} && targetdir=${targetdir%/*} && mkdir -p "${S}/${targetdir}" |
258 |
rsync --recursive ${rsync_options} "${ESVN_WC_PATH}/${kmnamedir}${subdir%/}" "${S}/${targetdir}" \ |
259 |
|| die "${ESVN}: can't export subdirectory '${subdir}' to '${S}/${targetdir}'." |
260 |
done |
261 |
|
262 |
if [[ ${KMNAME} = kdebase-runtime && ${PN} != kdebase-data ]]; then |
263 |
sed -i -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \ |
264 |
"${S}"/CMakeLists.txt || die "Sed to exclude bin/kde4 failed" |
265 |
fi |
266 |
else |
267 |
local abort tarball tarfile f extractlist moduleprefix postfix |
268 |
case ${PV} in |
269 |
4.2.9* | 4.2.8* | 4.2.7* | 4.2.6*) |
270 |
KMTARPARAMS="${KMTARPARAMS} --lzma" # lzma |
271 |
postfix="lzma" |
272 |
;; |
273 |
*) |
274 |
KMTARPARAMS="${KMTARPARAMS} --bzip2" # bz2 |
275 |
postfix="bz2" |
276 |
;; |
277 |
esac |
278 |
case ${KMNAME} in |
279 |
kdebase-apps) |
280 |
# kdebase/apps -> kdebasa-apps |
281 |
tarball="kdebase-${PV}.tar.${postfix}" |
282 |
# Go one level deeper for kdebase-apps in tarballs |
283 |
moduleprefix=apps/ |
284 |
KMTARPARAMS="${KMTARPARAMS} --transform=s|apps/||" |
285 |
;; |
286 |
*) |
287 |
# Create tarball name from module name (this is the default) |
288 |
tarball="${KMNAME}-${PV}.tar.${postfix}" |
289 |
;; |
290 |
esac |
291 |
|
292 |
# Full patch to source tarball |
293 |
tarfile="${DISTDIR}/${tarball}" |
294 |
|
295 |
# Detect real toplevel dir from tarball name - it will be used upon extraction |
296 |
# and in __list_needed_subdirectories |
297 |
topdir="${tarball%.tar.*}/" |
298 |
|
299 |
ebegin "Unpacking parts of ${tarball} to ${WORKDIR}" |
300 |
|
301 |
kde4-meta_create_extractlists |
302 |
|
303 |
for f in cmake/ CMakeLists.txt ConfigureChecks.cmake config.h.cmake \ |
304 |
AUTHORS COPYING INSTALL README NEWS ChangeLog |
305 |
do |
306 |
extractlist="${extractlist} ${topdir}${moduleprefix}${f}" |
307 |
done |
308 |
extractlist="${extractlist} $(__list_needed_subdirectories)" |
309 |
|
310 |
pushd "${WORKDIR}" > /dev/null |
311 |
[[ -n ${KDE4_STRICTER} ]] && echo tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} >&2 |
312 |
tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} 2> /dev/null |
313 |
|
314 |
# Default $S is based on $P; rename the extracted directory to match $S if necessary |
315 |
mv ${topdir} ${P} || die "Died while moving \"${topdir}\" to \"${P}\"" |
316 |
|
317 |
popd > /dev/null |
318 |
|
319 |
eend $? |
320 |
|
321 |
# We need to clear it here to make verification below work |
322 |
unset moduleprefix |
323 |
|
324 |
if [[ -n ${KDE4_STRICTER} ]]; then |
325 |
for f in $(__list_needed_subdirectories fatal); do |
326 |
if [[ ! -e "${S}/${f#*/}" ]]; then |
327 |
eerror "'${f#*/}' is missing" |
328 |
abort=true |
329 |
fi |
330 |
done |
331 |
[[ -n ${abort} ]] && die "There were missing files." |
332 |
fi |
333 |
|
334 |
# We don't need it anymore |
335 |
unset topdir |
336 |
fi |
337 |
} |
338 |
|
339 |
# @FUNCTION: kde4-meta_create_extractlists |
340 |
# @DESCRIPTION: |
341 |
# Create lists of files and subdirectories to extract. |
342 |
# Also see descriptions of KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY, |
343 |
# KMEXTRACTONLY and KMTARPARAMS. |
344 |
kde4-meta_create_extractlists() { |
345 |
debug-print-function ${FUNCNAME} "$@" |
346 |
|
347 |
if has htmlhandbook ${IUSE//+} && use htmlhandbook; then |
348 |
# We use the basename of $KMMODULE because $KMMODULE can contain |
349 |
# the path to the module subdirectory. |
350 |
KMEXTRA_NONFATAL="${KMEXTRA_NONFATAL} doc/${KMMODULE##*/}" |
351 |
fi |
352 |
|
353 |
# Add some CMake-files to KMEXTRACTONLY. |
354 |
# Note that this actually doesn't include KMEXTRA handling. |
355 |
# In those cases you should care to add the relevant files to KMEXTRACTONLY |
356 |
case ${KMNAME} in |
357 |
kdebase) |
358 |
KMEXTRACTONLY="${KMEXTRACTONLY} |
359 |
apps/config-apps.h.cmake |
360 |
apps/ConfigureChecks.cmake" |
361 |
;; |
362 |
kdebase-apps) |
363 |
KMEXTRACTONLY="${KMEXTRACTONLY} |
364 |
config-apps.h.cmake |
365 |
ConfigureChecks.cmake" |
366 |
;; |
367 |
kdebase-runtime) |
368 |
KMEXTRACTONLY="${KMEXTRACTONLY} |
369 |
config-runtime.h.cmake" |
370 |
;; |
371 |
kdebase-workspace) |
372 |
KMEXTRACTONLY="${KMEXTRACTONLY} |
373 |
config-unix.h.cmake |
374 |
ConfigureChecks.cmake |
375 |
config-workspace.h.cmake |
376 |
config-X11.h.cmake |
377 |
startkde.cmake |
378 |
KDE4WorkspaceConfig.cmake.in" |
379 |
;; |
380 |
kdegames) |
381 |
if [[ ${PN} != libkdegames ]]; then |
382 |
KMEXTRACTONLY="${KMEXTRACTONLY} |
383 |
libkdegames" |
384 |
fi |
385 |
;; |
386 |
kdepim) |
387 |
if [[ ${PN} != libkdepim ]]; then |
388 |
KMEXTRACTONLY="${KMEXTRACTONLY} |
389 |
libkdepim" |
390 |
fi |
391 |
KMEXTRACTONLY="${KMEXTRACTONLY} |
392 |
kleopatra/ConfigureChecks.cmake" |
393 |
if has kontact ${IUSE//+} && use kontact; then |
394 |
KMEXTRA="${KMEXTRA} kontact/plugins/${PLUGINNAME:-${PN}}" |
395 |
KMEXTRACTONLY="${KMEXTRACTONLY} kontactinterfaces/" |
396 |
fi |
397 |
;; |
398 |
koffice) |
399 |
KMEXTRACTONLY="${KMEXTRACTONLY} |
400 |
config-endian.h.cmake |
401 |
filters/config-filters.h.cmake |
402 |
config-openctl.h.cmake |
403 |
config-openexr.h.cmake |
404 |
config-opengl.h.cmake |
405 |
config-prefix.h.cmake" |
406 |
;; |
407 |
esac |
408 |
# Don't install cmake modules for split ebuilds, to avoid collisions. |
409 |
case ${KMNAME} in |
410 |
kdebase-runtime|kdebase-workspace|kdeedu|kdegames|kdegraphics|kdepim) |
411 |
case ${PN} in |
412 |
libkdegames|libkdeedu|marble|libkworkspace) |
413 |
KMEXTRA="${KMEXTRA} |
414 |
cmake/modules/" |
415 |
;; |
416 |
*) |
417 |
KMCOMPILEONLY="${KMCOMPILEONLY} |
418 |
cmake/modules/" |
419 |
;; |
420 |
esac |
421 |
;; |
422 |
esac |
423 |
|
424 |
debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME}: KMEXTRACTONLY ${KMEXTRACTONLY}" |
425 |
} |
426 |
|
427 |
__list_needed_subdirectories() { |
428 |
local i j kmextra kmextra_expanded kmmodule_expanded kmcompileonly_expanded extractlist |
429 |
|
430 |
# We expand KMEXTRA by adding CMakeLists.txt files |
431 |
kmextra="${KMEXTRA}" |
432 |
[[ ${1} != fatal ]] && kmextra="${kmextra} ${KMEXTRA_NONFATAL}" |
433 |
for i in ${kmextra}; do |
434 |
kmextra_expanded="${kmextra_expanded} ${i}" |
435 |
j=$(dirname ${i}) |
436 |
while [[ ${j} != "." ]]; do |
437 |
kmextra_expanded="${kmextra_expanded} ${j}/CMakeLists.txt"; |
438 |
j=$(dirname ${j}) |
439 |
done |
440 |
done |
441 |
|
442 |
# Expand KMMODULE |
443 |
if [[ -n ${KMMODULE} ]]; then |
444 |
kmmodule_expanded="${KMMODULE}" |
445 |
j=$(dirname ${KMMODULE}) |
446 |
while [[ ${j} != "." ]]; do |
447 |
kmmodule_expanded="${kmmodule_expanded} ${j}/CMakeLists.txt"; |
448 |
j=$(dirname ${j}) |
449 |
done |
450 |
fi |
451 |
|
452 |
# Expand KMCOMPILEONLY |
453 |
for i in ${KMCOMPILEONLY}; do |
454 |
kmcompileonly_expanded="${kmcompileonly_expanded} ${i}" |
455 |
j=$(dirname ${i}) |
456 |
while [[ ${j} != "." ]]; do |
457 |
kmcompileonly_expanded="${kmcompileonly_expanded} ${j}/CMakeLists.txt"; |
458 |
j=$(dirname ${j}) |
459 |
done |
460 |
done |
461 |
|
462 |
debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}" |
463 |
debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded: ${kmmodule_expanded}" |
464 |
debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}" |
465 |
|
466 |
# Create final list of stuff to extract |
467 |
# We append topdir only when specified (usually for tarballs) |
468 |
for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \ |
469 |
${KMEXTRACTONLY} |
470 |
do |
471 |
extractlist="${extractlist} ${topdir}${moduleprefix}${i}" |
472 |
done |
473 |
|
474 |
echo ${extractlist} |
475 |
} |
476 |
|
477 |
# @FUNCTION: kde4-meta_src_prepare |
478 |
# @DESCRIPTION: |
479 |
# Meta-package build system configuration handling - commenting out targets, etc.. |
480 |
kde4-meta_src_prepare() { |
481 |
debug-print-function ${FUNCNAME} "$@" |
482 |
|
483 |
kde4-meta_change_cmakelists |
484 |
kde4-base_src_prepare |
485 |
} |
486 |
|
487 |
# FIXME: no comment here? |
488 |
_change_cmakelists_parent_dirs() { |
489 |
debug-print-function ${FUNCNAME} "$@" |
490 |
|
491 |
local _olddir _dir |
492 |
_dir="${S}"/${1} |
493 |
until [[ ${_dir} == "${S}" ]]; do |
494 |
_olddir=$(basename "${_dir}") |
495 |
_dir=$(dirname "${_dir}") |
496 |
debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}" |
497 |
if [[ -f ${_dir}/CMakeLists.txt ]]; then |
498 |
sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \ |
499 |
-e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \ |
500 |
-i ${_dir}/CMakeLists.txt || die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}" |
501 |
fi |
502 |
done |
503 |
} |
504 |
|
505 |
# FIXME: add description |
506 |
# @FUNCTION: kde4-meta_change_cmakelists |
507 |
# @DESCRIPTION: |
508 |
kde4-meta_change_cmakelists() { |
509 |
debug-print-function ${FUNCNAME} "$@" |
510 |
|
511 |
pushd "${S}" > /dev/null |
512 |
|
513 |
comment_all_add_subdirectory ./ |
514 |
|
515 |
# Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt |
516 |
if [[ -f "${S}"/CMakeLists.txt ]]; then |
517 |
sed -e '/add_subdirectory[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \ |
518 |
-e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \ |
519 |
-i "${S}"/CMakeLists.txt || die "${LINENO}: cmake sed died" |
520 |
fi |
521 |
|
522 |
if [[ -z ${KMNOMODULE} ]]; then |
523 |
# Restore "add_subdirectory" in $KMMODULE subdirectories |
524 |
find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ |
525 |
die "${LINENO}: died in KMMODULE section" |
526 |
_change_cmakelists_parent_dirs ${KMMODULE} |
527 |
fi |
528 |
|
529 |
local i |
530 |
|
531 |
# KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY |
532 |
for i in ${KMEXTRACTONLY}; do |
533 |
if [[ -d "${S}"/${i} && -f "${S}"/${i}/../CMakeLists.txt ]]; then |
534 |
sed -i -e "/([[:space:]]*$(basename $i)[[:space:]]*)/s/^/#DONOTCOMPILE /" "${S}"/${i}/../CMakeLists.txt || \ |
535 |
die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}" |
536 |
fi |
537 |
done |
538 |
|
539 |
# KMCOMPILEONLY |
540 |
for i in ${KMCOMPILEONLY}; do |
541 |
debug-print "${LINENO}: KMCOMPILEONLY, processing ${i}" |
542 |
# Uncomment "add_subdirectory" instructions inside $KMCOMPILEONLY, then comment "install" instructions. |
543 |
find "${S}"/${i} -name CMakeLists.txt -print0 | \ |
544 |
xargs -0 sed -i \ |
545 |
-e 's/^#DONOTCOMPILE //g' \ |
546 |
-e '/install(.*)/{s/^/#DONOTINSTALL /;}' \ |
547 |
-e '/^install(/,/)/{s/^/#DONOTINSTALL /;}' \ |
548 |
-e '/kde4_install_icons(.*)/{s/^/#DONOTINSTALL /;}' || \ |
549 |
die "${LINENO}: sed died in the KMCOMPILEONLY section while processing ${i}" |
550 |
_change_cmakelists_parent_dirs ${i} |
551 |
done |
552 |
|
553 |
# KMEXTRA section |
554 |
for i in ${KMEXTRA}; do |
555 |
debug-print "${LINENO}: KMEXTRA section, processing ${i}" |
556 |
find "${S}"/${i} -name CMakeLists.txt -print0 | \ |
557 |
xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ |
558 |
die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}" |
559 |
_change_cmakelists_parent_dirs ${i} |
560 |
done |
561 |
# KMEXTRA_NONFATAL section |
562 |
for i in ${KMEXTRA_NONFATAL}; do |
563 |
if [[ -d "${S}"/${i} ]]; then |
564 |
find "${S}"/${i} -name CMakeLists.txt -print0 | \ |
565 |
xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ |
566 |
die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}" |
567 |
_change_cmakelists_parent_dirs ${i} |
568 |
fi |
569 |
done |
570 |
|
571 |
case ${KMNAME} in |
572 |
kdebase-workspace) |
573 |
# COLLISION PROTECT section |
574 |
# Install the startkde script just once, as a part of kde-base/kdebase-startkde, |
575 |
# not as a part of every package. |
576 |
if [[ ${PN} != kdebase-startkde && -f "${S}"/CMakeLists.txt ]]; then |
577 |
# The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0. |
578 |
sed -i -e '/startkde/s/^/#DONOTINSTALL /' "${S}"/CMakeLists.txt || \ |
579 |
die "${LINENO}: sed died in the kdebase-startkde collision prevention section" |
580 |
fi |
581 |
# Strip EXPORT feature section from workspace for KDE4 versions > 4.1.82 |
582 |
if [[ ${PN} != libkworkspace ]]; then |
583 |
sed -i -e '/install(FILES ${CMAKE_CURRENT_BINARY_DIR}\/KDE4WorkspaceConfig.cmake/,/^[[:space:]]*FILE KDE4WorkspaceLibraryTargets.cmake )[[:space:]]*^/d' \ |
584 |
CMakeLists.txt || die "${LINENO}: sed died in kdebase-workspace strip EXPORT section" |
585 |
fi |
586 |
;; |
587 |
kdebase-runtime) |
588 |
# COLLISION PROTECT section |
589 |
# Only install the kde4 script as part of kde-base/kdebase-data |
590 |
if [[ ${PN} != kdebase-data && -f "${S}"/CMakeLists.txt ]]; then |
591 |
sed -i -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \ |
592 |
"${S}"/CMakeLists.txt || die "Sed to exclude bin/kde4 failed" |
593 |
fi |
594 |
;; |
595 |
kdepim) |
596 |
case ${PN} in |
597 |
kaddressbook|kalarm|kmailcvt|kontact|korganizer|korn) |
598 |
sed -i -n -e '/qt4_generate_dbus_interface(.*org\.kde\.kmail\.\(kmail\|mailcomposer\)\.xml/p' \ |
599 |
-e '/add_custom_target(kmail_xml /,/)/p' "${S}"/kmail/CMakeLists.txt || die "uncommenting xml failed" |
600 |
_change_cmakelists_parent_dirs kmail |
601 |
;; |
602 |
esac |
603 |
;; |
604 |
koffice) |
605 |
# prevent collisions |
606 |
if [[ ${PN} != koffice-data ]]; then |
607 |
sed -i -e '/install(.*FindKOfficeLibs.cmake/,/)/ d' \ |
608 |
"${S}"/cmake/modules/CMakeLists.txt || \ |
609 |
die "${LINENO}: sed died in collision prevention section" |
610 |
sed -i -n -e '1h;1!H;${g;s/install(.\+config-openexr.h.\+)//;p}' \ |
611 |
"${S}"/CMakeLists.txt || \ |
612 |
die "${LINENO}: sed died in collision prevention section" |
613 |
fi |
614 |
esac |
615 |
|
616 |
popd > /dev/null |
617 |
} |
618 |
|
619 |
# @FUNCTION: kde4-meta_src_configure |
620 |
# @DESCRIPTION: |
621 |
# Currently just calls its equivalent in kde4-base.eclass(5). Use this one in split |
622 |
# ebuilds. |
623 |
kde4-meta_src_configure() { |
624 |
debug-print-function ${FUNCNAME} "$@" |
625 |
|
626 |
kde4-base_src_configure |
627 |
} |
628 |
|
629 |
# @FUNCTION: kde4-meta_src_compile |
630 |
# @DESCRIPTION: |
631 |
# General function for compiling split KDE4 applications. |
632 |
# Overrides kde4-base_src_compile. |
633 |
kde4-meta_src_compile() { |
634 |
debug-print-function ${FUNCNAME} "$@" |
635 |
|
636 |
kde4-base_src_compile |
637 |
} |
638 |
|
639 |
# @FUNCTION: kde4-meta_src_test |
640 |
# @DESCRIPTION: |
641 |
# Currently just calls its equivalent in kde4-base.eclass(5). Use this in split |
642 |
# ebuilds. |
643 |
kde4-meta_src_test() { |
644 |
debug-print-function $FUNCNAME "$@" |
645 |
|
646 |
kde4-base_src_test |
647 |
} |
648 |
|
649 |
# @FUNCTION: kde4-meta_src_install |
650 |
# @DESCRIPTION: |
651 |
# Function for installing KDE4 split applications. |
652 |
kde4-meta_src_install() { |
653 |
debug-print-function $FUNCNAME "$@" |
654 |
|
655 |
kde4-meta_src_make_doc |
656 |
cmake-utils_src_install |
657 |
|
658 |
if [[ -n ${KMSAVELIBS} ]]; then |
659 |
install_library_dependencies |
660 |
fi |
661 |
} |
662 |
|
663 |
# @FUNCTION: kde4-meta_src_make_doc |
664 |
# @DESCRIPTION: |
665 |
# This function searches in ${S}/${KMMODULE}, |
666 |
# and tries to install "AUTHORS ChangeLog* README* NEWS todo" if these files exist. |
667 |
kde4-meta_src_make_doc() { |
668 |
debug-print-function ${FUNCNAME} "$@" |
669 |
|
670 |
local doc |
671 |
for doc in AUTHORS ChangeLog* README* NEWS TODO; do |
672 |
[[ -s ${KMMODULE}/${doc} ]] && newdoc "${KMMODULE}/${doc}" "${doc}.${KMMODULE##*/}" |
673 |
done |
674 |
|
675 |
kde4-base_src_make_doc |
676 |
} |
677 |
|
678 |
# @FUNCTION: kde4-meta_pkg_postinst |
679 |
# @DESCRIPTION: |
680 |
# Currently just calls its equivalent in kde4-base.eclass(5). Use this in split |
681 |
# ebuilds. |
682 |
kde4-meta_pkg_postinst() { |
683 |
debug-print-function ${FUNCNAME} "$@" |
684 |
|
685 |
kde4-base_pkg_postinst |
686 |
} |
687 |
|
688 |
# @FUNCTION: kde4-meta_pkg_postrm |
689 |
# @DESCRIPTION: |
690 |
# Currently just calls its equivalent in kde4-base.eclass(5). Use this in split |
691 |
# ebuilds. |
692 |
kde4-meta_pkg_postrm() { |
693 |
debug-print-function ${FUNCNAME} "$@" |
694 |
|
695 |
kde4-base_pkg_postrm |
696 |
} |