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