blob: c771a0588fcda4e8aecfe859210e77bdcd408751 (
plain)
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
#!/bin/bash
# -*- mode: shell-script; coding: UTF-8 -*-
#
# Build Xvnc with Xorg 7.4 or 7.5
#
set -e
PREFIX=
MAKE="make"
PARALLEL_MAKE=0
XORG_VERSION=7.4
XONLY=0
CFGHOST=
SRCDIR=`dirname $0`/..
modules="dri2proto \
libpthread-stubs \
glproto \
xf86vidmodeproto \
xextproto \
xproto \
kbproto \
inputproto \
xcmiscproto \
bigreqsproto \
fixesproto \
damageproto \
xf86driproto \
randrproto \
renderproto \
scrnsaverproto \
resourceproto \
fontsproto \
videoproto \
compositeproto \
xineramaproto \
libdrm \
libXau \
xtrans \
libXdmcp \
libX11 \
libXext \
libXxf86vm \
libICE \
libSM \
libXt \
libXmu \
libXfixes \
libXdamage \
libXi \
libxkbfile \
libfontenc \
libXfont \
libpciaccess \
pixman"
modules74="fontcacheproto \
evieext"
init()
{
update_modules
pushd xorg
tar jxf ~/.tigervnc-xorg-$XORG_VERSION/util-macros.tar.bz2
pushd util-macros-*
echo "Building macros"
./configure --prefix=${PREFIX}
($MAKE install)
popd
pushd xserver
if [ "$XORG_VERSION" = "7.4" ]; then
patch -p1 < $SRCDIR/unix/xserver16.patch
else
patch -p1 < $SRCDIR/unix/xserver18.patch
fi
for all in `find $SRCDIR/unix/xorg-$XORG_VERSION-patches/ -type f |grep '.*\.patch$'`; do
echo Applying $all
patch -p1 < $all
done
popd
popd
}
update_modules()
{
if [ -d xorg ]; then rm -rf xorg; fi
if [ -d xorg.build ]; then rm -rf xorg.build; fi
mkdir xorg
pushd xorg
$SRCDIR/unix/download-xorg-$XORG_VERSION
for module in ${modules}; do
tar jxf ~/.tigervnc-xorg-$XORG_VERSION/${module}.tar.bz2
done
[ -r ~/.tigervnc-xorg-$XORG_VERSION/Mesa.tar.bz2 ] && \
tar jxf ~/.tigervnc-xorg-$XORG_VERSION/Mesa.tar.bz2
[ -r ~/.tigervnc-xorg-$XORG_VERSION/Mesa.tar.gz ] && \
tar zxf ~/.tigervnc-xorg-$XORG_VERSION/Mesa.tar.gz
tar jxf ~/.tigervnc-xorg-$XORG_VERSION/freetype.tar.bz2
tar jxf ~/.tigervnc-xorg-$XORG_VERSION/xorg-server.tar.bz2
cp -r $SRCDIR/unix/xserver xserver
cp -r xorg-server-1.*/* xserver
popd
}
build ()
{
if [ $XONLY -eq 0 ]; then
# Build VNC
echo "*** Building VNC ***"
cmake -G"Unix Makefiles" ${1+"$@"} -DUSE_INCLUDED_ZLIB=1 -DUSE_INCLUDED_FLTK=1 -DBUILD_STATIC=1 $SRCDIR
$MAKE
# Build Xorg
echo "*** Building Xorg ***"
pushd xorg
# build freetype
echo "*** Building freetype ***"
pushd freetype-*
./configure ${CFGHOST} --prefix=${PREFIX} --enable-static --disable-shared
if [ $? -ne 0 ]; then
echo "Failed to configure freetype."
exit
fi
$MAKE install
popd
for module in ${modules}; do
extraoptions=""
cd ${module}-*
echo ======================
echo configuring ${module}
echo ======================
if [ "${module}" = "libX11" ]; then
extraoptions="${extraoptions} --without-xcb --disable-specs"
fi
if [ "${module}" = "libSM" ]; then
extraoptions="${extraoptions} --without-libuuid"
fi
if [ "${module}" = "pixman" ]; then
extraoptions="${extraoptions} --disable-gtk"
fi
if [ "${module}" = "libXfont" ]; then
extraoptions="${extraoptions} --with-freetype-config=${PREFIX}/bin/freetype-config"
fi
OLD_CFLAGS=${CFLAGS}
OLD_CXXFLAGS=${CXXFLAGS}
CFLAGS=${CFLAGS}' -fPIC'
CXXFLAGS=${CXXFLAGS}' -fPIC'
export CFLAGS CXXFLAGS
./configure ${CFGHOST} --prefix="${PREFIX}" ${extraoptions} --enable-static --disable-shared
CFLAGS=${OLD_CFLAGS}
CXXFLAGS=${OLD_CXXFLAGS}
export CFLAGS CXXFLAGS
echo ======================
echo building ${module}
echo ======================
if [ $? -ne 0 ]; then
echo "Failed to configure ${module}."
exit
fi
$MAKE install
cd ..
done
# build mesa
echo "*** Building Mesa ***"
pushd Mesa-*
./configure ${CFGHOST} --prefix=${PREFIX} --disable-driglx-direct --with-dri-drivers=swrast --with-driver=dri --disable-glut --without-demos
if [ $? -ne 0 ]; then
echo "Failed to configure Mesa."
exit
fi
$MAKE
$MAKE install
popd
popd
fi # XONLY
# build xserver
echo "*** Building xserver ***"
pushd xorg/xserver
autoreconf -fiv
XORGCFGFLAGS="--disable-dri --enable-dri2 --disable-composite --disable-xinerama --disable-xvfb --disable-xnest --disable-xorg --disable-dmx --disable-xwin --disable-xephyr --disable-kdrive --disable-config-dbus --disable-config-hal --disable-config-udev --with-sha1=libgcrypt SHA1_LIB=-lcrypto --disable-shared --enable-static ${XORGCFGFLAGS}"
./configure ${CFGHOST} --prefix=${PREFIX} ${XORGCFGFLAGS}
if [ $? -ne 0 ]; then
echo "Failed to configure X server."
exit
fi
$MAKE TIGERVNC_SRCDIR=$SRCDIR install
popd
}
rebuild ()
{
# Build VNC
echo "*** Building VNC ***"
$MAKE ${1+"$@"}
# build xserver
echo "*** Building xserver ***"
pushd xorg/xserver
$MAKE TIGERVNC_SRCDIR=$SRCDIR install ${1+"$@"}
popd
}
usage ()
{
echo "Usage: $0 init [-version <7.4 | 7.5>]"
echo
echo " $0 build [-version <7.4 | 7.5>]"
echo " [additional CMake flags]"
echo
echo " $0 rebuild [additional make options]"
echo
echo " $0 update [-version <7.4 | 7.5>]"
echo
exit 1
}
if [ -x '/usr/bin/getconf' -a "$PARALLEL_MAKE" = "1" ]; then
MAKE_PARALLEL=`/usr/bin/getconf _NPROCESSORS_ONLN 2>&1`
[ "$MAKE_PARALLEL" -gt 1 ] && MAKE="$MAKE -j$MAKE_PARALLEL"
fi
while [ $# -gt 0 ]
do
case "$1" in
init) MODE=init ;;
build) MODE=build ;;
xbuild) MODE=build; XONLY=1 ;;
rebuild) MODE=rebuild ;;
update) MODE=update ;;
-version) XORG_VERSION=$2; shift ;;
-parallel) PARALLEL_MAKE=1; ;;
-srcdir) SRCDIR=$2; shift ;;
*) break ;;
esac
shift
done
case "$XORG_VERSION" in
7.4) modules=$modules" "$modules74 ;;
7.5) ;;
*) if [ ! "$MODE" = "rebuild" ]; then usage; fi ;;
esac
pushd $SRCDIR
SRCDIR=`pwd`
echo "*** Using TigerVNC source tree at $SRCDIR ***"
popd
if [ "`pwd`" = "$SRCDIR/unix" ]; then
cd $SRCDIR
fi
if [ "$PREFIX" = "" ]; then
PREFIX=`pwd`/xorg.build
fi
if [ "$MODE" = "build" ]; then
if [ ! -d ./xorg.build/syslib ]; then
mkdir -p ./xorg.build/syslib
fi
for i in "$@"; do
case "$i" in
CC=*) CC=`echo $i | sed s/^CC=//g` ;;
CXX=*) CXX=`echo $i | sed s/^CXX=//g` ;;
CFLAGS=*) CFLAGS=`echo $i | sed s/^CFLAGS=//g` ;;
CXXFLAGS=*) CXXFLAGS=`echo $i | sed s/^CXXFLAGS=//g` ;;
LDFLAGS=*) LDFLAGS=`echo $i | sed s/^LDFLAGS=//g` ;;
esac
done
if [ "$CC" = "" ]; then
CC=gcc
fi
if [ "$CXX" = "" ]; then
CXX=g++
fi
if [ "$CFLAGS" = "" ]; then
CFLAGS=-O3
fi
if [ "$CXXFLAGS" = "" ]; then
CXXFLAGS=-O3
fi
CFLAGS="$CFLAGS -fPIC"
CXXFLAGS="$CXXFLAGS -fPIC"
LDFLAGS="$LDFLAGS -static-libgcc -L`pwd`/xorg.build/syslib"
echo CC = $CC
echo CXX = $CXX
echo CFLAGS = $CFLAGS
echo CXXFLAGS = $CXXFLAGS
echo LDFLAGS = $LDFLAGS
if [[ $CFLAGS = *-m32* ]]; then
CFGHOST="--host i686-pc-linux-gnu"
fi
STATICLIBS='libcrypto.a libz.a'
for lib in $STATICLIBS; do
if [ -f ./xorg.build/syslib/$lib ]; then
rm -f ./xorg.build/syslib/$lib
fi
done
IS64BIT=`echo -e "#ifdef __x86_64__\nis64bit_yes\n#else\nis64bit_no\n#endif" | $CC $CFLAGS -E - | grep is64bit`
STATICLIBDIR=
case $IS64BIT in
is64bit_yes)
if [ -d /usr/lib64 ]; then STATICLIBDIR=lib64;
else STATICLIBDIR=lib; fi
;;
is64bit_no)
if [ -d /usr/lib32 ]; then STATICLIBDIR=lib32;
else STATICLIBDIR=lib; fi
;;
*)
echo "Cannot determine whether compiler output is 64-bit or 32-bit. Are you using GCC?"
exit 1
;;
esac
for lib in $STATICLIBS; do
if [ -f /usr/$STATICLIBDIR/$lib ]; then
ln -fs /usr/$STATICLIBDIR/$lib ./xorg.build/syslib
else
if [ -f /$STATICLIBDIR/$lib ]; then
ln -fs /$STATICLIBDIR/$lib ./xorg.build/syslib
else
DYLIB=`echo $lib | sed s/\\\.a/\\.so/g`
if [ -f /usr/$STATICLIBDIR/$DYLIB -o -f /$STATICLIBDIR/$DYLIB ]; then
echo WARNING: Cannot find suitable $lib. Xvnc will depend on $DYLIB.
fi
fi
fi
done
fi
export ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:${PREFIX}/share/pkgconfig"
case "$MODE" in
init) init ;;
build)
export CFLAGS CXXFLAGS LDFLAGS
build ${1+"$@"};
;;
rebuild) rebuild ${1+"$@"} ;;
update) update ;;
*) usage ;;
esac
|