1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
# Copyright 1999-2000 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author Dan Armak <danarmak@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/eclass/kde-functions.eclass,v 1.21 2002/08/06 11:58:16 danarmak Exp $
# This contains everything except things that modify ebuild variables and functions (e.g. $P, src_compile() etc.)
ECLASS=kde-functions
INHERITED="$INHERITED $ECLASS"
# convinience functions for requesting autotools versions
need-automake() {
debug-print-function $FUNCNAME $*
unset WANT_AUTOMAKE_1_4
unset WANT_AUTOMAKE_1_5
unset WANT_AUTOMAKE_1_6
case $1 in
1.4) export WANT_AUTOMAKE_1_4=1;;
1.5) export WANT_AUTOMAKE_1_5=1;;
1.6) export WANT_AUTOMAKE_1_6=1;;
*) echo "!!! $FUNCNAME: Error: unrecognized automake version $1 requested";;
esac
}
need-autoconf() {
debug-print-function $FUNCNAME $*
unset WANT_AUTOCONF_2_1
unset WANT_AUTOCONF_2_5
case $1 in
2.1) export WANT_AUTOCONF_2_1=1;;
2.5) export WANT_AUTOCONF_2_5=1;;
*) echo "!!! $FUNCNAME: Error: unrecognized autoconf version $1 requested";;
esac
}
# ---------------------------------------------------------------
# kde/qt directory management etc. functions, was kde-dirs.ebuild
# ---------------------------------------------------------------
need-kde() {
debug-print-function $FUNCNAME $*
KDEVER="$1"
# if we're a kde-base package, we need an exact version of kdelibs
# to compile correctly.
if [ "${INHERITED//kde-dist}" != "$INHERITED" ]; then
newdepend "~kde-base/kdelibs-${KDEVER}"
set-kdedir $KDEVER
else
# everyone else only needs a minimum version
set-kdedir $KDEVER
if [ "$KDEMAJORVER" == "2" ]; then
newdepend "=kde-base/kdelibs-2.2*"
else
min-kde-ver $KDEVER
newdepend ">=kde-base/kdelibs-${selected_version}"
fi
fi
qtver-from-kdever $KDEVER
need-qt $selected_version
SLOT="$KDEMAJORVER"
}
set-kdedir() {
# NOTE: version 5 (no minor version or revision)
# are the new cvs ebuilds; these go into /usr/kde/cvs
debug-print-function $FUNCNAME $*
case "$1" in
2*)
need-autoconf 2.1
need-automake 1.4
;;
3*)
need-autoconf 2.5
need-automake 1.4
;;
5*)
need-autoconf 2.5
need-automake 1.4
;;
esac
# get version elements
IFSBACKUP=$IFS
IFS=".-_"
for x in $1; do
if [ -z "$KDEMAJORVER" ]; then KDEMAJORVER=$x
else if [ -z "$KDEMINORVER" ]; then KDEMINORVER=$x
else if [ -z "$KDEREVISION" ]; then KDEREVISION=$x
fi; fi; fi
done
IFS=$IFSBACKUP
# set install location:
# - 3rd party apps go into /usr/kde/$MAJORVER by default and have SLOT="$MAJORVER"
# - kde-base ebuilds go into /usr/kde/$MAJORVER.$MINORVER by default
# and have SLOT="$MAJORVER.$MINORVER"
# - kde-base cvs ebuilds have major version 5 and go into /usr/kde/cvs by default;
# they have SLOT="cvs"
# - if $KDE3DIR is defined (by the user), it overrides everything
# and both base and 3rd party kde stuff goes in there, while
# using the kdelibs (assumedly) present in $KDE3LIBSDIR
# which equals $KDE3DIR if not set (for kde3, same applies to kde2 with $KDE2DIR etc.)
# kde.eclass:src_compile:myconf doesn't know about it, we just tell it
# $KDEDIR (libraries location) and $PREFIX (install location)
case $KDEMAJORVER in
2)
if [ -n "$KDE2DIR" ]; then
export PREFIX=${KDE2DIR}
export KDEDIR=${KDE2LIBSDIR}
else
export PREFIX=/usr/kde/2
# backward compatibility, kde 2.2.2 goes in /usr/kde/2 not /usr/kde/2.2
export KDEDIR=/usr/kde/2
fi
;;
3)
if [ -n "$KDE3DIR" ]; then
# override all other considerations
export PREFIX=${KDE3DIR}
else
# base kde part
if [ "${INHERITED//kde-dist}" != "${INHERITED}" -o PN=kdelibs -o PN=arts ]; then
case $KDEMINORVER in
"") export PREFIX=/usr/kde/3
;;
0) export PREFIX=/usr/kde/3
# kde 3.1 alphas
[ "$KDEREVISION" -ge 6 ] && export PREFIX=/usr/kde/3.1
;;
1) export PREFIX=/usr/kde/3.1
;;
2) export PREFIX=/usr/kde/3.2
;;
esac
else
# 3rd party kde app
export PREFIX=/usr/kde/3
fi
fi
# set kdelibs location
# KDE3LIBSDIR overrides all considerations
if [ -n "$KDE3LIBSDIR" ]; then
export KDEDIR=${KDE3LIBSDIR}
else
# for kde base, equal to prefix
if [ "${INHERITED//kde-dist}" != "$INHERITED" ] || [ "$PN" == kdelibs ] || [ "$PN" == arts ]; then
debug-print "base package"
export KDEDIR=$PREFIX
else
# for everything else: try to locate latest version
# of kdelibs installed. if yours is outside the standard
# paths, that's what KDE3LIBSDIR is for, use it
for x in /usr/kde/{cvs,3.2,3.1,3.0,3} $KDEDIR $KDE3DIR $KDE3LIBSDIR /usr/kde/*; do
debug-print "checking for $x/include/kwin.h..."
if [ -f "${x}/include/kwin.h" ]; then
debug-print found
export KDEDIR="$x"
break
fi
done
fi
fi
;;
5)
# cvs
if [ -n "$KDECVSDIR" ]; then
# override all other considerations
export PREFIX="${KDECVSDIR}"
else
# cvs ebuilds are all from kde-base
export PREFIX="/usr/kde/cvs"
fi
# set kdelibs location
# KDECVSLIBSDIR overrides all considerations
if [ -n "$KDECVSLIBSDIR" ]; then
export KDEDIR=${KDECVSLIBSDIR}
else
# for kde base, equal to prefix
export KDEDIR=$PREFIX
fi
;;
esac # $KDEMAJORVER in
# check that we've set everything
[ -z "$PREFIX" ] && die "$ECLASS: Error: could not set install prefix, consult log"
[ "${INHERITED//kde-dist}" != "${INHERITED}" -a -z "$KDEDIR" ] && die "$ECLASS: Error: could set kdelibs location, consult log"
debug-print "$FUNCNAME: result: KDEDIR=$KDEDIR, PREFIX=$PREFIX"
}
need-qt() {
debug-print-function $FUNCNAME $*
QTVER="$1"
case $QTVER in
2*) newdepend "=x11-libs/qt-2.3*" ;;
3*) newdepend ">=x11-libs/qt-3.0.4" ;;
*) echo "!!! error: $FUNCNAME() called with invalid parameter: \"$QTVER\", please report bug" && exit 1;;
esac
set-qtdir $QTVER
}
set-qtdir() {
debug-print-function $FUNCNAME $*
# select 1st element in dot-separated string
IFSBACKUP=$IFS
IFS="."
QTMAJORVER=""
for x in $1; do
[ -z "$QTMAJORVER" ] && QTMAJORVER=$x
done
IFS=$IFSBACKUP
export QTDIR="/usr/qt/$QTMAJORVER"
}
# returns minimal qt version needed for specified kde version
qtver-from-kdever() {
debug-print-function $FUNCNAME $*
local ver
case $1 in
2*) ver=2.3.1;;
3*) ver=3.0.3;;
5) ver=3.0.3;; # cvs version
*) echo "!!! error: $FUNCNAME called with invalid parameter: \"$1\", please report bug" && exit 1;;
esac
selected_version="$ver"
}
# compat
need-kdelibs() {
echo "WARNING: need-kdelibs() called, where need-kde() is correct.
If this happens at the unmerging of an old ebuild, disregard; otherwise report."
need-kde $*
}
min-kde-ver() {
debug-print-function $FUNCNAME $*
case $1 in
2*) selected_version="2.2.2";;
3.0_beta1) selected_version="3.0_beta1";;
3.0_beta2) selected_version="3.0_beta2";;
3.0_rc1) selected_version="3.0_rc1";;
3.0_rc2) selected_version="3.0_rc2";;
3.0_rc3) selected_version="3.0_rc3";;
3.0) selected_version="3.0";;
3.0.*) selected_version="3.0";;
3.1_alpha1) selected_version="3.1_alpha1";;
3.1.*) selected_version="3.1";;
3*) selected_version="3.0";;
*) echo "!!! error: $FUNCNAME() called with invalid parameter: \"$1\", please report bug" && exit 1;;
esac
}
# generic makefile sed for sandbox compatibility. for some reason when the kde makefiles (of many packages
# and versions) try to chown root and chmod 4755 some binaries (after installing, target isntall-exec-local),
# they do it to the files in $(bindir), not $(DESTDIR)/$(bindir). Most of these have been fixed in latest cvs
# but a few remain here and there.
# Pass a list of dirs to sed, Makefile.{am,in} in these dirs will be sed'ed.
# This should be harmless if the makefile doesn't need fixing.
kde_sandbox_patch() {
debug-print-function $FUNCNAME $*
while [ -n "$1" ]; do
# can't use dosed, because it only works for things in ${D}, not ${S}
cd $1
for x in Makefile.am Makefile.in Makefile
do
if [ -f "$x" ]; then
echo Running sed on $x
cp $x ${x}.orig
sed -e 's: $(bindir): $(DESTDIR)/$(bindir):g' -e 's: $(kde_datadir): $(DESTDIR)/$(kde_datadir):g' -e 's: $(TIMID_DIR): $(DESTDIR)/$(TIMID_DIR):g' ${x}.orig > ${x}
rm ${x}.orig
fi
done
shift
done
}
# remove an optimization flag from a specific subdirectory's makefiles.
# currently kdebase and koffice use it to compile certain subdirs without
# -fomit-frame-pointer which breaks some things.
# Parameters:
# $1: subdirectory
# $2: flag to remove
kde_remove_flag() {
cd ${S}/${1} || die
[ -n "$2" ] || die
cp Makefile Makefile.orig
sed -e "/CFLAGS/ s/${2}//g
/CXXFLAGS/ s/${2}//g" Makefile.orig > Makefile
cd $OLDPWD
}
|