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/imageworks/OpenShadingLanguage/archive/Release-1.3.0.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" \
788 # Always refresh the whole build!
789 if [ -d build ]; then
795 cmake_d="-D CMAKE_BUILD_TYPE=Release"
796 cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
797 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
798 cmake_d="$cmake_d -D BUILDSTATIC=ON"
800 # linking statically could give issues on Debian/Ubuntu (and probably other distros
801 # which doesn't like static linking) when linking shared oiio library due to missing
802 # text symbols (static libs should be compiled with -fPIC)
803 # cmake_d="$cmake_d -D LINKSTATIC=ON"
805 if [ -d $INST/boost ]; then
806 cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
808 cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
812 # Looks like we do not need ocio in oiio for now...
813 # if [ -d $INST/ocio ]; then
814 # cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio"
817 if file /bin/cp | grep -q '32-bit'; then
818 cflags="-fPIC -m32 -march=i686"
823 cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ../src
825 make -j$THREADS && make install
828 if [ -d $_inst ]; then
830 ln -s oiio-$OIIO_VERSION $INST/oiio
832 ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
836 magic_compile_set oiio-$OIIO_VERSION $oiio_magic
838 # Rebuild dependecies as well!
839 OSL_FORCE_REBUILD=true
842 INFO "Done compiling OpenImageIO-$OIIO_VERSION!"
844 INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!"
845 INFO "If you want to force rebuild of this lib, use the --force-oiio option."
850 # To be changed each time we make edits that would modify the compiled result!
853 _src=$SRC/LLVM-$LLVM_VERSION
854 _inst=$INST/llvm-$LLVM_VERSION
855 _src_clang=$SRC/CLANG-$LLVM_VERSION
857 # Clean install if needed!
858 magic_compile_check llvm-$LLVM_VERSION $llvm_magic
859 if [ $? -eq 1 -o $LLVM_FORCE_REBUILD == true ]; then
864 if [ ! -d $_inst ]; then
865 INFO "Building LLVM-$LLVM_VERSION (CLANG included!)"
869 if [ ! -d $_src -o true ]; then
871 wget -c $LLVM_SOURCE -O "$_src.tar.gz"
872 wget -c $LLVM_CLANG_SOURCE -O "$_src_clang.tar.gz"
874 INFO "Unpacking LLVM-$LLVM_VERSION"
875 tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
877 INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang"
879 --transform "s,([^/]*/?)clang-[^/]*(.*),\1clang\2,x" \
880 -xf $_src_clang.tar.gz
884 # XXX Ugly patching hack!
885 cat << EOF | patch -p1
889 set(LLVM_VERSION_MAJOR 3)
890 set(LLVM_VERSION_MINOR 1)
892 -set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
893 +set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
895 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
905 # Always refresh the whole build!
906 if [ -d build ]; then
912 cmake_d="-D CMAKE_BUILD_TYPE=Release"
913 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
914 cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
915 cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
917 if [ -d $_FFI_INCLUDE_DIR ]; then
918 cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
923 make -j$THREADS && make install
926 if [ -d $_inst ]; then
928 ln -s llvm-$LLVM_VERSION $INST/llvm
930 ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
934 magic_compile_set llvm-$LLVM_VERSION $llvm_magic
936 # Rebuild dependecies as well!
937 OSL_FORCE_REBUILD=true
940 INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!"
942 INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
943 INFO "If you want to force rebuild of this lib, use the --force-llvm option."
948 # To be changed each time we make edits that would modify the compiled result!
951 _src=$SRC/OpenShadingLanguage-$OSL_VERSION
952 _inst=$INST/osl-$OSL_VERSION
954 # Clean install if needed!
955 magic_compile_check osl-$OSL_VERSION $osl_magic
956 if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
960 if [ ! -d $_inst ]; then
961 INFO "Building OpenShadingLanguage-$OSL_VERSION"
965 if [ ! -d $_src ]; then
968 # XXX Using git on my own repo for now, looks like archives are not updated immediately... :/
969 # wget -c $OSL_SOURCE -O "$_src.tar.gz"
971 # INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
972 # tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
974 git clone https://github.com/mont29/OpenShadingLanguage.git $_src
976 git checkout blender-fixes
981 # XXX For now, always update from latest repo...
984 # Always refresh the whole build!
985 if [ -d build ]; then
991 cmake_d="-D CMAKE_BUILD_TYPE=Release"
992 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
993 cmake_d="$cmake_d -D BUILDSTATIC=ON"
994 cmake_d="$cmake_d -D BUILD_TESTING=OFF"
995 cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
997 if [ -d $INST/boost ]; then
998 cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
1000 cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
1004 if [ -d $INST/oiio ]; then
1005 cmake_d="$cmake_d -D OPENIMAGEIOHOME=$INST/oiio"
1008 if [ ! -z $LLVM_VERSION_FOUND ]; then
1009 cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
1010 if [ -d $INST/llvm ]; then
1011 cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
1012 cmake_d="$cmake_d -D LLVM_STATIC=ON"
1016 cmake $cmake_d ../src
1018 make -j$THREADS && make install
1021 if [ -d $_inst ]; then
1023 ln -s osl-$OSL_VERSION $INST/osl
1025 ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
1029 magic_compile_set osl-$OSL_VERSION $osl_magic
1032 INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!"
1034 INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!"
1035 INFO "If you want to force rebuild of this lib, use the --force-osl option."
1039 compile_OpenCOLLADA() {
1040 # To be changed each time we make edits that would modify the compiled results!
1043 _src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
1044 _inst=$INST/opencollada-$OPENCOLLADA_VERSION
1046 # Clean install if needed!
1047 magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic
1048 if [ $? -eq 1 -o $OPENCOLLADA_FORCE_REBUILD == true ]; then
1052 if [ ! -d $_inst ]; then
1053 INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION"
1057 if [ ! -d $_src ]; then
1059 git clone $OPENCOLLADA_SOURCE $_src
1064 # XXX For now, always update from latest repo...
1067 # Always refresh the whole build!
1068 if [ -d build ]; then
1074 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1075 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1076 cmake_d="$cmake_d -D USE_EXPAT=OFF"
1077 cmake_d="$cmake_d -D USE_LIBXML=ON"
1078 cmake_d="$cmake_d -D USE_STATIC=ON"
1082 make -j$THREADS && make install
1085 if [ -d $_inst ]; then
1086 rm -f $INST/opencollada
1087 ln -s opencollada-$OPENCOLLADA_VERSION $INST/opencollada
1089 ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
1093 magic_compile_set opencollada-$OPENCOLLADA_VERSION $opencollada_magic
1096 INFO "Done compiling OpenCOLLADA-$OPENCOLLADA_VERSION!"
1098 INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
1099 INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
1104 # To be changed each time we make edits that would modify the compiled result!
1107 _src=$SRC/ffmpeg-$FFMPEG_VERSION
1108 _inst=$INST/ffmpeg-$FFMPEG_VERSION
1110 # Clean install if needed!
1111 magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
1112 if [ $? -eq 1 -o $FFMPEG_FORCE_REBUILD == true ]; then
1116 if [ ! -d $_inst ]; then
1117 INFO "Building ffmpeg-$FFMPEG_VERSION"
1121 if [ ! -d $_src ]; then
1122 INFO "Downloading ffmpeg-$FFMPEG_VERSION"
1124 wget -c $FFMPEG_SOURCE -O "$_src.tar.bz2"
1126 INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
1127 tar -C $SRC -xf $_src.tar.bz2
1134 if $VORBIS_USE; then
1135 extra="$extra --enable-libvorbis"
1138 if $THEORA_USE; then
1139 extra="$extra --enable-libtheora"
1142 # XXX At least under Debian, static schro gives problem at blender linking time... :/
1143 if $SCHRO_USE && ! $ALL_STATIC; then
1144 extra="$extra --enable-libschroedinger"
1148 extra="$extra --enable-libxvid"
1152 extra="$extra --enable-libx264"
1156 extra="$extra --enable-libvpx"
1159 if $MP3LAME_USE; then
1160 extra="$extra --enable-libmp3lame"
1163 if $OPENJPEG_USE; then
1164 extra="$extra --enable-libopenjpeg"
1167 ./configure --cc="gcc -Wl,--as-needed" \
1168 --extra-ldflags="-pthread -static-libgcc" \
1169 --prefix=$_inst --enable-static \
1170 --disable-ffplay --disable-ffserver --disable-doc \
1172 --enable-avfilter --disable-vdpau \
1173 --disable-bzlib --disable-libgsm --disable-libspeex \
1174 --enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
1175 --disable-vaapi --disable-libfaac --disable-nonfree --enable-gpl \
1176 --disable-postproc --disable-x11grab --disable-librtmp --disable-libopencore-amrnb \
1177 --disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
1178 --disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
1179 --disable-indev=lavfi $extra
1181 make -j$THREADS && make install
1184 if [ -d $_inst ]; then
1186 ln -s ffmpeg-$FFMPEG_VERSION $INST/ffmpeg
1188 ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
1192 magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
1195 INFO "Done compiling ffmpeg-$FFMPEG_VERSION!"
1197 INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
1198 INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
1204 get_package_version_DEB() {
1205 dpkg-query -W -f '${Version}' $1 | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'
1208 check_package_DEB() {
1209 r=`apt-cache policy $1 | grep -c 'Candidate:'`
1211 if [ $r -ge 1 ]; then
1218 check_package_version_match_DEB() {
1219 v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'`
1221 if [ -z "$v" ]; then
1229 check_package_version_ge_DEB() {
1230 v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
1232 if [ -z "$v" ]; then
1240 install_packages_DEB() {
1241 sudo apt-get install -y --force-yes $@
1242 if [ $? -ge 1 ]; then
1243 ERROR "apt-get failed to install requested packages, exiting."
1250 INFO "Installing dependencies for DEB-based distribution"
1252 INFO "`eval _echo "$COMMON_INFO"`"
1255 read -p "Do you want to continue (Y/n)?"
1256 [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
1258 if [ ! -z "`cat /etc/debian_version | grep ^6`" ]; then
1259 if [ -z "`cat /etc/apt/sources.list | grep backports.debian.org`" ]; then
1260 INFO "Looks like you're using Debian Squeeze which does have broken CMake"
1261 INFO "It is highly recommended to install cmake from backports, otherwise"
1262 INFO "compilation of some libraries could fail"
1264 INFO "You could install newer CMake from debian-backports repository"
1265 INFO "Add this this line to your /etc/apt/sources.lixt:"
1267 INFO "deb http://backports.debian.org/debian-backports squeeze-backports main"
1269 INFO "and then run:"
1271 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"
1273 INFO "(you could also add this reporisotry using GUI like synaptic)"
1275 INFO "Hit Enter to continue running the script, or hit Ctrl-C to abort the script"
1284 # These libs should always be available in debian/ubuntu official repository...
1285 OPENJPEG_DEV="libopenjpeg-dev"
1286 VORBIS_DEV="libvorbis-dev"
1287 THEORA_DEV="libtheora-dev"
1289 _packages="gawk cmake cmake-curses-gui scons build-essential libjpeg-dev libpng-dev \
1290 libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
1291 libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
1292 libopenexr-dev libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV \
1293 libsdl1.2-dev libfftw3-dev patch bzip2"
1299 # Install newest libtiff-dev in debian/ubuntu.
1301 check_package_DEB $TIFF
1302 if [ $? -eq 0 ]; then
1303 _packages="$_packages $TIFF-dev"
1306 check_package_DEB $TIFF
1307 if [ $? -eq 0 ]; then
1308 _packages="$_packages $TIFF-dev"
1313 _packages="$_packages libspnav-dev libjack-dev"
1317 install_packages_DEB $_packages
1320 X264_DEV="libx264-dev"
1321 check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN
1322 if [ $? -eq 0 ]; then
1323 install_packages_DEB $X264_DEV
1329 # Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev!
1330 # Note: not since ubuntu 10.04
1331 XVID_DEV="libxvidcore-dev"
1332 check_package_DEB $XVID_DEV
1333 if [ $? -eq 0 ]; then
1334 install_packages_DEB $XVID_DEV
1337 XVID_DEV="libxvidcore4-dev"
1338 check_package_DEB $XVID_DEV
1339 if [ $? -eq 0 ]; then
1340 install_packages_DEB $XVID_DEV
1346 MP3LAME_DEV="libmp3lame-dev"
1347 check_package_DEB $MP3LAME_DEV
1348 if [ $? -eq 0 ]; then
1349 install_packages_DEB $MP3LAME_DEV
1354 VPX_DEV="libvpx-dev"
1355 check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN
1356 if [ $? -eq 0 ]; then
1357 install_packages_DEB $VPX_DEV
1362 SCHRO_DEV="libschroedinger-dev"
1363 check_package_DEB $SCHRO_DEV
1364 if [ $? -eq 0 ]; then
1365 install_packages_DEB $SCHRO_DEV
1371 if $PYTHON_SKIP; then
1372 INFO "WARNING! Skipping Python installation, as requested..."
1374 check_package_DEB python$PYTHON_VERSION_MIN-dev
1375 if [ $? -eq 0 ]; then
1376 install_packages_DEB python$PYTHON_VERSION_MIN-dev
1378 if $NUMPY_SKIP; then
1379 INFO "WARNING! Skipping NumPy installation, as requested..."
1381 check_package_DEB python$PYTHON_VERSION_MIN-numpy
1382 if [ $? -eq 0 ]; then
1383 install_packages_DEB python$PYTHON_VERSION_MIN-numpy
1385 INFO "WARNING! Sorry, using python package but no numpy package available!"
1391 if $NUMPY_SKIP; then
1392 INFO "WARNING! Skipping NumPy installation, as requested..."
1400 if $BOOST_SKIP; then
1401 INFO "WARNING! Skipping Boost installation, as requested..."
1403 check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN
1404 if [ $? -eq 0 ]; then
1405 install_packages_DEB libboost-dev
1407 boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
1409 check_package_DEB libboost-locale$boost_version-dev
1410 if [ $? -eq 0 ]; then
1411 install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
1412 libboost-regex$boost_version-dev libboost-system$boost_version-dev \
1413 libboost-thread$boost_version-dev
1424 INFO "WARNING! Skipping OpenColorIO installation, as requested..."
1426 check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
1427 if [ $? -eq 0 ]; then
1428 install_packages_DEB libopencolorio-dev
1436 INFO "WARNING! Skipping OpenImageIO installation, as requested..."
1438 check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN
1439 if [ $? -eq 0 ]; then
1440 install_packages_DEB libopenimageio-dev
1450 INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
1453 check_package_DEB llvm-$LLVM_VERSION-dev
1454 if [ $? -eq 0 ]; then
1455 install_packages_DEB llvm-$LLVM_VERSION-dev clang
1457 LLVM_VERSION_FOUND=$LLVM_VERSION
1459 check_package_DEB llvm-$LLVM_VERSION_MIN-dev
1460 if [ $? -eq 0 ]; then
1461 install_packages_DEB llvm-$LLVM_VERSION_MIN-dev clang
1463 LLVM_VERSION_FOUND=$LLVM_VERSION_MIN
1465 install_packages_DEB libffi-dev
1466 # LLVM can't find the debian ffi header dir
1467 _FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
1471 LLVM_VERSION_FOUND=$LLVM_VERSION
1477 INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
1481 install_packages_DEB flex bison libtbb-dev git
1482 # No package currently!
1489 if $WITH_OPENCOLLADA; then
1490 if $OPENCOLLADA_SKIP; then
1491 INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
1494 install_packages_DEB git libpcre3-dev libxml2-dev
1495 # Find path to libxml shared lib...
1496 _XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"`
1504 if $FFMPEG_SKIP; then
1505 INFO "WARNING! Skipping FFMpeg installation, as requested..."
1507 # XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/
1508 # So for now, always build our own ffmpeg.
1509 # check_package_DEB ffmpeg
1510 # if [ $? -eq 0 ]; then
1511 # install_packages_DEB ffmpeg
1512 # ffmpeg_version=`get_package_version_DEB ffmpeg`
1513 # INFO "ffmpeg version: $ffmpeg_version"
1514 # if [ ! -z "$ffmpeg_version" ]; then
1515 # if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then
1516 # install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
1528 get_package_version_RPM() {
1530 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1531 yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
1532 elif [ $RPM = "SUSE" ]; then
1533 zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
1537 check_package_RPM() {
1539 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1540 r=`yum info $1 | grep -c 'Summary'`
1541 elif [ $RPM = "SUSE" ]; then
1542 r=`zypper info $1 | grep -c 'Summary'`
1545 if [ $r -ge 1 ]; then
1552 check_package_version_match_RPM() {
1553 v=`get_package_version_RPM $1`
1555 if [ -z "$v" ]; then
1563 check_package_version_ge_RPM() {
1564 v=`get_package_version_RPM $1`
1566 if [ -z "$v" ]; then
1574 install_packages_RPM() {
1576 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1577 sudo yum install -y $@
1578 if [ $? -ge 1 ]; then
1579 ERROR "yum failed to install requested packages, exiting."
1583 elif [ $RPM = "SUSE" ]; then
1584 sudo zypper --non-interactive install --auto-agree-with-licenses $@
1585 if [ $? -ge 1 ]; then
1586 ERROR "zypper failed to install requested packages, exiting."
1594 INFO "Installing dependencies for RPM-based distribution"
1596 INFO "`eval _echo "$COMMON_INFO"`"
1599 read -p "Do you want to continue (Y/n)?"
1600 [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
1602 # Enable non-free repositories for all flavours
1604 if [ $RPM = "FEDORA" ]; then
1605 sudo yum -y localinstall --nogpgcheck \
1606 http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm \
1607 http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
1611 # Install cmake now because of difference with RHEL
1612 sudo yum -y install cmake
1614 elif [ $RPM = "RHEL" ]; then
1615 sudo yum -y localinstall --nogpgcheck \
1616 http://download.fedoraproject.org/pub/epel/6/$(uname -i)/epel-release-6-8.noarch.rpm \
1617 http://download1.rpmfusion.org/free/el/updates/6/$(uname -i)/rpmfusion-free-release-6-1.noarch.rpm \
1618 http://download1.rpmfusion.org/nonfree/el/updates/6/$(uname -i)/rpmfusion-nonfree-release-6-1.noarch.rpm
1622 # Install cmake 2.8 from other repo
1624 if [ -f $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm ]; then
1626 INFO "Special cmake already installed"
1628 curl -O ftp://ftp.pbone.net/mirror/atrpms.net/el6-$(uname -i)/atrpms/testing/cmake-2.8.8-4.el6.$(uname -m).rpm
1629 mv cmake-2.8.8-4.el6.$(uname -m).rpm $SRC/
1630 sudo rpm -ihv $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm
1633 elif [ $RPM = "SUSE" ]; then
1634 _suse_rel="`grep VERSION /etc/SuSE-release | gawk '{print $3}'`"
1635 sudo zypper ar -f http://packman.inode.at/suse/openSUSE_$_suse_rel/ packman
1637 sudo zypper --non-interactive --gpg-auto-import-keys update --auto-agree-with-licenses
1640 # These libs should always be available in fedora/suse official repository...
1641 OPENJPEG_DEV="openjpeg-devel"
1642 VORBIS_DEV="libvorbis-devel"
1643 THEORA_DEV="libtheora-devel"
1645 _packages="gcc gcc-c++ make scons libpng-devel libtiff-devel \
1646 freetype-devel libX11-devel libXi-devel wget ncurses-devel \
1647 readline-devel $OPENJPEG_DEV openal-soft-devel \
1648 glew-devel yasm $THEORA_DEV $VORBIS_DEV SDL-devel fftw-devel \
1649 libjpeg-devel patch"
1655 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1657 _packages="$_packages libsqlite3-devel openexr-devel"
1660 _packages="$_packages jack-audio-connection-kit-devel libspnav-devel"
1664 install_packages_RPM $_packages
1667 X264_DEV="x264-devel"
1668 check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
1669 if [ $? -eq 0 ]; then
1670 install_packages_RPM $X264_DEV
1676 XVID_DEV="xvidcore-devel"
1677 check_package_RPM $XVID_DEV
1678 if [ $? -eq 0 ]; then
1679 install_packages_RPM $XVID_DEV
1684 MP3LAME_DEV="lame-devel"
1685 check_package_RPM $MP3LAME_DEV
1686 if [ $? -eq 0 ]; then
1687 install_packages_RPM $MP3LAME_DEV
1692 elif [ $RPM = "SUSE" ]; then
1694 _packages="$_packages cmake sqlite3-devel libopenexr-devel"
1697 _packages="$_packages libjack-devel libspnav-devel"
1701 install_packages_RPM $_packages
1704 X264_DEV="libx264-devel"
1705 check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
1706 if [ $? -eq 0 ]; then
1707 install_packages_RPM $X264_DEV
1713 XVID_DEV="libxvidcore-devel"
1714 check_package_RPM $XVID_DEV
1715 if [ $? -eq 0 ]; then
1716 install_packages_RPM $XVID_DEV
1721 MP3LAME_DEV="libmp3lame-devel"
1722 check_package_RPM $MP3LAME_DEV
1723 if [ $? -eq 0 ]; then
1724 install_packages_RPM $MP3LAME_DEV
1732 VPX_DEV="libvpx-devel"
1733 check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN
1734 if [ $? -eq 0 ]; then
1735 install_packages_RPM $VPX_DEV
1740 SCHRO_DEV="schroedinger-devel"
1741 check_package_RPM $SCHRO_DEV
1742 if [ $? -eq 0 ]; then
1743 install_packages_RPM $SCHRO_DEV
1749 if $PYTHON_SKIP; then
1750 INFO "WARNING! Skipping Python installation, as requested..."
1752 check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
1753 if [ $? -eq 0 ]; then
1754 install_packages_RPM python3-devel
1756 if $NUMPY_SKIP; then
1757 INFO "WARNING! Skipping NumPy installation, as requested..."
1759 check_package_version_match_RPM python3-numpy $NUMPY_VERSION_MIN
1760 if [ $? -eq 0 ]; then
1761 install_packages_RPM python3-numpy
1763 INFO "WARNING! Sorry, using python package but no numpy package available!"
1769 if $NUMPY_SKIP; then
1770 INFO "WARNING! Skipping NumPy installation, as requested..."
1778 if $BOOST_SKIP; then
1779 INFO "WARNING! Skipping Boost installation, as requested..."
1781 check_package_version_ge_RPM boost-devel $BOOST_VERSION
1782 if [ $? -eq 0 ]; then
1783 install_packages_RPM boost-devel
1791 INFO "WARNING! Skipping OpenColorIO installation, as requested..."
1793 check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
1794 if [ $? -eq 0 ]; then
1795 install_packages_RPM OpenColorIO-devel
1803 INFO "WARNING! Skipping OpenImageIO installation, as requested..."
1805 check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN
1806 if [ $? -eq 0 ]; then
1807 install_packages_RPM OpenImageIO-devel
1818 INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
1820 check_package_RPM llvm-$LLVM_VERSION-devel
1821 if [ $? -eq 0 ]; then
1822 install_packages_RPM llvm-$LLVM_VERSION-devel clang
1824 LLVM_VERSION_FOUND=$LLVM_VERSION
1827 # Better to compile it than use minimum version from repo...
1829 install_packages_RPM libffi-devel
1830 # LLVM can't find the fedora ffi header dir...
1831 _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
1835 LLVM_VERSION_FOUND=$LLVM_VERSION
1841 INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
1844 # No package currently!
1846 install_packages_RPM flex bison git
1847 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1848 install_packages_RPM tbb-devel
1856 if $WITH_OPENCOLLADA; then
1857 if $OPENCOLLADA_SKIP; then
1858 INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
1861 install_packages_RPM pcre-devel libxml2-devel git
1862 # Find path to libxml shared lib...
1863 _XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
1871 if $FFMPEG_SKIP; then
1872 INFO "WARNING! Skipping FFMpeg installation, as requested..."
1874 # Always for now, not sure which packages should be installed
1881 print_info_ffmpeglink_DEB() {
1882 if $ALL_STATIC; then
1883 dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
1885 dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
1889 print_info_ffmpeglink_RPM() {
1890 # # XXX No static libs...
1891 # if $ALL_STATIC; then
1892 # rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
1894 rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
1898 print_info_ffmpeglink() {
1899 # This func must only print a ';'-separated list of libs...
1900 if [ -z "$DISTRO" ]; then
1901 ERROR "Failed to detect distribution type"
1905 # Create list of packages from which to get libs names...
1908 if $THEORA_USE; then
1909 _packages="$_packages $THEORA_DEV"
1912 if $VORBIS_USE; then
1913 _packages="$_packages $VORBIS_DEV"
1917 _packages="$_packages $XVID_DEV"
1921 _packages="$_packages $VPX_DEV"
1924 if $MP3LAME_USE; then
1925 _packages="$_packages $MP3LAME_DEV"
1929 _packages="$_packages $X264_DEV"
1932 if $OPENJPEG_USE; then
1933 _packages="$_packages $OPENJPEG_DEV"
1937 _packages="$_packages $SCHRO_DEV"
1940 if [ "$DISTRO" = "DEB" ]; then
1941 print_info_ffmpeglink_DEB
1942 elif [ "$DISTRO" = "RPM" ]; then
1943 print_info_ffmpeglink_RPM
1944 # elif [ "$DISTRO" = "ARCH" ]; then
1945 # print_info_ffmpeglink_ARCH
1947 else INFO "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
1953 INFO "If you're using CMake add this to your configuration flags:"
1957 if $ALL_STATIC; then
1958 _1="-D WITH_STATIC_LIBS=ON"
1959 # XXX Force linking with shared SDL lib!
1960 _2="-D SDL_LIBRARY='libSDL.so;-lpthread'"
1963 _buildargs="$_buildargs $_1 $_2"
1966 if [ -d $INST/boost ]; then
1967 _1="-D BOOST_ROOT=$INST/boost"
1968 _2="-D Boost_NO_SYSTEM_PATHS=ON"
1971 _buildargs="$_buildargs $_1 $_2"
1972 elif $ALL_STATIC; then
1973 _1="-D Boost_USE_ICU=ON"
1975 _buildargs="$_buildargs $_1"
1978 if [ -d $INST/osl -a $WITH_OSL == true ]; then
1979 _1="-D CYCLES_OSL=$INST/osl"
1980 _2="-D WITH_CYCLES_OSL=ON"
1981 _3="-D LLVM_VERSION=$LLVM_VERSION_FOUND"
1985 _buildargs="$_buildargs $_1 $_2 $_3"
1986 if [ -d $INST/llvm ]; then
1987 _1="-D LLVM_DIRECTORY=$INST/llvm"
1988 _2="-D LLVM_STATIC=ON"
1991 _buildargs="$_buildargs $_1 $_2"
1995 if [ -d $INST/opencollada -a $WITH_OPENCOLLADA == true ]; then
1996 _1="-D WITH_OPENCOLLADA=ON"
1998 _buildargs="$_buildargs $_1"
1999 if $ALL_STATIC; then
2000 _1="-D XML2_LIBRARY=$_XML2_LIB"
2002 _buildargs="$_buildargs $_1"
2006 if [ -d $INST/ffmpeg ]; then
2007 _1="-D WITH_CODEC_FFMPEG=ON"
2008 _2="-D FFMPEG=$INST/ffmpeg"
2009 _3="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;rt;`print_info_ffmpeglink`'"
2013 _buildargs="$_buildargs $_1 $_2 $_3"
2017 INFO "Or even simpler, just run (in your blender-source dir):"
2018 INFO " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
2021 INFO "If you're using SCons add this to your user-config:"
2023 if [ -d $INST/python-$PYTHON_VERSION_MIN ]; then
2024 INFO "BF_PYTHON = '$INST/python-$PYTHON_VERSION_MIN'"
2025 INFO "BF_PYTHON_ABI_FLAGS = 'm'"
2028 if [ -d $INST/ocio ]; then
2029 INFO "BF_OCIO = '$INST/ocio'"
2032 if [ -d $INST/oiio ]; then
2033 INFO "BF_OIIO = '$INST/oiio'"
2036 if [ -d $INST/osl ]; then
2037 INFO "BF_OSL = '$INST/osl'"
2040 if [ -d $INST/boost ]; then
2041 INFO "BF_BOOST = '$INST/boost'"
2042 INFO "WITH_BF_BOOST = True"
2045 if [ -d $INST/ffmpeg ]; then
2046 INFO "BF_FFMPEG = '$INST/ffmpeg'"
2047 _ffmpeg_list_sep=" "
2048 INFO "BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice `print_info_ffmpeglink`'"
2053 INFO "WARNING: If this script had to build boost into $INST, and you are dynamically linking "
2054 INFO " blender against it, you will have to run those commands as root user:"
2056 INFO " echo \"$INST/boost/lib\" > /etc/ld.so.conf.d/boost.conf"
2061 # Detect distributive type used on this machine
2064 if [ -z "$DISTRO" ]; then
2065 ERROR "Failed to detect distribution type"
2067 elif [ "$DISTRO" = "DEB" ]; then
2069 elif [ "$DISTRO" = "RPM" ]; then
2071 #elif [ "$DISTRO" = "ARCH" ]; then
2075 print_info | tee BUILD_NOTES.txt
2077 INFO "This information has been written to BUILD_NOTES.txt"
2080 # Switch back to user language.