/[gentoo-x86]/eclass/kde-functions.eclass
Gentoo

Contents of /eclass/kde-functions.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.59 - (show annotations) (download)
Tue Jul 1 11:51:43 2003 UTC (17 years ago) by danarmak
Branch: MAIN
Branch point for: RELEASE-1_4
Changes since 1.58: +2 -1 lines
predict accesses to QTDIR/etc/settings for the sandbox to make sure there are no access denied aborts even under userpriv+usersandbox. can't hurt anything, as it's just an addpredict not an addwrite. in fact, the addwrite (and the trick with ~/.kde, ~/.qt) should be removed and replaced with an addpredict - but that has to be tested, so not committing yet.

1 # Copyright 1999-2003 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/eclass/kde-functions.eclass,v 1.58 2003/06/10 17:30:20 danarmak Exp $
4 #
5 # Author Dan Armak <danarmak@gentoo.org>
6 #
7 # This contains everything except things that modify ebuild variables
8 # and functions (e.g. $P, src_compile() etc.)
9
10 ECLASS=kde-functions
11 INHERITED="$INHERITED $ECLASS"
12 # convinience functions for requesting autotools versions
13 need-automake() {
14
15 debug-print-function $FUNCNAME $*
16
17 unset WANT_AUTOMAKE_1_4
18 unset WANT_AUTOMAKE_1_5
19 unset WANT_AUTOMAKE_1_6
20 unset WANT_AUTOMAKE
21
22 case $1 in
23 1.4) export WANT_AUTOMAKE_1_4=1;;
24 1.5) export WANT_AUTOMAKE_1_5=1;;
25 1.6) export WANT_AUTOMAKE_1_6=1;;
26 1.7) export WANT_AUTOMAKE='1.7';;
27 *) echo "!!! $FUNCNAME: Error: unrecognized automake version $1 requested";;
28 esac
29
30 }
31
32 need-autoconf() {
33
34 debug-print-function $FUNCNAME $*
35
36 unset WANT_AUTOCONF_2_1
37 unset WANT_AUTOCONF_2_5
38
39 case $1 in
40 2.1) export WANT_AUTOCONF_2_1=1;;
41 2.5) export WANT_AUTOCONF_2_5=1;;
42 *) echo "!!! $FUNCNAME: Error: unrecognized autoconf version $1 requested";;
43 esac
44
45 }
46
47
48 # ---------------------------------------------------------------
49 # kde/qt directory management etc. functions, was kde-dirs.ebuild
50 # ---------------------------------------------------------------
51
52 need-kde() {
53
54 debug-print-function $FUNCNAME $*
55 KDEVER="$1"
56
57 # determine install locations
58 set-kdedir $KDEVER
59
60 # ask for autotools
61 case "$KDEVER" in
62 2*)
63 need-autoconf 2.1
64 need-automake 1.4
65 ;;
66 3.1*) # actually, newer 3.0.x stuff uses this too, but i want to make a clean switch
67 need-automake 1.6
68 need-autoconf 2.5
69 ;;
70 3*) # a generic call for need-kde 3 - automake 1.4 works most often
71 need-autoconf 2.5
72 need-automake 1.4
73 ;;
74 5*)
75 need-autoconf 2.5
76 need-automake 1.6
77 ;;
78 esac
79
80 # Things that need more special handling can just set NEED_KDE_DONT_ADD_KDELIBS_DEP
81 # and add one of their own manually.
82 if [ -n "$NEED_KDE_DONT_ADD_KDELIBS_DEP" ]; then
83 # do nothing
84 debug-print "$FUNCNAME: NEED_KDE_DONT_ADD_KDELIBS_DEP set, complying with request"
85 elif [ "${INHERITED//kde-dist}" != "$INHERITED" ]; then
86 # if we're a kde-base package, we need an exact version of kdelibs
87 # to compile correctly.
88 # all kinds of special cases live here.
89 # goes to show this code is awfully inflexible, i guess.
90 # maybe i should look at relocating it...
91 if [ "$PV" == "3.0.3" ]; then
92 newdepend "=kde-base/kdelibs-3.0.3*"
93 elif [ "$PV" == "3.1.1" ]; then
94 newdepend "=kde-base/kdelibs-3.1.1*"
95 elif [ "$PV" == "2.2.2" ]; then
96 newdepend "=kde-base/kdelibs-2.2.2*"
97 else
98 newdepend "~kde-base/kdelibs-${KDEVER}"
99 fi
100 else
101 # everything else only needs a minimum version
102 if [ "$KDEMAJORVER" == "2" ]; then
103 newdepend "=kde-base/kdelibs-2.2*"
104 else
105 min-kde-ver $KDEVER
106 newdepend ">=kde-base/kdelibs-${selected_version}"
107 fi
108 fi
109
110 qtver-from-kdever $KDEVER
111 need-qt $selected_version
112
113 if [ -n "$KDEBASE" ]; then
114 SLOT="$KDEMAJORVER.$KDEMINORVER"
115 else
116 SLOT="0"
117 fi
118
119 }
120
121 set-kdedir() {
122
123 debug-print-function $FUNCNAME $*
124
125
126 # set install location:
127 # - 3rd party apps go into /usr, and have SLOT="0".
128 # - kde-base category ebuilds go into /usr/kde/$MAJORVER.$MINORVER,
129 # and have SLOT="$MAJORVER.$MINORVER".
130 # - kde-base category cvs ebuilds have major version 5 and go into
131 # /usr/kde/cvs; they have SLOT="cvs".
132 # - Backward-compatibility exceptions: all kde2 packages (kde-base or otherwise)
133 # go into /usr/kde/2. kde 3.0.x goes into /usr/kde/3 (and not 3.0).
134 # - kde-base category ebuilds always depend on their exact matching version of
135 # kdelibs and link against it. Other ebuilds link aginst the latest one found.
136 # - This function exports $PREFIX (location to install to) and $KDEDIR
137 # (location of kdelibs to link against) for all ebuilds.
138 #
139 # -- Overrides - deprecated but working for now: --
140 # - If $KDEPREFIX is defined (in the profile or env), it overrides everything
141 # and both base and 3rd party kde stuff goes in there.
142 # - If $KDELIBSDIR is defined, the kdelibs installed in that location will be
143 # used, even by kde-base packages.
144
145 # get version elements
146 IFSBACKUP="$IFS"
147 IFS=".-_"
148 for x in $1; do
149 if [ -z "$KDEMAJORVER" ]; then KDEMAJORVER=$x
150 else if [ -z "$KDEMINORVER" ]; then KDEMINORVER=$x
151 else if [ -z "$KDEREVISION" ]; then KDEREVISION=$x
152 fi; fi; fi
153 done
154 [ -z "$KDEMINORVER" ] && KDEMINORVER="0"
155 [ -z "$KDEREVISION" ] && KDEREVISION="0"
156 IFS="$IFSBACKUP"
157 debug-print "$FUNCNAME: version breakup: KDEMAJORVER=$KDEMAJORVER KDEMINORVER=$KDEMINORVER KDEREVISION=$KDEREVISION"
158
159 # install prefix
160 if [ -n "$KDEPREFIX" ]; then
161 export PREFIX="$KDEPREFIX"
162 elif [ "$KDEMAJORVER" == "2" ]; then
163 export PREFIX="/usr/kde/2"
164 else
165 if [ -z "$KDEBASE" ]; then
166 export PREFIX="/usr"
167 else
168 case $KDEMAJORVER.$KDEMINORVER in
169 3.0) export PREFIX="/usr/kde/3";;
170 3.1) export PREFIX="/usr/kde/3.1";;
171 3.2) export PREFIX="/usr/kde/3.2";;
172 5.0) export PREFIX="/usr/kde/cvs";;
173 esac
174 fi
175 fi
176
177 # kdelibs location
178 if [ -n "$KDELIBSDIR" ]; then
179 export KDEDIR="$KDELIBSDIR"
180 elif [ "$KDEMAJORVER" == "2" ]; then
181 export KDEDIR="/usr/kde/2"
182 else
183 if [ -z "$KDEBASE" ]; then
184 # find the latest kdelibs installed
185 for x in /usr/kde/{cvs,3.2,3.1,3.0,3} $PREFIX $KDE3LIBSDIR $KDELIBSDIR $KDE3DIR $KDEDIR /usr/kde/*; do
186 if [ -f "${x}/include/kwin.h" ]; then
187 debug-print found
188 export KDEDIR="$x"
189 break
190 fi
191 done
192 else
193 # kde-base ebuilds msut always use the exact version of kdelibs they came with
194 case $KDEMAJORVER.$KDEMINORVER in
195 3.0) export KDEDIR="/usr/kde/3";;
196 3.1) export KDEDIR="/usr/kde/3.1";;
197 3.2) export KDEDIR="/usr/kde/3.2";;
198 5.0) export KDEDIR="/usr/kde/cvs";;
199 esac
200 fi
201 fi
202
203
204 # check that we've set everything
205 [ -z "$PREFIX" ] && debug-print "$FUNCNAME: ERROR: could not set install prefix"
206 [ -z "$KDEDIR" ] && debug-print "$FUNCNAME: ERROR: couldn't set kdelibs location"
207
208 debug-print "$FUNCNAME: Will use the kdelibs installed in $KDEDIR, and install into $PREFIX."
209
210 }
211
212 need-qt() {
213
214 debug-print-function $FUNCNAME $*
215 QTVER="$1"
216
217 QT=qt
218
219 case $QTVER in
220 2*) newdepend "=x11-libs/${QT}-2.3*" ;;
221 3*) newdepend ">=x11-libs/${QT}-${QTVER}" ;;
222 *) echo "!!! error: $FUNCNAME() called with invalid parameter: \"$QTVER\", please report bug" && exit 1;;
223 esac
224
225 set-qtdir $QTVER
226
227 }
228
229 set-qtdir() {
230
231 debug-print-function $FUNCNAME $*
232
233
234 # select 1st element in dot-separated string
235 IFSBACKUP=$IFS
236 IFS="."
237 QTMAJORVER=""
238 for x in $1; do
239 [ -z "$QTMAJORVER" ] && QTMAJORVER=$x
240 done
241 IFS=$IFSBACKUP
242
243 export QTDIR="/usr/qt/$QTMAJORVER"
244
245 # i'm putting this here so that the maximum amount of qt/kde apps gets it -- danarmak
246 # if $QTDIR/etc/settings/qtrc file exists, the qt build tools try to create
247 # a .qtrc.lock file in that directory. It's easiest to allow them to do so.
248 [ -d "$QTDIR/etc/settings" ] && addwrite "$QTDIR/etc/settings"
249 addpredict "$QTDIR/etc/settings"
250
251 }
252
253 # returns minimal qt version needed for specified kde version
254 qtver-from-kdever() {
255
256 debug-print-function $FUNCNAME $*
257
258 local ver
259
260 case $1 in
261 2*) ver=2.3.1;;
262 3.1*) ver=3.1;;
263 3*) ver=3.0.5;;
264 5) ver=3.1;; # cvs version
265 *) echo "!!! error: $FUNCNAME called with invalid parameter: \"$1\", please report bug" && exit 1;;
266 esac
267
268 selected_version="$ver"
269
270 }
271
272 # compat - not used anymore, but old ebuilds that once used this fail if it's not present
273 # when they are unmerged
274 need-kdelibs() {
275 echo "WARNING: need-kdelibs() called, where need-kde() is correct.
276 If this happens at the unmerging of an old ebuild, disregard; otherwise report."
277 need-kde $*
278 }
279
280 min-kde-ver() {
281
282 debug-print-function $FUNCNAME $*
283
284 case $1 in
285 2*) selected_version="2.2.2";;
286 3.0_beta1) selected_version="3.0_beta1";;
287 3.0_beta2) selected_version="3.0_beta2";;
288 3.0_rc1) selected_version="3.0_rc1";;
289 3.0_rc2) selected_version="3.0_rc2";;
290 3.0_rc3) selected_version="3.0_rc3";;
291 3.0) selected_version="3.0";;
292 3.0.*) selected_version="3.0";;
293 3.1_alpha1) selected_version="3.1_alpha1";;
294 3.1_beta1) selected_version="3.1_beta1";;
295 3.1_beta2) selected_version="3.1_beta2";;
296 3.1_rc1) selected_version="3.1_rc1";;
297 3.1_rc2) selected_version="3.1_rc2";;
298 3.1_rc3) selected_version="3.1_rc3";;
299 3.1_rc5) selected_version="3.1_rc5";;
300 3.1_rc6) selected_version="3.1_rc6";;
301 3.1.*) selected_version="3.1";;
302 3*) selected_version="3.0";;
303 5) selected_version="5";;
304 *) echo "!!! error: $FUNCNAME() called with invalid parameter: \"$1\", please report bug" && exit 1;;
305 esac
306
307 }
308
309 # generic makefile sed for sandbox compatibility. for some reason when the kde makefiles (of many packages
310 # and versions) try to chown root and chmod 4755 some binaries (after installing, target isntall-exec-local),
311 # they do it to the files in $(bindir), not $(DESTDIR)/$(bindir). Most of these have been fixed in latest cvs
312 # but a few remain here and there.
313 # Pass a list of dirs to sed, Makefile.{am,in} in these dirs will be sed'ed.
314 # This should be harmless if the makefile doesn't need fixing.
315 kde_sandbox_patch() {
316
317 debug-print-function $FUNCNAME $*
318
319 while [ -n "$1" ]; do
320 # can't use dosed, because it only works for things in ${D}, not ${S}
321 cd $1
322 for x in Makefile.am Makefile.in Makefile
323 do
324 if [ -f "$x" ]; then
325 echo Running sed on $x
326 cp $x ${x}.orig
327 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}
328 rm ${x}.orig
329 fi
330 done
331 shift
332 done
333
334 }
335
336
337 # remove an optimization flag from a specific subdirectory's makefiles.
338 # currently kdebase and koffice use it to compile certain subdirs without
339 # -fomit-frame-pointer which breaks some things.
340 # Parameters:
341 # $1: subdirectory
342 # $2: flag to remove
343 kde_remove_flag() {
344
345 debug-print-function $FUNCNAME $*
346
347 cd ${S}/${1} || die
348 [ -n "$2" ] || die
349
350 cp Makefile Makefile.orig
351 sed -e "/CFLAGS/ s/${2}//g
352 /CXXFLAGS/ s/${2}//g" Makefile.orig > Makefile
353
354 cd $OLDPWD
355
356 }
357
358 # disable a subdir of a module from building.
359 # used by kdemultimedia et al
360 # autorun from kde_src_compile:configure if $KDE_REMOVE_DIR is set;
361 # $KDE_REMOVE_DIR is then passed as parameter
362 kde_remove_dir(){
363
364 debug-print-function $FUNCNAME $*
365
366 cd ${S}
367
368 while [ -n "$1" ]; do
369 for dir in $1; do
370
371 debug-print "$FUNCNAME: removing subdirectory $dir"
372
373 rm -rf $dir
374
375 if [ -f subdirs ]; then
376 mv subdirs subdirs.orig
377 grep -v $dir subdirs.orig > subdirs
378 fi
379
380 rm -f configure configure.in
381
382 export DO_NOT_COMPILE="$DO_NOT_COMPILE $dir"
383
384 done
385 shift
386 done
387
388 }
389
390
391 # is this a kde-base ebuid?
392 case $PN in kde-i18n*|arts|kdeaddons|kdeadmin|kdeartwork|kdebase|kdebindings|kdeedu|kdegames|kdegraphics|kdelibs|kdemultimedia|kdenetwork|kdepim|kdesdk|kdetoys|kdeutils|kdelibs-apidocs)
393 debug-print "$ECLASS: KDEBASE ebuild recognized"
394 export KDEBASE="true"
395 ;;
396 esac
397

  ViewVC Help
Powered by ViewVC 1.1.20