blob: 5a593f1a0e828365d43f2b45c77ec23ccd97896b (
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
|
#!/bin/sh
# buildx.sh: a script for building X11R7.6 X server for use with xrdp
#
# Copyright 2011-2012 Jay Sorg Jay.Sorg@gmail.com
#
# Authors
# Jay Sorg Jay.Sorg@gmail.com
# Laxmikant Rashinkar LK.Rashinkar@gmail.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# debian packages needed
# flex bison libxml2-dev intltool xsltproc xutils-dev python-libxml2 g++ xutils
download_file()
{
file=$1
# if we already have the file, don't download it
if [ -r downloads/$file ]; then
return 0
fi
cd downloads
echo "downloading file $file"
if [ "$file" = "pixman-0.15.20.tar.bz2" ]; then
wget -cq http://ftp.x.org/pub/individual/lib/$file
status=$?
cd ..
return $status
elif [ "$file" = "libdrm-2.4.26.tar.bz2" ]; then
wget -cq http://dri.freedesktop.org/libdrm/$file
status=$?
cd ..
return $status
elif [ "$file" = "MesaLib-7.10.3.tar.bz2" ]; then
wget -cq ftp://ftp.freedesktop.org/pub/mesa/7.10.3/$file
status=$?
cd ..
return $status
elif [ "$file" = "expat-2.0.1.tar.gz" ]; then
wget -cq http://server1.xrdp.org/xrdp/expat-2.0.1.tar.gz
status=$?
cd ..
return $status
elif [ "$file" = "freetype-2.4.6.tar.bz2" ]; then
wget -cq http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.bz2
status=$?
cd ..
return $status
elif [ "$file" = "xkeyboard-config-2.0.tar.bz2" ]; then
wget -cq http://www.x.org/releases/individual/data/xkeyboard-config/xkeyboard-config-2.0.tar.bz2
status=$?
cd ..
return $status
elif [ "$file" = "makedepend-1.0.3.tar.bz2" ]; then
wget -cq http://xorg.freedesktop.org/releases/individual/util/makedepend-1.0.3.tar.bz2
status=$?
cd ..
return $status
elif [ "$file" = "libxml2-sources-2.7.8.tar.gz" ]; then
wget -cq ftp://ftp.xmlsoft.org/libxml2/libxml2-sources-2.7.8.tar.gz
status=$?
cd ..
return $status
elif [ "$file" = "Python-2.5.tar.bz2" ]; then
wget -cq http://www.python.org/ftp/python/2.5/Python-2.5.tar.bz2
status=$?
cd ..
return $status
elif [ "$file" = "Python-2.7.tar.bz2" ]; then
wget -cq http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
status=$?
cd ..
return $status
elif [ "$file" = "expat-2.0.1.tar.gz" ]; then
wget -cq http://server1.xrdp.org/xrdp/expat-2.0.1.tar.gz
status=$?
cd ..
return $status
elif [ "$file" = "cairo-1.8.8.tar.gz" ]; then
wget -cq http://server1.xrdp.org/xrdp/cairo-1.8.8.tar.gz
status=$?
cd ..
return $status
elif [ "$file" = "libpng-1.2.46.tar.gz" ]; then
wget -cq http://server1.xrdp.org/xrdp/libpng-1.2.46.tar.gz
status=$?
cd ..
return $status
elif [ "$file" = "intltool-0.41.1.tar.gz" ]; then
wget -cq http://launchpad.net/intltool/trunk/0.41.1/+download/intltool-0.41.1.tar.gz
status=$?
cd ..
return $status
elif [ "$file" = "libxslt-1.1.26.tar.gz" ]; then
wget -cq ftp://xmlsoft.org/libxslt/libxslt-1.1.26.tar.gz
status=$?
cd ..
return $status
elif [ "$file" = "fontconfig-2.8.0.tar.gz" ]; then
wget -cq http://server1.xrdp.org/xrdp/fontconfig-2.8.0.tar.gz
status=$?
cd ..
return $status
else
wget -cq $download_url/$file
status=$?
cd ..
return $status
fi
}
remove_modules()
{
if [ -d cookies ]; then
rm cookies/*
fi
if [ ! -d build_dir ]; then
echo ""
echo "build_dir does not exist; nothing to delete"
echo ""
exit 0
fi
cd build_dir
while read line
do
mod_dir=`echo $line | cut -d':' -f2`
if [ -d $mod_dir ]; then
rm -rf $mod_dir
fi
done < ../$data_file
cd ..
}
extract_it()
{
mod_file=$1
mod_name=$2
mod_args=$3
if [ -e cookies/$mod_name.extracted ]; then
return 0
fi
# download file
download_file $mod_file
if [ $? -ne 0 ]; then
echo ""
echo "failed to download $mod_file - aborting build"
echo ""
exit 1
fi
cd build_dir
# if pkg has not yet been extracted, do so now
if [ ! -d $mod_name ]; then
echo $mod_file | grep -q tar.bz2
if [ $? -eq 0 ]; then
tar xjf ../downloads/$mod_file > /dev/null 2>&1
else
tar xzf ../downloads/$mod_file > /dev/null 2>&1
fi
if [ $? -ne 0 ]; then
echo "error extracting module $mod_name"
exit 1
fi
fi
# patch and configure module - we only need to do this once
cd $mod_name
# check for patches
if [ -e ../../$mod_name.patch ]; then
patch -p1 < ../../$mod_name.patch
fi
# now configure
echo "executing ./configure --prefix=$PREFIX_DIR $mod_args"
./configure --prefix=$PREFIX_DIR $mod_args
if [ $? -ne 0 ]; then
echo "configuration failed for module $mn"
exit 1
fi
cd ../..
touch cookies/$mod_name.extracted
}
make_it()
{
mod_file=$1
mod_name=$2
mod_args=$3
count=`expr $count + 1`
# if a cookie with $mod_name exists...
if [ -e cookies/$mod_name.installed ]; then
# ...package has already been installed
return 0
fi
echo ""
echo "*** processing module $mod_name ($count of $num_modules) ***"
echo ""
extract_it $mod_file $mod_name "$mod_args"
if [ $? -ne 0 ]; then
echo ""
echo "extract failed for module $mod_name"
echo ""
exit 1
fi
# make module
if [ ! -e cookies/$mod_name.made ]; then
(cd build_dir/$mod_name ; make)
if [ $? -ne 0 ]; then
echo ""
echo "make failed for module $mod_name"
echo ""
exit 1
fi
touch cookies/$mod_name.made
fi
# install module
(cd build_dir/$mod_name ; make install)
if [ $? -ne 0 ]; then
echo ""
echo "make install failed for module $mod_name"
echo ""
exit 1
fi
# special case after installing python make this sym link
# so Mesa builds using this python version
case "$mod_name" in
*Python-2*)
(cd build_dir/$mod_name ; ln -s python $PREFIX_DIR/bin/python2)
;;
esac
touch cookies/$mod_name.installed
return 0
}
# this is where we store list of modules to be processed
data_file=x11_file_list.txt
# this is the default download location for most modules
download_url=http://www.x.org/releases/X11R7.6/src/everything
num_modules=`cat $data_file | wc -l`
count=0
##########################
# program flow starts here
##########################
if [ $# -lt 1 ]; then
echo ""
echo "usage: buildx.sh <installation dir>"
echo "usage: buildx.sh <clean>"
echo "usage: buildx.sh default"
echo "usage: buildx.sh <installation dir> drop - set env and run bash in rdp dir"
echo ""
exit 1
fi
# remove all modules
if [ "$1" = "clean" ]; then
echo "removing source modules"
remove_modules
exit 0
fi
if [ "$1" = "default" ]; then
export PREFIX_DIR=$PWD/staging
else
export PREFIX_DIR=$1
fi
if ! test -d $PREFIX_DIR; then
echo "dir does not exit, creating [$PREFIX_DIR]"
mkdir $PREFIX_DIR
if ! test $? -eq 0; then
echo "mkdir failed [$PREFIX_DIR]"
exit 0
fi
fi
echo "using $PREFIX_DIR"
export PKG_CONFIG_PATH=$PREFIX_DIR/lib/pkgconfig:$PREFIX_DIR/share/pkgconfig
export PATH=$PREFIX_DIR/bin:$PATH
export LDFLAGS=-Wl,-rpath=$PREFIX_DIR/lib
export CFLAGS="-I$PREFIX_DIR/include -fPIC -O2"
# prefix dir must exist...
if [ ! -d $PREFIX_DIR ]; then
mkdir -p $PREFIX_DIR
if [ $? -ne 0 ]; then
echo "$PREFIX_DIR does not exist; failed to create it - cannot continue"
exit 1
fi
fi
# ...and be writable
if [ ! -w $PREFIX_DIR ]; then
echo "directory $PREFIX_DIR is not writable - cannot continue"
exit 1
fi
# create a downloads dir
if [ ! -d downloads ]; then
mkdir downloads
if [ $? -ne 0 ]; then
echo "error creating downloads directory"
exit 1
fi
fi
# this is where we do the actual build
if [ ! -d build_dir ]; then
mkdir build_dir
if [ $? -ne 0 ]; then
echo "error creating build_dir directory"
exit 1
fi
fi
# this is where we store cookie files
if [ ! -d cookies ]; then
mkdir cookies
if [ $? -ne 0 ]; then
echo "error creating cookies directory"
exit 1
fi
fi
while read line
do
mod_file=`echo $line | cut -d':' -f1`
mod_dir=`echo $line | cut -d':' -f2`
mod_args=`echo $line | cut -d':' -f3`
mod_args=`eval echo $mod_args`
make_it $mod_file $mod_dir "$mod_args"
done < $data_file
echo "build for X OK"
X11RDPBASE=$PREFIX_DIR
export X11RDPBASE
cd rdp
make
if [ $? -ne 0 ]; then
echo "error building rdp"
exit 1
fi
# this will copy the build X server with the other X server binaries
strip X11rdp
cp X11rdp $X11RDPBASE/bin
if [ "$2" = "drop" ]; then
echo ""
echo "dropping you in dir, type exit to get out"
bash
exit 1
fi
echo "All done"
|