Typo
[linux_from_scratch_hints.git] / OLD / kde.txt
blob17f6ff44a2d4d122576a7cf9210931e23f18d554
1 TITLE:          KDE 2.2.2 optimized
2 LFS-VERSION:    3.0
3 AUTHOR:         Adam Ottley <aottley@shaw.ca>
5 SYNOPSIS:
6         The point of this hint is to build not just a simple KDE2 install, but
7 a highly optimized one.  KDE2 has a reputation for being somewhat of a
8 slowpoke, but there are things you can do to alleviate that.  A part of this
9 hint borrows from Bruce Dubbs's KDE hint, that being the part about building
10 a shared lcms library.  This hint assumes you've followed the x11.txt hint and
11 therefore have XFree86 and zlib installed.
13 Changelog:
14         Oct 30/01: Add symlinks so libmng can find the lcms headers (/me smacks
15 his head and thanks Michael Aichler)
16         Dec 01/01: KDE 2.2.2, new versions of support packages, and a better
17 list of optional packages.
18         Dec 10/01: Spun off lame/vorbis/cdparanoia into a separate hint, added
19 gdb and ispell to list of optional packages, added references to other hints
20 with the optional packages, added a fix for no font AA in kicker.
22 HINT:
24 The packages you'll need:
26 ----Required----
28   jpegsrc.v6b.tar.gz (http://www.ijg.org/)
29   libpng-1.2.0.tar.gz (http://www.libpng.org/pub/png/libpng.html)
30   tiff-v3.5.7.tar.gz (http://www.libtiff.org/)
31   libmng-1.0.3.tar.gz (http://www.libmng.com/)
32   qt-x11-2.3.1.tar.gz (http://www.trolltech.com/)
33   pcre-3.4.tar.gz (http://www.pcre.org/)
34   audiofile-0.2.3.tar.gz (http://dreamscape.68k.org/~michael/audiofile/)
35   libxml2-2.4.8.tar.gz (http://xmlsoft.org/)
36   libxslt-1.0.6.tar.gz (http://xmlsoft.org/)
37   lcms-1.0.7.tar.gz (http://www.littlecms.com/)
38   kdelibs-2.2.2.tar.bz2 (http://www.kde.org/)
39   kdebase-2.2.2.tar.bz2
42 Optional (but recommended) KDE packages:
43   kdeaddons-2.2.2.tar.bz2
44   kdeadmin-2.2.2.tar.bz2
45   kdeartwork-2.2.2.tar.bz2
46   kdegames-2.2.2.tar.bz2
47   kdegraphics-2.2.2.tar.bz2
48   kdemultimedia-2.2.2.tar.bz2
49   kdenetwork-2.2.2.tar.bz2
50   kdepim-2.2.2.tar.bz2
51   kdetoys-2.2.2.tar.bz2
52   kdeutils-2.2.2.tar.bz2
53   kdoc-2.2.2.tar.bz2
54   koffice-1.1.tar.bz2
55   <whichever KDE localization (i18n) package you need>
57 KDE packages that developers may want:
58   kdebindings-2.2.2.tar.bz2
59   kdevelop-2.0.2.tar.bz2
60   kdesdk-2.2.2.tar.bz2
63 ----Optional packages----
65 KDE relies on a number of outside packages for certain functionalities.  I've
66 compiled a list of here of what packages are used for what purposes (if I've
67 missed any, let me know).  The optional package lesstif is covered in this
68 hint.  
70   ltmain.patch (http://homepage.usask.ca/~aco907/ltmain.patch)
71 If you get absurdly long link lines when compiling KDE, you need this.
73   objprelink  (http://leon.bottou.com/objprelink/howto.html)
74 Prelinks the C++ libs, resulting in faster startup.  You also should get the 
75 patch for QT from the site, and if you're compiling KOffice, get the KDE patch 
76 as well.
78 -------
80 The following optional packages must be installed before compiling kdelibs:
82   openssl  (http://www.openssl.org/)
83 Needed for SSL support (i.e. https://).  See the openssh.txt hint.
85   cups  (http://www.cups.org/)
86 So KDE can print using the Common Unix Printing System.  See the
87 cups-printing.txt hint.
89   libfam  (http://oss.sgi.com/projects/fam/)
90 Allows libkio to monitor file alteration.
92 -------
94 The following optional packages must be installed before compiling kdebase:
96   lesstif  (http://www.lesstif.org/)
97 A Motif-like GUI toolkit used by Netscape browser plugins in Konqueror.
99   libao, libogg, libvorbis  (http://www.vorbis.com/)
100 Needed for encoding audio CDs into Ogg Vorbis format using KDE's audiocd:/ 
101 ioslave.  See the mp3ogg.txt hint.
103   lame  (http://www.mp3dev.org/mp3/)
104 Needed for encoding audio CDs into MP3 using audiocd:/.  See the mp3ogg.txt
105 hint.
107   cdparanoia  (http://www.xiph.org/paranoia/)
108 Needed for CD ripping using audiocd:/.  See the mp3ogg.txt hint.
110   lm_sensors  (http://www.netroedge.com/~lm78/)
111 Enables hardware temperature/voltage/fan RPM monitoring in ksysguard.  See the
112 lm_sensors.txt hint.
114   libsmbclient  (http://www.samba.org/)
115 Used for the SMB kioslave (Samba must be configured --with-libsmbclient).  See
116 the samba.txt hint.
118   openldap  (http://www.openldap.org/)
119 Used for the LDAP kioslave, enabling LDAP access to all KDE apps.
121   PAM  (http://www.kernel.org/pub/linux/libs/pam/pre/library/)
122 Pluggable authentication modules, used in KDM & Kscreensaver
123 (if anyone finds a PAM config that works with KDE + PAM + LFS, let me know
124 because KDE's included config doesn't work).
126   MesaGL  (http://www.mesa3d.org/)
127 OpenGL-compatible library, required for building the OpenGL screensavers.  See
128 the tuxracer.txt hint.
130 -------
131   
132 The following optional packages must be installed before compiling
133 kdegraphics:
135   sane  (http://www.mostang.com/sane/)
136 Needed for accessing scanners in KDE apps.
138   gPhoto2  (http://www.gphoto.org/)
139 For accessing digital cameras in KDE apps.
141 -------
143 The following optional packages must be installed before compiling 
144 kdemultimedia:
146   cdparanoia  (http://www.xiph.org/paranoia/)
147 Adds CD playback via Digital Audio Extraction to the included mpeglib.  See the
148 mp3ogg.txt hint.
150   libao, libogg, libvorbis  (http://www.vorbis.com/)
151 Needed for ogg vorbis playback in noatun.  See the mp3ogg.txt hint.
153 -------
155 The following optional packages must be installed before compiling kdeadmin:
157   rpm  (http://www.rpm.org)
158 For RPM support in kpackage.  See the rpm.txt hint.
160 -------
162 The following optional packages must be installed before compiling kdepim:
164   pilot-link  (http://www.pilot-link.org)
165 For connecting to Palm PDAs.
167 -------
169 The following optional packages must be installed before compiling kdeaddons:
171   SDL  (http://www.libsdl.org/)
172 A multimedia API used by noatun visualization plugins.  See the tuxracer.txt
173 hint.
175 -------
177 These four packages are useful, but do not have to be installed before 
178 compiling kde:
180   gdb  (http://www.gnu.org/)
181 The GNU debugger, allows backtraces to be generated following a crash.
183   teTeX  (http://www.tug.org/teTeX/)
184 Enables viewing DVI files in kdvi.
186   ghostscript  (http://www.cs.wisc.edu/~ghost/doc/gnu/index.htm)
187 Enables viewing Postscript and PDF files in kghostview.  See the gnome.txt
188 hint.
190   ispell  (http://fmg-www.cs.ucla.edu/fmg-members/geoff/ispell.html)
191 This multi-language spell checker is used in many KDE apps.
194 ----------------------------
195 INSTALL INSTRUCTIONS
196 ----------------------------
199 Optimization
201 Choose your CFLAGS and CXXFLAGS wisely.  -march=i686 has been known to cause 
202 problems in some cases, and the truth is, -march=i686 rarely gives a 
203 noticeable speedup over using just -mcpu=i686.  I built everything in this 
204 hint using "-O3 -march=i386 -mcpu=i686" on a LFS 3.0 system, and have not had 
205 problems.  That said, set your CFLAGS and CXXFLAGS variables to your choice of 
206 optimization.
208   export CFLAGS='-O3 -march=i386 -mcpu=i686'
209   export CXXFLAGS='-O3 -march=i386 -mcpu=i686'
212 -----------------------------
215 libjpeg v6b  (http://www.ijg.org/)
217 This library handles JPEG images.
219 Install jpeglib with these commands:
221 ./configure --prefix=/usr --enable-shared --enable-static &&
222 make &&
223 make install
226 -----------------------------
229 libpng 1.2.0  (http://www.libpng.org/pub/png/libpng.html)
231 WARNING: If you already have libpng-1.0.x installed and have apps linked to it,
232 it is recommended that you NOT install libpng-1.2.0.  Conflicts may occur if
233 you do.
235 libpng is used for portable network graphics images, which are losslessly 
236 compressed and used extensively in KDE.
238 Copy the appropriate makefile from the scripts directory to the root libpng 
239 directory.  makefile.linux is the obvious choice, but you can use 
240 makefile.gcmmx to get MMX optimizations if you like.
242   cp scripts/makefile.linux Makefile
244 Now edit the Makefile and change
246         prefix=/usr/local
248 to your choice of prefix and
250         #ZLIBLIB=/usr/local/lib
251         #ZLIBINC=/usr/local/include
252         ZLIBLIB=../zlib
253         ZLIBINC=../zlib
257         ZLIBLIB=/usr/lib
258         ZLIBINC=/usr/include
259         #ZLIBLIB=../zlib
260         #ZLIBINC=../zlib
262 and add any optimization flags you want to the CFLAGS declaration.  After 
263 that, it's just
265   make &&
266   make install
268 to install libpng.
271 --------------------------
274 lcms 1.07  (http://www.littlecms.com/)
276 LCMS is a colour management system.
278 Edit the install.gcc file to add the optimizations you want to the gcc line.  
279 i.e: gcc -O3 -march=i386 -mcpu=i686 -c *.c
280 You will get an error at the end of the build, but that's just a test of the 
281 library failing because of a missing parameter. The test will not fail if you 
282 add -lm after /usr/lib/liblcms.a in the second-last line of install.gcc.
284 To build and install the static library, run
286   ./install.gcc
288 I had to build a shared library in order for QT to successfully build against
289 libmng, so do that using these commands:
291   cd src &&
292   gcc -o liblcms.so.1.0.7 -shared *.o &&
293   cp liblcms.so.1.0.7 /usr/lib &&
294   cd /usr/lib &&
295   ln -s liblcms.so.1.0.7 liblcms.so.1 &&
296   ln -s liblcms.so.1 liblcms.so
298 Some programs (like libmng) look in different places for the lcms headers, so
299 we'll set up symlinks with these commands:
301   mkdir /usr/include/lcms &&
302   cd /usr/include/lcms &&
303   ln -s ../lcms.h lcms.h &&
304   ln -s ../icc34.h icc34.h
307 ----------------------------
310 libmng 1.0.3  (http://www.libmng.com/)
312 MNG is basically animated PNG.  With the patent controversy over GIF, there's
313 been a call to replace GIF with PNG, but until MNG there was nothing to
314 replace animated GIF.
316 Install libmng with these commands:
318   ./configure --prefix=/usr --with-zlib --with-jpeg --with-lcms &&
319   make &&
320   make install
323 ----------------------------
326 libtiff 3.5.7  (http://www.libtiff.org/)
328 libtiff handles TIFF format images.
330 If you don't want it installed in /usr/local, edit the config.site file and
331 uncomment the DIR_BIN, DIR_INC, DIR_LIB, and DIR_MAN declarations, and change
332 them to your preferred install location.
334 Configure tiff:
336   ./configure --noninteractive
338 In order to avoid inserting debug code, we unset COPTS in the make command,
339 but first we have to fix the Makefile:
341   cp Makefile Makefile.old &&
342   sed 's/-${MAKEFLAGS}/${MAKEFLAGS}/' Makefile.old > Makefile &&
343   make COPTS="" OPTIMIZER="$CFLAGS" &&
344   make install
347 ----------------------------
350 pcre 3.4  (http://www.pcre.org/)
352 PCRE stands for perl-compatible regular expressions, and is used by KDE for 
353 regular expressions in Javascript.
355 Install pcre with these commands:
357   ./configure --prefix=/usr &&
358   make &&
359   make install
362 -----------------------------
365 libxml2 2.4.8  (http://xmlsoft.org/)
367 Formerly a part of the kdesupport package, libxml2 is used for KDE's 
368 documentation and help system.  There are newer versions of libxml
369 available, but there are many reports of newer versions not working
370 with KDE 2.2.2.
373 Install libxml2 with these commands:
375   ./configure --prefix=/usr &&
376   make &&
377   make install
380 -----------------------------
383 libxslt 1.0.6  (http://xmlsoft.org/)
385 libxslt is a companion package to libxml2, and is used in KDE's help
386 system.  There are newer versions of libxslt available, but there are 
387 many reports of newer versions not working with KDE 2.2.2.
390 Install libxslt with these commands:
392   ./configure --prefix=/usr &&
393   make &&
394   make install
397 -----------------------------
400 audiofile 0.2.3  (http://dreamscape.68k.org/~michael/audiofile/)
402 Also a former part of kdesupport, you need audiofile for sound in KDE.
404 Install audiofile with these commands:
406   ./configure --prefix=/usr &&
407   make &&
408   make install
411 ------------------------------
414 objprelink  (http://leon.bottou.com/objprelink/howto.html)
416 This part is optional, but highly recommended.  You'll need the latest 
417 version of binutils (2.11.2 at this point), and if any of glibc, gcc or 
418 binutils were compiled with optimizations there is a chance that everything 
419 you prelink will segfault when run.  Prelinking failed for me on my LFS 2.4.3 
420 system where those were built with optimizations; on a LFS 3.0 system where 
421 glibc, gcc and binutils were compiled with no optimizations and everything 
422 else was built -O3 -march=i386 -mcpu=i686, prelinking worked fine.  Proceed 
423 with caution.
425 That said, build and install objprelink with these commands:
427   gcc -o objprelink -O2 objprelink.c -lbfd -liberty &&
428   cp objprelink /usr/bin
430 We can dynamically link with libbfd because the reason for statically linking 
431 given on the objprelink page doesn't apply to LFS.
434 ------------------------------
437 qt 2.3.1  (http://www.trolltech.com/)
439 The C++ GUI toolkit on which KDE is built may take an hour or two to compile.  
440 We'll save time by not compiling some of the things that aren't needed.  qt 
441 version 2.3.2 is NOT recommended, as KDE will likely not build against it due
442 to bugs.
444 Personally, I unpack qt into /usr/lib/qt-2.3.1 and make a symlink /usr/lib/qt2 
445 that points to qt-2.3.1.  You may have to add /usr/lib/qt2/lib to 
446 /etc/ld.so.conf, which I do just in case.
448 If you're prelinking, then apply the patch from the root qt directory:
450   patch -p0 -i qt-configs.patch
452 This will patch the file configs/linux-g++-shared.  You can also edit the 
453 linux-g++-shared file and add your optimizations to the SYSCONF_CXXFLAGS and 
454 SYSCONF_CFLAGS entries.  
457 Now configure qt:
459   export QTDIR=$PWD
460   ./configure -shared -sm -thread -gif -system-libpng -system-libmng \
461 -system-zlib -system-jpeg -no-opengl -xft -no-g++-exceptions
464 Configure parameter explanations:
466   -gif -system-libpng -system-libmng -system-zlib -system-jpeg:  
467 By default, GIF support is disabled and QT uses its own included zlib, libmng, 
468 libpng and jpeglib distributions.  We want it to use the libs we've already 
469 built, and we want GIF support.
471   -no-opengl:
472 OpenGL support isn't needed.
474   -xft:
475 Build with font antialiasing support.
477   -no-g++-exceptions:
478 Building QT without exceptions cuts a few megabytes off of the library size 
479 and speeds it up noticeably.
482 Now compile QT by running:
484   make symlinks sub-src sub-tools
486 And let it run for a while.  Telling it to make just those targets will keep 
487 it from compiling the tutorial and examples which aren't needed.  If you 
488 applied the objprelink patch and the build process unexpectedly stops with a 
489 segmentation fault when it runs "moc", that's an indication that prelinking 
490 will not work on your system.  I wish I knew what to do about it, but there 
491 is no known fix right now.
493 Once the make process is finished, that's it for building QT.
495 Since font anti-aliasing support has been compiled in, you'll need to add the 
496 path to your TrueType fonts to /etc/X11/XftConfig.  Just insert the line:
498   dir "/usr/X11R6/lib/X11/fonts/TrueType"
500 (or wherever you put your TrueType fonts), save and you're golden.  You may 
501 also want to prevent it from antialiasing certain font sizes.  For example, 
502 you can prevent it from antialiasing sizes between 8pt and 14pt by adding 
503 these lines to /etc/X11/XftConfig:
505   match
506         any size > 8
507         any size < 14
508   edit
509         antialias = false;
512 ----------------------------
515 lesstif  (optional) (http://www.lesstif.org/)
517 lesstif is an open version of the Motif toolkit, and is used by KDE for 
518 Netscape plugin support in Konqueror.
520 Install lesstif with these commands:
522   ./configure --prefix=/usr --disable-debug &&
523   make &&
524   make install
527 ----------------------------
530 KDE 2.2.2 preparation  (http://www.kde.org/)
533 KDE 2.2.x has been known to be problematic when compiled with -march=i686. 
534 Most notably, aRts tends to fail completely.  If you experience flakiness,
535 tone down your CFLAGS and CXXFLAGS and try again.
538 KDE2 usually goes into its own directory, most of the time /usr/local/kde2 or 
539 /opt/kde2.  I use the former.  Whatever you use, be sure to add the bin 
540 directory to your path and the lib directory to /etc/ld.so.conf.
543 Note for Nvidia driver users:  If you installed MesaGL into /usr for the 3D 
544 screensavers and subsequently installed the Nvidia drivers, the kdebase build
545 process will not find the libGL.la file and will halt.  To fix this, install
546 MesaGL, then KDE2, then the Nvidia drivers.
549 The included ltmain.sh file in each KDE package has a bug that causes very
550 long link commands, resulting in libtool taking much longer than normal to
551 execute.  However, this bug appears to only show up if you have multiple
552 versions of gcc installed simultaneously.  It didn't show up when building
553 KDE 2.2.2 with only gcc 2.95.3 installed, but when building KDE it with both
554 2.95.3 and 3.0.2 installed (with 2.95.3 being the default), the bug did show
555 up.  You'll know you're affected if you see something like this when doing a
556 make:
558 -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lc
559 -lm -lm -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s
560 -lgcc -lm -lc -lpthread -lpthread -lm -lm -lm -lgcc_s -lgcc -lc -lgcc_s
561 -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lc -lm -lm -lm -lgcc_s -lgcc
562 -lc -lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lc -lpthread -lm
563 -lm -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
564 -lm -lc -lm -lm -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lm -lgcc_s -lgcc -lc
565 -lgcc_s -lgcc -lm -lc -lpthread
567 If this happens, apply the ltmain.patch
568 (http://homepage.usask.ca/~aco907/ltmain.patch) file to each module using this
569 command in each module's directory:
571   patch -p0 -i ../ltmain.patch
573 This patch will not get the compile time down to the levels it would be with
574 only one gcc installed, but things will improve a lot.
577 The kdemultimedia configure script fails to enable the cdparanoia libraries
578 because of a missing link parameter.  To fix this, run the following commands
579 in the kdemultimedia directory before configuring:
581   cp configure configure.old
582   sed 's/-lcdda_interface/-lcdda_interface -lm/' configure.old > configure
585 ----------------------------
588 Installing KDE 2.2.2 (finally!)
590 Installing the KDE packages is straightforward.  First install kdelibs, then 
591 kdebase.  The rest can be done in any order.  Compile each package using
592 these commands:
594   ./configure --prefix=/usr/local/kde2 --disable-debug --enable-objprelink \
595 --enable-final &&
596   make &&
597   make install
599 Remove --enable-objprelink if you're not prelinking.  --enable-final is used 
600 because it tends to cut compile times by about 30-40%.  All optional packages
601 you've installed will be automatically detected by the configure script.
604 If you want KOffice prelinked, you'll need the kde-admin-acinclude.patch from 
605 the objprelink page.  Also, you'll need to use autoconf 2.13 and automake 
606 1.4-p5 - newer versions of autoconf and automake will NOT work.
608 If you're not prelinking KOffice, you can ignore the first two commands in the
609 instructions below.
611 Install KOffice with the following commands:
613   patch -p0 -i ../kde-admin-acinclude.patch &&
614   make -f Makefile.cvs &&
615   ./configure --prefix=/usr/local/kde2 --disable-debug --enable-objprelink \
616 --enable-final &&
617   make &&
618   make install
621 Now add "exec startkde" to your ~/.xinitrc.
623   echo "exec startkde" >> ~/.xinitrc
625 And fire it up by running "startx".  Configure it to your heart's content, but
626 check for another oddity:  if even after enabling font antialiasing in the
627 control center, programs launched from kicker (the panel where the K Menu/
628 taskbar/system tray reside) still don't have their fonts antialiased, exit KDE
629 and open up the startkde script (found in KDEDIR/bin) in a text editor and
630 go to the line near the bottom:
632   LD_BIND_NOW=true kdeinit +kcminit +knotify
634 remove LD_BIND_NOW=true so that it looks like
636   kdeinit +kcminit +knotify
638 and restart KDE.  That should fix the problem without slowing things down.
641 For reference, here are the times it took for me to compile the KDE2 packages
642 on a 400MHz Pentium 2 with 256MB of RAM, with only gcc 2.95.3 installed:
644 kdeaddons:      6 min
645 kdeadmin:       7 min
646 kdeartwork:     2 min
647 kdebase:        82 min
648 kdegames:       21 min
649 kdegraphics:    11 min
650 kdelibs:        55 min
651 kdemultimedia:  31 min
652 kdenetwork:     27 min
653 kdepim:         9 min
654 kdeutils:       18 min
655 kdetoys:        4 min
656 kdoc:           1 min
657 koffice:        55 min