sys-cluster/openmpi: bump 2.0.3
[gentoo.git] / eclass / kde4-meta.eclass
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 #
4 # @ECLASS: kde4-meta.eclass
5 # @MAINTAINER:
6 # kde@gentoo.org
7 # @BLURB: Eclass for writing "split" KDE packages.
8 # @DESCRIPTION:
9 # This eclass provides all necessary functions for writing split KDE ebuilds.
10 #
11 # You must define KMNAME to use this eclass, and do so before inheriting it. All other variables are optional.
12 # Do not include the same item in more than one of KMMODULE, KMMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY.
13
14 if [[ -z ${_KDE4_META_ECLASS} ]]; then
15 _KDE4_META_ECLASS=1
16
17 [[ -z ${KMNAME} ]] && die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild"
18
19 inherit kde4-base
20
21 KDEMETA_EXPF="pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm"
22 EXPORT_FUNCTIONS ${KDEMETA_EXPF}
23
24 # Add dependencies that all packages in a certain module share.
25 case ${KMNAME} in
26         kdepim|kdepim-runtime)
27                 case ${PN} in
28                         akregator|kaddressbook|kjots|kmail|knode|knotes|korganizer|ktimetracker)
29                                 IUSE+=" +kontact"
30                                 RDEPEND+=" kontact? ( $(add_kdeapps_dep kontact '' ${PV}) )"
31                                 ;;
32                 esac
33                 ;;
34 esac
35
36 DEPEND+=" ${COMMONDEPEND}"
37 RDEPEND+=" ${COMMONDEPEND}"
38 unset COMMONDEPEND
39
40 debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after metapackage-specific dependencies"
41 debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after metapackage-specific dependencies"
42
43 # Useful to build kde4-meta style stuff from extragear/playground (plasmoids etc)
44 case ${KDE_BUILD_TYPE} in
45         live)
46                 if [[ ${KDE_SCM} == svn ]]; then
47                         case ${KMNAME} in
48                                 extragear*|playground*)
49                                         ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}"
50                                         ESVN_PROJECT="${KMNAME}${ESVN_PROJECT_SUFFIX}"
51                                         ;;
52                         esac
53                 fi
54                 ;;
55 esac
56
57 # @ECLASS-VARIABLE: KMNAME
58 # @DESCRIPTION:
59 # Name of the parent-module (e.g. kdebase, kdepim, ...). You _must_ set it
60 # _before_ inheriting this eclass, (unlike the other parameters), since it's
61 # used to set $SRC_URI.
62
63 # @ECLASS-VARIABLE: KMMODULE
64 # @DESCRIPTION:
65 # Specify exactly one subdirectory of $KMNAME here. Defaults to $PN.
66 # The subdirectory listed here is treated exactly like items in $KMEXTRA.
67 #
68 # Example: The ebuild name of "kdebase/l10n" is kde-base/kdebase-l10n, because
69 # just 'l10n' would be too confusing. Hence it sets KMMODULE="l10n".
70
71 # @ECLASS-VARIABLE: KMNOMODULE
72 # @DESCRIPTION:
73 # If set to "true", $KMMODULE doesn't have to be defined.
74 #
75 # Example usage: If you're installing subdirectories of a package, like plugins,
76 # you mark the top subdirectory (containing the package) as $KMEXTRACTONLY, and
77 # set KMNOMODULE="true".
78 if [[ -z ${KMMODULE} ]] && [[ ${KMNOMODULE} != true ]]; then
79         KMMODULE=${PN}
80 fi
81
82 # @ECLASS-VARIABLE: KMEXTRA
83 # @DESCRIPTION:
84 # All subdirectories listed here will be extracted, compiled & installed.
85 # $KMMODULE is always added to $KMEXTRA.
86 # If KDE_HANDBOOK is 'always' or 'optional' and handbook USE-flag is set, and if this
87 # directory exists, then "doc/$KMMODULE" is added to $KMEXTRA. If there's additional
88 # documentation in different subdirectories, it should be added to KMEXTRA manually..
89
90 # @ECLASS-VARIABLE: KMCOMPILEONLY
91 # @DESCRIPTION:
92 # All subdirectories listed here will be extracted & compiled, but not installed.
93
94 # TODO: better formulation may be needed
95 # @ECLASS-VARIABLE: KMEXTRACTONLY
96 # @DESCRIPTION:
97 # All subdirectories listed here will be extracted, but neither compiled nor installed.
98 # This can be used to avoid compilation in a subdirectory of a directory in $KMMODULE or $KMEXTRA
99
100 # @ECLASS-VARIABLE: KMTARPARAMS
101 # @DESCRIPTION:
102 # Specify extra parameters to pass to tar, in kde4-meta_src_extract.
103 # '-xpf -j' are passed to tar by default.
104
105 # @FUNCTION: kde4-meta_pkg_setup
106 # @DESCRIPTION:
107 # Currently calls its equivalent in kde4-base.eclass(5) and checks the gcc version.
108 # Use this one in split ebuilds.
109 kde4-meta_pkg_setup() {
110         debug-print-function ${FUNCNAME} "$@"
111
112         kde4-base_pkg_setup
113 }
114
115 # @FUNCTION: kde4-meta_src_unpack
116 # @DESCRIPTION:
117 # This function unpacks the source for split ebuilds.
118 # Further more is processed in kde4-meta_src_extract
119 kde4-meta_src_unpack() {
120         debug-print-function ${FUNCNAME} "$@"
121
122         if [[ ${KDE_BUILD_TYPE} = live ]]; then
123                 case "${KDE_SCM}" in
124                         svn)
125                                 S="${WORKDIR}/${P}"
126                                 mkdir -p "${S}"
127                                 ESVN_RESTRICT="export" subversion_src_unpack
128                                 subversion_wc_info
129                                 subversion_bootstrap
130                                 ;;
131                         git)
132                                 git-r3_src_unpack
133                                 ;;
134                 esac
135         fi
136         kde4-meta_src_extract
137 }
138
139 # @FUNCTION: kde4-meta_src_extract
140 # @DESCRIPTION:
141 # A function to extract the source for a split KDE ebuild.
142 # Also see KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY and
143 # KMTARPARAMS.
144 kde4-meta_src_extract() {
145         debug-print-function ${FUNCNAME} "$@"
146
147         if [[ ${KDE_BUILD_TYPE} = live ]]; then
148                 # Export working copy to ${S}
149                 einfo "Exporting parts of working copy to ${S}"
150                 kde4-meta_create_extractlists
151
152                 case ${KDE_SCM} in
153                         svn)
154                                 local rsync_options subdir targetdir wc_path escm
155
156                                 rsync_options="--group --links --owner --perms --quiet --exclude=.svn/ --exclude=.git/"
157                                 wc_path="${ESVN_WC_PATH}"
158                                 escm="{ESVN}"
159
160                                 # Copy ${KMNAME} non-recursively (toplevel files)
161                                 rsync ${rsync_options} "${wc_path}"/* "${S}" \
162                                         || die "${escm}: can't export toplevel files to '${S}'."
163                                 # Copy cmake directory
164                                 if [[ -d "${wc_path}/cmake" ]]; then
165                                         rsync --recursive ${rsync_options} "${wc_path}/cmake" "${S}" \
166                                                 || die "${escm}: can't export cmake files to '${S}'."
167                                 fi
168                                 # Copy all subdirectories
169                                 for subdir in $(_list_needed_subdirectories); do
170                                         targetdir=""
171                                         if [[ $subdir = doc/* && ! -e "$wc_path/$subdir" ]]; then
172                                                 continue
173                                         fi
174
175                                         [[ ${subdir%/} = */* ]] && targetdir=${subdir%/} && targetdir=${targetdir%/*} && mkdir -p "${S}/${targetdir}"
176                                         rsync --recursive ${rsync_options} "${wc_path}/${subdir%/}" "${S}/${targetdir}" \
177                                                 || die "${escm}: can't export subdirectory '${subdir}' to '${S}/${targetdir}'."
178                                 done
179                                 ;;
180                 esac
181         else
182                 local abort tarball tarfile f extractlist postfix
183
184                 if [[ ${PV} =~ 4.4.11 ]]; then
185                         postfix="bz2"
186                         KMTARPARAMS+=" --bzip2"
187                 else
188                         postfix="xz"
189                         KMTARPARAMS+=" --xz"
190                 fi
191
192                 tarball="${KMNAME}-${PV}.tar.${postfix}"
193
194                 # Full path to source tarball
195                 tarfile="${DISTDIR}/${tarball}"
196
197                 # Detect real toplevel dir from tarball name - it will be used upon extraction
198                 # and in _list_needed_subdirectories
199                 topdir="${tarball%.tar.*}/"
200
201                 ebegin "Unpacking parts of ${tarball} to ${WORKDIR}"
202
203                 kde4-meta_create_extractlists
204
205                 for f in cmake/ CMakeLists.txt ConfigureChecks.cmake config.h.cmake
206                 do
207                         extractlist+=" ${topdir}${f}"
208                 done
209                 extractlist+=" $(_list_needed_subdirectories)"
210
211                 pushd "${WORKDIR}" > /dev/null || die
212
213                 # @ECLASS-VARIABLE: KDE4_STRICTER
214                 # @DESCRIPTION:
215                 # Print out all issues found executing tar / kmextract files
216                 # Set on if you want to find issues in kde-base ebuild unpack sequences
217                 [[ -n ${KDE4_STRICTER} ]] && echo 'tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist}'
218                 tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} 2> /dev/null || echo "tar extract command failed at least partially - continuing anyway"
219
220                 # Default $S is based on $P; rename the extracted directory to match $S if necessary
221                 if [[ ${KMNAME} != ${PN} ]]; then
222                         mv ${topdir} ${P} || die "Died while moving \"${topdir}\" to \"${P}\""
223                 fi
224
225                 popd > /dev/null || die
226
227                 eend $?
228
229                 if [[ -n ${KDE4_STRICTER} ]]; then
230                         for f in $(_list_needed_subdirectories fatal); do
231                                 if [[ ! -e ${S}/${f#*/} ]]; then
232                                         eerror "'${f#*/}' is missing"
233                                         abort=true
234                                 fi
235                         done
236                         [[ -n ${abort} ]] && die "There were missing files."
237                 fi
238
239                 # We don't need it anymore
240                 unset topdir
241         fi
242 }
243
244 # @FUNCTION: kde4-meta_create_extractlists
245 # @DESCRIPTION:
246 # Create lists of files and subdirectories to extract.
247 # Also see descriptions of KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY,
248 # KMEXTRACTONLY and KMTARPARAMS.
249 kde4-meta_create_extractlists() {
250         debug-print-function ${FUNCNAME} "$@"
251
252         # Add default handbook locations
253         # FIXME - legacy code - remove when 4.4.5 is gone or preferrably port 4.4.5.
254         if [[ $(get_kde_version) < 4.5 ]] && use_if_iuse handbook && [[ -z ${KMNOMODULE} ]]; then
255                 # We use the basename of $KMMODULE because $KMMODULE can contain
256                 # the path to the module subdirectory.
257                 KMEXTRA_NONFATAL+="
258                         doc/${KMMODULE##*/}"
259         fi
260
261         # Add default handbook locations
262         if [[ -z ${KMNOMODULE} ]] && ( [[ ${KDE_HANDBOOK} == always ]] || ( [[ ${KDE_HANDBOOK} == optional ]] && use handbook ) ); then
263                 KMEXTRA_NONFATAL+=" doc/${KMMODULE##*/}"
264         fi
265
266         # Add some CMake-files to KMEXTRACTONLY.
267         # Note that this actually doesn't include KMEXTRA handling.
268         # In those cases you should care to add the relevant files to KMEXTRACTONLY
269         case ${KMNAME} in
270                 kde-baseapps)
271                         KMEXTRACTONLY+="
272                                 CTestConfig.cmake
273                                 config-apps.h.cmake
274                                 ConfigureChecks.cmake"
275                         ;;
276                 kde-runtime)
277                         KMEXTRACTONLY+="
278                                 cmake/modules/
279                                 CTestConfig.cmake
280                                 config-runtime.h.cmake"
281                         ;;
282                 kde-workspace)
283                         KMEXTRACTONLY+="
284                                 cmake/modules/
285                                 config-unix.h.cmake
286                                 ConfigureChecks.cmake
287                                 config-workspace.h.cmake
288                                 config-X11.h.cmake
289                                 startkde.cmake
290                                 KDE4WorkspaceConfig.cmake.in"
291                         ;;
292                 kdepim)
293                         if [[ ${PN} != libkdepim ]]; then
294                                 KMEXTRACTONLY+="
295                                         libkdepim/"
296                         fi
297                         KMEXTRACTONLY+="
298                                 config-enterprise.h.cmake
299                                 kleopatra/ConfigureChecks.cmake
300                                 CTestCustom.cmake
301                                 kdepim-version.h.cmake
302                                 kdepim-version.h"
303                         if use_if_iuse kontact; then
304                                 KMEXTRA+="
305                                         kontact/plugins/${PLUGINNAME:-${PN}}/"
306                         fi
307                         ;;
308         esac
309
310         debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME}: KMEXTRACTONLY ${KMEXTRACTONLY}"
311 }
312
313 _list_needed_subdirectories() {
314         local i j kmextra kmextra_expanded kmmodule_expanded kmcompileonly_expanded extractlist
315
316         # We expand KMEXTRA by adding CMakeLists.txt files
317         kmextra="${KMEXTRA}"
318         [[ ${1} != fatal ]] && kmextra+=" ${KMEXTRA_NONFATAL}"
319         for i in ${kmextra}; do
320                 kmextra_expanded+=" ${i}"
321                 j=$(dirname ${i})
322                 while [[ ${j} != "." ]]; do
323                         kmextra_expanded+=" ${j}/CMakeLists.txt";
324                         j=$(dirname ${j})
325                 done
326         done
327
328         # Expand KMMODULE
329         if [[ -n ${KMMODULE} ]]; then
330                 kmmodule_expanded="${KMMODULE}"
331                 j=$(dirname ${KMMODULE})
332                 while [[ ${j} != "." ]]; do
333                         kmmodule_expanded+=" ${j}/CMakeLists.txt";
334                         j=$(dirname ${j})
335                 done
336         fi
337
338         # Expand KMCOMPILEONLY
339         for i in ${KMCOMPILEONLY}; do
340                 kmcompileonly_expanded+=" ${i}"
341                 j=$(dirname ${i})
342                 while [[ ${j} != "." ]]; do
343                         kmcompileonly_expanded+=" ${j}/CMakeLists.txt";
344                         j=$(dirname ${j})
345                 done
346         done
347
348         debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}"
349         debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded:  ${kmmodule_expanded}"
350         debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}"
351
352         # Create final list of stuff to extract
353         # We append topdir only when specified (usually for tarballs)
354         for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \
355                 ${KMEXTRACTONLY}
356         do
357                 extractlist+=" ${topdir}${i}"
358         done
359
360         echo ${extractlist}
361 }
362
363 # @FUNCTION: kde4-meta_src_prepare
364 # @DESCRIPTION:
365 # Meta-package build system configuration handling - commenting out targets, etc..
366 kde4-meta_src_prepare() {
367         debug-print-function ${FUNCNAME} "$@"
368
369         kde4-meta_change_cmakelists
370         kde4-base_src_prepare
371 }
372
373 # @FUNCTION: _change_cmakelists_parent_dirs
374 # @DESCRIPTION:
375 # Adjust CMakeLists.txt to shadow subdirectories
376 # that are not required for the build.
377 _change_cmakelists_parent_dirs() {
378         debug-print-function ${FUNCNAME} "$@"
379
380         local _olddir _dir
381         _dir="${S}"/${1}
382         until [[ ${_dir} == ${S} ]]; do
383                 _olddir=$(basename "${_dir}")
384                 _dir=$(dirname "${_dir}")
385                 debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}"
386                 if [[ -f ${_dir}/CMakeLists.txt ]]; then
387                         sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
388                                 -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
389                                 -i ${_dir}/CMakeLists.txt || die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}"
390                 fi
391         done
392 }
393
394 # @FUNCTION: kde4-meta_change_cmakelists
395 # @DESCRIPTION:
396 # Adjust CMakeLists.txt to comply to our splitting.
397 kde4-meta_change_cmakelists() {
398         debug-print-function ${FUNCNAME} "$@"
399
400         pushd "${S}" > /dev/null || die
401
402         comment_all_add_subdirectory ./
403
404         # Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt
405         if [[ -f CMakeLists.txt ]]; then
406                 sed -e '/add_subdirectory[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
407                         -e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
408                         -i CMakeLists.txt || die "${LINENO}: cmake sed died"
409         fi
410
411         # Restore "add_subdirectory( ${ ..." (this is done in kdesdk)
412         if [[ -f CMakeLists.txt ]]; then
413                 sed -e '/add_subdirectory[[:space:]]*([[:space:]]*\${/s/^#DONOTCOMPILE //' \
414                         -e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*\${/s/^#DONOTCOMPILE //' \
415                         -i CMakeLists.txt || die "${LINENO}: cmake sed died"
416         fi
417
418         if [[ -z ${KMNOMODULE} ]]; then
419                 # Restore "add_subdirectory" in $KMMODULE subdirectories
420                 find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | \
421                         xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
422                                 die "${LINENO}: died in KMMODULE section"
423                 _change_cmakelists_parent_dirs ${KMMODULE}
424         fi
425
426         local i
427
428         # KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY
429         for i in ${KMEXTRACTONLY}; do
430                 if [[ -d ${i} && -f ${i}/../CMakeLists.txt ]]; then
431                         sed -e "/([[:space:]]*$(basename $i)[[:space:]]*)/s/^/#DONOTCOMPILE /" \
432                                 -i ${i}/../CMakeLists.txt || \
433                                 die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}"
434                 fi
435         done
436
437         # KMCOMPILEONLY
438         for i in ${KMCOMPILEONLY}; do
439                 debug-print "${LINENO}: KMCOMPILEONLY, processing ${i}"
440                 # Uncomment "add_subdirectory" instructions inside $KMCOMPILEONLY, then comment "install" instructions.
441                 find "${S}"/${i} -name CMakeLists.txt -print0 | \
442                         xargs -0 sed -i \
443                                 -e 's/^#DONOTCOMPILE //g' \
444                                 -e '/install(.*)/I{s/^/#DONOTINSTALL /;}' \
445                                 -e '/^install(/,/)/I{s/^/#DONOTINSTALL /;}' \
446                                 -e '/kde4_install_icons(.*)/I{s/^/#DONOTINSTALL /;}' || \
447                                 die "${LINENO}: sed died in the KMCOMPILEONLY section while processing ${i}"
448                 _change_cmakelists_parent_dirs ${i}
449         done
450
451         # KMEXTRA section
452         for i in ${KMEXTRA}; do
453                 debug-print "${LINENO}: KMEXTRA section, processing ${i}"
454                 find "${S}"/${i} -name CMakeLists.txt -print0 | \
455                         xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
456                         die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}"
457                 _change_cmakelists_parent_dirs ${i}
458         done
459         # KMEXTRA_NONFATAL section
460         for i in ${KMEXTRA_NONFATAL}; do
461                 if [[ -d "${S}"/${i} ]]; then
462                         find "${S}"/${i} -name CMakeLists.txt -print0 | \
463                                 xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
464                                         die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}"
465                         _change_cmakelists_parent_dirs ${i}
466                 fi
467         done
468
469         case ${KMNAME} in
470                 kde-workspace)
471                         # COLLISION PROTECT section
472                         # Install the startkde script just once, as a part of kde-plasma/kdebase-startkde,
473                         # not as a part of every package.
474                         if [[ ${PN} != kdebase-startkde && -f CMakeLists.txt ]]; then
475                                 # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0.
476                                 sed -e '/startkde/s/^/#DONOTINSTALL /' \
477                                         -i CMakeLists.txt || die "${LINENO}: sed died in the kdebase-startkde collision prevention section"
478                         fi
479                         # Remove workspace target prefix in order to get direct linking to workspace libs
480                         sed -e '/set(KDE4WORKSPACE_TARGET_PREFIX/s/^/#OVERRIDE /' \
481                                 -i CMakeLists.txt || die "${LINENO}: sed died in KDE4WORKSPACE_TARGET_PREFIX removal section"
482                         # Strip EXPORT feature section from workspace for KDE4 versions > 4.1.82
483                         if [[ ${PN} != libkworkspace ]]; then
484                                 sed -e '/install(FILES ${CMAKE_CURRENT_BINARY_DIR}\/KDE4WorkspaceConfig.cmake/,/^[[:space:]]*FILE KDE4WorkspaceLibraryTargets.cmake )[[:space:]]*^/d' \
485                                         -i CMakeLists.txt || die "${LINENO}: sed died in kde-workspace strip config install and fix EXPORT section"
486                         fi
487                         # <KDE/4.11
488                         if [[ ${PN} != plasma-workspace ]]; then
489                                 sed -e '/KActivities/s/REQUIRED//' \
490                                         -i CMakeLists.txt || die "${LINENO}: sed died in kde-workspace dep reduction section"
491                         fi
492                         sed -e '/QImageBlitz/s/REQUIRED//' \
493                                 -i CMakeLists.txt || die "${LINENO}: sed died in kde-workspace dep reduction section 2"
494
495                         # >=KDE/4.11
496                         sed -e 's/TYPE REQUIRED/TYPE OPTIONAL/' -e 's/XCB REQUIRED/XCB/' -e 's/X11 REQUIRED/X11/' \
497                                 -e 's/message(FATAL_ERROR/message(/' -i CMakeLists.txt \
498                                 || die "${LINENO}: sed died in kde-workspace dep reduction section"
499                         if [[ "${PN}" != "kwin" ]]; then
500                                 sed -i -e "/^    macro_log_feature(OPENGL_OR_ES_FOUND/s/TRUE/FALSE/" \
501                                         "${S}"/CMakeLists.txt || die "${LINENO}: sed died removing kde-workspace opengl dependency"
502                         fi
503                         ;;
504                 kde-runtime)
505                         sed -e 's/TYPE REQUIRED/TYPE OPTIONAL/' -e '/LibGcrypt/s/REQUIRED//' -i CMakeLists.txt \
506                                 || die "${LINENO}: sed died in kde-runtime dep reduction section"
507
508                         # COLLISION PROTECT section
509                         # Only install the kde4 script as part of kde-base/kdebase-data
510                         if [[ ${PN} != kdebase-data && -f CMakeLists.txt ]]; then
511                                 sed -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \
512                                         -i CMakeLists.txt || die "Sed to exclude bin/kde4 failed"
513                         fi
514                         ;;
515                 kdenetwork)
516                         # Disable hardcoded kdepimlibs check
517                         sed -e 's/find_package(KdepimLibs REQUIRED)/macro_optional_find_package(KdepimLibs)/' \
518                                 -i CMakeLists.txt || die "failed to disable hardcoded checks"
519                         ;;
520                 kdepim)
521                         # Disable hardcoded checks
522                         sed -r -e 's/TYPE REQUIRED/TYPE OPTIONAL/' -e '/find_package\(KdepimLibs/s/REQUIRED//' \
523                                 -e '/find_package\((KdepimLibs|Boost|QGpgme|Akonadi|ZLIB|Strigi|SharedDesktopOntologies|Soprano|Nepomuk)/{/macro_optional_/!s/find/macro_optional_&/}' \
524                                 -e '/macro_log_feature\((Boost|QGPGME|Akonadi|ZLIB|STRIGI|SHAREDDESKTOPONTOLOGIES|Soprano|Nepomuk)_FOUND/s/ TRUE / FALSE /' \
525                                 -e 's/if[[:space:]]*([[:space:]]*BUILD_.*)[[:space:]]*/if(1) # &/' \
526                                 -e 's/if[[:space:]]*([[:space:]]*[[:alnum:]]*_FOUND[[:space:]]*)[[:space:]]*$/if(1) # &/' \
527                                 -i CMakeLists.txt || die "failed to disable hardcoded checks"
528                         # Disable broken or redundant build logic
529                         if use_if_iuse kontact || [[ ${PN} = kontact ]]; then
530                                 sed -e 's/if[[:space:]]*([[:space:]]*BUILD_.*)[[:space:]]*$/if(1) # &/' \
531                                         -e 's/if[[:space:]]*([[:space:]]*[[:alnum:]]*_FOUND[[:space:]]*)[[:space:]]*$/if(1) # &/' \
532                                         -i kontact/plugins/CMakeLists.txt || die 'failed to override build logic'
533                         fi
534                         case ${PV} in
535                                 4.4*)
536                                         case ${PN} in
537                                                 kalarm|kmailcvt|kontact|korganizer|korn)
538                                                         sed -n -e '/qt4_generate_dbus_interface(.*org\.kde\.kmail\.\(kmail\|mailcomposer\)\.xml/p' \
539                                                                 -e '/add_custom_target(kmail_xml /,/)/p' \
540                                                                 -i kmail/CMakeLists.txt || die "uncommenting xml failed"
541                                                         _change_cmakelists_parent_dirs kmail
542                                                         ;;
543                                         esac
544                                         ;;
545                         esac
546                         ;;
547         esac
548
549         popd > /dev/null || die
550 }
551
552 # @FUNCTION: kde4-meta_src_configure
553 # @DESCRIPTION:
554 # Currently just calls its equivalent in kde4-base.eclass(5). Use this one in split
555 # ebuilds.
556 kde4-meta_src_configure() {
557         debug-print-function ${FUNCNAME} "$@"
558
559         kde4-base_src_configure
560 }
561
562 # @FUNCTION: kde4-meta_src_compile
563 # @DESCRIPTION:
564 # General function for compiling split KDE4 applications.
565 # Overrides kde4-base_src_compile.
566 kde4-meta_src_compile() {
567         debug-print-function ${FUNCNAME} "$@"
568
569         kde4-base_src_compile "$@"
570 }
571
572 # @FUNCTION: kde4-meta_src_test
573 # @DESCRIPTION:
574 # Currently just calls its equivalent in kde4-base.eclass(5) if
575 # I_KNOW_WHAT_I_AM_DOING is set. Use this in split ebuilds.
576 kde4-meta_src_test() {
577         debug-print-function ${FUNCNAME} "$@"
578
579         if [[ $I_KNOW_WHAT_I_AM_DOING ]]; then
580                 kde4-base_src_test
581         else
582                 einfo "Tests disabled"
583         fi
584 }
585
586 # @FUNCTION: kde4-meta_src_install
587 # @DESCRIPTION:
588 # Function for installing KDE4 split applications.
589 kde4-meta_src_install() {
590         debug-print-function ${FUNCNAME} "$@"
591
592         # Search ${S}/${KMMODULE} and install common documentation files found
593         local doc
594         for doc in "${S}/${KMMODULE}"/{AUTHORS,CHANGELOG,ChangeLog*,README*,NEWS,TODO,HACKING}; do
595                 [[ -f "${doc}" ]] && [[ -s "${doc}" ]] && dodoc "${doc}"
596         done
597
598         kde4-base_src_install
599 }
600
601 # @FUNCTION: kde4-meta_pkg_preinst
602 # @DESCRIPTION:
603 # Invoke its equivalent in kde4-base.eclass.
604 kde4-meta_pkg_preinst() {
605         debug-print-function ${FUNCNAME} "$@"
606
607         kde4-base_pkg_preinst
608 }
609
610 # @FUNCTION: kde4-meta_pkg_postinst
611 # @DESCRIPTION:
612 # Invoke kbuildsycoca4.
613 kde4-meta_pkg_postinst() {
614         debug-print-function ${FUNCNAME} "$@"
615
616         kde4-base_pkg_postinst
617 }
618
619 # @FUNCTION: kde4-meta_pkg_postrm
620 # @DESCRIPTION:
621 # Currently just calls its equivalent in kde4-base.eclass(5). Use this in split
622 # ebuilds.
623 kde4-meta_pkg_postrm() {
624         debug-print-function ${FUNCNAME} "$@"
625
626         kde4-base_pkg_postrm
627 }
628
629 fi