2
# ##### BEGIN GPL LICENSE BLOCK #####
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software Foundation,
16
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
# ##### END GPL LICENSE BLOCK #####
20
# A shell script installing/building all needed dependencies to build Blender, for some Linux distributions.
26
--long source:,install:,threads:,help,with-all,with-osl,with-opencollada,all-static,force-all,\
27
force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-opencollada,\
28
force-ffmpeg,skip-python,skip-numpy,skip-boost,skip-ocio,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg,\
35
SRC="$HOME/src/blender-deps"
39
# Do not install some optional, potentially conflicting libs by default...
42
# Do not yet enable osl, use --with-osl (or --with-all) option to try it.
45
# Do not yet enable opencollada, use --with-opencollada (or --with-all) option to try it.
46
WITH_OPENCOLLADA=false
48
# Try to link everything statically. Use this to produce portable versions of blender.
51
THREADS=`cat /proc/cpuinfo | grep cores | uniq | sed -e "s/.*: *\(.*\)/\\1/"`
52
if [ -z "$THREADS" ]; then
56
COMMON_INFO="\"Source code of dependencies needed to be compiled will be downloaded and extracted into '\$SRC'.
57
Built libs of dependencies needed to be compiled will be installed into '\$INST'.
58
Please edit \\\$SRC and/or \\\$INST variables at the beginning of this script,
59
or use --source/--install options, if you want to use other paths!
61
Number of threads for building: \$THREADS (automatically detected, use --threads=<nbr> to override it).
62
Full install: \$WITH_ALL (use --with-all option to enable it).
63
Building OSL: \$WITH_OSL (use --with-osl option to enable it).
64
Building OpenCOLLADA: \$WITH_OPENCOLLADA (use --with-opencollada option to enable it).
65
All static linking: \$ALL_STATIC (use --all-static option to enable it).
68
Full install without OpenCOLLADA: --with-all --skip-opencollada
70
Use --help to show all available options!\""
72
ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
74
Show this message and exit.
76
-s <path>, --source=<path>
77
Use a specific path where to store downloaded libraries sources (defaults to '\$SRC').
79
-i <path>, --install=<path>
80
Use a specific path where to install built libraries (defaults to '\$INST').
83
Use a specific number of threads when building the libraries (auto-detected as '\$THREADS').
86
By default, a number of optional and not-so-often needed libraries are not installed.
87
This option will try to install them, at the cost of potential conflicts (depending on
88
how your package system is set…).
89
Note this option also implies all other (more specific) --with-foo options below.
92
Try to install or build the OpenShadingLanguage libraries (and their dependencies).
96
Build and install the OpenCOLLADA libraries.
99
Build libraries as statically as possible, to create static builds of Blender.
102
Force the rebuild of all built libraries.
105
Force the rebuild of Python.
108
Force the rebuild of NumPy.
111
Force the rebuild of Boost.
114
Force the rebuild of OpenColorIO.
117
Force the rebuild of OpenImageIO.
120
Force the rebuild of LLVM.
123
Force the rebuild of OpenShadingLanguage.
126
Force the rebuild of OpenCOLLADA.
129
Force the rebuild of FFMpeg.
131
Note about the --force-foo options:
132
* They obviously only have an effect if those libraries are built by this script
133
(i.e. if there is no available and satisfactory package)!
134
* If the “force-rebuilt” library is a dependency of others, it will force the rebuild
135
of those libraries too (e.g. --force-boost will also rebuild oiio and osl...).
136
* Do not forget --with-osl if you built it and still want it!
139
Unconditionally skip Python installation/building.
142
Unconditionally skip NumPy installation/building.
145
Unconditionally skip Boost installation/building.
148
Unconditionally skip OpenColorIO installation/building.
151
Unconditionally skip OpenImageIO installation/building.
154
Unconditionally skip LLVM installation/building.
157
Unconditionally skip OpenShadingLanguage installation/building.
160
Unconditionally skip OpenCOLLADA installation/building.
163
Unconditionally skip FFMpeg installation/building.\""
165
PYTHON_VERSION="3.3.0"
166
PYTHON_VERSION_MIN="3.3"
167
PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2"
168
PYTHON_FORCE_REBUILD=false
171
#Could not get numpy-1.6.2 to compile with python-3.3
172
NUMPY_VERSION="1.7.0rc1"
173
NUMPY_VERSION_MIN="1.7"
174
NUMPY_SOURCE="http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz"
175
NUMPY_FORCE_REBUILD=false
178
BOOST_VERSION="1.51.0"
179
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
180
BOOST_SOURCE="http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download"
181
BOOST_VERSION_MIN="1.49"
182
BOOST_FORCE_REBUILD=false
186
OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
187
OCIO_VERSION_MIN="1.0"
188
OCIO_FORCE_REBUILD=false
192
OIIO_SOURCE="https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_VERSION"
193
OIIO_VERSION_MIN="1.1"
194
OIIO_FORCE_REBUILD=false
198
LLVM_VERSION_MIN="3.0"
199
LLVM_VERSION_FOUND=""
200
LLVM_SOURCE="http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz"
201
LLVM_CLANG_SOURCE="http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz"
202
LLVM_FORCE_REBUILD=false
205
# OSL needs to be compiled for now!
207
OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage/archive/blender-fixes.tar.gz"
208
OSL_FORCE_REBUILD=false
212
OPENCOLLADA_VERSION="1.3"
213
OPENCOLLADA_SOURCE="https://github.com/KhronosGroup/OpenCOLLADA.git"
214
OPENCOLLADA_FORCE_REBUILD=false
215
OPENCOLLADA_SKIP=false
218
FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
219
FFMPEG_VERSION_MIN="0.7.6"
220
FFMPEG_FORCE_REBUILD=false
224
# FFMPEG optional libs.
235
X264_VERSION_MIN=0.118
237
VPX_VERSION_MIN=0.9.7
244
# Switch to english language, else some things (like check_package_DEB()) won't work!
251
if [ "X$1" = "X-n" ]; then
252
shift; printf "%s" "$@"
266
# Finish parsing the commandline args.
271
SRC="$2"; shift; shift; continue
274
INST="$2"; shift; shift; continue
277
THREADS="$2"; shift; shift; continue
283
INFO "`eval _echo "$COMMON_INFO"`"
285
INFO "`eval _echo "$ARGUMENTS_INFO"`"
290
WITH_ALL=true; shift; continue
293
WITH_OSL=true; shift; continue
296
WITH_OPENCOLLADA=true; shift; continue
299
ALL_STATIC=true; shift; continue
302
PYTHON_FORCE_REBUILD=true
303
NUMPY_FORCE_REBUILD=true
304
BOOST_FORCE_REBUILD=true
305
OCIO_FORCE_REBUILD=true
306
OIIO_FORCE_REBUILD=true
307
LLVM_FORCE_REBUILD=true
308
OSL_FORCE_REBUILD=true
309
OPENCOLLADA_FORCE_REBUILD=true
310
FFMPEG_FORCE_REBUILD=true
314
PYTHON_FORCE_REBUILD=true; shift; continue
317
NUMPY_FORCE_REBUILD=true; shift; continue
320
BOOST_FORCE_REBUILD=true; shift; continue
323
OCIO_FORCE_REBUILD=true; shift; continue
326
OIIO_FORCE_REBUILD=true; shift; continue
329
LLVM_FORCE_REBUILD=true; shift; continue
332
OSL_FORCE_REBUILD=true; shift; continue
335
OPENCOLLADA_FORCE_REBUILD=true; shift; continue
338
FFMPEG_FORCE_REBUILD=true; shift; continue
341
PYTHON_SKIP=true; shift; continue
344
NUMPY_SKIP=true; shift; continue
347
BOOST_SKIP=true; shift; continue
350
OCIO_SKIP=true; shift; continue
353
OIIO_SKIP=true; shift; continue
356
LLVM_SKIP=true; shift; continue
359
OSL_SKIP=true; shift; continue
362
OPENCOLLADA_SKIP=true; shift; continue
365
FFMPEG_SKIP=true; shift; continue
368
# no more arguments to parse
373
INFO "Wrong parameter! Usage:"
375
INFO "`eval _echo "$COMMON_INFO"`"
384
WITH_OPENCOLLADA=true
387
# Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
388
# $1 and $2 should be version numbers made of numbers only.
393
# Split both version numbers into their numeric elements.
401
if [ $count2 -ge $count1 ]; then
410
for (( i=0; $i < $count2; i++ ))
412
if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
418
for (( i=$count2; $i < $count1; i++ ))
420
if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then
430
# Return 0 if $1 >= $2, else 1.
431
# $1 and $2 should be version numbers made of numbers only.
434
if [ $? -eq 1 -a $(_echo "$1" "$2" | sort --version-sort | head --lines=1) = "$1" ]; then
441
# Return 0 if $1 is into $2 (e.g. 3.3.2 is into 3.3, but not 3.3.0 or 3.3.5), else 1.
442
# $1 and $2 should be version numbers made of numbers only.
443
# $1 should be at least as long as $2!
448
# Split both version numbers into their numeric elements.
456
if [ $count1 -ge $count2 ]; then
458
for (( i=0; $i < $count2; i++ ))
460
if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
472
if [ -f /etc/debian_version ]; then
474
elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
476
elif [ -f /etc/arch-release ]; then
482
if [ -f /etc/redhat-release ]; then
483
if [ "`grep '6\.' /etc/redhat-release`" ]; then
488
elif [ -f /etc/SuSE-release ]; then
494
INFO "Ensuring $INST exists and is writable by us"
495
if [ ! -d $INST ]; then
499
if [ ! -w $INST ]; then
500
sudo chown $USER $INST
505
# Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name...
506
magic_compile_check() {
507
if [ -f $INST/.$1-magiccheck-$2 ]; then
514
magic_compile_set() {
515
rm -f $INST/.$1-magiccheck-*
516
touch $INST/.$1-magiccheck-$2
520
# To be changed each time we make edits that would modify the compiled result!
523
_src=$SRC/Python-$PYTHON_VERSION
524
_inst=$INST/python-$PYTHON_VERSION
526
# Clean install if needed!
527
magic_compile_check python-$PYTHON_VERSION $py_magic
528
if [ $? -eq 1 -o $PYTHON_FORCE_REBUILD == true ]; then
532
if [ ! -d $_inst ]; then
533
INFO "Building Python-$PYTHON_VERSION"
537
if [ ! -d $_src ]; then
539
wget -c $PYTHON_SOURCE -O $_src.tar.bz2
541
INFO "Unpacking Python-$PYTHON_VERSION"
542
tar -C $SRC -xf $_src.tar.bz2
547
./configure --prefix=$_inst --enable-ipv6 \
548
--enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
549
--with-computed-gotos --with-pymalloc
551
make -j$THREADS && make install
554
if [ -d $_inst ]; then
555
rm -f $INST/python-3.3
556
ln -s python-$PYTHON_VERSION $INST/python-3.3
558
ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
562
magic_compile_set python-$PYTHON_VERSION $py_magic
565
INFO "Done compiling Python-$PYTHON_VERSION!"
567
INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
568
INFO "If you want to force rebuild of this lib, use the --force-python option."
573
# To be changed each time we make edits that would modify the compiled result!
576
_src=$SRC/numpy-$NUMPY_VERSION
577
_inst=$INST/numpy-$NUMPY_VERSION
578
_python=$INST/python-$PYTHON_VERSION
579
_site=lib/python3.3/site-packages
581
# Clean install if needed!
582
magic_compile_check numpy-$NUMPY_VERSION $py_magic
583
if [ $? -eq 1 -o $NUMPY_FORCE_REBUILD == true ]; then
587
if [ ! -d $_inst ]; then
588
INFO "Building Numpy-$NUMPY_VERSION"
592
if [ ! -d $_src ]; then
594
wget -c $NUMPY_SOURCE -O $_src.tar.gz
596
INFO "Unpacking Numpy-$NUMPY_VERSION"
597
tar -C $SRC -xf $_src.tar.gz
602
$_python/bin/python3 setup.py install --prefix=$_inst
604
if [ -d $_inst ]; then
605
rm -f $_python/$_site/numpy
606
ln -s $_inst/$_site/numpy $_python/$_site/numpy
608
ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting"
612
magic_compile_set numpy-$NUMPY_VERSION $py_magic
615
INFO "Done compiling Numpy-$NUMPY_VERSION!"
617
INFO "Own Numpy-$NUMPY_VERSION is up to date, nothing to do!"
618
INFO "If you want to force rebuild of this lib, use the --force-numpy option."
623
# To be changed each time we make edits that would modify the compiled result!
626
_src=$SRC/boost-$BOOST_VERSION
627
_inst=$INST/boost-$BOOST_VERSION
629
# Clean install if needed!
630
magic_compile_check boost-$BOOST_VERSION $boost_magic
631
if [ $? -eq 1 -o $BOOST_FORCE_REBUILD == true ]; then
635
if [ ! -d $_inst ]; then
636
INFO "Building Boost-$BOOST_VERSION"
640
if [ ! -d $_src ]; then
641
INFO "Downloading Boost-$BOOST_VERSION"
643
wget -c $BOOST_SOURCE -O $_src.tar.bz2
644
tar -C $SRC --transform "s,(.*/?)boost_1_[^/]+(.*),\1boost-$BOOST_VERSION\2,x" -xf $_src.tar.bz2
648
if [ ! -f $_src/b2 ]; then
651
./b2 -j$THREADS -a --with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time \
652
--prefix=$_inst --disable-icu boost.locale.icu=off install
655
if [ -d $_inst ]; then
657
ln -s boost-$BOOST_VERSION $INST/boost
659
ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
663
magic_compile_set boost-$BOOST_VERSION $boost_magic
665
# Rebuild dependecies as well!
666
OIIO_FORCE_REBUILD=true
667
OSL_FORCE_REBUILD=true
670
INFO "Done compiling Boost-$BOOST_VERSION!"
672
INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!"
673
INFO "If you want to force rebuild of this lib, use the --force-boost option."
678
# To be changed each time we make edits that would modify the compiled result!
681
_src=$SRC/OpenColorIO-$OCIO_VERSION
682
_inst=$INST/ocio-$OCIO_VERSION
684
# Clean install if needed!
685
magic_compile_check ocio-$OCIO_VERSION $ocio_magic
686
if [ $? -eq 1 -o $OCIO_FORCE_REBUILD == true ]; then
690
if [ ! -d $_inst ]; then
691
INFO "Building OpenColorIO-$OCIO_VERSION"
695
if [ ! -d $_src ]; then
696
INFO "Downloading OpenColorIO-$OCIO_VERSION"
698
wget -c $OCIO_SOURCE -O $_src.tar.gz
700
INFO "Unpacking OpenColorIO-$OCIO_VERSION"
701
tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
706
# Always refresh the whole build!
707
if [ -d build ]; then
713
if file /bin/cp | grep -q '32-bit'; then
714
cflags="-fPIC -m32 -march=i686"
719
cmake -D CMAKE_BUILD_TYPE=Release \
720
-D CMAKE_PREFIX_PATH=$_inst \
721
-D CMAKE_INSTALL_PREFIX=$_inst \
722
-D CMAKE_CXX_FLAGS="$cflags" \
723
-D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" \
724
-D OCIO_BUILD_APPS=OFF \
725
-D OCIO_BUILD_PYGLUE=OFF \
728
make -j$THREADS && make install
730
# Force linking against static libs
731
rm -f $_inst/lib/*.so*
733
# Additional depencencies
734
cp ext/dist/lib/libtinyxml.a $_inst/lib
735
cp ext/dist/lib/libyaml-cpp.a $_inst/lib
739
if [ -d $_inst ]; then
741
ln -s ocio-$OCIO_VERSION $INST/ocio
743
ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
747
magic_compile_set ocio-$OCIO_VERSION $ocio_magic
750
INFO "Done compiling OpenColorIO-$OCIO_VERSION!"
752
INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!"
753
INFO "If you want to force rebuild of this lib, use the --force-ocio option."
758
# To be changed each time we make edits that would modify the compiled result!
761
_src=$SRC/OpenImageIO-$OIIO_VERSION
762
_inst=$INST/oiio-$OIIO_VERSION
764
# Clean install if needed!
765
magic_compile_check oiio-$OIIO_VERSION $oiio_magic
766
if [ $? -eq 1 -o $OIIO_FORCE_REBUILD == true ]; then
770
if [ ! -d $_inst ]; then
771
INFO "Building OpenImageIO-$OIIO_VERSION"
775
if [ ! -d $_src ]; then
777
wget -c $OIIO_SOURCE -O "$_src.tar.gz"
779
INFO "Unpacking OpenImageIO-$OIIO_VERSION"
780
tar -C $SRC --transform "s,(.*/?)OpenImageIO-oiio[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \
785
# XXX Ugly patching hack!
786
cat << EOF | patch -p1
787
diff --git a/src/libutil/SHA1.cpp b/src/libutil/SHA1.cpp
788
index b9e6c8b..c761185 100644
789
--- a/src/libutil/SHA1.cpp
790
+++ b/src/libutil/SHA1.cpp
793
// If compiling with MFC, you might want to add #include "StdAfx.h"
800
#ifdef SHA1_UTILITY_FUNCTIONS
801
#define SHA1_MAX_FILE_BUFFER 8000
809
# Always refresh the whole build!
810
if [ -d build ]; then
816
cmake_d="-D CMAKE_BUILD_TYPE=Release"
817
cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
818
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
819
cmake_d="$cmake_d -D BUILDSTATIC=ON"
821
# linking statically could give issues on Debian/Ubuntu (and probably other distros
822
# which doesn't like static linking) when linking shared oiio library due to missing
823
# text symbols (static libs should be compiled with -fPIC)
824
# cmake_d="$cmake_d -D LINKSTATIC=ON"
826
if [ -d $INST/boost ]; then
827
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
829
cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
833
# Looks like we do not need ocio in oiio for now...
834
# if [ -d $INST/ocio ]; then
835
# cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio"
838
if file /bin/cp | grep -q '32-bit'; then
839
cflags="-fPIC -m32 -march=i686"
844
cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ../src
846
make -j$THREADS && make install
849
if [ -d $_inst ]; then
851
ln -s oiio-$OIIO_VERSION $INST/oiio
853
ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
857
magic_compile_set oiio-$OIIO_VERSION $oiio_magic
859
# Rebuild dependecies as well!
860
OSL_FORCE_REBUILD=true
863
INFO "Done compiling OpenImageIO-$OIIO_VERSION!"
865
INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!"
866
INFO "If you want to force rebuild of this lib, use the --force-oiio option."
871
# To be changed each time we make edits that would modify the compiled result!
874
_src=$SRC/LLVM-$LLVM_VERSION
875
_inst=$INST/llvm-$LLVM_VERSION
876
_src_clang=$SRC/CLANG-$LLVM_VERSION
878
# Clean install if needed!
879
magic_compile_check llvm-$LLVM_VERSION $llvm_magic
880
if [ $? -eq 1 -o $LLVM_FORCE_REBUILD == true ]; then
885
if [ ! -d $_inst ]; then
886
INFO "Building LLVM-$LLVM_VERSION (CLANG included!)"
890
if [ ! -d $_src -o true ]; then
892
wget -c $LLVM_SOURCE -O "$_src.tar.gz"
893
wget -c $LLVM_CLANG_SOURCE -O "$_src_clang.tar.gz"
895
INFO "Unpacking LLVM-$LLVM_VERSION"
896
tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
898
INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang"
900
--transform "s,([^/]*/?)clang-[^/]*(.*),\1clang\2,x" \
901
-xf $_src_clang.tar.gz
905
# XXX Ugly patching hack!
906
cat << EOF | patch -p1
910
set(LLVM_VERSION_MAJOR 3)
911
set(LLVM_VERSION_MINOR 1)
913
-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
914
+set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
916
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
926
# Always refresh the whole build!
927
if [ -d build ]; then
933
cmake_d="-D CMAKE_BUILD_TYPE=Release"
934
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
935
cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
936
cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
938
if [ -d $_FFI_INCLUDE_DIR ]; then
939
cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
944
make -j$THREADS && make install
947
if [ -d $_inst ]; then
949
ln -s llvm-$LLVM_VERSION $INST/llvm
951
ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
955
magic_compile_set llvm-$LLVM_VERSION $llvm_magic
957
# Rebuild dependecies as well!
958
OSL_FORCE_REBUILD=true
961
INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!"
963
INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
964
INFO "If you want to force rebuild of this lib, use the --force-llvm option."
969
# To be changed each time we make edits that would modify the compiled result!
972
_src=$SRC/OpenShadingLanguage-$OSL_VERSION
973
_inst=$INST/osl-$OSL_VERSION
975
# Clean install if needed!
976
magic_compile_check osl-$OSL_VERSION $osl_magic
977
if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
981
if [ ! -d $_inst ]; then
982
INFO "Building OpenShadingLanguage-$OSL_VERSION"
986
if [ ! -d $_src ]; then
989
# XXX Using git on my own repo for now, looks like archives are not updated immediately... :/
990
# wget -c $OSL_SOURCE -O "$_src.tar.gz"
992
# INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
993
# tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
995
git clone https://github.com/mont29/OpenShadingLanguage.git $_src
997
git checkout blender-fixes
1002
# XXX For now, always update from latest repo...
1005
# Always refresh the whole build!
1006
if [ -d build ]; then
1012
cmake_d="-D CMAKE_BUILD_TYPE=Release"
1013
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1014
cmake_d="$cmake_d -D BUILDSTATIC=ON"
1015
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
1016
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
1018
if [ -d $INST/boost ]; then
1019
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
1020
if $ALL_STATIC; then
1021
cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
1025
if [ -d $INST/oiio ]; then
1026
cmake_d="$cmake_d -D OPENIMAGEIOHOME=$INST/oiio"
1029
if [ ! -z $LLVM_VERSION_FOUND ]; then
1030
cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
1031
if [ -d $INST/llvm ]; then
1032
cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
1033
cmake_d="$cmake_d -D LLVM_STATIC=ON"
1037
cmake $cmake_d ../src
1039
make -j$THREADS && make install
1042
if [ -d $_inst ]; then
1044
ln -s osl-$OSL_VERSION $INST/osl
1046
ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
1050
magic_compile_set osl-$OSL_VERSION $osl_magic
1053
INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!"
1055
INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!"
1056
INFO "If you want to force rebuild of this lib, use the --force-osl option."
1060
compile_OpenCOLLADA() {
1061
# To be changed each time we make edits that would modify the compiled results!
1064
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
1065
_inst=$INST/opencollada-$OPENCOLLADA_VERSION
1067
# Clean install if needed!
1068
magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic
1069
if [ $? -eq 1 -o $OPENCOLLADA_FORCE_REBUILD == true ]; then
1073
if [ ! -d $_inst ]; then
1074
INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION"
1078
if [ ! -d $_src ]; then
1080
git clone $OPENCOLLADA_SOURCE $_src
1085
# XXX For now, always update from latest repo...
1088
# Always refresh the whole build!
1089
if [ -d build ]; then
1095
cmake_d="-D CMAKE_BUILD_TYPE=Release"
1096
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1097
cmake_d="$cmake_d -D USE_EXPAT=OFF"
1098
cmake_d="$cmake_d -D USE_LIBXML=ON"
1099
cmake_d="$cmake_d -D USE_STATIC=ON"
1103
make -j$THREADS && make install
1106
if [ -d $_inst ]; then
1107
rm -f $INST/opencollada
1108
ln -s opencollada-$OPENCOLLADA_VERSION $INST/opencollada
1110
ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
1114
magic_compile_set opencollada-$OPENCOLLADA_VERSION $opencollada_magic
1117
INFO "Done compiling OpenCOLLADA-$OPENCOLLADA_VERSION!"
1119
INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
1120
INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
1125
# To be changed each time we make edits that would modify the compiled result!
1128
_src=$SRC/ffmpeg-$FFMPEG_VERSION
1129
_inst=$INST/ffmpeg-$FFMPEG_VERSION
1131
# Clean install if needed!
1132
magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
1133
if [ $? -eq 1 -o $FFMPEG_FORCE_REBUILD == true ]; then
1137
if [ ! -d $_inst ]; then
1138
INFO "Building ffmpeg-$FFMPEG_VERSION"
1142
if [ ! -d $_src ]; then
1143
INFO "Downloading ffmpeg-$FFMPEG_VERSION"
1145
wget -c $FFMPEG_SOURCE -O "$_src.tar.bz2"
1147
INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
1148
tar -C $SRC -xf $_src.tar.bz2
1155
if $VORBIS_USE; then
1156
extra="$extra --enable-libvorbis"
1159
if $THEORA_USE; then
1160
extra="$extra --enable-libtheora"
1163
# XXX At least under Debian, static schro gives problem at blender linking time... :/
1164
if $SCHRO_USE && ! $ALL_STATIC; then
1165
extra="$extra --enable-libschroedinger"
1169
extra="$extra --enable-libxvid"
1173
extra="$extra --enable-libx264"
1177
extra="$extra --enable-libvpx"
1180
if $MP3LAME_USE; then
1181
extra="$extra --enable-libmp3lame"
1184
if $OPENJPEG_USE; then
1185
extra="$extra --enable-libopenjpeg"
1188
./configure --cc="gcc -Wl,--as-needed" \
1189
--extra-ldflags="-pthread -static-libgcc" \
1190
--prefix=$_inst --enable-static \
1191
--disable-ffplay --disable-ffserver --disable-doc \
1193
--enable-avfilter --disable-vdpau \
1194
--disable-bzlib --disable-libgsm --disable-libspeex \
1195
--enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
1196
--disable-vaapi --disable-libfaac --disable-nonfree --enable-gpl \
1197
--disable-postproc --disable-x11grab --disable-librtmp --disable-libopencore-amrnb \
1198
--disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
1199
--disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
1200
--disable-indev=lavfi $extra
1202
make -j$THREADS && make install
1205
if [ -d $_inst ]; then
1207
ln -s ffmpeg-$FFMPEG_VERSION $INST/ffmpeg
1209
ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
1213
magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
1216
INFO "Done compiling ffmpeg-$FFMPEG_VERSION!"
1218
INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
1219
INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
1225
get_package_version_DEB() {
1226
dpkg-query -W -f '${Version}' $1 | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'
1229
check_package_DEB() {
1230
r=`apt-cache policy $1 | grep -c 'Candidate:'`
1232
if [ $r -ge 1 ]; then
1239
check_package_version_match_DEB() {
1240
v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'`
1242
if [ -z "$v" ]; then
1250
check_package_version_ge_DEB() {
1251
v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
1253
if [ -z "$v" ]; then
1261
install_packages_DEB() {
1262
sudo apt-get install -y --force-yes $@
1263
if [ $? -ge 1 ]; then
1264
ERROR "apt-get failed to install requested packages, exiting."
1271
INFO "Installing dependencies for DEB-based distribution"
1273
INFO "`eval _echo "$COMMON_INFO"`"
1276
read -p "Do you want to continue (Y/n)?"
1277
[ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
1279
if [ ! -z "`cat /etc/debian_version | grep ^6`" ]; then
1280
if [ -z "`cat /etc/apt/sources.list | grep backports.debian.org`" ]; then
1281
INFO "Looks like you're using Debian Squeeze which does have broken CMake"
1282
INFO "It is highly recommended to install cmake from backports, otherwise"
1283
INFO "compilation of some libraries could fail"
1285
INFO "You could install newer CMake from debian-backports repository"
1286
INFO "Add this this line to your /etc/apt/sources.lixt:"
1288
INFO "deb http://backports.debian.org/debian-backports squeeze-backports main"
1290
INFO "and then run:"
1292
INFO "sudo apt-get update && sudo apt-get install cmake=2.8.7-4~bpo60+1 sudo apt-get install cmake=2.8.7-4~bpo60+1"
1294
INFO "(you could also add this reporisotry using GUI like synaptic)"
1296
INFO "Hit Enter to continue running the script, or hit Ctrl-C to abort the script"
1305
# These libs should always be available in debian/ubuntu official repository...
1306
OPENJPEG_DEV="libopenjpeg-dev"
1307
VORBIS_DEV="libvorbis-dev"
1308
THEORA_DEV="libtheora-dev"
1310
_packages="gawk cmake cmake-curses-gui scons build-essential libjpeg-dev libpng-dev \
1311
libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
1312
libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
1313
libopenexr-dev libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV \
1314
libsdl1.2-dev libfftw3-dev patch bzip2"
1320
# Install newest libtiff-dev in debian/ubuntu.
1322
check_package_DEB $TIFF
1323
if [ $? -eq 0 ]; then
1324
_packages="$_packages $TIFF-dev"
1327
check_package_DEB $TIFF
1328
if [ $? -eq 0 ]; then
1329
_packages="$_packages $TIFF-dev"
1334
_packages="$_packages libspnav-dev libjack-dev"
1338
install_packages_DEB $_packages
1341
X264_DEV="libx264-dev"
1342
check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN
1343
if [ $? -eq 0 ]; then
1344
install_packages_DEB $X264_DEV
1350
# Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev!
1351
# Note: not since ubuntu 10.04
1352
XVID_DEV="libxvidcore-dev"
1353
check_package_DEB $XVID_DEV
1354
if [ $? -eq 0 ]; then
1355
install_packages_DEB $XVID_DEV
1358
XVID_DEV="libxvidcore4-dev"
1359
check_package_DEB $XVID_DEV
1360
if [ $? -eq 0 ]; then
1361
install_packages_DEB $XVID_DEV
1367
MP3LAME_DEV="libmp3lame-dev"
1368
check_package_DEB $MP3LAME_DEV
1369
if [ $? -eq 0 ]; then
1370
install_packages_DEB $MP3LAME_DEV
1375
VPX_DEV="libvpx-dev"
1376
check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN
1377
if [ $? -eq 0 ]; then
1378
install_packages_DEB $VPX_DEV
1383
SCHRO_DEV="libschroedinger-dev"
1384
check_package_DEB $SCHRO_DEV
1385
if [ $? -eq 0 ]; then
1386
install_packages_DEB $SCHRO_DEV
1392
if $PYTHON_SKIP; then
1393
INFO "WARNING! Skipping Python installation, as requested..."
1395
check_package_DEB python$PYTHON_VERSION_MIN-dev
1396
if [ $? -eq 0 ]; then
1397
install_packages_DEB python$PYTHON_VERSION_MIN-dev
1399
if $NUMPY_SKIP; then
1400
INFO "WARNING! Skipping NumPy installation, as requested..."
1402
check_package_DEB python$PYTHON_VERSION_MIN-numpy
1403
if [ $? -eq 0 ]; then
1404
install_packages_DEB python$PYTHON_VERSION_MIN-numpy
1406
INFO "WARNING! Sorry, using python package but no numpy package available!"
1412
if $NUMPY_SKIP; then
1413
INFO "WARNING! Skipping NumPy installation, as requested..."
1421
if $BOOST_SKIP; then
1422
INFO "WARNING! Skipping Boost installation, as requested..."
1424
check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN
1425
if [ $? -eq 0 ]; then
1426
install_packages_DEB libboost-dev
1428
boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
1430
check_package_DEB libboost-locale$boost_version-dev
1431
if [ $? -eq 0 ]; then
1432
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
1433
libboost-regex$boost_version-dev libboost-system$boost_version-dev \
1434
libboost-thread$boost_version-dev
1445
INFO "WARNING! Skipping OpenColorIO installation, as requested..."
1447
check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
1448
if [ $? -eq 0 ]; then
1449
install_packages_DEB libopencolorio-dev
1457
INFO "WARNING! Skipping OpenImageIO installation, as requested..."
1459
check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN
1460
if [ $? -eq 0 ]; then
1461
install_packages_DEB libopenimageio-dev
1471
INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
1474
check_package_DEB llvm-$LLVM_VERSION-dev
1475
if [ $? -eq 0 ]; then
1476
install_packages_DEB llvm-$LLVM_VERSION-dev clang
1478
LLVM_VERSION_FOUND=$LLVM_VERSION
1480
check_package_DEB llvm-$LLVM_VERSION_MIN-dev
1481
if [ $? -eq 0 ]; then
1482
install_packages_DEB llvm-$LLVM_VERSION_MIN-dev clang
1484
LLVM_VERSION_FOUND=$LLVM_VERSION_MIN
1486
install_packages_DEB libffi-dev
1487
# LLVM can't find the debian ffi header dir
1488
_FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
1492
LLVM_VERSION_FOUND=$LLVM_VERSION
1498
INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
1502
install_packages_DEB flex bison libtbb-dev git
1503
# No package currently!
1510
if $WITH_OPENCOLLADA; then
1511
if $OPENCOLLADA_SKIP; then
1512
INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
1515
install_packages_DEB git libpcre3-dev libxml2-dev
1516
# Find path to libxml shared lib...
1517
_XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"`
1525
if $FFMPEG_SKIP; then
1526
INFO "WARNING! Skipping FFMpeg installation, as requested..."
1528
# XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/
1529
# So for now, always build our own ffmpeg.
1530
# check_package_DEB ffmpeg
1531
# if [ $? -eq 0 ]; then
1532
# install_packages_DEB ffmpeg
1533
# ffmpeg_version=`get_package_version_DEB ffmpeg`
1534
# INFO "ffmpeg version: $ffmpeg_version"
1535
# if [ ! -z "$ffmpeg_version" ]; then
1536
# if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then
1537
# install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
1549
get_package_version_RPM() {
1551
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1552
yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
1553
elif [ $RPM = "SUSE" ]; then
1554
zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
1558
check_package_RPM() {
1560
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1561
r=`yum info $1 | grep -c 'Summary'`
1562
elif [ $RPM = "SUSE" ]; then
1563
r=`zypper info $1 | grep -c 'Summary'`
1566
if [ $r -ge 1 ]; then
1573
check_package_version_match_RPM() {
1574
v=`get_package_version_RPM $1`
1576
if [ -z "$v" ]; then
1584
check_package_version_ge_RPM() {
1585
v=`get_package_version_RPM $1`
1587
if [ -z "$v" ]; then
1595
install_packages_RPM() {
1597
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1598
sudo yum install -y $@
1599
if [ $? -ge 1 ]; then
1600
ERROR "yum failed to install requested packages, exiting."
1604
elif [ $RPM = "SUSE" ]; then
1605
sudo zypper --non-interactive install --auto-agree-with-licenses $@
1606
if [ $? -ge 1 ]; then
1607
ERROR "zypper failed to install requested packages, exiting."
1615
INFO "Installing dependencies for RPM-based distribution"
1617
INFO "`eval _echo "$COMMON_INFO"`"
1620
read -p "Do you want to continue (Y/n)?"
1621
[ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
1623
# Enable non-free repositories for all flavours
1625
if [ $RPM = "FEDORA" ]; then
1626
sudo yum -y localinstall --nogpgcheck \
1627
http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm \
1628
http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
1632
# Install cmake now because of difference with RHEL
1633
sudo yum -y install cmake
1635
elif [ $RPM = "RHEL" ]; then
1636
sudo yum -y localinstall --nogpgcheck \
1637
http://download.fedoraproject.org/pub/epel/6/$(uname -i)/epel-release-6-8.noarch.rpm \
1638
http://download1.rpmfusion.org/free/el/updates/6/$(uname -i)/rpmfusion-free-release-6-1.noarch.rpm \
1639
http://download1.rpmfusion.org/nonfree/el/updates/6/$(uname -i)/rpmfusion-nonfree-release-6-1.noarch.rpm
1643
# Install cmake 2.8 from other repo
1645
if [ -f $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm ]; then
1647
INFO "Special cmake already installed"
1649
curl -O ftp://ftp.pbone.net/mirror/atrpms.net/el6-$(uname -i)/atrpms/testing/cmake-2.8.8-4.el6.$(uname -m).rpm
1650
mv cmake-2.8.8-4.el6.$(uname -m).rpm $SRC/
1651
sudo rpm -ihv $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm
1654
elif [ $RPM = "SUSE" ]; then
1655
_suse_rel="`grep VERSION /etc/SuSE-release | gawk '{print $3}'`"
1656
sudo zypper ar -f http://packman.inode.at/suse/openSUSE_$_suse_rel/ packman
1658
sudo zypper --non-interactive --gpg-auto-import-keys update --auto-agree-with-licenses
1661
# These libs should always be available in fedora/suse official repository...
1662
OPENJPEG_DEV="openjpeg-devel"
1663
VORBIS_DEV="libvorbis-devel"
1664
THEORA_DEV="libtheora-devel"
1666
_packages="gcc gcc-c++ make scons libpng-devel libtiff-devel \
1667
freetype-devel libX11-devel libXi-devel wget ncurses-devel \
1668
readline-devel $OPENJPEG_DEV openal-soft-devel \
1669
glew-devel yasm $THEORA_DEV $VORBIS_DEV SDL-devel fftw-devel \
1670
libjpeg-devel patch"
1676
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1678
_packages="$_packages libsqlite3-devel openexr-devel"
1681
_packages="$_packages jack-audio-connection-kit-devel libspnav-devel"
1685
install_packages_RPM $_packages
1688
X264_DEV="x264-devel"
1689
check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
1690
if [ $? -eq 0 ]; then
1691
install_packages_RPM $X264_DEV
1697
XVID_DEV="xvidcore-devel"
1698
check_package_RPM $XVID_DEV
1699
if [ $? -eq 0 ]; then
1700
install_packages_RPM $XVID_DEV
1705
MP3LAME_DEV="lame-devel"
1706
check_package_RPM $MP3LAME_DEV
1707
if [ $? -eq 0 ]; then
1708
install_packages_RPM $MP3LAME_DEV
1713
elif [ $RPM = "SUSE" ]; then
1715
_packages="$_packages cmake sqlite3-devel libopenexr-devel"
1718
_packages="$_packages libjack-devel libspnav-devel"
1722
install_packages_RPM $_packages
1725
X264_DEV="libx264-devel"
1726
check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
1727
if [ $? -eq 0 ]; then
1728
install_packages_RPM $X264_DEV
1734
XVID_DEV="libxvidcore-devel"
1735
check_package_RPM $XVID_DEV
1736
if [ $? -eq 0 ]; then
1737
install_packages_RPM $XVID_DEV
1742
MP3LAME_DEV="libmp3lame-devel"
1743
check_package_RPM $MP3LAME_DEV
1744
if [ $? -eq 0 ]; then
1745
install_packages_RPM $MP3LAME_DEV
1753
VPX_DEV="libvpx-devel"
1754
check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN
1755
if [ $? -eq 0 ]; then
1756
install_packages_RPM $VPX_DEV
1761
SCHRO_DEV="schroedinger-devel"
1762
check_package_RPM $SCHRO_DEV
1763
if [ $? -eq 0 ]; then
1764
install_packages_RPM $SCHRO_DEV
1770
if $PYTHON_SKIP; then
1771
INFO "WARNING! Skipping Python installation, as requested..."
1773
check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
1774
if [ $? -eq 0 ]; then
1775
install_packages_RPM python3-devel
1777
if $NUMPY_SKIP; then
1778
INFO "WARNING! Skipping NumPy installation, as requested..."
1780
check_package_version_match_RPM python3-numpy $NUMPY_VERSION_MIN
1781
if [ $? -eq 0 ]; then
1782
install_packages_RPM python3-numpy
1784
INFO "WARNING! Sorry, using python package but no numpy package available!"
1790
if $NUMPY_SKIP; then
1791
INFO "WARNING! Skipping NumPy installation, as requested..."
1799
if $BOOST_SKIP; then
1800
INFO "WARNING! Skipping Boost installation, as requested..."
1802
check_package_version_ge_RPM boost-devel $BOOST_VERSION
1803
if [ $? -eq 0 ]; then
1804
install_packages_RPM boost-devel
1812
INFO "WARNING! Skipping OpenColorIO installation, as requested..."
1814
check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
1815
if [ $? -eq 0 ]; then
1816
install_packages_RPM OpenColorIO-devel
1824
INFO "WARNING! Skipping OpenImageIO installation, as requested..."
1826
check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN
1827
if [ $? -eq 0 ]; then
1828
install_packages_RPM OpenImageIO-devel
1839
INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
1841
check_package_RPM llvm-$LLVM_VERSION-devel
1842
if [ $? -eq 0 ]; then
1843
install_packages_RPM llvm-$LLVM_VERSION-devel clang
1845
LLVM_VERSION_FOUND=$LLVM_VERSION
1848
# Better to compile it than use minimum version from repo...
1850
install_packages_RPM libffi-devel
1851
# LLVM can't find the fedora ffi header dir...
1852
_FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
1856
LLVM_VERSION_FOUND=$LLVM_VERSION
1862
INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
1865
# No package currently!
1867
install_packages_RPM flex bison git
1868
if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1869
install_packages_RPM tbb-devel
1877
if $WITH_OPENCOLLADA; then
1878
if $OPENCOLLADA_SKIP; then
1879
INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
1882
install_packages_RPM pcre-devel libxml2-devel git
1883
# Find path to libxml shared lib...
1884
_XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
1892
if $FFMPEG_SKIP; then
1893
INFO "WARNING! Skipping FFMpeg installation, as requested..."
1895
# Always for now, not sure which packages should be installed
1902
print_info_ffmpeglink_DEB() {
1903
if $ALL_STATIC; then
1904
dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
1906
dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
1910
print_info_ffmpeglink_RPM() {
1911
# # XXX No static libs...
1912
# if $ALL_STATIC; then
1913
# rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
1915
rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
1919
print_info_ffmpeglink() {
1920
# This func must only print a ';'-separated list of libs...
1921
if [ -z "$DISTRO" ]; then
1922
ERROR "Failed to detect distribution type"
1926
# Create list of packages from which to get libs names...
1929
if $THEORA_USE; then
1930
_packages="$_packages $THEORA_DEV"
1933
if $VORBIS_USE; then
1934
_packages="$_packages $VORBIS_DEV"
1938
_packages="$_packages $XVID_DEV"
1942
_packages="$_packages $VPX_DEV"
1945
if $MP3LAME_USE; then
1946
_packages="$_packages $MP3LAME_DEV"
1950
_packages="$_packages $X264_DEV"
1953
if $OPENJPEG_USE; then
1954
_packages="$_packages $OPENJPEG_DEV"
1958
_packages="$_packages $SCHRO_DEV"
1961
if [ "$DISTRO" = "DEB" ]; then
1962
print_info_ffmpeglink_DEB
1963
elif [ "$DISTRO" = "RPM" ]; then
1964
print_info_ffmpeglink_RPM
1965
# elif [ "$DISTRO" = "ARCH" ]; then
1966
# print_info_ffmpeglink_ARCH
1968
else INFO "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
1974
INFO "If you're using CMake add this to your configuration flags:"
1978
if $ALL_STATIC; then
1979
_1="-D WITH_STATIC_LIBS=ON"
1980
# XXX Force linking with shared SDL lib!
1981
_2="-D SDL_LIBRARY='libSDL.so;-lpthread'"
1984
_buildargs="$_buildargs $_1 $_2"
1987
if [ -d $INST/boost ]; then
1988
_1="-D BOOST_ROOT=$INST/boost"
1989
_2="-D Boost_NO_SYSTEM_PATHS=ON"
1992
_buildargs="$_buildargs $_1 $_2"
1993
elif $ALL_STATIC; then
1994
_1="-D Boost_USE_ICU=ON"
1996
_buildargs="$_buildargs $_1"
1999
if [ -d $INST/osl -a $WITH_OSL == true ]; then
2000
_1="-D CYCLES_OSL=$INST/osl"
2001
_2="-D WITH_CYCLES_OSL=ON"
2002
_3="-D LLVM_VERSION=$LLVM_VERSION_FOUND"
2006
_buildargs="$_buildargs $_1 $_2 $_3"
2007
if [ -d $INST/llvm ]; then
2008
_1="-D LLVM_DIRECTORY=$INST/llvm"
2009
_2="-D LLVM_STATIC=ON"
2012
_buildargs="$_buildargs $_1 $_2"
2016
if [ -d $INST/opencollada -a $WITH_OPENCOLLADA == true ]; then
2017
_1="-D WITH_OPENCOLLADA=ON"
2019
_buildargs="$_buildargs $_1"
2020
if $ALL_STATIC; then
2021
_1="-D XML2_LIBRARY=$_XML2_LIB"
2023
_buildargs="$_buildargs $_1"
2027
if [ -d $INST/ffmpeg ]; then
2028
_1="-D WITH_CODEC_FFMPEG=ON"
2029
_2="-D FFMPEG=$INST/ffmpeg"
2030
_3="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;rt;`print_info_ffmpeglink`'"
2034
_buildargs="$_buildargs $_1 $_2 $_3"
2038
INFO "Or even simpler, just run (in your blender-source dir):"
2039
INFO " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
2042
INFO "If you're using SCons add this to your user-config:"
2044
if [ -d $INST/python-$PYTHON_VERSION_MIN ]; then
2045
INFO "BF_PYTHON = '$INST/python-$PYTHON_VERSION_MIN'"
2046
INFO "BF_PYTHON_ABI_FLAGS = 'm'"
2049
if [ -d $INST/ocio ]; then
2050
INFO "BF_OCIO = '$INST/ocio'"
2053
if [ -d $INST/oiio ]; then
2054
INFO "BF_OIIO = '$INST/oiio'"
2057
if [ -d $INST/boost ]; then
2058
INFO "BF_BOOST = '$INST/boost'"
2059
INFO "WITH_BF_BOOST = True"
2062
if [ -d $INST/ffmpeg ]; then
2063
INFO "BF_FFMPEG = '$INST/ffmpeg'"
2064
_ffmpeg_list_sep=" "
2065
INFO "BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice `print_info_ffmpeglink`'"
2070
INFO "WARNING: If this script had to build boost into $INST, and you are dynamically linking "
2071
INFO " blender against it, you will have to run those commands as root user:"
2073
INFO " echo \"$INST/boost/lib\" > /etc/ld.so.conf.d/boost.conf"
2078
# Detect distributive type used on this machine
2081
if [ -z "$DISTRO" ]; then
2082
ERROR "Failed to detect distribution type"
2084
elif [ "$DISTRO" = "DEB" ]; then
2086
elif [ "$DISTRO" = "RPM" ]; then
2088
#elif [ "$DISTRO" = "ARCH" ]; then
2092
print_info | tee BUILD_NOTES.txt
2094
INFO "This information has been written to BUILD_NOTES.txt"
2097
# Switch back to user language.