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

Contents of /eclass/kde4-meta.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.29 - (hide annotations) (download)
Wed Dec 2 17:07:05 2009 UTC (4 years, 7 months ago) by abcd
Branch: MAIN
Changes since 1.28: +6 -1 lines
Update kde4 eclasses from overlay

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

  ViewVC Help
Powered by ViewVC 1.1.20