4
# This script will prepare build environment with the same settings as release environment
6
# It will install two chroot environments:
7
# - /home/buildbot_squeeze_i686
8
# - /home/buildbot_squeeze_x86_64
9
# which are used for 32bit and 64bit
11
# This sctipt will also create folder /home/sources where all dependent libraries sources are
12
# downloading and compiling.
14
# Release builder scripts are stored in /home/sources/release-builder
15
# See build_all.sh script for usage details
17
# This script was tested on debian squeeze and wheezy, should work on ubuntu as well
18
# It wouldn't work on other distros
21
# - It's still required manual copying of build configuration files to /home/sources/release-builder/config
22
# - OSL is not set up yet
31
CONFIRM="--i-really-do-know-what-im-doing"
34
echo ${ERED}${@}${NO_COLOR}
38
echo ${EWHITE}${@}${NO_COLOR}
42
ERROR "Usage: $0 $CONFIRM"
46
if [ "$1" != "$CONFIRM" ]; then
47
ERROR "Usage: $0 $CONFIRM"
51
DEBIAN_BRANCH="squeeze"
52
DEBIAN_MIRROR="http://ftp.de.debian.org/debian"
55
# For now it's always /home, so we can setup schroot to map /sources to the same
56
# path at both host and chroot systems (which is currently needed for release building script)
59
AMD64_PATH="$ENV_PATH/buildbot_${DEBIAN_BRANCH}_x86_64"
60
I686_PATH="$ENV_PATH/buildbot_${DEBIAN_BRANCH}_i686"
61
SOURCES_PATH="$ENV_PATH/sources"
63
THREADS=`cat /proc/cpuinfo | grep cores | uniq | sed -e "s/.*: *\(.*\)/\\1/"`
65
# Force vpx be installed from the backports
66
VPX_V="1.0.0-2~bpo60+1"
69
BINUTILS_FV="2.22-7.1"
79
DEBHELPER_FV="9.20120909"
92
OPENSSL_FV="0.9.8o-4squeeze13"
95
CUDA_DISTR="ubuntu10.04"
96
CUDA_32="cudatoolkit_${CUDA_V}_linux_32_${CUDA_DISTR}.run"
97
CUDA_64="cudatoolkit_${CUDA_V}_linux_64_${CUDA_DISTR}.run"
99
INSTALL_RELEASE_BUILDER() {
102
RB=$SOURCES_PATH/release-builder
103
if [ ! -d $RB ]; then
104
INFO "Installing release building scripts"
108
cat << EOF > $RB/Readme.txt
109
This directory contains scrips needed for automated release archive preparation
111
config/: storage of scons configs for different platforms
113
build_all.sh: script asks version to add to archive name and revision to compile,
114
when script finished, there'll be 32 and 64 bit archives in current directory
115
better to run this script from this directory
117
do_build_all.sh: uses environment variables set by build_all.sh script (or other scripts)
118
and launches compilation inside chroot environments
120
chroot_compile.py: runs compilation process with giver parameters in chroots
121
compile.py: script runs inside chroot environment and prepares archive
123
blender-buildenv.tar.bz2: archive, received from Ken Hughes when i've been preparing
124
new environment to make it as close to old one as it's possible
126
Hope all this would help you.
131
cat << EOF > $RB/build_all.sh
136
echo -n "svn revision (blank to latest, 0 to keep unchanged): "
143
\${d}/do_build_all.sh
145
chmod +x $RB/build_all.sh
147
cat << EOF > $RB/build_all-test.sh
151
\${d}/do_build_all.sh
153
chmod +x $RB/build_all-test.sh
155
cat << EOF > $RB/chroot-compile.py
156
#!/usr/bin/env python
162
from optparse import OptionParser
164
# This could be passed through options, but does we actually need this?
165
bl_source = '/home/sources/blender'
166
build_dir = '/home/sources/blender-build/'
167
install_dir = '/home/sources/blender-install/'
171
curr_arch = platform.architecture()[0]
172
def_arch = 'x86_64' if curr_arch == '64bit' else 'i686'
173
builder_dir = os.path.dirname(os.path.realpath(__file__))
176
# builder_dir = builder_dir.replace("sources-new", "sources")
179
if hasattr(os, 'sysconf'):
180
if 'SC_NPROCESSORS_ONLN' in os.sysconf_names:
181
def_cores = os.sysconf('SC_NPROCESSORS_ONLN')
183
# Per-architecture chroot name
184
chroots = { 'i686': 'buildbot_squeeze_i686',
185
'x86_64': 'buildbot_squeeze_x86_64'}
189
op.add_option('--tag', default = None)
190
op.add_option('--branch', default = None)
191
op.add_option('--arch', default = def_arch)
192
op.add_option('--cores', default = def_cores)
193
op.add_option('--bl-version', default = 'UNDEFINED')
194
op.add_option('--no-clean', default = False)
195
(opts, args) = op.parse_args()
197
if opts.arch not in chroots:
198
print('Error: No configured machine gound to build ' +
199
'{0} version' . format(opts.arch))
202
chroot = chroots[opts.arch]
205
bl_source = '/home/sources/blender-tags/' + opts.tag
207
bl_source = '/home/sources/blender-branches/' + opts.branch
209
if not os.path.isdir(bl_source):
210
print('Uname to find directory with sources: ' + bl_source)
213
print('Building {0} version, machine is {1}' . format(opts.bl_version, opts.arch))
215
# Assume builder directory is binded to the same location in
216
# chroot environments
217
compiler = os.path.join(builder_dir, 'compile.py')
219
cmd = 'schroot -c %s -d /home/sources/release-builder --' % (chroot)
220
cmd += ' python %s' % (compiler)
221
cmd += ' --bl-version=%s' % (opts.bl_version)
222
cmd += ' --bl-source=%s' % (bl_source)
223
cmd += ' --arch=%s' % (opts.arch)
224
cmd += ' --build-dir=%s' % (build_dir)
225
cmd += ' --install-dir=%s' % (install_dir)
228
cmd += ' --no-clean=1'
231
cmd += ' --with-player=1'
234
# cmd += ' --use-new-ffmpeg=1'
236
result = os.system(cmd)
238
print('compiler script exited with errcode: %s' % (result))
241
chmod +x $RB/chroot-compile.py
243
cat << EOF > $RB/compile.py
244
#!/usr/bin/env python
251
from optparse import OptionParser
254
curr_arch = platform.architecture()[0]
255
def_arch = 'x86_64' if curr_arch == '64bit' else 'i686'
256
builder_dir = os.path.dirname(os.path.realpath(__file__))
259
if hasattr(os, 'sysconf'):
260
if 'SC_NPROCESSORS_ONLN' in os.sysconf_names:
261
def_cores = os.sysconf('SC_NPROCESSORS_ONLN')
265
op.add_option('--arch', default = def_arch)
266
op.add_option('--cores', default = def_cores)
267
op.add_option('--no-clean', default = False)
268
op.add_option('--bl-version', default = 'UNKNOWN')
269
op.add_option('--bl-source', default = '')
270
op.add_option('--config-dir', default = '')
271
op.add_option('--build-dir', default = '')
272
op.add_option('--install-dir', default = '')
273
op.add_option('--with-player', default = False)
274
#op.add_option('--use-new-ffmpeg', default = False)
275
(opts, args) = op.parse_args()
277
if opts.config_dir == '':
278
opts.config_dir = os.path.join(builder_dir, 'config')
280
# Initial directory checking (could be problems with permissions)
281
if not os.path.isdir(opts.bl_source):
282
print('Blender\'s source tree not found: %s' % (opts.bl_source))
285
if not os.path.isdir(opts.config_dir):
286
print('Directory with configuration files not found: %s' % (opts.config_dir))
289
if not os.path.isdir(os.path.dirname(opts.build_dir)):
290
print('Build directory can\'t be reached: %s' % (opts.build_dir))
293
if not os.path.isdir(os.path.dirname(opts.install_dir)):
294
print('Install directory can\'t be reached: %s' % (opts.install_dir))
297
# Detect glibc version
298
libc = [name for name in os.listdir('/lib') if 'libc.so.' in name]
300
print('Could not find "/lib/libc.so.*": cannot determine glibc version')
304
print('warning: found more than one "/lib/libc.so.*": '+
305
'using %s' % (libc[0]))
307
glibc = 'glibc' + os.readlink('/lib/' + libc[0])[5:][:-3].replace('.', '')
310
# Full name for archive
311
full_name = 'blender-%s-linux-%s-%s' % (opts.bl_version, glibc, opts.arch)
312
build_dir = os.path.join(opts.build_dir, full_name)
313
install_dir = os.path.join(opts.install_dir, full_name)
314
scons = os.path.join(opts.bl_source, 'scons', 'scons.py')
315
scons_cmd = 'python %s -C %s' % (scons, opts.bl_source)
316
config = os.path.join(opts.config_dir, 'user-config-' + glibc + '-' + opts.arch + '.py')
318
if not os.path.isfile(config):
319
print('Configuration file not found: %s' % (config))
322
# Clean build directory
323
if not opts.no_clean:
324
print('Cleaning up build directory...')
325
os.system('%s BF_BUILDDIR=%s clean ' % (scons_cmd, build_dir))
327
# Clean install directory
328
if os.path.isdir(install_dir):
329
shutil.rmtree(install_dir)
333
# Switch to newer libraries if needed
334
#if opts.use_new_ffmpeg:
335
# print("Using new ffmpeg-0.8.1")
336
# flags += " BF_FFMPEG='/home/sources/staticlibs/ffmpeg-0.8'"
338
# Build blenderplayer first
339
# (to be sure all stuff needed for blender would copied automatically)
341
player_config = os.path.join(opts.config_dir,
342
'user-config-player-' + glibc + '-' + opts.arch + '.py')
344
if not os.path.isfile(player_config):
345
print('Player configuration file not found: %s' % (player_config))
348
cmd = '%s -j %d blenderplayer ' % (scons_cmd, opts.cores + 1)
349
cmd += ' BF_BUILDDIR=%s' % (build_dir + '-player')
350
cmd += ' BF_INSTALLDIR=%s' % (install_dir)
351
cmd += ' BF_CONFIG=%s' % (player_config)
354
result = os.system(cmd)
356
print('Compilation failed, exit code is %d' % (result))
359
# Build blender itself
360
cmd = '%s -j %d blender ' % (scons_cmd, opts.cores + 1)
361
cmd += ' BF_BUILDDIR=%s' % (build_dir)
362
cmd += ' BF_INSTALLDIR=%s' % (install_dir)
363
cmd += ' BF_CONFIG=%s' % (config)
366
result = os.system(cmd)
368
print('Compilation failed, exit code is %d' % (result))
371
blender = os.path.join(install_dir, 'blender')
372
blenderplayer = blender + 'player'
374
if not os.path.exists(blender):
375
print('scons completed successfully but blender executable missing')
378
if opts.with_player and not os.path.exists(blenderplayer):
379
print('scons completed successfully but blenderplayer executable missing')
382
# compile python modules
383
#result = os.system('%s --background --python %s/source/tools/compile_scripts.py' % (blender, opts.bl_source))
385
# print('Python modules compilation failed, exit code is %d' % (result))
388
print('build successful')
390
os.system('strip -s %s %s' % (blender, blenderplayer))
392
# Copy all texts needed for release
393
release_texts = os.path.join(opts.bl_source, 'release', 'text', '*')
394
release_txt = os.path.join(install_dir, 'release_%s.txt' % (opts.bl_version))
396
os.system('cp -r %s %s' % (release_texts, install_dir))
398
if os.path.exists(release_txt):
399
print 'RELEASE TEXT FOUND'
401
print 'WARNING! RELEASE TEXT NOT FOUND!'
403
# TODO: copy plugins data when ready
405
# Add software gl libraries and scripts
408
if opts.arch == 'x86_64':
409
mesa_arch = 'mesalibs64.tar.bz2'
410
elif opts.arch == 'i686':
411
mesa_arch = 'mesalibs32.tar.bz2'
413
if mesa_arch is not None:
414
mesalibs = os.path.join(builder_dir, 'extra', mesa_arch)
415
software_gl = os.path.join(builder_dir, 'extra', 'blender-softwaregl')
417
os.system('tar -xpf %s -C %s' % (mesalibs, install_dir))
418
os.system('cp %s %s' % (software_gl, install_dir))
419
os.system('chmod 755 %s' % (os.path.join(install_dir, 'blender-softwaregl')))
421
# Pack release archive
422
print("Building Dynamic Tarball")
423
os.system('tar -C %s -cjf %s.tar.bz2 %s ' % (opts.install_dir,
424
full_name, full_name))
428
chmod +x $RB/compile.py
430
cat << EOF > $RB/do_build_al.sh
433
SOURCES="/home/sources"
438
if [ "x\${tag}" != "x" ]; then
439
echo "Getting tagged source tree..."
440
d="\${SOURCES}/blender-tags/\${tag}"
441
opts="\${opts} --tag=\${tag}"
442
if [ ! -d \${d} ]; then
443
svn co https://svn.blender.org/svnroot/bf-blender/tags/\${tag}/blender/@\${revision} \${d}
445
svn up -r \${revision} \${d}
447
elif [ "x\${branch}" != "x" ]; then
448
echo "Getting branched source tree..."
449
d="\${SOURCES}/blender-branches/\${branch}"
450
opts="\${opts} --branch=\${branch}"
451
if [ ! -d \${d} ]; then
452
if [ "x\${revision}" != "x" ]; then
453
svn co https://svn.blender.org/svnroot/bf-blender/branches/\${branch}/@\${revision} \${d}
455
svn co https://svn.blender.org/svnroot/bf-blender/branches/\${branch}/ \${d}
458
if [ "x\${revision}" != "x" ]; then
459
svn up -r \${revision} \${d}
465
if [ "x\${revision}" != "x" ]; then
466
if [ "x\${revision}" != "x0" ]; then
467
svn up -r \${revision} \${SOURCES}/blender
469
svn up \${SOURCES}/blender
474
if [ "x\${tag}" != "x" ]; then
475
b="\${SOURCES}/blender-tags/\${tag}"
476
elif [ "x\${branch}" != "x" ]; then
477
b="\${SOURCES}/blender-branches/\${branch}"
479
b="\${SOURCES}/blender"
482
if [ "x\${addons_revision}" != "x" ]; then
483
d="\${b}/release/scripts/addons"
485
if [ "x\${addons_revision}" != "x0" ]; then
486
svn up -r \${addons_revision} \${d}
492
if [ "x\${locale_revision}" != "x" ]; then
493
d="\${b}/release/datafiles/locale"
495
if [ "x\${locale_revision}" != "x0" ]; then
496
svn up -r \${locale_revision} \${d}
502
if [ -z "\$version" ]; then
503
version=r\`/usr/bin/svnversion \$SOURCES/blender\`
510
python chroot-compile.py \${opts} --arch=x86_64 --bl-version \${version} # --no-clean=1
511
python chroot-compile.py \${opts} --arch=i686 --bl-version \${version} # --no-clean=1
513
chmod +x $RB/do_build_al.sh
517
cat << EOF > $RB/extra/blender-softwaregl
520
BF_DIST_BIN=\`dirname "\$0"\`
521
BF_PROGRAM="blender" # BF_PROGRAM=\`basename "\$0"\`-bin
524
LD_LIBRARY_PATH=\${BF_DIST_BIN}/lib:\${LD_LIBRARY_PATH}
526
if [ -n "\$LD_LIBRARYN32_PATH" ]; then
527
LD_LIBRARYN32_PATH=\${BF_DIST_BIN}/lib:\${LD_LIBRARYN32_PATH}
529
if [ -n "\$LD_LIBRARYN64_PATH" ]; then
530
LD_LIBRARYN64_PATH=\${BF_DIST_BIN}/lib:\${LD_LIBRARYN64_PATH}
532
if [ -n "\$LD_LIBRARY_PATH_64" ]; then
533
LD_LIBRARY_PATH_64=\${BF_DIST_BIN}/lib:\${LD_LIBRARY_PATH_64}
536
# Workaround for half-transparent windows when compiz is enabled
537
XLIB_SKIP_ARGB_VISUALS=1
539
export LD_LIBRARY_PATH LD_LIBRARYN32_PATH LD_LIBRARYN64_PATH LD_LIBRARY_PATH_64 LD_PRELOAD XLIB_SKIP_ARGB_VISUALS
541
"\$BF_DIST_BIN/\$BF_PROGRAM" \${1+"\$@"}
545
chmod +x $RB/extra/blender-softwaregl
547
cat << EOF > $RB/extra/do_update-libs.sh
551
V="\`readlink /opt/lib/mesa | sed -r 's/mesa-//'\`"
555
if [ ! -f \$N.tar.bz2 ]; then
557
cp -P /opt/lib/mesa/lib/libGL* \$TMP/lib
559
tar -C \$TMP -cf \$N.tar lib
562
rm -f mesalibs\$BITS.tar,bz2
563
ln -s \$N.tar.bz2 mesalibs\$BITS.tar.bz2
568
chmod +x $RB/extra/do_update-libs.sh
570
cat << EOF > $RB/extra/update-libs.sh
573
P="/home/sources/release-builder/extra"
574
CHROOT_PREFIX="buildbot_squeeze_"
575
CHROOT32="\${CHROOT_PREFIX}i686"
576
CHROOT64="\${CHROOT_PREFIX}x86_64"
577
RUN32="schroot -c \$CHROOT32 -d \$P"
578
RUN64="schroot -c \$CHROOT64 -d \$P"
580
\$RUN64 ./do_update-libs.sh 64
581
\$RUN32 ./do_update-libs.sh 32
583
chmod +x $RB/extra/update-libs.sh
586
cp $SOURCES_PATH/blender/build_files/buildbot/config/* $RB/config
594
if [ ! -d "$SOURCES_PATH" ]; then
595
INFO "Creating sources directory"
596
mkdir -p "$SOURCES_PATH"
599
if [ ! -d "$SOURCES_PATH/backport/binutils" ]; then
600
INFO "Downloading binutils"
601
mkdir -p "$SOURCES_PATH/backport/binutils"
602
wget -c $DEBIAN_MIRROR/pool/main/b/binutils/binutils_$BINUTILS_FV.diff.gz \
603
$DEBIAN_MIRROR/pool/main/b/binutils/binutils_$BINUTILS_FV.dsc \
604
$DEBIAN_MIRROR/pool/main/b/binutils/binutils_$BINUTILS_V.orig.tar.gz \
605
-P "$SOURCES_PATH/backport/binutils"
608
if [ ! -d "$SOURCES_PATH/backport/gcc-4.7" ]; then
609
INFO "Downloading gcc-4.7"
610
mkdir -p "$SOURCES_PATH/backport/gcc-4.7"
611
wget -c $DEBIAN_MIRROR/pool/main/g/gcc-4.7/gcc-$GCC_FV.diff.gz \
612
$DEBIAN_MIRROR/pool/main/g/gcc-4.7/gcc-$GCC_FV.dsc \
613
$DEBIAN_MIRROR/pool/main/g/gcc-4.7/gcc-$GCC_V.orig.tar.gz \
614
-P "$SOURCES_PATH/backport/gcc-4.7"
617
if [ ! -d "$SOURCES_PATH/backport/openssl" ]; then
618
INFO "Downloading openssl"
619
mkdir -p "$SOURCES_PATH/backport/openssl"
620
wget -c $DEBIAN_MIRROR/pool/main/o/openssl/openssl_$OPENSSL_FV.debian.tar.gz \
621
$DEBIAN_MIRROR/pool/main/o/openssl/openssl_$OPENSSL_FV.dsc \
622
$DEBIAN_MIRROR/pool/main/o/openssl/openssl_$OPENSSL_V.orig.tar.gz \
623
-P "$SOURCES_PATH/backport/openssl"
627
J="$SOURCES_PATH/packages/jemalloc-$JEMALLOC_V"
628
if [ ! -d "$J" ]; then
629
INFO "Downloading jemalloc-$JEMALLOC_V"
630
wget -c http://www.canonware.com/download/jemalloc/jemalloc-$JEMALLOC_V.tar.bz2 -P "$SOURCES_PATH/packages"
631
tar -C "$SOURCES_PATH/packages" -xf "$J.tar.bz2"
632
cat << EOF > "$J/0config.sh"
635
./configure CC="gcc-4.7 -Wl,--as-needed" CXX="g++-4.7 -Wl,--as-needed" LDFLAGS="-pthread -static-libgcc" --prefix=/opt/lib/jemalloc-$JEMALLOC_V
637
chmod +x "$J/0config.sh"
641
S="$SOURCES_PATH/packages/libspnav-$SPNAV_V"
642
if [ ! -d "$S" ]; then
643
wget -c http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%200.2.2/libspnav-$SPNAV_V.tar.gz \
644
-P "$SOURCES_PATH/packages"
645
tar -C "$SOURCES_PATH/packages" -xf "$S.tar.gz"
646
cat << EOF > "$S/0config.sh"
649
./configure --prefix=/opt/lib/libspnav-$SPNAV_V
651
chmod +x "$S/0config.sh"
655
F="$SOURCES_PATH/packages/ffmpeg-$FFMPEG_V"
656
if [ ! -d "$F" ]; then
657
INFO "Downloading FFmpeg-$FFMPEG_V"
658
wget -c http://ffmpeg.org/releases/ffmpeg-$FFMPEG_V.tar.bz2 -P "$SOURCES_PATH/packages"
659
tar -C "$SOURCES_PATH/packages" -xf "$F.tar.bz2"
660
cat << EOF > "$F/0config.sh"
664
--cc="/usr/bin/gcc-4.7 -Wl,--as-needed" \\
665
--extra-ldflags="-pthread -static-libgcc" \\
666
--prefix=/opt/lib/ffmpeg-$FFMPEG_V \\
672
--enable-libschroedinger \\
673
--disable-libspeex \\
674
--enable-libtheora \\
675
--enable-libvorbis \\
679
--enable-stripping \\
680
--enable-runtime-cpudetect \\
682
--enable-libopenjpeg \\
686
--disable-postproc \\
688
--enable-libmp3lame \\
692
--disable-libopencore-amrnb \\
693
--disable-libopencore-amrwb \\
694
--disable-libdc1394 \\
695
--disable-version3 \\
696
--disable-outdev=sdl \\
697
--disable-outdev=alsa \\
698
--disable-indev=sdl \\
699
--disable-indev=alsa \\
700
--disable-indev=jack \\
701
--disable-indev=lavfi
704
# --disable-optimizations
707
chmod +x "$F/0config.sh"
711
B="$SOURCES_PATH/packages/boost_$BOOST_V"
712
if [ ! -d "$B" ]; then
713
INFO "Downloading Boost-$BOOST_V"
714
b_d=`echo "$BOOST_V" | sed -r 's/_/./g'`
715
wget -c http://sourceforge.net/projects/boost/files/boost/$b_d/boost_$BOOST_V.tar.bz2/download -O "$B.tar.bz2"
716
tar -C "$SOURCES_PATH/packages" -xf "$B.tar.bz2"
720
P="$SOURCES_PATH/packages/Python-$PYTHON_V"
721
if [ ! -d "$P" ]; then
722
INFO "Downloading Python-$PYTHON_V"
723
wget -c http://python.org/ftp/python/$PYTHON_V/Python-$PYTHON_V.tar.bz2 -P "$SOURCES_PATH/packages"
724
tar -C "$SOURCES_PATH/packages" -xf "$P.tar.bz2"
725
cat << EOF > "$P/0config.sh"
728
# NOTE: this sounds strange, but make sure /dev/shm/ is writable by your user,
729
# otherwise syncronization primitives wouldn't be included into python
730
if [[ "\`stat -c '%a' /dev/shm/\`" != "777" ]]; then
731
echo "Error checking syncronization primitives"
735
./configure --prefix=/opt/lib/python-$PYTHON_V \\
737
--enable-loadable-sqlite-extensions \\
738
--with-dbmliborder=bdb \\
739
--with-wide-unicode \\
740
--with-computed-gotos \\
743
chmod +x "$P/0config.sh"
747
O="$SOURCES_PATH/packages/OpenImageIO-$OIIO_V"
748
if [ ! -d "$O" ]; then
749
INFO "Downloading OpenImageIO-$OIIO_V"
750
wget -c https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_V -O "$O.tar.gz"
751
tar -C "$SOURCES_PATH/packages" -xf "$O.tar.gz"
752
mv $SOURCES_PATH/packages/OpenImageIO-oiio* $O
754
cat << EOF > "$O/build/prepare.sh"
757
if file /bin/cp | grep -q '32-bit'; then
758
cflags="-fPIC -m32 -march=i686"
764
-D CMAKE_BUILD_TYPE=Release \\
765
-D CMAKE_PREFIX_PATH=/opt/lib/oiio-$OIIO_V \\
766
-D CMAKE_INSTALL_PREFIX=/opt/lib/oiio-$OIIO_V \\
769
-D CMAKE_CXX_FLAGS:STRING="\${cflags}" \\
770
-D CMAKE_C_FLAGS:STRING="\${cflags}" \\
771
-D CMAKE_EXE_LINKER_FLAGS='-lgcc_s -lgcc' \\
772
-D BOOST_ROOT=/opt/lib/boost \\
775
chmod +x "$O/build/prepare.sh"
779
O="$SOURCES_PATH/packages/OpenColorIO-$OCIO_V"
780
if [ ! -d "$O" ]; then
781
INFO "Downloading OpenColorIO-$OCIO_V"
782
wget -c http://github.com/imageworks/OpenColorIO/tarball/v$OCIO_V -O "$O.tar.gz"
783
tar -C "$SOURCES_PATH/packages" -xf "$O.tar.gz"
784
mv $SOURCES_PATH/packages/imageworks-OpenColorIO* $O
786
cat << EOF > "$O/build/prepare.sh"
789
if file /bin/cp | grep -q '32-bit'; then
790
cflags="-fPIC -m32 -march=i686"
796
-D CMAKE_BUILD_TYPE=Release \\
797
-D CMAKE_PREFIX_PATH=/opt/lib/ocio-1.0.7 \\
798
-D CMAKE_INSTALL_PREFIX=/opt/lib/ocio-1.0.7 \\
800
-D CMAKE_CXX_FLAGS:STRING="\${cflags}" \\
801
-D CMAKE_C_FLAGS:STRING="\${cflags}" \\
802
-D CMAKE_EXE_LINKER_FLAGS='-lgcc_s -lgcc' \\
806
chmod +x "$O/build/prepare.sh"
810
M="$SOURCES_PATH/packages/Mesa-$MESA_V"
811
if [ ! -d "$M" ]; then
812
INFO "Downloading Mesa-$MESA_V"
813
wget -c ftp://ftp.freedesktop.org/pub/mesa/$MESA_V/MesaLib-$MESA_V.tar.bz2 -P "$SOURCES_PATH/packages"
814
tar -C "$SOURCES_PATH/packages" -xf "$SOURCES_PATH/packages/MesaLib-$MESA_V.tar.bz2"
815
cat << EOF > "$M/0config.sh"
818
OPTS="--with-driver=xlib \\
819
--disable-driglx-direct \\
821
--enable-gallium-gbm=no \\
822
--enable-gallium-egl=no \\
823
--enable-gallium-llvm=no \\
824
--with-gallium-drivers=swrast \\
825
--with-dri-drivers=swrast \\
826
--prefix=/opt/lib/mesa-$MESA_V"
828
if file /bin/cp | grep -q '32-bit'; then
829
./configure CC="gcc-4.7 -Wl,--as-needed" CXX="g++-4.7 -Wl,--as-needed" LDFLAGS="-pthread -static-libgcc" \${OPTS} --enable-32-bit #--build=i486-linux-gnu
831
./configure CC="gcc-4.7 -Wl,--as-needed" CXX="g++-4.7 -Wl,--as-needed" LDFLAGS="-pthread -static-libgcc" \${OPTS}
835
chmod +x "$M/0config.sh"
839
O="$SOURCES_PATH/packages/openal-soft-$OPENAL_V"
840
if [ ! -d "$O" ]; then
841
INFO "Downloading OpenAL-$OPENAL_V"
842
wget -c http://kcat.strangesoft.net/openal-releases/openal-soft-$OPENAL_V.tar.bz2 -P "$SOURCES_PATH/packages"
843
tar -C "$SOURCES_PATH/packages" -xf "$SOURCES_PATH/packages/openal-soft-$OPENAL_V.tar.bz2"
844
cat << EOF > "$O/build-openal.sh"
847
DEB_CMAKE_OPTIONS="-DCMAKE_VERBOSE_MAKEFILE=ON \\
848
-DCMAKE_INSTALL_PREFIX=/opt/lib/openal-$OPENAL_V \\
849
-DCMAKE_BUILD_TYPE:String=Release \\
850
-DALSOFT_CONFIG=ON \\
851
-DLIBTYPE=STATIC .. "
853
BUILD_TREE=./build-tree
855
rm -rf "\${BUILD_TREE}"
856
mkdir -p "\${BUILD_TREE}"
859
sh -c "cmake \`echo \$DEB_CMAKE_OPTIONS\`"
863
chmod +x "$O/build-openal.sh"
867
O="$SOURCES_PATH/packages/opencollada"
868
if [ ! -d "$O" ]; then
869
INFO "Checking out OpenCollada sources"
870
svn co http://opencollada.googlecode.com/svn/trunk $O
872
cat << EOF > "$O/build_all.sh"
875
scons RELEASE=0 NOVALIDATION=1 XMLPARSER=libxmlnative PCRENATIVE=1 SHAREDLIB=0 -j ${THREADS} --clean
876
scons RELEASE=1 NOVALIDATION=1 XMLPARSER=libxmlnative PCRENATIVE=1 SHAREDLIB=0 -j ${THREADS} --clean
878
scons RELEASE=0 NOVALIDATION=1 XMLPARSER=libxmlnative PCRENATIVE=1 SHAREDLIB=0 -j ${THREADS}
879
scons RELEASE=1 NOVALIDATION=1 XMLPARSER=libxmlnative PCRENATIVE=1 SHAREDLIB=0 -j ${THREADS}
882
cat << EOF > "$O/prepare_lib-libxml.sh"
885
src="./COLLADAStreamWriter/include
886
./COLLADABaseUtils/include
887
./COLLADABaseUtils/include/Math
888
./COLLADAFramework/include
889
./GeneratedSaxParser/include
890
./COLLADASaxFrameworkLoader/include
891
./COLLADASaxFrameworkLoader/include/generated14
892
./COLLADASaxFrameworkLoader/include/generated15"
900
libs="./GeneratedSaxParser/lib/posix/\${arch}/releaselibxml/libGeneratedSaxParser.a
901
./Externals/MathMLSolver/lib/posix/\${arch}/release/libMathMLSolver.a
902
./COLLADABaseUtils/lib/posix/\${arch}/release/libOpenCOLLADABaseUtils.a
903
./COLLADAFramework/lib/posix/\${arch}/release/libOpenCOLLADAFramework.a
904
./COLLADASaxFrameworkLoader/lib/posix/\${arch}/releaselibxmlNovalidation/libOpenCOLLADASaxFrameworkLoader.a
905
./COLLADAStreamWriter/lib/posix/\${arch}/release/libOpenCOLLADAStreamWriter.a
906
./Externals/UTF/lib/posix/\${arch}/release/libUTF.a
907
./common/libBuffer/lib/posix/\${arch}/release/libbuffer.a
908
./common/libftoa/lib/posix/\${arch}/release/libftoa.a"
910
#./Externals/pcre/lib/posix/\${arch}/release/libpcre.a
911
#./Externals/LibXML/lib/posix/\${arch}/release/libxml.a
913
debug_libs="./GeneratedSaxParser/lib/posix/\${arch}/debuglibxml/libGeneratedSaxParser.a
914
./Externals/MathMLSolver/lib/posix/\${arch}/debug/libMathMLSolver.a
915
./COLLADABaseUtils/lib/posix/\${arch}/debug/libOpenCOLLADABaseUtils.a
916
./COLLADAFramework/lib/posix/\${arch}/debug/libOpenCOLLADAFramework.a
917
./COLLADASaxFrameworkLoader/lib/posix/\${arch}/debuglibxmlNovalidation/libOpenCOLLADASaxFrameworkLoader.a
918
./COLLADAStreamWriter/lib/posix/\${arch}/debug/libOpenCOLLADAStreamWriter.a
919
./Externals/UTF/lib/posix/\${arch}/debug/libUTF.a
920
./common/libBuffer/lib/posix/\${arch}/debug/libbuffer.a
921
./common/libftoa/lib/posix/\${arch}/debug/libftoa.a"
923
#./Externals/pcre/lib/posix/\${arch}/debug/libpcre.a
924
#./Externals/LibXML/lib/posix/\${arch}/debug/libxml.a
926
d="opencollada-libxml"
928
mkdir -p \${d}/include
931
mkdir -p \${d}/include/\${i}
932
cp \${i}/*.h \${d}/include/\${i}
936
for i in \${libs}; do
941
for i in \${debug_libs}; do
944
cp \${i} \${d}/lib/\${o}
947
rm -rf /opt/lib/opencollada
948
mv \${d} /opt/lib/opencollada
949
chown -R root:staff /opt/lib/opencollada
952
chmod +x "$O/build_all.sh"
953
chmod +x "$O/prepare_lib-libxml.sh"
957
B="$SOURCES_PATH/blender"
958
if [ ! -d "$B" ]; then
959
INFO "Checking out Blender sources"
960
svn co https://svn.blender.org/svnroot/bf-blender/trunk/blender $B
964
C=$SOURCES_PATH/cudatoolkit
965
if [ ! -f "$C/$CUDA_32" ]; then
966
INFO "Downloading CUDA 32bit toolkit"
968
wget -c http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/$CUDA_32 -P $C
971
if [ ! -f "$C/$CUDA_64" ]; then
972
INFO "Downloading CUDA 64bit toolkit"
974
wget -c http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/$CUDA_64 -P $C
977
if [ ! -f $SOURCES_PATH/Readme.txt ]; then
979
cat << EOF > $SOURCES_PATH/Readme.txt
980
This directory contains different things needed for Blender builds
982
blender/: directory with blender's svnsnapshot
984
blender-build/, blender-install/: build and install directories for
985
automated release creation
987
buildbot-i686-slave/,
988
buildbot-x86_64-slave/: buildbot slave environments for automated builds
989
(maybe it'll be better to move them to /home?)
991
staticlibs/: set of static libs. Mostly needed to make static linking prioretized
992
under dynamic linking
994
release-builder/: all stuff needed for release archives preparation
996
Hope all this would help you.
1002
INSTALL_RELEASE_BUILDER $SOURCES_PATH
1009
RUN="chroot $CHROOT_PATH"
1010
P="/home/sources/backport"
1012
# Backport fresh binutils
1013
if [ `$RUN dpkg-query -W -f='${Version}\n' binutils | grep -c $BINUTILS_V` -eq "0" ]; then
1014
INFO "Backporting binutils"
1015
B="$P/binutils/binutils-$BINUTILS_V"
1016
pkg="$P/binutils/binutils_${BINUTILS_FV}_amd64.deb"
1018
if [ ! -d "$CHROOT_PATH/$B" ]; then
1019
INFO "Unpacking binutils"
1020
$RUN dpkg-source -x "$P/binutils/binutils_$BINUTILS_FV.dsc" "$B"
1023
if [ "$CHROOT_ARCH" = "i386" ]; then
1024
pkg=`echo "$pkg" | sed -r 's/amd64/i386/g'`
1027
if [ ! -f "$CHROOT_PATH/$pkg" ]; then
1028
INFO "Compiling binutils"
1029
sed -ie 's/with_check := yes/with_check := no/' "$CHROOT_PATH/$B/debian/rules"
1030
$RUN sh -c "cd '$B' && dpkg-buildpackage -rfakeroot -j$THREADS"
1033
INFO "Installing binutils"
1036
INFO "Cleaning binutils"
1037
$RUN sh -c "cd '$B' && fakeroot debian/rules clean"
1041
if [ `$RUN dpkg-query -W -f='${Status}\n' gcc-4.7 2> /dev/null | grep -c installed` -eq "0" ]; then
1042
INFO "Backporting gcc-4.7"
1043
G="$P/gcc-4.7/gcc-$GCC_V"
1045
pkg="cpp-4.7_4.7.1-7_amd64.deb gcc-4.7-base_4.7.1-7_amd64.deb \
1046
libstdc++6-4.7-dev_4.7.1-7_amd64.deb libstdc++6_4.7.1-7_amd64.deb libgcc1_4.7.1-7_amd64.deb \
1047
libgomp1_4.7.1-7_amd64.deb libitm1_4.7.1-7_amd64.deb libquadmath0_4.7.1-7_amd64.deb \
1048
gcc-4.7_4.7.1-7_amd64.deb g++-4.7_4.7.1-7_amd64.deb"
1050
if [ ! -d "$CHROOT_PATH/$G" ]; then
1051
INFO "Unpacking gcc-4.7"
1052
$RUN dpkg-source -x "$P/gcc-4.7/gcc-$GCC_FV.dsc" "$G"
1055
if [ "$CHROOT_ARCH" = "i386" ]; then
1056
pkg=`echo "$pkg" | sed -r 's/amd64/i386/g'`
1060
for x in `echo "$pkg"`; do
1061
if [ ! -f "$CHROOT_PATH/$P/gcc-4.7/$x" ]; then
1068
INFO "Compiling gcc-4.7"
1069
sed -ie 's/#with_check := disabled by hand/with_check := disabled by hand/' "$CHROOT_PATH/$G/debian/rules.defs"
1070
sed -ie 's/dpkg-dev (>= 1.16.0~ubuntu4)/dpkg-dev (>= 1.15.8)/' "$CHROOT_PATH/$G/debian/control"
1071
sed -ie 's/doxygen (>= 1.7.2)/doxygen (>= 1.7.1)/' "$CHROOT_PATH/$G/debian/control"
1072
sed -ie 's/libmpfr-dev (>= 3.0.0-9~)/libmpfr-dev (>= 3.0.0)/' "$CHROOT_PATH/$G/debian/control"
1073
sed -ie 's/libc6-dev (>= 2.13-5)/libc6-dev (>= 2.11.3)/' "$CHROOT_PATH/$G/debian/control"
1074
sed -ie 's/libgmp-dev (>= 2:5.0.1~)/libgmp3-dev (>= 2:4.3.2)/' "$CHROOT_PATH/$G/debian/control"
1075
$RUN sh -c "cd '$G' && dpkg-buildpackage -rfakeroot"
1079
for x in `echo "$pkg"`; do
1080
inst="$inst $P/gcc-4.7/$x"
1083
INFO "Installing gcc-4.7"
1086
INFO "Cleaning gcc-4.7"
1087
$RUN sh -c "cd '$G' && fakeroot debian/rules clean"
1091
if [ ! -f $CHROOT_PATH/usr/lib/libssl_pic.a ]; then
1092
INFO "Backporting OpenSSL"
1093
O="$P/openssl/openssl-$OPENSSL_V"
1095
pkg="libssl-dev_0.9.8o-4squeeze13_amd64.deb libssl0.9.8_0.9.8o-4squeeze13_amd64.deb openssl_0.9.8o-4squeeze13_amd64.deb"
1097
if [ ! -d "$CHROOT_PATH/$O" ]; then
1098
INFO "Unpacking OpenSSL"
1099
$RUN dpkg-source -x "$P/openssl/openssl_$OPENSSL_FV.dsc" "$O"
1102
if [ "$CHROOT_ARCH" = "i386" ]; then
1103
pkg=`echo "$pkg" | sed -r 's/amd64/i386/g'`
1107
for x in `echo "$pkg"`; do
1108
if [ ! -f "$CHROOT_PATH/$P/openssl/$x" ]; then
1115
INFO "Compiling OpenSSL"
1116
sed -ie 's/#\s*mv debian\/tmp\/usr\/lib\/libcrypto.a debian\/tmp\/usr\/lib\/libcrypto_pic.a/ mv debian\/tmp\/usr\/lib\/libcrypto.a debian\/tmp\/usr\/lib\/libcrypto_pic.a/' "$CHROOT_PATH/$O/debian/rules"
1117
sed -ie 's/#\s*mv debian\/tmp\/usr\/lib\/libssl.a debian\/tmp\/usr\/lib\/libssl_pic.a/ mv debian\/tmp\/usr\/lib\/libssl.a debian\/tmp\/usr\/lib\/libssl_pic.a/' "$CHROOT_PATH/$O/debian/rules"
1118
cat << EOF > $CHROOT_PATH/$O/debian/libssl-dev.files
1120
usr/lib/libcrypto.so
1123
usr/lib/libssl_pic.a
1124
usr/lib/libcrypto_pic.a
1129
$RUN sh -c "cd '$O' && dpkg-buildpackage -rfakeroot -j$THREADS"
1133
for x in `echo "$pkg"`; do
1134
inst="$inst $P/openssl/$x"
1137
INFO "Installing OpenSSL"
1140
echo "openssl hold" | $RUN dpkg --set-selections
1141
echo "libssl-dev hold" | $RUN dpkg --set-selections
1142
echo "libssl0.9.8 hold" | $RUN dpkg --set-selections
1144
INFO "Cleaning OpenSSL"
1145
$RUN sh -c "cd '$O' && fakeroot debian/rules clean"
1153
RUN="chroot $CHROOT_PATH"
1154
P="/home/sources/packages"
1155
L="$CHROOT_PATH/opt/lib"
1158
if [ ! -d "$L/jemalloc-$JEMALLOC_V" ]; then
1159
INFO "Copmiling jemalloc-$JEMALLOC_V"
1160
$RUN sh -c "cd '$P/jemalloc-$JEMALLOC_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
1163
ln -s "jemalloc-$JEMALLOC_V" "$L/jemalloc"
1167
if [ ! -d "$L/libspnav-$SPNAV_V" ]; then
1168
INFO "Copmiling libspnav-$SPNAV_V"
1169
mkdir -p "$L/libspnav-$SPNAV_V/lib"
1170
mkdir -p "$L/libspnav-$SPNAV_V/include"
1171
$RUN sh -c "cd '$P/libspnav-$SPNAV_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
1174
ln -s "libspnav-$SPNAV_V" "$L/libspnav"
1178
if [ ! -d "$L/ffmpeg-$FFMPEG_V" ]; then
1179
INFO "Copmiling ffmpeg-$FFMPEG_V"
1180
$RUN sh -c "cd '$P/ffmpeg-$FFMPEG_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
1183
ln -s "ffmpeg-$FFMPEG_V" "$L/ffmpeg"
1187
V=`echo $BOOST_V | sed -r 's/_/./g'`
1188
if [ ! -d "$L/boost-$V" ]; then
1189
INFO "Copmiling boost-$V"
1190
$RUN sh -c "cd '$P/boost_$BOOST_V' && ./bootstrap.sh && ./b2 --clean && ./b2 install --prefix='/opt/lib/boost-$V' && ./b2 --clean"
1193
ln -s "boost-$V" "$L/boost"
1197
if [ ! -d "$L/ocio-$OCIO_V" ]; then
1198
INFO "Copmiling ocio-$OCIO_V"
1199
$RUN sh -c "cd '$P/OpenColorIO-$OCIO_V/build' && ./prepare.sh && make clean && make -j$THREADS && make install && make clean"
1201
# Force linking against sttaic libs
1202
rm -f $L/ocio-$OCIO_V/lib/*.so*
1204
# Additional depencencies
1205
cp $CHROOT_PATH/$P/OpenColorIO-$OCIO_V/build/ext/dist/lib/libtinyxml.a $L/ocio-$OCIO_V/lib
1206
cp $CHROOT_PATH/$P/OpenColorIO-$OCIO_V/build/ext/dist/lib/libyaml-cpp.a $L/ocio-$OCIO_V/lib
1209
ln -s "ocio-$OCIO_V" "$L/ocio"
1213
if [ ! -d "$L/oiio-$OIIO_V" ]; then
1214
INFO "Copmiling oiio-$OIIO_V"
1215
$RUN sh -c "cd '$P/OpenImageIO-$OIIO_V/build' && ./prepare.sh && make clean && make -j$THREADS && make install && make clean"
1218
ln -s "oiio-$OIIO_V" "$L/oiio"
1222
if [ ! -d "$L/python-$PYTHON_V" ]; then
1223
INFO "Copmiling Python-$PYTHON_V"
1225
cat << EOF > $CHROOT_PATH/$P/Python-$PYTHON_V/Modules/Setup.local
1229
_sha256 sha256module.c
1230
_sha512 sha512module.c
1233
sed -ie "s/libraries = \['ssl', 'crypto'\]/libraries = ['ssl_pic', 'crypto_pic', 'z']/" "$P/Python-$PYTHON_V/setup.py"
1235
$RUN sh -c "cd '$P/Python-$PYTHON_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
1237
rm -f "$L/python-$PYTHIN_V_SHORT"
1238
ln -s "python-$PYTHON_V" "$L/python-$PYTHIN_V_SHORT"
1242
if [ ! -d "$L/mesa-$MESA_V" ]; then
1243
INFO "Copmiling Mesa-$MESA_V"
1245
$RUN sh -c "cd '$P/Mesa-$MESA_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
1248
ln -s "mesa-$MESA_V" "$L/mesa"
1252
if [ ! -d "$L/openal-$OPENAL_V" ]; then
1253
INFO "Copmiling openal-$OPENAL_V"
1255
$RUN sh -c "cd '$P/openal-soft-$OPENAL_V' && ./build-openal.sh"
1258
ln -s "openal-$OPENAL_V" "$L/openal"
1262
if [ ! -d "$L/opencollada" ]; then
1263
INFO "Copmiling opencollada"
1265
cat << EOF > "$CHROOT_PATH/$P/opencollada/collada.patch"
1266
Index: common/libBuffer/include/CommonBuffer.h
1267
===================================================================
1268
--- common/libBuffer/include/CommonBuffer.h (revision 876)
1269
+++ common/libBuffer/include/CommonBuffer.h (working copy)
1271
#define __COMMON_BUFFER_H__
1273
#include "CommonIBufferFlusher.h"
1274
+#include "COLLADABUPlatform.h"
1278
Index: common/libBuffer/src/CommonLogFileBufferFlusher.cpp
1279
===================================================================
1280
--- common/libBuffer/src/CommonLogFileBufferFlusher.cpp (revision 876)
1281
+++ common/libBuffer/src/CommonLogFileBufferFlusher.cpp (working copy)
1284
#include "CommonLogFileBufferFlusher.h"
1290
+FILE *_wfopen(const wchar_t *path, const char *mode)
1292
+ const wchar_t *src = path;
1297
+ n = (int)wcsrtombs(NULL, &src, 0, NULL);
1302
+ path_mbs = (char *)malloc(n + 1);
1303
+ wcsrtombs(path_mbs, &path, n, NULL);
1306
+ file = fopen(path_mbs, mode);
1316
//--------------------------------------------------------------------
1319
mError = (int)_wfopen_s( &stream, fileName, L"wb" );
1321
- stream = _wfopen( fileName, L"wb" );
1322
+ stream = _wfopen( fileName, "wb" );
1323
mError = stream ? 0 : errno;
1328
if ( mUseWideFileName )
1330
- stream = _wfopen( mWideFileName.c_str(), L"a" );
1331
+ stream = _wfopen( mWideFileName.c_str(), "a" );
1335
Index: common/libBuffer/SConscript
1336
===================================================================
1337
--- common/libBuffer/SConscript (revision 876)
1338
+++ common/libBuffer/SConscript (working copy)
1340
targetPath = outputDir + libName
1343
-incDirs = ['include/', '../libftoa/include']
1344
+incDirs = ['include/', '../libftoa/include', '../../COLLADABaseUtils/include/', '../../Externals/UTF/include']
1350
# We're building in a chroot, architecture of host system would be used by scons
1351
collada_arch="x86_64"
1353
$RUN sh -c "cd '$P/opencollada' && svn revert . -R && cat collada.patch | patch -p0 && ./build_all.sh && ./prepare_lib-libxml.sh $collada_arch"
1361
C="$CHROOT_PATH/etc/apt/sources.list"
1362
RUN="chroot $CHROOT_PATH"
1364
if [ `cat "$C" | grep -c "$REPO"` -eq "0" ]; then
1365
INFO "Adding repo $DESC"
1367
echo "deb $REPO" >> $C
1368
echo "deb-src $REPO" >> $C
1370
INFO "Updating packages list"
1379
RUN="chroot $CHROOT_PATH"
1381
# Install fresh debian to a chroot
1382
if [ ! -d "$CHROOT_PATH" ]; then
1384
INFO "Installing Debian ${DEBIAN_BRANCH} to ${CHROOT_PATH}"
1385
debootstrap --arch "${CHROOT_ARCH}" "${DEBIAN_BRANCH}" "${CHROOT_PATH}" "${DEBIAN_MIRROR}"
1388
# Configure users and groups
1390
if [ `cat ${CHROOT_PATH}/etc/group | grep -c developers` -eq "0" ]; then
1391
INFO "Creating gorup 'developers'"
1392
$RUN groupadd -g 7001 developers
1395
if [ `mount | grep -c "$CHROOT_PATH/dev"` -eq "0" ]; then
1396
INFO "Mounting devices from host system to chroot"
1398
mount -t proc none $CHROOT_PATH/proc
1399
mount -t auto -o bind /dev $CHROOT_PATH/dev
1400
mount -t devpts -o mode=0620 none $CHROOT_PATH/dev/pts
1403
# Configure apt and install packages
1405
if [ ! -f ${CHROOT_PATH}/etc/apt/apt.conf ]; then
1406
INFO "Setting up apt to not use recommended packages (saves disk space)"
1408
cat << EOF > "${CHROOT_PATH}/etc/apt/apt.conf"
1410
Default-Release "${DEBIAN_BRANCH}";
1411
Install-Recommends "0";
1416
ADD_REPO $CHROOT_PATH "mirror.yandex.ru" "http://mirror.yandex.ru/debian-multimedia/ squeeze main non-free"
1417
ADD_REPO $CHROOT_PATH "backports.debian.org" "http://backports.debian.org/debian-backports squeeze-backports main non-free"
1419
$RUN apt-get upgrade
1421
$RUN apt-get install -y --force-yes deb-multimedia-keyring libx264-dev libxvidcore4-dev libmp3lame-dev
1423
if [ `$RUN dpkg-query -W -f='${Status}\n' locales | grep -c not-installed` -eq "1" ]; then
1424
INFO "Configuring locales"
1425
$RUN apt-get install -y locales
1426
$RUN localedef -i en_US -f UTF-8 en_US.UTF-8
1429
INFO "Installing packages from repository"
1431
$RUN apt-get install -y mc gcc g++ cmake python dpkg-dev build-essential autoconf bison \
1432
flex gettext texinfo dejagnu quilt file lsb-release zlib1g-dev fakeroot debhelper \
1433
g++-multilib libtool autoconf2.64 automake gawk lzma patchutils gperf sharutils \
1434
libcloog-ppl-dev libmpc-dev libmpfr-dev libgmp3-dev autogen realpath chrpath doxygen \
1435
graphviz gsfonts-x11 texlive-latex-base libelfg0-dev libx11-dev yasm libopenjpeg-dev \
1436
libschroedinger-dev libtheora-dev libvorbis-dev libvpx-dev=$VPX_V \
1437
libopenexr-dev libpng-dev libjpeg-dev libtiff-dev python-dev libbz2-dev libreadline-dev \
1438
libsqlite3-dev liblzma-dev libncurses5-dev xutils-dev libxext-dev python-libxml2 \
1439
libglu1-mesa-dev libfftw3-dev libfreetype6-dev libsdl1.2-dev libopenal-dev libjack-dev \
1440
libxi-dev portaudio19-dev po4a subversion scons libpcre3-dev libexpat1-dev sudo \
1443
if [ $CHROOT_ARCH = "amd64" ]; then
1444
$RUN apt-get install -y libc6-dev-i386 lib32gcc1
1447
# Configure sources directory
1448
if [ ! -d "$CHROOT_PATH/home/sources" ]; then
1449
INFO "Creating sources directory"
1450
$RUN mkdir "/home/sources"
1451
$RUN chmod 775 /home/sources
1452
$RUN chown root:developers /home/sources
1455
# Bind directory from host system
1456
if [ ! -d "$CHROOT_PATH/home/sources/backport" ]; then
1457
INFO "Binding sources directory from host system to chroot"
1458
mount -o bind "$SOURCES_PATH" "$CHROOT_PATH/home/sources"
1461
if [ "`$RUN getent passwd $USER_ID`" = "" ]; then
1462
INFO "Adding default user to chroot"
1463
login=`getent passwd $USER_ID | cut -d : -f 1`
1464
$RUN useradd -d "/home/$login" -G developers,sudo -m -u $USER_ID "$login"
1468
DO_BACKPORT "$CHROOT_ARCH" "$CHROOT_PATH"
1470
# Set default compiler to gcc-4.7
1471
if [ `readlink "$CHROOT_PATH/usr/bin/gcc"` != "gcc-4.7" ]; then
1472
INFO "Setting gcc-4.7 as default compiler"
1473
rm -f $CHROOT_PATH/usr/bin/gcc
1474
rm -f $CHROOT_PATH/usr/bin/g++
1475
ln -s gcc-4.7 $CHROOT_PATH/usr/bin/gcc
1476
ln -s g++-4.7 $CHROOT_PATH/usr/bin/g++
1480
DO_COMPILE "$CHROOT_ARCH" "$CHROOT_PATH"
1482
# Install CUDA toolkit
1483
if [ ! -d "$CHROOT_PATH/usr/local/cuda-$CUDA_V" ]; then
1484
INFO "Installing CUDA toolkit"
1486
if [ "$CHROOT_ARCH" = "amd64" ]; then
1487
C="cudatoolkit_${CUDA_V}_linux_64_${CUDA_DISTR}.run"
1489
C="cudatoolkit_${CUDA_V}_linux_32_${CUDA_DISTR}.run"
1492
rm -f $CHROOT_PATH/usr/local/cuda
1494
chmod +x $CHROOT_PATH//home/sources/cudatoolkit/$C
1496
$RUN /usr/bin/expect <<EOF
1497
spawn /home/sources/cudatoolkit/$C
1498
expect "Enter install path"
1500
expect "Installation Complete"
1503
mv $CHROOT_PATH/usr/local/cuda $CHROOT_PATH/usr/local/cuda-$CUDA_V
1504
ln -s cuda-$CUDA_V $CHROOT_PATH/usr/local/cuda
1505
sudo ln -s /usr/bin/gcc-4.4 $CHROOT_PATH/usr/local/cuda/bin/gcc
1508
# Change permissions
1509
INFO "Changing permissions on sources"
1510
login=`$RUN getent passwd $USER_ID | cut -d : -f 1`
1511
for x in /home/sources /opt/lib; do
1512
$RUN chmod g+w -R $x
1513
$RUN chown "$login:developers" -R $x
1517
if ! which debootstrap > /dev/null 2>&1; then
1518
ERROR "debootstrap command not found, can not create chroot environment"
1519
ERROR "Use apt-get install debootstrap to install debootstrap"
1523
if [ -z "$ENV_PATH" ]; then
1524
ERROR "Incorrect environment directory is set"
1528
INSTALL_SOURCES "$SOURCES_PATH"
1529
INSTALL_CHROOT amd64 "$AMD64_PATH"
1530
INSTALL_CHROOT i386 "$I686_PATH"
1532
INFO "Configurtion of build environment is completed!"
1533
echo "Add this lines to your /etc/fstab:"
1536
for x in $I686_PATH $AMD64_PATH; do
1537
echo "none $x/proc proc auto 0 0"
1538
echo "/dev $x/dev auto bind,auto 0 0"
1539
echo "none $x/dev/pts devpts mode=0620,auto 0 0"
1540
echo "/home/sources $x/home/sources auto bind,auto 0 0"
1544
echo "Add this lines to your /etc/schroot/schroot.conf:"
1546
login=`getent passwd $USER_ID | cut -d : -f 1`
1548
for x in $I686_PATH $AMD64_PATH; do
1549
echo [`basename $x`]
1550
echo "description=Linux buildbot environment"
1553
echo "root-groups=root"