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 NUMPY_VERSION="1.7.0"
172 NUMPY_VERSION_MIN="1.7"
173 NUMPY_SOURCE="http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz"
174 NUMPY_FORCE_REBUILD=false
177 BOOST_VERSION="1.51.0"
178 _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
179 BOOST_SOURCE="http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download"
180 BOOST_VERSION_MIN="1.49"
181 BOOST_FORCE_REBUILD=false
185 OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
186 OCIO_VERSION_MIN="1.0"
187 OCIO_FORCE_REBUILD=false
191 OIIO_SOURCE="https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_VERSION"
192 OIIO_VERSION_MIN="1.1"
193 OIIO_FORCE_REBUILD=false
197 LLVM_VERSION_MIN="3.0"
198 LLVM_VERSION_FOUND=""
199 LLVM_SOURCE="http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz"
200 LLVM_CLANG_SOURCE="http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz"
201 LLVM_FORCE_REBUILD=false
204 # OSL needs to be compiled for now!
206 OSL_SOURCE="https://github.com/imageworks/OpenShadingLanguage/archive/Release-1.3.0.tar.gz"
207 OSL_FORCE_REBUILD=false
211 OPENCOLLADA_VERSION="1.3"
212 OPENCOLLADA_SOURCE="https://github.com/KhronosGroup/OpenCOLLADA.git"
213 OPENCOLLADA_FORCE_REBUILD=false
214 OPENCOLLADA_SKIP=false
217 FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
218 FFMPEG_VERSION_MIN="0.7.6"
219 FFMPEG_FORCE_REBUILD=false
223 # FFMPEG optional libs.
232 X264_VERSION_MIN=0.118
234 VPX_VERSION_MIN=0.9.7
241 # Switch to english language, else some things (like check_package_DEB()) won't work!
248 if [ "X$1" = "X-n" ]; then
249 shift; printf "%s" "$@"
263 # Finish parsing the commandline args.
268 SRC="$2"; shift; shift; continue
271 INST="$2"; shift; shift; continue
274 THREADS="$2"; shift; shift; continue
280 INFO "`eval _echo "$COMMON_INFO"`"
282 INFO "`eval _echo "$ARGUMENTS_INFO"`"
287 WITH_ALL=true; shift; continue
290 WITH_OSL=true; shift; continue
293 WITH_OPENCOLLADA=true; shift; continue
296 ALL_STATIC=true; shift; continue
299 PYTHON_FORCE_REBUILD=true
300 NUMPY_FORCE_REBUILD=true
301 BOOST_FORCE_REBUILD=true
302 OCIO_FORCE_REBUILD=true
303 OIIO_FORCE_REBUILD=true
304 LLVM_FORCE_REBUILD=true
305 OSL_FORCE_REBUILD=true
306 OPENCOLLADA_FORCE_REBUILD=true
307 FFMPEG_FORCE_REBUILD=true
311 PYTHON_FORCE_REBUILD=true; shift; continue
314 NUMPY_FORCE_REBUILD=true; shift; continue
317 BOOST_FORCE_REBUILD=true; shift; continue
320 OCIO_FORCE_REBUILD=true; shift; continue
323 OIIO_FORCE_REBUILD=true; shift; continue
326 LLVM_FORCE_REBUILD=true; shift; continue
329 OSL_FORCE_REBUILD=true; shift; continue
332 OPENCOLLADA_FORCE_REBUILD=true; shift; continue
335 FFMPEG_FORCE_REBUILD=true; shift; continue
338 PYTHON_SKIP=true; shift; continue
341 NUMPY_SKIP=true; shift; continue
344 BOOST_SKIP=true; shift; continue
347 OCIO_SKIP=true; shift; continue
350 OIIO_SKIP=true; shift; continue
353 LLVM_SKIP=true; shift; continue
356 OSL_SKIP=true; shift; continue
359 OPENCOLLADA_SKIP=true; shift; continue
362 FFMPEG_SKIP=true; shift; continue
365 # no more arguments to parse
370 INFO "Wrong parameter! Usage:"
372 INFO "`eval _echo "$COMMON_INFO"`"
381 WITH_OPENCOLLADA=true
384 # Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
385 # $1 and $2 should be version numbers made of numbers only.
390 # Split both version numbers into their numeric elements.
398 if [ $count2 -ge $count1 ]; then
407 for (( i=0; $i < $count2; i++ ))
409 if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
415 for (( i=$count2; $i < $count1; i++ ))
417 if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then
427 # Return 0 if $1 >= $2, else 1.
428 # $1 and $2 should be version numbers made of numbers only.
431 if [ $? -eq 1 -a $(_echo "$1" "$2" | sort --version-sort | head --lines=1) = "$1" ]; then
438 # 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.
439 # $1 and $2 should be version numbers made of numbers only.
440 # $1 should be at least as long as $2!
445 # Split both version numbers into their numeric elements.
453 if [ $count1 -ge $count2 ]; then
455 for (( i=0; $i < $count2; i++ ))
457 if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
469 if [ -f /etc/debian_version ]; then
471 elif [ -f /etc/arch-release ]; then
473 elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
479 if [ -f /etc/redhat-release ]; then
480 if [ "`grep '6\.' /etc/redhat-release`" ]; then
485 elif [ -f /etc/SuSE-release ]; then
491 INFO "Ensuring $INST exists and is writable by us"
492 if [ ! -d $INST ]; then
496 if [ ! -w $INST ]; then
497 sudo chown $USER $INST
502 # Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name...
503 magic_compile_check() {
504 if [ -f $INST/.$1-magiccheck-$2 ]; then
511 magic_compile_set() {
512 rm -f $INST/.$1-magiccheck-*
513 touch $INST/.$1-magiccheck-$2
517 # To be changed each time we make edits that would modify the compiled result!
520 _src=$SRC/Python-$PYTHON_VERSION
521 _inst=$INST/python-$PYTHON_VERSION
523 # Clean install if needed!
524 magic_compile_check python-$PYTHON_VERSION $py_magic
525 if [ $? -eq 1 -o $PYTHON_FORCE_REBUILD == true ]; then
529 if [ ! -d $_inst ]; then
530 INFO "Building Python-$PYTHON_VERSION"
534 if [ ! -d $_src ]; then
536 wget -c $PYTHON_SOURCE -O $_src.tar.bz2
538 INFO "Unpacking Python-$PYTHON_VERSION"
539 tar -C $SRC -xf $_src.tar.bz2
544 ./configure --prefix=$_inst --enable-ipv6 \
545 --enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
546 --with-computed-gotos --with-pymalloc
548 make -j$THREADS && make install
551 if [ -d $_inst ]; then
552 rm -f $INST/python-3.3
553 ln -s python-$PYTHON_VERSION $INST/python-3.3
555 ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
559 magic_compile_set python-$PYTHON_VERSION $py_magic
562 INFO "Done compiling Python-$PYTHON_VERSION!"
564 INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
565 INFO "If you want to force rebuild of this lib, use the --force-python option."
570 # To be changed each time we make edits that would modify the compiled result!
573 _src=$SRC/numpy-$NUMPY_VERSION
574 _inst=$INST/numpy-$NUMPY_VERSION
575 _python=$INST/python-$PYTHON_VERSION
576 _site=lib/python3.3/site-packages
578 # Clean install if needed!
579 magic_compile_check numpy-$NUMPY_VERSION $py_magic
580 if [ $? -eq 1 -o $NUMPY_FORCE_REBUILD == true ]; then
584 if [ ! -d $_inst ]; then
585 INFO "Building Numpy-$NUMPY_VERSION"
589 if [ ! -d $_src ]; then
591 wget -c $NUMPY_SOURCE -O $_src.tar.gz
593 INFO "Unpacking Numpy-$NUMPY_VERSION"
594 tar -C $SRC -xf $_src.tar.gz
599 $_python/bin/python3 setup.py install --prefix=$_inst
601 if [ -d $_inst ]; then
602 rm -f $_python/$_site/numpy
603 ln -s $_inst/$_site/numpy $_python/$_site/numpy
605 ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting"
609 magic_compile_set numpy-$NUMPY_VERSION $py_magic
612 INFO "Done compiling Numpy-$NUMPY_VERSION!"
614 INFO "Own Numpy-$NUMPY_VERSION is up to date, nothing to do!"
615 INFO "If you want to force rebuild of this lib, use the --force-numpy option."
620 # To be changed each time we make edits that would modify the compiled result!
623 _src=$SRC/boost-$BOOST_VERSION
624 _inst=$INST/boost-$BOOST_VERSION
626 # Clean install if needed!
627 magic_compile_check boost-$BOOST_VERSION $boost_magic
628 if [ $? -eq 1 -o $BOOST_FORCE_REBUILD == true ]; then
632 if [ ! -d $_inst ]; then
633 INFO "Building Boost-$BOOST_VERSION"
637 if [ ! -d $_src ]; then
638 INFO "Downloading Boost-$BOOST_VERSION"
640 wget -c $BOOST_SOURCE -O $_src.tar.bz2
641 tar -C $SRC --transform "s,(.*/?)boost_1_[^/]+(.*),\1boost-$BOOST_VERSION\2,x" -xf $_src.tar.bz2
645 if [ ! -f $_src/b2 ]; then
648 ./b2 -j$THREADS -a --with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time \
649 --prefix=$_inst --disable-icu boost.locale.icu=off install
652 if [ -d $_inst ]; then
654 ln -s boost-$BOOST_VERSION $INST/boost
656 ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
660 magic_compile_set boost-$BOOST_VERSION $boost_magic
662 # Rebuild dependecies as well!
663 OIIO_FORCE_REBUILD=true
664 OSL_FORCE_REBUILD=true
667 INFO "Done compiling Boost-$BOOST_VERSION!"
669 INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!"
670 INFO "If you want to force rebuild of this lib, use the --force-boost option."
675 # To be changed each time we make edits that would modify the compiled result!
678 _src=$SRC/OpenColorIO-$OCIO_VERSION
679 _inst=$INST/ocio-$OCIO_VERSION
681 # Clean install if needed!
682 magic_compile_check ocio-$OCIO_VERSION $ocio_magic
683 if [ $? -eq 1 -o $OCIO_FORCE_REBUILD == true ]; then
687 if [ ! -d $_inst ]; then
688 INFO "Building OpenColorIO-$OCIO_VERSION"
692 if [ ! -d $_src ]; then
693 INFO "Downloading OpenColorIO-$OCIO_VERSION"
695 wget -c $OCIO_SOURCE -O $_src.tar.gz
697 INFO "Unpacking OpenColorIO-$OCIO_VERSION"
698 tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
703 # Always refresh the whole build!
704 if [ -d build ]; then
710 if file /bin/cp | grep -q '32-bit'; then
711 cflags="-fPIC -m32 -march=i686"
716 cmake -D CMAKE_BUILD_TYPE=Release \
717 -D CMAKE_PREFIX_PATH=$_inst \
718 -D CMAKE_INSTALL_PREFIX=$_inst \
719 -D CMAKE_CXX_FLAGS="$cflags" \
720 -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" \
721 -D OCIO_BUILD_APPS=OFF \
722 -D OCIO_BUILD_PYGLUE=OFF \
725 make -j$THREADS && make install
727 # Force linking against static libs
728 rm -f $_inst/lib/*.so*
730 # Additional depencencies
731 cp ext/dist/lib/libtinyxml.a $_inst/lib
732 cp ext/dist/lib/libyaml-cpp.a $_inst/lib
736 if [ -d $_inst ]; then
738 ln -s ocio-$OCIO_VERSION $INST/ocio
740 ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
744 magic_compile_set ocio-$OCIO_VERSION $ocio_magic
747 INFO "Done compiling OpenColorIO-$OCIO_VERSION!"
749 INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!"
750 INFO "If you want to force rebuild of this lib, use the --force-ocio option."
755 # To be changed each time we make edits that would modify the compiled result!
758 _src=$SRC/OpenImageIO-$OIIO_VERSION
759 _inst=$INST/oiio-$OIIO_VERSION
761 # Clean install if needed!
762 magic_compile_check oiio-$OIIO_VERSION $oiio_magic
763 if [ $? -eq 1 -o $OIIO_FORCE_REBUILD == true ]; then
767 if [ ! -d $_inst ]; then
768 INFO "Building OpenImageIO-$OIIO_VERSION"
772 if [ ! -d $_src ]; then
774 wget -c $OIIO_SOURCE -O "$_src.tar.gz"
776 INFO "Unpacking OpenImageIO-$OIIO_VERSION"
777 tar -C $SRC --transform "s,(.*/?)OpenImageIO-oiio[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \
785 # Always refresh the whole build!
786 if [ -d build ]; then
792 cmake_d="-D CMAKE_BUILD_TYPE=Release"
793 cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
794 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
795 cmake_d="$cmake_d -D BUILDSTATIC=ON"
797 # Optional tests and cmd tools
798 cmake_d="$cmake_d -D USE_QT=OFF"
799 cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
800 cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
802 # linking statically could give issues on Debian/Ubuntu (and probably other distros
803 # which doesn't like static linking) when linking shared oiio library due to missing
804 # text symbols (static libs should be compiled with -fPIC)
805 # cmake_d="$cmake_d -D LINKSTATIC=ON"
807 if [ -d $INST/boost ]; then
808 cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
810 cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
814 # Looks like we do not need ocio in oiio for now...
815 # if [ -d $INST/ocio ]; then
816 # cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio"
819 if file /bin/cp | grep -q '32-bit'; then
820 cflags="-fPIC -m32 -march=i686"
825 cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ../src
827 make -j$THREADS && make install
830 if [ -d $_inst ]; then
832 ln -s oiio-$OIIO_VERSION $INST/oiio
834 ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
838 magic_compile_set oiio-$OIIO_VERSION $oiio_magic
840 # Rebuild dependecies as well!
841 OSL_FORCE_REBUILD=true
844 INFO "Done compiling OpenImageIO-$OIIO_VERSION!"
846 INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!"
847 INFO "If you want to force rebuild of this lib, use the --force-oiio option."
852 # To be changed each time we make edits that would modify the compiled result!
855 _src=$SRC/LLVM-$LLVM_VERSION
856 _inst=$INST/llvm-$LLVM_VERSION
857 _src_clang=$SRC/CLANG-$LLVM_VERSION
859 # Clean install if needed!
860 magic_compile_check llvm-$LLVM_VERSION $llvm_magic
861 if [ $? -eq 1 -o $LLVM_FORCE_REBUILD == true ]; then
866 if [ ! -d $_inst ]; then
867 INFO "Building LLVM-$LLVM_VERSION (CLANG included!)"
871 if [ ! -d $_src -o true ]; then
873 wget -c $LLVM_SOURCE -O "$_src.tar.gz"
874 wget -c $LLVM_CLANG_SOURCE -O "$_src_clang.tar.gz"
876 INFO "Unpacking LLVM-$LLVM_VERSION"
877 tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
879 INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang"
881 --transform "s,([^/]*/?)clang-[^/]*(.*),\1clang\2,x" \
882 -xf $_src_clang.tar.gz
886 # XXX Ugly patching hack!
887 cat << EOF | patch -p1
891 set(LLVM_VERSION_MAJOR 3)
892 set(LLVM_VERSION_MINOR 1)
894 -set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
895 +set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
897 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
907 # Always refresh the whole build!
908 if [ -d build ]; then
914 cmake_d="-D CMAKE_BUILD_TYPE=Release"
915 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
916 cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
917 cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
919 if [ -d $_FFI_INCLUDE_DIR ]; then
920 cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
925 make -j$THREADS && make install
928 if [ -d $_inst ]; then
930 ln -s llvm-$LLVM_VERSION $INST/llvm
932 ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
936 magic_compile_set llvm-$LLVM_VERSION $llvm_magic
938 # Rebuild dependecies as well!
939 OSL_FORCE_REBUILD=true
942 INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!"
944 INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
945 INFO "If you want to force rebuild of this lib, use the --force-llvm option."
950 # To be changed each time we make edits that would modify the compiled result!
953 _src=$SRC/OpenShadingLanguage-$OSL_VERSION
954 _inst=$INST/osl-$OSL_VERSION
956 # Clean install if needed!
957 magic_compile_check osl-$OSL_VERSION $osl_magic
958 if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
962 if [ ! -d $_inst ]; then
963 INFO "Building OpenShadingLanguage-$OSL_VERSION"
967 if [ ! -d $_src ]; then
970 # XXX Using git on my own repo for now, looks like archives are not updated immediately... :/
971 # wget -c $OSL_SOURCE -O "$_src.tar.gz"
973 # INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
974 # tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
976 git clone https://github.com/mont29/OpenShadingLanguage.git $_src
978 git checkout blender-fixes
983 # XXX For now, always update from latest repo...
986 # Always refresh the whole build!
987 if [ -d build ]; then
993 cmake_d="-D CMAKE_BUILD_TYPE=Release"
994 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
995 cmake_d="$cmake_d -D BUILDSTATIC=ON"
996 cmake_d="$cmake_d -D BUILD_TESTING=OFF"
997 cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
999 if [ -d $INST/boost ]; then
1000 cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
1001 if $ALL_STATIC; then
1002 cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
1006 if [ -d $INST/oiio ]; then
1007 cmake_d="$cmake_d -D OPENIMAGEIOHOME=$INST/oiio"
1010 if [ ! -z $LLVM_VERSION_FOUND ]; then
1011 cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
1012 if [ -d $INST/llvm ]; then
1013 cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
1014 cmake_d="$cmake_d -D LLVM_STATIC=ON"
1018 cmake $cmake_d ../src
1020 make -j$THREADS && make install
1023 if [ -d $_inst ]; then
1025 ln -s osl-$OSL_VERSION $INST/osl
1027 ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
1031 magic_compile_set osl-$OSL_VERSION $osl_magic
1034 INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!"
1036 INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!"
1037 INFO "If you want to force rebuild of this lib, use the --force-osl option."
1041 compile_OpenCOLLADA() {
1042 # To be changed each time we make edits that would modify the compiled results!
1045 _src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
1046 _inst=$INST/opencollada-$OPENCOLLADA_VERSION
1048 # Clean install if needed!
1049 magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic
1050 if [ $? -eq 1 -o $OPENCOLLADA_FORCE_REBUILD == true ]; then
1054 if [ ! -d $_inst ]; then
1055 INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION"
1059 if [ ! -d $_src ]; then
1061 git clone $OPENCOLLADA_SOURCE $_src
1066 # XXX For now, always update from latest repo...
1067 git pull origin master
1069 # Stick to same rev as windows' libs...
1070 git checkout e886e196673222f2f4bc32b936dc96419fff815f
1073 # Always refresh the whole build!
1074 if [ -d build ]; then
1080 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1081 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1082 cmake_d="$cmake_d -D USE_EXPAT=OFF"
1083 cmake_d="$cmake_d -D USE_LIBXML=ON"
1084 cmake_d="$cmake_d -D USE_STATIC=ON"
1088 make -j$THREADS && make install
1091 if [ -d $_inst ]; then
1092 rm -f $INST/opencollada
1093 ln -s opencollada-$OPENCOLLADA_VERSION $INST/opencollada
1095 ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
1099 magic_compile_set opencollada-$OPENCOLLADA_VERSION $opencollada_magic
1102 INFO "Done compiling OpenCOLLADA-$OPENCOLLADA_VERSION!"
1104 INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
1105 INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
1110 # To be changed each time we make edits that would modify the compiled result!
1113 _src=$SRC/ffmpeg-$FFMPEG_VERSION
1114 _inst=$INST/ffmpeg-$FFMPEG_VERSION
1116 # Clean install if needed!
1117 magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
1118 if [ $? -eq 1 -o $FFMPEG_FORCE_REBUILD == true ]; then
1122 if [ ! -d $_inst ]; then
1123 INFO "Building ffmpeg-$FFMPEG_VERSION"
1127 if [ ! -d $_src ]; then
1128 INFO "Downloading ffmpeg-$FFMPEG_VERSION"
1130 wget -c $FFMPEG_SOURCE -O "$_src.tar.bz2"
1132 INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
1133 tar -C $SRC -xf $_src.tar.bz2
1140 if $VORBIS_USE; then
1141 extra="$extra --enable-libvorbis"
1144 if $THEORA_USE; then
1145 extra="$extra --enable-libtheora"
1149 extra="$extra --enable-libxvid"
1153 extra="$extra --enable-libx264"
1157 extra="$extra --enable-libvpx"
1160 if $MP3LAME_USE; then
1161 extra="$extra --enable-libmp3lame"
1164 if $OPENJPEG_USE; then
1165 extra="$extra --enable-libopenjpeg"
1168 ./configure --cc="gcc -Wl,--as-needed" \
1169 --extra-ldflags="-pthread -static-libgcc" \
1170 --prefix=$_inst --enable-static \
1171 --disable-ffplay --disable-ffserver --disable-doc \
1173 --enable-avfilter --disable-vdpau \
1174 --disable-bzlib --disable-libgsm --disable-libspeex \
1175 --enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
1176 --disable-vaapi --disable-libfaac --disable-nonfree --enable-gpl \
1177 --disable-postproc --disable-x11grab --disable-librtmp --disable-libopencore-amrnb \
1178 --disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
1179 --disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
1180 --disable-indev=lavfi $extra
1182 make -j$THREADS && make install
1185 if [ -d $_inst ]; then
1187 ln -s ffmpeg-$FFMPEG_VERSION $INST/ffmpeg
1189 ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
1193 magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
1196 INFO "Done compiling ffmpeg-$FFMPEG_VERSION!"
1198 INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
1199 INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
1205 get_package_version_DEB() {
1206 dpkg-query -W -f '${Version}' $1 | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'
1209 check_package_DEB() {
1210 r=`apt-cache policy $1 | grep -c 'Candidate:'`
1212 if [ $r -ge 1 ]; then
1219 check_package_version_match_DEB() {
1220 v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'`
1222 if [ -z "$v" ]; then
1230 check_package_version_ge_DEB() {
1231 v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
1233 if [ -z "$v" ]; then
1241 install_packages_DEB() {
1242 sudo apt-get install -y --force-yes $@
1243 if [ $? -ge 1 ]; then
1244 ERROR "apt-get failed to install requested packages, exiting."
1251 INFO "Installing dependencies for DEB-based distribution"
1253 INFO "`eval _echo "$COMMON_INFO"`"
1256 read -p "Do you want to continue (Y/n)?"
1257 [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
1259 if [ ! -z "`cat /etc/debian_version | grep ^6`" ]; then
1260 if [ -z "`cat /etc/apt/sources.list | grep backports.debian.org`" ]; then
1261 INFO "Looks like you're using Debian Squeeze which does have broken CMake"
1262 INFO "It is highly recommended to install cmake from backports, otherwise"
1263 INFO "compilation of some libraries could fail"
1265 INFO "You could install newer CMake from debian-backports repository"
1266 INFO "Add this this line to your /etc/apt/sources.lixt:"
1268 INFO "deb http://backports.debian.org/debian-backports squeeze-backports main"
1270 INFO "and then run:"
1272 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"
1274 INFO "(you could also add this reporisotry using GUI like synaptic)"
1276 INFO "Hit Enter to continue running the script, or hit Ctrl-C to abort the script"
1285 # These libs should always be available in debian/ubuntu official repository...
1286 OPENJPEG_DEV="libopenjpeg-dev"
1287 VORBIS_DEV="libvorbis-dev"
1288 THEORA_DEV="libtheora-dev"
1290 _packages="gawk cmake cmake-curses-gui scons build-essential libjpeg-dev libpng-dev \
1291 libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
1292 libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
1293 libopenexr-dev libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV \
1294 libsdl1.2-dev libfftw3-dev patch bzip2"
1300 # Install newest libtiff-dev in debian/ubuntu.
1302 check_package_DEB $TIFF
1303 if [ $? -eq 0 ]; then
1304 _packages="$_packages $TIFF-dev"
1307 check_package_DEB $TIFF
1308 if [ $? -eq 0 ]; then
1309 _packages="$_packages $TIFF-dev"
1314 _packages="$_packages libspnav-dev libjack-dev"
1318 install_packages_DEB $_packages
1321 X264_DEV="libx264-dev"
1322 check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN
1323 if [ $? -eq 0 ]; then
1324 install_packages_DEB $X264_DEV
1330 # Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev!
1331 # Note: not since ubuntu 10.04
1332 XVID_DEV="libxvidcore-dev"
1333 check_package_DEB $XVID_DEV
1334 if [ $? -eq 0 ]; then
1335 install_packages_DEB $XVID_DEV
1338 XVID_DEV="libxvidcore4-dev"
1339 check_package_DEB $XVID_DEV
1340 if [ $? -eq 0 ]; then
1341 install_packages_DEB $XVID_DEV
1347 MP3LAME_DEV="libmp3lame-dev"
1348 check_package_DEB $MP3LAME_DEV
1349 if [ $? -eq 0 ]; then
1350 install_packages_DEB $MP3LAME_DEV
1355 VPX_DEV="libvpx-dev"
1356 check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN
1357 if [ $? -eq 0 ]; then
1358 install_packages_DEB $VPX_DEV
1364 if $PYTHON_SKIP; then
1365 INFO "WARNING! Skipping Python installation, as requested..."
1367 check_package_DEB python$PYTHON_VERSION_MIN-dev
1368 if [ $? -eq 0 ]; then
1369 install_packages_DEB python$PYTHON_VERSION_MIN-dev
1371 if $NUMPY_SKIP; then
1372 INFO "WARNING! Skipping NumPy installation, as requested..."
1374 check_package_DEB python$PYTHON_VERSION_MIN-numpy
1375 if [ $? -eq 0 ]; then
1376 install_packages_DEB python$PYTHON_VERSION_MIN-numpy
1378 INFO "WARNING! Sorry, using python package but no numpy package available!"
1384 if $NUMPY_SKIP; then
1385 INFO "WARNING! Skipping NumPy installation, as requested..."
1393 if $BOOST_SKIP; then
1394 INFO "WARNING! Skipping Boost installation, as requested..."
1396 check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN
1397 if [ $? -eq 0 ]; then
1398 install_packages_DEB libboost-dev
1400 boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
1402 check_package_DEB libboost-locale$boost_version-dev
1403 if [ $? -eq 0 ]; then
1404 install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
1405 libboost-regex$boost_version-dev libboost-system$boost_version-dev \
1406 libboost-thread$boost_version-dev
1417 INFO "WARNING! Skipping OpenColorIO installation, as requested..."
1419 check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
1420 if [ $? -eq 0 ]; then
1421 install_packages_DEB libopencolorio-dev
1429 INFO "WARNING! Skipping OpenImageIO installation, as requested..."
1431 check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN
1432 if [ $? -eq 0 ]; then
1433 install_packages_DEB libopenimageio-dev
1443 INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
1446 check_package_DEB llvm-$LLVM_VERSION-dev
1447 if [ $? -eq 0 ]; then
1448 install_packages_DEB llvm-$LLVM_VERSION-dev clang
1450 LLVM_VERSION_FOUND=$LLVM_VERSION
1452 check_package_DEB llvm-$LLVM_VERSION_MIN-dev
1453 if [ $? -eq 0 ]; then
1454 install_packages_DEB llvm-$LLVM_VERSION_MIN-dev clang
1456 LLVM_VERSION_FOUND=$LLVM_VERSION_MIN
1458 install_packages_DEB libffi-dev
1459 # LLVM can't find the debian ffi header dir
1460 _FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
1464 LLVM_VERSION_FOUND=$LLVM_VERSION
1470 INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
1474 install_packages_DEB flex bison libtbb-dev git
1475 # No package currently!
1482 if $WITH_OPENCOLLADA; then
1483 if $OPENCOLLADA_SKIP; then
1484 INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
1487 install_packages_DEB git libpcre3-dev libxml2-dev
1488 # Find path to libxml shared lib...
1489 _XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"`
1497 if $FFMPEG_SKIP; then
1498 INFO "WARNING! Skipping FFMpeg installation, as requested..."
1500 # XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/
1501 # So for now, always build our own ffmpeg.
1502 # check_package_DEB ffmpeg
1503 # if [ $? -eq 0 ]; then
1504 # install_packages_DEB ffmpeg
1505 # ffmpeg_version=`get_package_version_DEB ffmpeg`
1506 # INFO "ffmpeg version: $ffmpeg_version"
1507 # if [ ! -z "$ffmpeg_version" ]; then
1508 # if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then
1509 # install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
1521 get_package_version_RPM() {
1523 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1524 yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
1525 elif [ $RPM = "SUSE" ]; then
1526 zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
1530 check_package_RPM() {
1532 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1533 r=`yum info $1 | grep -c 'Summary'`
1534 elif [ $RPM = "SUSE" ]; then
1535 r=`zypper info $1 | grep -c 'Summary'`
1538 if [ $r -ge 1 ]; then
1545 check_package_version_match_RPM() {
1546 v=`get_package_version_RPM $1`
1548 if [ -z "$v" ]; then
1556 check_package_version_ge_RPM() {
1557 v=`get_package_version_RPM $1`
1559 if [ -z "$v" ]; then
1567 install_packages_RPM() {
1569 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1570 sudo yum install -y $@
1571 if [ $? -ge 1 ]; then
1572 ERROR "yum failed to install requested packages, exiting."
1576 elif [ $RPM = "SUSE" ]; then
1577 sudo zypper --non-interactive install --auto-agree-with-licenses $@
1578 if [ $? -ge 1 ]; then
1579 ERROR "zypper failed to install requested packages, exiting."
1587 INFO "Installing dependencies for RPM-based distribution"
1589 INFO "`eval _echo "$COMMON_INFO"`"
1592 read -p "Do you want to continue (Y/n)?"
1593 [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
1595 # Enable non-free repositories for all flavours
1597 if [ $RPM = "FEDORA" ]; then
1598 _fedora_rel="`egrep "[0-9]{1,}" /etc/fedora-release -o`"
1599 sudo yum -y localinstall --nogpgcheck \
1600 http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$_fedora_rel.noarch.rpm \
1601 http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$_fedora_rel.noarch.rpm
1605 # Install cmake now because of difference with RHEL
1606 sudo yum -y install cmake
1608 elif [ $RPM = "RHEL" ]; then
1609 sudo yum -y localinstall --nogpgcheck \
1610 http://download.fedoraproject.org/pub/epel/6/$(uname -i)/epel-release-6-8.noarch.rpm \
1611 http://download1.rpmfusion.org/free/el/updates/6/$(uname -i)/rpmfusion-free-release-6-1.noarch.rpm \
1612 http://download1.rpmfusion.org/nonfree/el/updates/6/$(uname -i)/rpmfusion-nonfree-release-6-1.noarch.rpm
1616 # Install cmake 2.8 from other repo
1618 if [ -f $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm ]; then
1620 INFO "Special cmake already installed"
1622 curl -O ftp://ftp.pbone.net/mirror/atrpms.net/el6-$(uname -i)/atrpms/testing/cmake-2.8.8-4.el6.$(uname -m).rpm
1623 mv cmake-2.8.8-4.el6.$(uname -m).rpm $SRC/
1624 sudo rpm -ihv $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm
1627 elif [ $RPM = "SUSE" ]; then
1628 # Install this now to avoid using the version from packman repository...
1630 install_packages_RPM libjack-devel
1633 _suse_rel="`grep VERSION /etc/SuSE-release | gawk '{print $3}'`"
1634 sudo zypper ar -f http://packman.inode.at/suse/openSUSE_$_suse_rel/ packman
1636 sudo zypper --non-interactive --gpg-auto-import-keys update --auto-agree-with-licenses
1639 # These libs should always be available in fedora/suse official repository...
1640 OPENJPEG_DEV="openjpeg-devel"
1641 VORBIS_DEV="libvorbis-devel"
1642 THEORA_DEV="libtheora-devel"
1644 _packages="gcc gcc-c++ make scons libtiff-devel freetype-devel libjpeg-devel\
1645 libpng-devel libX11-devel libXi-devel wget ncurses-devel \
1646 readline-devel $OPENJPEG_DEV openal-soft-devel \
1647 glew-devel yasm $THEORA_DEV $VORBIS_DEV patch"
1653 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1655 _packages="$_packages libsqlite3x-devel openexr-devel fftw-devel SDL-devel"
1658 _packages="$_packages jack-audio-connection-kit-devel"
1662 install_packages_RPM $_packages
1665 X264_DEV="x264-devel"
1666 check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
1667 if [ $? -eq 0 ]; then
1668 install_packages_RPM $X264_DEV
1674 XVID_DEV="xvidcore-devel"
1675 check_package_RPM $XVID_DEV
1676 if [ $? -eq 0 ]; then
1677 install_packages_RPM $XVID_DEV
1682 MP3LAME_DEV="lame-devel"
1683 check_package_RPM $MP3LAME_DEV
1684 if [ $? -eq 0 ]; then
1685 install_packages_RPM $MP3LAME_DEV
1690 elif [ $RPM = "SUSE" ]; then
1692 _packages="$_packages cmake sqlite3-devel libopenexr-devel fftw3-devel libSDL-devel"
1695 install_packages_RPM $_packages
1698 X264_DEV="libx264-devel"
1699 check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
1700 if [ $? -eq 0 ]; then
1701 install_packages_RPM $X264_DEV
1707 XVID_DEV="libxvidcore-devel"
1708 check_package_RPM $XVID_DEV
1709 if [ $? -eq 0 ]; then
1710 install_packages_RPM $XVID_DEV
1715 MP3LAME_DEV="libmp3lame-devel"
1716 check_package_RPM $MP3LAME_DEV
1717 if [ $? -eq 0 ]; then
1718 install_packages_RPM $MP3LAME_DEV
1726 VPX_DEV="libvpx-devel"
1727 check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN
1728 if [ $? -eq 0 ]; then
1729 install_packages_RPM $VPX_DEV
1733 install_packages_RPM libspnav-devel
1737 if $PYTHON_SKIP; then
1738 INFO "WARNING! Skipping Python installation, as requested..."
1740 check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
1741 if [ $? -eq 0 ]; then
1742 install_packages_RPM python3-devel
1744 if $NUMPY_SKIP; then
1745 INFO "WARNING! Skipping NumPy installation, as requested..."
1747 check_package_version_match_RPM python3-numpy $NUMPY_VERSION_MIN
1748 if [ $? -eq 0 ]; then
1749 install_packages_RPM python3-numpy
1751 INFO "WARNING! Sorry, using python package but no numpy package available!"
1757 if $NUMPY_SKIP; then
1758 INFO "WARNING! Skipping NumPy installation, as requested..."
1766 if $BOOST_SKIP; then
1767 INFO "WARNING! Skipping Boost installation, as requested..."
1769 check_package_version_ge_RPM boost-devel $BOOST_VERSION
1770 if [ $? -eq 0 ]; then
1771 install_packages_RPM boost-devel
1779 INFO "WARNING! Skipping OpenColorIO installation, as requested..."
1781 check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
1782 if [ $? -eq 0 ]; then
1783 install_packages_RPM OpenColorIO-devel
1791 INFO "WARNING! Skipping OpenImageIO installation, as requested..."
1793 check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN
1794 if [ $? -eq 0 ]; then
1795 install_packages_RPM OpenImageIO-devel
1806 INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
1808 # Problem compiling with LLVM 3.2 so match version 3.1 ...
1809 check_package_version_match_RPM llvm $LLVM_VERSION
1810 if [ $? -eq 0 ]; then
1811 if [ $RPM = "SUSE" ]; then
1812 install_packages_RPM llvm-devel llvm-clang-devel
1814 install_packages_RPM llvm-devel clang-devel
1817 LLVM_VERSION_FOUND=$LLVM_VERSION
1820 # Better to compile it than use minimum version from repo...
1822 install_packages_RPM libffi-devel
1823 # LLVM can't find the fedora ffi header dir...
1824 _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
1828 LLVM_VERSION_FOUND=$LLVM_VERSION
1834 INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
1837 # No package currently!
1839 install_packages_RPM flex bison git
1840 if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
1841 install_packages_RPM tbb-devel
1849 if $WITH_OPENCOLLADA; then
1850 if $OPENCOLLADA_SKIP; then
1851 INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
1854 install_packages_RPM pcre-devel libxml2-devel git
1855 # Find path to libxml shared lib...
1856 _XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
1863 if $FFMPEG_SKIP; then
1864 INFO "WARNING! Skipping FFMpeg installation, as requested..."
1866 check_package_version_ge_RPM ffmpeg $FFMPEG_VERSION_MIN
1867 if [ $? -eq 0 ]; then
1868 install_packages_RPM ffmpeg ffmpeg-devel
1877 get_package_version_ARCH() {
1878 pacman -Si $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
1881 check_package_ARCH() {
1882 r=`pacman -Si $1 | grep -c 'Description'`
1884 if [ $r -ge 1 ]; then
1891 check_package_version_match_ARCH() {
1892 v=`get_package_version_ARCH $1`
1894 if [ -z "$v" ]; then
1902 check_package_version_ge_ARCH() {
1903 v=`get_package_version_ARCH $1`
1905 if [ -z "$v" ]; then
1913 install_packages_ARCH() {
1914 sudo pacman -S --needed --noconfirm $@
1915 if [ $? -ge 1 ]; then
1916 ERROR "pacman failed to install requested packages, exiting."
1923 INFO "Installing dependencies for ARCH-based distribution"
1925 INFO "`eval _echo "$COMMON_INFO"`"
1928 read -p "Do you want to continue (Y/n)?"
1929 [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
1932 if [ ! -x "/usr/bin/sudo" ]; then
1934 INFO "This script requires sudo but it is not installed."
1935 INFO "Please setup sudo according to:"
1936 INFO "https://wiki.archlinux.org/index.php/Sudo"
1937 INFO "and try again."
1944 # These libs should always be available in arch official repository...
1945 OPENJPEG_DEV="openjpeg"
1946 VORBIS_DEV="libvorbis"
1947 THEORA_DEV="libtheora"
1949 _packages="base-devel scons cmake libxi glew libpng libtiff wget openal \
1950 $OPENJPEG_DEV $VORBIS_DEV $THEORA_DEV openexr yasm sdl fftw"
1957 # No libspacenav in official arch repos...
1958 _packages="$_packages jack"
1962 install_packages_ARCH $_packages
1966 check_package_version_ge_ARCH $X264_DEV $X264_VERSION_MIN
1967 if [ $? -eq 0 ]; then
1968 install_packages_ARCH $X264_DEV
1975 check_package_ARCH $XVID_DEV
1976 if [ $? -eq 0 ]; then
1977 install_packages_ARCH $XVID_DEV
1983 check_package_ARCH $MP3LAME_DEV
1984 if [ $? -eq 0 ]; then
1985 install_packages_ARCH $MP3LAME_DEV
1991 check_package_version_ge_ARCH $VPX_DEV $VPX_VERSION_MIN
1992 if [ $? -eq 0 ]; then
1993 install_packages_ARCH $VPX_DEV
1999 if $PYTHON_SKIP; then
2000 INFO "WARNING! Skipping Python installation, as requested..."
2002 check_package_version_ge_ARCH python $PYTHON_VERSION_MIN
2003 if [ $? -eq 0 ]; then
2004 install_packages_ARCH python
2006 if $WITH_NUMPY; then
2007 if $NUMPY_SKIP; then
2008 INFO "WARNING! Skipping NumPy installation, as requested..."
2010 check_package_version_ge_ARCH python-numpy $NUMPY_VERSION_MIN
2011 if [ $? -eq 0 ]; then
2012 install_packages_ARCH python-numpy
2014 INFO "WARNING! Sorry, using python package but no numpy package available!"
2021 if $WITH_NUMPY; then
2022 if $NUMPY_SKIP; then
2023 INFO "WARNING! Skipping NumPy installation, as requested..."
2032 if $BOOST_SKIP; then
2033 INFO "WARNING! Skipping Boost installation, as requested..."
2035 check_package_version_ge_ARCH boost $BOOST_VERSION_MIN
2036 if [ $? -eq 0 ]; then
2037 install_packages_ARCH boost
2045 INFO "WARNING! Skipping OpenColorIO installation, as requested..."
2047 check_package_version_ge_ARCH opencolorio $OCIO_VERSION_MIN
2048 if [ $? -eq 0 ]; then
2049 install_packages_ARCH opencolorio yaml-cpp tinyxml
2051 install_packages_ARCH yaml-cpp tinyxml
2058 INFO "WARNING! Skipping OpenImageIO installation, as requested..."
2060 check_package_version_ge_ARCH openimageio $OIIO_VERSION_MIN
2061 if [ $? -eq 0 ]; then
2062 install_packages_ARCH openimageio
2073 INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
2075 check_package_version_ge_ARCH llvm $LLVM_VERSION_MIN
2076 if [ $? -eq 0 ]; then
2077 install_packages_ARCH llvm clang
2079 LLVM_VERSION=`check_package_version_ge_ARCH llvm`
2080 LLVM_VERSION_FOUND=$LLVM_VERSION
2082 install_packages_ARCH libffi
2083 # LLVM can't find the arch ffi header dir...
2084 _FFI_INCLUDE_DIR=`pacman -Ql libffi | grep -e ".*/ffi.h" | awk '{print $2}' | sed -r 's/(.*)\/ffi.h/\1/'`
2085 # LLVM 3.1 needs python2 to build and arch defaults to python3
2086 _PYTHON2_BIN="/usr/bin/python2"
2090 LLVM_VERSION_FOUND=$LLVM_VERSION
2096 INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..."
2099 check_package_version_ge_ARCH openshadinglanguage $OSL_VERSION_MIN
2100 if [ $? -eq 0 ]; then
2101 install_packages_ARCH openshadinglanguage
2103 #XXX Note: will fail to build with LLVM 3.2!
2105 install_packages_ARCH git intel-tbb
2114 if $WITH_OPENCOLLADA; then
2115 if $OPENCOLLADA_SKIP; then
2116 INFO "WARNING! Skipping OpenCOLLADA installation, as requested..."
2119 check_package_ARCH opencollada
2120 if [ $? -eq 0 ]; then
2121 install_packages_ARCH opencollada
2123 install_packages_ARCH pcre git
2127 # Find path to libxml shared lib...
2128 _XML2_LIB=`pacman -Ql libxml2 | grep -e ".*/libxml2.so$" | gawk '{print $2}'`
2133 if $FFMPEG_SKIP; then
2134 INFO "WARNING! Skipping FFMpeg installation, as requested..."
2136 check_package_version_ge_ARCH ffmpeg $FFMPEG_VERSION_MIN
2137 if [ $? -eq 0 ]; then
2138 install_packages_ARCH ffmpeg
2146 print_info_ffmpeglink_DEB() {
2147 if $ALL_STATIC; then
2148 dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
2150 dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
2154 print_info_ffmpeglink_RPM() {
2155 # # XXX No static libs...
2156 # if $ALL_STATIC; then
2157 # rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
2159 rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
2163 print_info_ffmpeglink_ARCH() {
2165 pacman -Ql $_packages | grep -e ".*\/lib[^\/]\+\.so$" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", $0)); nlines++ }'
2168 print_info_ffmpeglink() {
2169 # This func must only print a ';'-separated list of libs...
2170 if [ -z "$DISTRO" ]; then
2171 ERROR "Failed to detect distribution type"
2175 # Create list of packages from which to get libs names...
2178 if $THEORA_USE; then
2179 _packages="$_packages $THEORA_DEV"
2182 if $VORBIS_USE; then
2183 _packages="$_packages $VORBIS_DEV"
2187 _packages="$_packages $XVID_DEV"
2191 _packages="$_packages $VPX_DEV"
2194 if $MP3LAME_USE; then
2195 _packages="$_packages $MP3LAME_DEV"
2199 _packages="$_packages $X264_DEV"
2202 if $OPENJPEG_USE; then
2203 _packages="$_packages $OPENJPEG_DEV"
2206 if [ "$DISTRO" = "DEB" ]; then
2207 print_info_ffmpeglink_DEB
2208 elif [ "$DISTRO" = "RPM" ]; then
2209 print_info_ffmpeglink_RPM
2210 elif [ "$DISTRO" = "ARCH" ]; then
2211 print_info_ffmpeglink_ARCH
2213 else INFO "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
2219 INFO "If you're using CMake add this to your configuration flags:"
2223 if $ALL_STATIC; then
2224 _1="-D WITH_STATIC_LIBS=ON"
2225 # XXX Force linking with shared SDL lib!
2226 _2="-D SDL_LIBRARY='libSDL.so;-lpthread'"
2229 _buildargs="$_buildargs $_1 $_2"
2230 # XXX Arch linux needs to link freetype dynamically...
2231 if [ "$DISTRO" = "ARCH" ]; then
2232 _1="-D FREETYPE_LIBRARY=/usr/lib/libfreetype.so"
2234 _buildargs="$_buildargs $_1"
2238 if [ -d $INST/boost ]; then
2239 _1="-D BOOST_ROOT=$INST/boost"
2240 _2="-D Boost_NO_SYSTEM_PATHS=ON"
2243 _buildargs="$_buildargs $_1 $_2"
2244 elif $ALL_STATIC; then
2245 _1="-D WITH_BOOST_ICU=ON"
2247 _buildargs="$_buildargs $_1"
2248 # XXX Arch linux fails static linking without these...
2249 if [ "$DISTRO" = "ARCH" ]; then
2250 _1="-D ICU_LIBRARY_DATA=/usr/lib/libicudata.so"
2251 _2="-D ICU_LIBRARY_I18N=/usr/lib/libicui18n.so"
2252 _3="-D ICU_LIBRARY_IO=/usr/lib/libicuio.so"
2253 _4="-D ICU_LIBRARY_LE=/usr/lib/libicule.so"
2254 _5="-D ICU_LIBRARY_LX=/usr/lib/libiculx.so"
2255 _6="-D ICU_LIBRARY_TU=/usr/lib/libicutu.so"
2256 _7="-D ICU_LIBRARY_UC=/usr/lib/libicuuc.so"
2264 _buildargs="$_buildargs $_1 $_2 $_3 $_4 $_5 $_6 $_7"
2269 _1="-D WITH_CYCLES_OSL=ON"
2270 _2="-D WITH_LLVM=ON"
2271 _3="-D LLVM_VERSION=$LLVM_VERSION_FOUND"
2275 _buildargs="$_buildargs $_1 $_2 $_3"
2276 if [ -d $INST/osl ]; then
2277 _1="-D CYCLES_OSL=$INST/osl"
2279 _buildargs="$_buildargs $_1"
2281 if [ -d $INST/llvm ]; then
2282 _1="-D LLVM_DIRECTORY=$INST/llvm"
2283 _2="-D LLVM_STATIC=ON"
2286 _buildargs="$_buildargs $_1 $_2"
2290 if $WITH_OPENCOLLADA; then
2291 _1="-D WITH_OPENCOLLADA=ON"
2293 _buildargs="$_buildargs $_1"
2294 if $ALL_STATIC; then
2295 _1="-D XML2_LIBRARY=$_XML2_LIB"
2297 _buildargs="$_buildargs $_1"
2301 _1="-D WITH_CODEC_FFMPEG=ON"
2302 _2="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;rt;`print_info_ffmpeglink`'"
2305 _buildargs="$_buildargs $_1 $_2"
2306 if [ -d $INST/ffmpeg ]; then
2307 _1="-D FFMPEG=$INST/ffmpeg"
2309 _buildargs="$_buildargs $_1"
2313 INFO "Or even simpler, just run (in your blender-source dir):"
2314 INFO " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
2317 INFO "If you're using SCons add this to your user-config:"
2319 if [ -d $INST/python-$PYTHON_VERSION_MIN ]; then
2320 INFO "BF_PYTHON = '$INST/python-$PYTHON_VERSION_MIN'"
2321 INFO "BF_PYTHON_ABI_FLAGS = 'm'"
2324 INFO "WITH_BF_OCIO = True"
2325 if [ -d $INST/ocio ]; then
2326 INFO "BF_OCIO = '$INST/ocio'"
2329 INFO "WITH_BF_OIIO = True"
2330 if [ -d $INST/oiio ]; then
2331 INFO "BF_OIIO = '$INST/oiio'"
2333 INFO "WITH_BF_CYCLES = True"
2335 if [ -d $INST/osl ]; then
2336 INFO "BF_OSL = '$INST/osl'"
2339 INFO "WITH_BF_BOOST = True"
2340 if [ -d $INST/boost ]; then
2341 INFO "BF_BOOST = '$INST/boost'"
2344 _ffmpeg_list_sep=" "
2345 INFO "BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice `print_info_ffmpeglink`'"
2346 if [ -d $INST/ffmpeg ]; then
2347 INFO "BF_FFMPEG = '$INST/ffmpeg'"
2350 if ! $WITH_ALL; then
2351 INFO "WITH_BF_3DMOUSE = False"
2352 # No libspacenav in official arch repos...
2353 elif [ "$DISTRO" = "ARCH" ]; then
2354 INFO "WITH_BF_3DMOUSE = False"
2359 INFO "WARNING: If this script had to build boost into $INST, and you are dynamically linking "
2360 INFO " blender against it, you will have to run those commands as root user:"
2362 INFO " echo \"$INST/boost/lib\" > /etc/ld.so.conf.d/boost.conf"
2367 # Detect distributive type used on this machine
2370 if [ -z "$DISTRO" ]; then
2371 ERROR "Failed to detect distribution type"
2373 elif [ "$DISTRO" = "DEB" ]; then
2375 elif [ "$DISTRO" = "RPM" ]; then
2377 elif [ "$DISTRO" = "ARCH" ]; then
2381 print_info | tee BUILD_NOTES.txt
2383 INFO "This information has been written to BUILD_NOTES.txt"
2386 # Switch back to user language.