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
|
#!/bin/sh
# Copyright 2006, 2007, 2008 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Build with NODEVEL=<something> after building the other deps to get rid of
# the .so, include, and other files not needed for runtime.
PKGNAM=qt3
VERSION=${VERSION:-3.3.8b}
ARCH=${ARCH:-x86_64}
NUMJOBS=${NUMJOBS:-" -j7 "}
BUILD=${BUILD:-opt2}
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-${PKGNAM}
rm -rf $PKG
mkdir -p $TMP $PKG
# Don't build a devel package (but put a devel SYSTEM on this machine...)
NODEVEL=true
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
fi
#cd $TMP
# I have *many* times tried building this package in /tmp, and it always
# ends up with a "/tmp" directory embedded in some wrong place. Hopefully
# the next time I see this comment I'll remember that and not make the
# same mistake again just for the sake of doing things "right" (but having
# the package come out wrong...)
#rm -rf ${PKGNAM}-${VERSION}
mkdir -p /opt/kde3/lib${LIBDIRSUFFIX}
cd /opt/kde3/lib${LIBDIRSUFFIX}
rm -rf qt-3* qt3 qt-3.* qt3-*
tar xvf $CWD/qt-x11-free-$VERSION.tar.bz2 || exit 1
mv qt-x11-free-$VERSION qt3
cd qt3
if [ $ARCH = "i486" ]; then
zcat $CWD/qt.x86.cflags.diff.gz | patch -p1 || exit 1
fi
zcat $CWD/qt-x11.diff.gz | patch -p1 || exit 1
zcat $CWD/qt.mysql.h.diff.gz | patch -p1 || exit 1
# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
QTDIR=/opt/kde3/lib${LIBDIRSUFFIX}/qt3
# And here's what we are currently using. The "yes" agrees to the GPL, so don't run this script if you
# don't agree. :-)
echo "yes" | CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" ./configure \
-prefix /opt/kde3/lib${LIBDIRSUFFIX}/qt3-${VERSION} \
-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
# We're using '-i' to work around a bug where the build tries to strip html files.
# Build the important stuff:
make $NUMJOBS -i
make install || exit 1
make $NUMJOBS -i symlinks sub-src sub-tools
make install || exit 1
make install INSTALL_ROOT=$PKG || exit 1
# Link the shared libraries into /opt/kde3/lib.
( cd /opt/kde3/lib${LIBDIRSUFFIX}
for file in qt3/lib/*.so* ; do
ln -sf $file .
done
)
# Leave these out so as not to interfere with Qt4:
if [ -z "$NODEVEL" ]; then
# Add man pages:
mkdir -p $PKG/usr/man
cp -a doc/man/* $PKG/usr/man
find $PKG/usr/man -type f -exec gzip -9 "{}" \;
fi
if [ $ARCH = "i486" ]; then
# Put this back as shipped:
( cd $PKG/opt/kde3/lib/qt3-${VERSION}
zcat $CWD/qt.x86.cflags.diff.gz | patch -p1 -R )
fi
mkdir -p $PKG/etc/profile.d
cat $CWD/profile.d/qt.sh | sed -e "s#/lib#/lib${LIBDIRSUFFIX}#" \
> $PKG/etc/profile.d/qt.sh
cat $CWD/profile.d/qt.csh | sed -e "s#/lib#/lib${LIBDIRSUFFIX}#" \
> $PKG/etc/profile.d/qt.csh
chmod 755 $PKG/etc/profile.d/*
# Strip binaries:
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
# Put a ton of links to more "normal" places. I'd just use a prefix of /usr, but it
# creates a ton of new (and ambiguously named) /usr directories...
mkdir -p $PKG/opt/kde3/bin
( cd $PKG/opt/kde3/bin
for file in assistant designer linguist lrelease lupdate moc qm2ts qmake qtconfig uic ; do
ln -sf /opt/kde3/lib${LIBDIRSUFFIX}/qt3/bin/$file .
done
)
sed -i -e "s#/lib\$#/lib${LIBDIRSUFFIX}#" \
$PKG/opt/kde3/lib${LIBDIRSUFFIX}/qt3-$VERSION/lib/pkgconfig/qt-mt.pc || exit 1
mkdir -p $PKG/opt/kde3/lib${LIBDIRSUFFIX}/pkgconfig
( cd $PKG/opt/kde3/lib${LIBDIRSUFFIX}/pkgconfig
ln -sf /opt/kde3/lib${LIBDIRSUFFIX}/qt3/lib/pkgconfig/qt-mt.pc .
)
# Add a documentation directory:
mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
cp -a \
FAQ INSTALL LICENSE.GPL* LICENSE.QPL MANIFEST PLATFORMS README* changes* \
$PKG/usr/doc/${PKGNAM}-$VERSION
# Put the actual file tree in /opt/kde3/lib/qt3:
mv $PKG/opt/kde3/lib${LIBDIRSUFFIX}/qt3-${VERSION} $PKG/opt/kde3/lib${LIBDIRSUFFIX}/qt3
( cd $PKG/opt/kde3/lib${LIBDIRSUFFIX} ; ln -sf qt3 qt3-${VERSION})
( cd $PKG/opt/kde3/lib${LIBDIRSUFFIX}
for file in qt3/lib/*.so* ; do
ln -sf $file .
done
)
# This much documentation isn't needed for the compat qt3 package -- look in the
# source if you need it.
rm -rf $PKG/opt/kde3/lib${LIBDIRSUFFIX}/qt3/doc
mkdir -p $PKG/install
zcat $CWD/doinst.sh.gz | sed -e "s#/lib#/lib${LIBDIRSUFFIX}#" \
> $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
|