I ran into trouble today: I wanted to compile a package, but it insisted on linking with the static version of the Qt library, which I did not have. I don't know why, but the static library is not included with Slackware. So what can I do? I thought I should be able to compile the library with ease, using Slackware sources. Well... it was a bit more involved than that.

The steps I took are for Slackware 10.2, but I think Slackware 11.0 uses nearly identical library versions.

First, in order to compile Qt, you need access to the source of the Freetype library, as Qt links to its internal bits and pieces. So unpack freetype 2.3.4. Then, create the following symbolic links:

/usr/include/freetype2/ft2build.h -> $FREETYPEDIR/include/ft2build.h
/usr/include/freetype2/freetype/internal -> $FREETYPEDIR/include/freetype/internal/

Here, $FREETYPEDIR is assumed to contain the location where Freetype was unpacked. No need to set an environment variable, just substitute the right path as you create the links above.

Note that you don't have to actually compile Freetype.

Next, unpack Qt. You also need the Slackware file KDE.Options. Look at the Slackware file qt.SlackBuild, and follow the steps. Essentially, this means

. ../KDE.options
mv qt-x11-free-$VERSION qt
mv qt-x11-free-3.3.4 qt
cd qt
QTDIR=`pwd`
export QTDIR
export YACC='byacc -d'
zcat $DOWNLOAD/qt.x86.cflags.diff.gz | patch -p1
zcat $CWD/qt-x11.diff.gz | patch -p1
zcat $CWD/qt.mysql.h.diff.gz | patch -p1
zcat $CWD/qt-x11-free-3.3.4.pixmap.overflow.check.diff.gz | patch -p1
zcat $CWD/utf8-bug-qt3.diff.gz | patch -p0
find . -perm 2775 -exec chmod 755 {} \;
find . -perm 2755 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 555 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;

I.e., you don't need to do a whole bunch of things that Slackware needs to create a real installation package, just the steps that are essential to make a successful compilation. The variable $CWD holds the location of the Slackware source files. Again, it is not necessary to set this variable, just make sure you're using the correct path in its place.

Now it is necessary to patch a file. In src/3rdparty/opentype, change ftxopen.c as follows:

--- ftxopen-orig.c 2003-09-08 07:09:07.000000000 -0400
+++ ftxopen.c 2007-07-14 15:19:23.000000000 -0400
@@ -15,6 +15,10 @@
 *
 ******************************************************************/
 
+#define FT2_BUILD_LIBRARY
+#include <freetype/config/ftheader.h>
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/ftmemory.h>
 #include <freetype/internal/tttypes.h>
 @@ -24,6 +28,10 @@
 #include "ftxopen.h"
 #include "ftxopenf.h"
 
+#ifdef ALLOC_ARRAY
+#undef ALLOC_ARRAY
+#endif
+#define ALLOC_ARRAY(ptr,count,type) ft_mem_realloc(memory,sizeof(type),count,0,ptr,&error)
 
 /***************************
 * Script related functions

Of course you can feed the above to patch -p0.

Now you can run configure using Slackware's options:

./configure \
-prefix /usr/lib/qt \
-release \
-system-zlib \
-system-libpng \
-qt-imgfmt-png \
-system-libmng \
-qt-imgfmt-mng \
-system-libjpeg \
-qt-imgfmt-jpeg \
-qt-gif \
-thread \
-stl \
-no-g++-exceptions \
-xft \
-plugin-sql-mysql \
-plugin-style-cde \
-plugin-style-compact \
-qt-style-motif \
-plugin-style-motifplus \
-plugin-style-platinum \
-plugin-style-sgi \
-plugin-style-windows \
-enable-opengl

To actually build the library, do the following:

cd src
make staticlib

If all goes well, this should produce the missing libqt-mt.a, which you should be able to copy to /usr/lib.

Of course in the end, I found out that I did not need the static library at all in the first place...