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.
22 ##### Args and Help Handling #####
28 --long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-confirm,with-all,with-opencollada,\
29 ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\
30 force-all,force-python,force-numpy,force-boost,\
31 force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
32 force-ffmpeg,force-opencollada,\
33 build-all,build-python,build-numpy,build-boost,\
34 build-ocio,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
35 build-ffmpeg,build-opencollada,\
36 skip-python,skip-numpy,skip-boost,\
37 skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
38 skip-ffmpeg,skip-opencollada \
46 SRC="$HOME/src/blender-deps"
51 SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
53 # Do not install some optional, potentially conflicting libs by default...
56 # Do not yet enable opencollada, use --with-opencollada (or --with-all) option to try it.
57 WITH_OPENCOLLADA=false
61 COMMON_INFO="\"Source code of dependencies needed to be compiled will be downloaded and extracted into '\$SRC'.
62 Built libs of dependencies needed to be compiled will be installed into '\$INST'.
63 Please edit \\\$SRC and/or \\\$INST variables at the beginning of this script,
64 or use --source/--install options, if you want to use other paths!
66 Number of threads for building: \$THREADS (automatically detected, use --threads=<nbr> to override it).
67 Full install: \$WITH_ALL (use --with-all option to enable it).
68 Building OpenCOLLADA: \$WITH_OPENCOLLADA (use --with-opencollada option to enable it).
71 Full install without OpenCOLLADA: --with-all --skip-opencollada
73 Use --help to show all available options!\""
75 ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
77 Show this message and exit.
80 Show main dependencies of Blender (including officially supported versions) and exit.
82 -s <path>, --source=<path>
83 Use a specific path where to store downloaded libraries sources (defaults to '\$SRC').
85 -i <path>, --install=<path>
86 Use a specific path where to install built libraries (defaults to '\$INST').
89 Use a specific temp path (defaults to '\$TMP').
92 Use a specific info path (to store BUILD_NOTES.txt, defaults to '\$INFO_PATH').
95 Use a specific number of threads when building the libraries (auto-detected as '\$THREADS').
98 Disable use of sudo (this script won't be able to do much though, will just print needed packages...).
101 Disable any interaction with user (suitable for automated run).
104 By default, a number of optional and not-so-often needed libraries are not installed.
105 This option will try to install them, at the cost of potential conflicts (depending on
106 how your package system is set…).
107 Note this option also implies all other (more specific) --with-foo options below.
110 Build and install the OpenCOLLADA libraries.
113 Force version of OCIO library.
116 Force version of OIIO library.
119 Force version of LLVM library.
122 Force version of OSL library.
125 Force version of OSD library.
128 Force version of OpenVDB library.
130 Note about the --ver-foo options:
131 It may not always work as expected (some libs are actually checked out from a git rev...), yet it might help
132 to fix some build issues (like LLVM mismatch with the version used by your graphic system).
135 Force the build of all possible libraries.
138 Force the build of Python.
141 Force the build of NumPy.
144 Force the build of Boost.
147 Force the build of OpenColorIO.
150 Force the build of OpenEXR.
153 Force the build of OpenImageIO.
156 Force the build of LLVM.
159 Force the build of OpenShadingLanguage.
162 Force the build of OpenSubdiv.
165 Force the build of OpenVDB.
168 Force the build of OpenCOLLADA.
171 Force the build of FFMpeg.
173 Note about the --build-foo options:
174 * They force the script to prefer building dependencies rather than using available packages.
175 This may make things simpler and allow working around some distribution bugs, but on the other hand it will
176 use much more space on your hard drive.
177 * Please be careful with the Blender building options if you have both 'official' dev packages and
178 install_deps' built ones on your system, by default CMake will prefer official packages, which may lead to
179 linking issues. Please ensure your CMake configuration always uses all correct library paths.
180 * If the “force-built” library is a dependency of others, it will force the build
181 of those libraries as well (e.g. --build-boost also implies --build-oiio and --build-osl...).
184 Force the rebuild of all built libraries.
187 Force the rebuild of Python.
190 Force the rebuild of NumPy.
193 Force the rebuild of Boost.
196 Force the rebuild of OpenColorIO.
199 Force the rebuild of OpenEXR.
202 Force the rebuild of OpenImageIO.
205 Force the rebuild of LLVM.
208 Force the rebuild of OpenShadingLanguage.
211 Force the rebuild of OpenSubdiv.
214 Force the rebuild of OpenVDB.
217 Force the rebuild of OpenCOLLADA.
220 Force the rebuild of FFMpeg.
222 Note about the --force-foo options:
223 * They obviously only have an effect if those libraries are built by this script
224 (i.e. if there is no available and satisfactory package)!
225 * If the “force-rebuilt” library is a dependency of others, it will force the rebuild
226 of those libraries too (e.g. --force-boost will also rebuild oiio and osl...).
229 Unconditionally skip Python installation/building.
232 Unconditionally skip NumPy installation/building.
235 Unconditionally skip Boost installation/building.
238 Unconditionally skip OpenColorIO installation/building.
241 Unconditionally skip OpenEXR installation/building.
244 Unconditionally skip OpenImageIO installation/building.
247 Unconditionally skip LLVM installation/building.
250 Unconditionally skip OpenShadingLanguage installation/building.
253 Unconditionally skip OpenSubdiv installation/building.
256 Unconditionally skip OpenVDB installation/building.
259 Unconditionally skip OpenCOLLADA installation/building.
262 Unconditionally skip FFMpeg installation/building.\""
264 ##### Main Vars #####
272 PYTHON_VERSION="3.5.1"
273 PYTHON_VERSION_MIN="3.5"
274 PYTHON_FORCE_BUILD=false
275 PYTHON_FORCE_REBUILD=false
278 NUMPY_VERSION="1.10.1"
279 NUMPY_VERSION_MIN="1.8"
280 NUMPY_FORCE_BUILD=false
281 NUMPY_FORCE_REBUILD=false
284 BOOST_VERSION="1.60.0"
285 BOOST_VERSION_MIN="1.49"
286 BOOST_FORCE_BUILD=false
287 BOOST_FORCE_REBUILD=false
291 OCIO_VERSION_MIN="1.0"
292 OCIO_FORCE_BUILD=false
293 OCIO_FORCE_REBUILD=false
296 OPENEXR_VERSION="2.2.0"
297 OPENEXR_VERSION_MIN="2.0.1"
298 ILMBASE_VERSION="2.2.0"
299 ILMBASE_VERSION_MIN="2.2"
300 OPENEXR_FORCE_BUILD=false
301 OPENEXR_FORCE_REBUILD=false
303 _with_built_openexr=false
306 OIIO_VERSION_MIN="1.6.0"
307 OIIO_VERSION_MAX="1.9.0" # UNKNOWN currently # Not supported by current OSL...
308 OIIO_FORCE_BUILD=false
309 OIIO_FORCE_REBUILD=false
313 LLVM_VERSION_MIN="3.4"
314 LLVM_VERSION_FOUND=""
315 LLVM_FORCE_BUILD=false
316 LLVM_FORCE_REBUILD=false
319 # OSL needs to be compiled for now!
321 OSL_VERSION_MIN=$OSL_VERSION
322 OSL_FORCE_BUILD=false
323 OSL_FORCE_REBUILD=false
326 # OpenSubdiv needs to be compiled for now
328 OSD_VERSION_MIN=$OSD_VERSION
329 OSD_FORCE_BUILD=false
330 OSD_FORCE_REBUILD=false
333 # OpenVDB needs to be compiled for now
334 OPENVDB_BLOSC_VERSION="1.7.0"
336 OPENVDB_VERSION="3.1.0"
337 OPENVDB_VERSION_MIN=$OPENVDB_VERSION
338 OPENVDB_FORCE_BUILD=false
339 OPENVDB_FORCE_REBUILD=false
343 OPENCOLLADA_VERSION="1.3"
344 OPENCOLLADA_FORCE_BUILD=true # no package!
345 OPENCOLLADA_FORCE_REBUILD=false
346 OPENCOLLADA_SKIP=false
348 FFMPEG_VERSION="2.8.4"
349 FFMPEG_VERSION_MIN="2.8.4"
350 FFMPEG_FORCE_BUILD=false
351 FFMPEG_FORCE_REBUILD=false
355 # FFMPEG optional libs.
366 X264_VERSION_MIN=0.118
368 VPX_VERSION_MIN=0.9.7
375 # Switch to english language, else some things (like check_package_DEB()) won't work!
380 ##### Generic Helpers #####
382 BLACK=$(tput setaf 0)
384 GREEN=$(tput setaf 2)
385 YELLOW=$(tput setaf 3)
386 LIME_YELLOW=$(tput setaf 190)
387 POWDER_BLUE=$(tput setaf 153)
389 MAGENTA=$(tput setaf 5)
391 WHITE=$(tput setaf 7)
396 UNDERLINE=$(tput smul)
399 if [ "X$1" = "X-n" ]; then
400 shift; printf "%s" "$@"
407 _echo "${BRIGHT}${RED}ERROR! ${NORMAL}${RED}$@${NORMAL}"
411 _echo "${BRIGHT}${YELLOW}WARNING! ${NORMAL}${YELLOW}$@${NORMAL}"
415 _echo "${GREEN}$@${NORMAL}"
422 ##### Args Handling #####
424 # Finish parsing the commandline args.
429 SRC="$2"; shift; shift; continue
432 INST="$2"; shift; shift; continue
435 TMP="$2"; shift; shift; continue
438 INFO_PATH="$2"; shift; shift; continue
441 THREADS="$2"; shift; shift; continue
447 PRINT "`eval _echo "$COMMON_INFO"`"
449 PRINT "`eval _echo "$ARGUMENTS_INFO"`"
454 # We have to defer...
455 DO_SHOW_DEPS=true; shift; continue
459 WARNING "--no-sudo enabled, this script might not be able to do much..."
461 SUDO=""; shift; continue
464 NO_CONFIRM=true; shift; continue
467 WITH_ALL=true; shift; continue
470 WITH_OPENCOLLADA=true; shift; continue
474 OCIO_VERSION_MIN=$OCIO_VERSION
475 shift; shift; continue
479 OIIO_VERSION_MIN=$OIIO_VERSION
480 shift; shift; continue
484 LLVM_VERSION_MIN=$LLVM_VERSION
485 shift; shift; continue
489 OSL_VERSION_MIN=$OSL_VERSION
490 shift; shift; continue
494 OSD_VERSION_MIN=$OSD_VERSION
495 shift; shift; continue
499 OPENVDB_VERSION_MIN=$OPENVDB_VERSION
500 shift; shift; continue
503 PYTHON_FORCE_BUILD=true
504 NUMPY_FORCE_BUILD=true
505 BOOST_FORCE_BUILD=true
506 OCIO_FORCE_BUILD=true
507 OPENEXR_FORCE_BUILD=true
508 OIIO_FORCE_BUILD=true
509 LLVM_FORCE_BUILD=true
512 OPENVDB_FORCE_BUILD=true
513 OPENCOLLADA_FORCE_BUILD=true
514 FFMPEG_FORCE_BUILD=true
518 PYTHON_FORCE_BUILD=true
519 NUMPY_FORCE_BUILD=true
523 PYTHON_FORCE_BUILD=true
524 NUMPY_FORCE_BUILD=true
528 BOOST_FORCE_BUILD=true; shift; continue
531 OCIO_FORCE_BUILD=true; shift; continue
534 OPENEXR_FORCE_BUILD=true; shift; continue
537 OIIO_FORCE_BUILD=true; shift; continue
540 LLVM_FORCE_BUILD=true; shift; continue
543 OSL_FORCE_BUILD=true; shift; continue
546 OSD_FORCE_BUILD=true; shift; continue
549 OPENVDB_FORCE_BUILD=true; shift; continue
552 OPENCOLLADA_FORCE_BUILD=true; shift; continue
555 FFMPEG_FORCE_BUILD=true; shift; continue
558 PYTHON_FORCE_REBUILD=true
559 NUMPY_FORCE_REBUILD=true
560 BOOST_FORCE_REBUILD=true
561 OCIO_FORCE_REBUILD=true
562 OPENEXR_FORCE_REBUILD=true
563 OIIO_FORCE_REBUILD=true
564 LLVM_FORCE_REBUILD=true
565 OSL_FORCE_REBUILD=true
566 OSD_FORCE_REBUILD=true
567 OPENVDB_FORCE_REBUILD=true
568 OPENCOLLADA_FORCE_REBUILD=true
569 FFMPEG_FORCE_REBUILD=true
573 PYTHON_FORCE_REBUILD=true
574 NUMPY_FORCE_REBUILD=true
578 NUMPY_FORCE_REBUILD=true; shift; continue
581 BOOST_FORCE_REBUILD=true; shift; continue
584 OCIO_FORCE_REBUILD=true; shift; continue
587 OPENEXR_FORCE_REBUILD=true; shift; continue
590 OIIO_FORCE_REBUILD=true; shift; continue
593 LLVM_FORCE_REBUILD=true; shift; continue
596 OSL_FORCE_REBUILD=true; shift; continue
599 OSD_FORCE_REBUILD=true; shift; continue
602 OPENVDB_FORCE_REBUILD=true; shift; continue
605 OPENCOLLADA_FORCE_REBUILD=true; shift; continue
608 FFMPEG_FORCE_REBUILD=true; shift; continue
611 PYTHON_SKIP=true; shift; continue
614 NUMPY_SKIP=true; shift; continue
617 BOOST_SKIP=true; shift; continue
620 OCIO_SKIP=true; shift; continue
623 OPENEXR_SKIP=true; shift; continue
626 OIIO_SKIP=true; shift; continue
629 LLVM_SKIP=true; shift; continue
632 OSL_SKIP=true; shift; continue
635 OSD_SKIP=true; shift; continue
638 OPENVDB_SKIP=true; shift; continue
641 OPENCOLLADA_SKIP=true; shift; continue
644 FFMPEG_SKIP=true; shift; continue
647 # no more arguments to parse
652 ERROR "Wrong parameter! Usage:"
654 PRINT "`eval _echo "$COMMON_INFO"`"
661 if [ "$WITH_ALL" = true -a "$OPENCOLLADA_SKIP" = false ]; then
662 WITH_OPENCOLLADA=true
667 # This has to be done here, because user might force some versions...
668 PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
669 NUMPY_SOURCE=( "http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz" )
671 _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
672 BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" )
673 BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave"
675 OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" )
677 OPENEXR_USE_REPO=false
678 OPENEXR_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/openexr-$OPENEXR_VERSION.tar.gz" )
679 OPENEXR_SOURCE_REPO=( "https://github.com/mont29/openexr.git" )
680 OPENEXR_SOURCE_REPO_UID="2787aa1cf652d244ed45ae124eb1553f6cff11ee"
681 ILMBASE_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/ilmbase-$ILMBASE_VERSION.tar.gz" )
684 OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz" )
685 OIIO_SOURCE_REPO=( "https://github.com/OpenImageIO/oiio.git" )
686 OIIO_SOURCE_REPO_UID="c9e67275a0b248ead96152f6d2221cc0c0f278a4"
688 LLVM_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" )
689 LLVM_CLANG_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" "http://llvm.org/releases/$LLVM_VERSION/cfe-$LLVM_VERSION.src.tar.gz" )
692 OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz" )
693 #~ OSL_SOURCE=( "https://github.com/Nazg-Gul/OpenShadingLanguage/archive/Release-1.5.11.tar.gz" )
694 #~ OSL_SOURCE_REPO=( "https://github.com/imageworks/OpenShadingLanguage.git" )
695 #~ OSL_SOURCE_REPO=( "https://github.com/mont29/OpenShadingLanguage.git" )
696 #~ OSL_SOURCE_REPO_UID="85179714e1bc69cd25ecb6bb711c1a156685d395"
697 #~ OSL_SOURCE_REPO_BRANCH="master"
698 OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
699 OSL_SOURCE_REPO_UID="7d40ff5fe8e47b030042afb92d0e955f5aa96f48"
700 OSL_SOURCE_REPO_BRANCH="blender-fixes"
703 # Script foo to make the version string compliant with the archive name:
704 # ${Varname//SearchForThisChar/ReplaceWithThisChar}
705 OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" )
706 OSD_SOURCE_REPO=( "https://github.com/PixarAnimationStudios/OpenSubdiv.git" )
707 OSD_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
708 OSD_SOURCE_REPO_BRANCH="dev"
710 OPENVDB_USE_REPO=false
711 OPENVDB_BLOSC_SOURCE=( "https://github.com/Blosc/c-blosc/archive/v${OPENVDB_BLOSC_VERSION}.tar.gz" )
712 OPENVDB_SOURCE=( "https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz" )
713 #~ OPENVDB_SOURCE_REPO=( "https:///dreamworksanimation/openvdb.git" )
714 #~ OPENVDB_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
715 #~ OPENVDB_SOURCE_REPO_BRANCH="dev"
717 OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
718 OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
719 OPENCOLLADA_REPO_BRANCH="master"
721 FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
725 #### Show Dependencies ####
727 # Need those to be after we defined versions...
728 DEPS_COMMON_INFO="\"COMMON DEPENDENCIES:
730 Those libraries should be available as packages in all recent distributions (optional ones are [between brackets]):
732 * Basics of dev environment (cmake, gcc, svn , git, ...).
733 * libjpeg, libpng, libtiff, [libopenjpeg], [libopenal].
734 * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
735 * libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
736 * libsdl1.2, libglew, libglewmx.\""
738 DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
740 The following libraries will probably not all be available as packages in your distribution
741 (install_deps will by default try to install packages, and fall back to building missing ones).
742 You can force install_deps to build those with '--build-all' or relevant 'build-foo' options, see '--help' message.
743 You may also want to build them yourself (optional ones are [between brackets]):
745 * Python $PYTHON_VERSION_MIN (from $PYTHON_SOURCE).
746 * [NumPy $NUMPY_VERSION_MIN] (from $NUMPY_SOURCE).
747 * Boost $BOOST_VERSION_MIN (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES).
748 * [FFMpeg $FFMPEG_VERSION_MIN (needs libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, ...)] (from $FFMPEG_SOURCE).
749 * [OpenColorIO $OCIO_VERSION_MIN] (from $OCIO_SOURCE).
750 * ILMBase $ILMBASE_VERSION_MIN (from $ILMBASE_SOURCE).
751 * OpenEXR $OPENEXR_VERSION_MIN (from $OPENEXR_SOURCE).
752 * OpenImageIO $OIIO_VERSION_MIN (from $OIIO_SOURCE).
753 * [LLVM $LLVM_VERSION_MIN (with clang)] (from $LLVM_SOURCE, and $LLVM_CLANG_SOURCE).
754 * [OpenShadingLanguage $OSL_VERSION_MIN] (from $OSL_SOURCE_REPO, branch $OSL_SOURCE_REPO_BRANCH, commit $OSL_SOURCE_REPO_UID).
755 * [OpenSubDiv $OSD_VERSION_MIN] (from $OSD_SOURCE_REPO, branch $OSD_SOURCE_REPO_BRANCH, commit $OSD_SOURCE_REPO_UID).
756 * [OpenVDB $OPENVDB_VERSION_MIN] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE).
757 * [OpenCollada] (from $OPENCOLLADA_SOURCE, branch $OPENCOLLADA_REPO_BRANCH, commit $OPENCOLLADA_REPO_UID).\""
759 if [ "$DO_SHOW_DEPS" = true ]; then
761 PRINT "Blender dependencies (libraries needed to build it):"
763 PRINT "`eval _echo "$DEPS_COMMON_INFO"`"
765 PRINT "`eval _echo "$DEPS_SPECIFIC_INFO"`"
772 ##### Generic Helpers #####
774 # Check return code of wget for success...
776 declare -a sources=("${!1}")
777 sources_count=${#sources[@]}
780 for (( i=0; $i < $sources_count; i++ ))
782 wget -c ${sources[$i]} -O $2
783 if [ $? -eq 0 ]; then
789 if [ $error -eq 1 ]; then
790 ERROR "wget could not find ${sources[@]}, or could not write it to $2, exiting"
795 # Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
796 # $1 and $2 should be version numbers made of numbers only.
801 # Split both version numbers into their numeric elements.
809 if [ $count2 -ge $count1 ]; then
818 for (( i=0; $i < $count2; i++ ))
820 if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
826 for (( i=$count2; $i < $count1; i++ ))
828 if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then
838 # Return 0 if $1 >= $2, else 1.
839 # $1 and $2 should be version numbers made of numbers only.
842 if [ $? -eq 1 -a $(_echo "$1" "$2" | sort --version-sort | head --lines=1) = "$1" ]; then
849 # Return 0 if $3 > $1 >= $2, else 1.
850 # $1 and $2 should be version numbers made of numbers only.
853 if [ $? -eq 0 ]; then
861 # 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.
862 # $1 and $2 should be version numbers made of numbers only.
863 # $1 should be at least as long as $2!
868 # Split both version numbers into their numeric elements.
876 if [ $count1 -ge $count2 ]; then
878 for (( i=0; $i < $count2; i++ ))
880 if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
891 ##### Generic compile helpers #####
893 INFO "Ensuring $INST exists and is writable by us"
895 WARNING "--no-sudo enabled, might be impossible to create install dir..."
897 if [ ! -d $INST ]; then
901 if [ ! -w $INST ]; then
902 $SUDO chown $USER $INST
903 $SUDO chmod 775 $INST
907 # Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name...
908 magic_compile_check() {
909 if [ -f $INST/.$1-magiccheck-$2 ]; then
916 magic_compile_set() {
917 rm -f $INST/.$1-magiccheck-*
918 touch $INST/.$1-magiccheck-$2
921 # Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib...
923 rm -rf `readlink -f $_inst_shortcut`
924 # Only remove $_src dir when not using git repo (avoids to re-clone the whole repo every time!!!).
925 if [ $_git == false ]; then
929 rm -rf $_inst_shortcut
932 _create_inst_shortcut() {
933 rm -f $_inst_shortcut
934 ln -s $_inst $_inst_shortcut
939 _lib_path="$INST/$1/lib"
940 _ldconf_path="/etc/ld.so.conf.d/$1.conf"
943 WARNING "--no-sudo enabled, impossible to run ldconfig for $1, you'll have to do it yourself..."
945 INFO "Running ldconfig for $1..."
946 $SUDO sh -c "echo \"$_lib_path\" > $_ldconf_path"
947 $SUDO /sbin/ldconfig # XXX OpenSuse does not include sbin in command path with sudo!!!
952 #### Build Python ####
954 _src=$SRC/Python-$PYTHON_VERSION
956 _inst=$INST/python-$PYTHON_VERSION
957 _inst_shortcut=$INST/python-$PYTHON_VERSION_MIN
967 # To be changed each time we make edits that would modify the compiled result!
971 # Clean install if needed!
972 magic_compile_check python-$PYTHON_VERSION $py_magic
973 if [ $? -eq 1 -o "$PYTHON_FORCE_REBUILD" = true ]; then
977 if [ ! -d $_inst ]; then
978 INFO "Building Python-$PYTHON_VERSION"
982 if [ ! -d $_src ]; then
984 download PYTHON_SOURCE[@] $_src.tgz
986 INFO "Unpacking Python-$PYTHON_VERSION"
987 tar -C $SRC -xf $_src.tgz
992 ./configure --prefix=$_inst --libdir=$_inst/lib --enable-ipv6 \
993 --enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
994 --with-computed-gotos --with-pymalloc
996 make -j$THREADS && make install
999 if [ -d $_inst ]; then
1000 _create_inst_shortcut
1002 ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
1006 magic_compile_set python-$PYTHON_VERSION $py_magic
1009 INFO "Done compiling Python-$PYTHON_VERSION!"
1011 INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
1012 INFO "If you want to force rebuild of this lib, use the --force-python option."
1016 ##### Build Numpy #####
1018 _src=$SRC/numpy-$NUMPY_VERSION
1020 _inst=$INST/numpy-$NUMPY_VERSION
1021 _python=$INST/python-$PYTHON_VERSION
1022 _site=lib/python$PYTHON_VERSION_MIN/site-packages
1023 _inst_shortcut=$_python/$_site/numpy
1032 # To be changed each time we make edits that would modify the compiled result!
1036 # Clean install if needed!
1037 magic_compile_check numpy-$NUMPY_VERSION $numpy_magic
1038 if [ $? -eq 1 -o "$NUMPY_FORCE_REBUILD" = true ]; then
1042 if [ ! -d $_inst ]; then
1043 INFO "Building Numpy-$NUMPY_VERSION"
1047 if [ ! -d $_src ]; then
1049 download NUMPY_SOURCE[@] $_src.tar.gz
1051 INFO "Unpacking Numpy-$NUMPY_VERSION"
1052 tar -C $SRC -xf $_src.tar.gz
1057 $_python/bin/python3 setup.py install --prefix=$_inst
1059 if [ -d $_inst ]; then
1060 # Can't use _create_inst_shortcut here...
1061 rm -f $_inst_shortcut
1062 ln -s $_inst/$_site/numpy $_inst_shortcut
1064 ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting"
1068 magic_compile_set numpy-$NUMPY_VERSION $numpy_magic
1071 INFO "Done compiling Numpy-$NUMPY_VERSION!"
1073 INFO "Own Numpy-$NUMPY_VERSION is up to date, nothing to do!"
1074 INFO "If you want to force rebuild of this lib, use the --force-numpy option."
1078 #### Build Boost ####
1080 _src=$SRC/boost-$BOOST_VERSION
1082 _inst=$INST/boost-$BOOST_VERSION
1083 _inst_shortcut=$INST/boost
1092 # To be changed each time we make edits that would modify the compiled result!
1097 # Clean install if needed!
1098 magic_compile_check boost-$BOOST_VERSION $boost_magic
1099 if [ $? -eq 1 -o "$BOOST_FORCE_REBUILD" = true ]; then
1103 if [ ! -d $_inst ]; then
1104 INFO "Building Boost-$BOOST_VERSION"
1106 # Rebuild dependecies as well!
1107 OIIO_FORCE_BUILD=true
1108 OIIO_FORCE_REBUILD=true
1109 OSL_FORCE_BUILD=true
1110 OSL_FORCE_REBUILD=true
1114 if [ ! -d $_src ]; then
1115 INFO "Downloading Boost-$BOOST_VERSION"
1117 download BOOST_SOURCE[@] $_src.tar.bz2
1118 tar -C $SRC --transform "s,(.*/?)boost_1_[^/]+(.*),\1boost-$BOOST_VERSION\2,x" -xf $_src.tar.bz2
1122 if [ ! -f $_src/b2 ]; then
1125 ./b2 -j$THREADS -a $BOOST_BUILD_MODULES \
1126 --prefix=$_inst --disable-icu boost.locale.icu=off install
1129 if [ -d $_inst ]; then
1130 _create_inst_shortcut
1132 ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
1136 magic_compile_set boost-$BOOST_VERSION $boost_magic
1139 INFO "Done compiling Boost-$BOOST_VERSION!"
1141 INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!"
1142 INFO "If you want to force rebuild of this lib, use the --force-boost option."
1145 # Just always run it, much simpler this way!
1146 run_ldconfig "boost"
1149 #### Build OCIO ####
1151 _src=$SRC/OpenColorIO-$OCIO_VERSION
1153 _inst=$INST/ocio-$OCIO_VERSION
1154 _inst_shortcut=$INST/ocio
1163 # To be changed each time we make edits that would modify the compiled result!
1167 # Clean install if needed!
1168 magic_compile_check ocio-$OCIO_VERSION $ocio_magic
1169 if [ $? -eq 1 -o "$OCIO_FORCE_REBUILD" = true ]; then
1173 if [ ! -d $_inst ]; then
1174 INFO "Building OpenColorIO-$OCIO_VERSION"
1178 if [ ! -d $_src ]; then
1179 INFO "Downloading OpenColorIO-$OCIO_VERSION"
1181 download OCIO_SOURCE[@] $_src.tar.gz
1183 INFO "Unpacking OpenColorIO-$OCIO_VERSION"
1184 tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
1189 # Always refresh the whole build!
1190 if [ -d build ]; then
1196 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1197 cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
1198 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1199 cmake_d="$cmake_d -D OCIO_BUILD_APPS=OFF"
1200 cmake_d="$cmake_d -D OCIO_BUILD_PYGLUE=OFF"
1202 if file /bin/cp | grep -q '32-bit'; then
1203 cflags="-fPIC -m32 -march=i686"
1208 cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
1210 make -j$THREADS && make install
1212 # Force linking against static libs
1213 rm -f $_inst/lib/*.so*
1215 # Additional depencencies
1216 cp ext/dist/lib/libtinyxml.a $_inst/lib
1217 cp ext/dist/lib/libyaml-cpp.a $_inst/lib
1221 if [ -d $_inst ]; then
1222 _create_inst_shortcut
1224 ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
1228 magic_compile_set ocio-$OCIO_VERSION $ocio_magic
1231 INFO "Done compiling OpenColorIO-$OCIO_VERSION!"
1233 INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!"
1234 INFO "If you want to force rebuild of this lib, use the --force-ocio option."
1240 #### Build ILMBase ####
1242 _src=$SRC/ILMBase-$ILMBASE_VERSION
1244 _inst=$TMP/ilmbase-$ILMBASE_VERSION
1245 _inst_shortcut=$TMP/ilmbase
1254 # To be changed each time we make edits that would modify the compiled result!
1258 # Clean install if needed!
1259 magic_compile_check ilmbase-$ILMBASE_VERSION $ilmbase_magic
1260 if [ $? -eq 1 -o "$OPENEXR_FORCE_REBUILD" = true ]; then
1262 rm -rf $_openexr_inst
1265 if [ ! -d $_openexr_inst ]; then
1266 INFO "Building ILMBase-$ILMBASE_VERSION"
1268 # Rebuild dependecies as well!
1269 OPENEXR_FORCE_BUILD=true
1270 OPENEXR_FORCE_REBUILD=true
1274 if [ ! -d $_src ]; then
1275 INFO "Downloading ILMBase-$ILMBASE_VERSION"
1277 download ILMBASE_SOURCE[@] $_src.tar.gz
1279 INFO "Unpacking ILMBase-$ILMBASE_VERSION"
1280 tar -C $SRC --transform "s,(.*/?)ilmbase-[^/]*(.*),\1ILMBase-$ILMBASE_VERSION\2,x" -xf $_src.tar.gz
1285 # Always refresh the whole build!
1286 if [ -d build ]; then
1292 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1293 cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
1294 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1295 cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
1296 cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
1298 if file /bin/cp | grep -q '32-bit'; then
1299 cflags="-fPIC -m32 -march=i686"
1304 cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
1306 make -j$THREADS && make install
1310 if [ -d $_inst ]; then
1311 _create_inst_shortcut
1313 ERROR "ILMBase-$ILMBASE_VERSION failed to compile, exiting"
1317 INFO "Done compiling ILMBase-$ILMBASE_VERSION!"
1319 INFO "Own ILMBase-$ILMBASE_VERSION is up to date, nothing to do!"
1320 INFO "If you want to force rebuild of this lib (and openexr), use the --force-openexr option."
1323 magic_compile_set ilmbase-$ILMBASE_VERSION $ilmbase_magic
1326 #### Build OpenEXR ####
1328 _src=$SRC/OpenEXR-$OPENEXR_VERSION
1330 _inst=$_openexr_inst
1331 _inst_shortcut=$INST/openexr
1341 # To be changed each time we make edits that would modify the compiled result!
1344 # Clean install if needed!
1345 magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic
1346 if [ $? -eq 1 -o "$OPENEXR_FORCE_REBUILD" = true ]; then
1350 _openexr_inst=$INST/openexr-$OPENEXR_VERSION
1353 _ilmbase_inst=$_inst_shortcut
1356 if [ ! -d $_inst ]; then
1357 INFO "Building OpenEXR-$OPENEXR_VERSION"
1359 # Rebuild dependecies as well!
1360 OIIO_FORCE_BUILD=true
1361 OIIO_FORCE_REBUILD=true
1365 if [ ! -d $_src ]; then
1366 INFO "Downloading OpenEXR-$OPENEXR_VERSION"
1369 if [ "$OPENEXR_USE_REPO" = true ]; then
1370 git clone ${OPENEXR_SOURCE_REPO[0]} $_src
1372 download OPENEXR_SOURCE[@] $_src.tar.gz
1373 INFO "Unpacking OpenEXR-$OPENEXR_VERSION"
1374 tar -C $SRC --transform "s,(.*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" -xf $_src.tar.gz
1381 if [ "$OPENEXR_USE_REPO" = true ]; then
1382 # XXX For now, always update from latest repo...
1383 git pull origin master
1384 # Stick to same rev as windows' libs...
1385 git checkout $OPENEXR_SOURCE_REPO_UID
1387 oiio_src_path="../OpenEXR"
1392 # Always refresh the whole build!
1393 if [ -d build ]; then
1399 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1400 cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
1401 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1402 cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst"
1403 cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
1404 cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
1406 if file /bin/cp | grep -q '32-bit'; then
1407 cflags="-fPIC -m32 -march=i686"
1412 cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" $oiio_src_path
1414 make -j$THREADS && make install
1418 if [ -d $_inst ]; then
1419 _create_inst_shortcut
1420 # Copy ilmbase files here (blender expects same dir for ilmbase and openexr :/).
1421 cp -Lrn $_ilmbase_inst/* $_inst_shortcut
1423 ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
1427 magic_compile_set openexr-$OPENEXR_VERSION $openexr_magic
1430 INFO "Done compiling OpenEXR-$OPENEXR_VERSION!"
1432 INFO "Own OpenEXR-$OPENEXR_VERSION is up to date, nothing to do!"
1433 INFO "If you want to force rebuild of this lib, use the --force-openexr option."
1436 _with_built_openexr=true
1438 # Just always run it, much simpler this way!
1439 run_ldconfig "openexr"
1442 #### Build OIIO ####
1444 _src=$SRC/OpenImageIO-$OIIO_VERSION
1446 _inst=$INST/oiio-$OIIO_VERSION
1447 _inst_shortcut=$INST/oiio
1456 # To be changed each time we make edits that would modify the compiled result!
1460 # Clean install if needed!
1461 magic_compile_check oiio-$OIIO_VERSION $oiio_magic
1462 if [ $? -eq 1 -o "$OIIO_FORCE_REBUILD" = true ]; then
1466 if [ ! -d $_inst ]; then
1467 INFO "Building OpenImageIO-$OIIO_VERSION"
1469 # Rebuild dependecies as well!
1470 OSL_FORCE_BUILD=true
1471 OSL_FORCE_REBUILD=true
1475 if [ ! -d $_src ]; then
1478 if [ "$OIIO_USE_REPO" = true ]; then
1479 git clone ${OIIO_SOURCE_REPO[0]} $_src
1481 download OIIO_SOURCE[@] "$_src.tar.gz"
1482 INFO "Unpacking OpenImageIO-$OIIO_VERSION"
1483 tar -C $SRC --transform "s,(.*/?)oiio-Release-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" -xf $_src.tar.gz
1489 if [ "$OIIO_USE_REPO" = true ]; then
1490 # XXX For now, always update from latest repo...
1491 git pull origin master
1492 # Stick to same rev as windows' libs...
1493 git checkout $OIIO_SOURCE_REPO_UID
1497 # Always refresh the whole build!
1498 if [ -d build ]; then
1504 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1505 cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
1506 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1507 cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
1508 cmake_d="$cmake_d -D BUILDSTATIC=OFF"
1509 cmake_d="$cmake_d -D LINKSTATIC=OFF"
1510 cmake_d="$cmake_d -D USE_SIMD=sse2"
1512 cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
1513 cmake_d="$cmake_d -D OPENEXR_VERSION=$OPENEXR_VERSION"
1515 if [ "$_with_built_openexr" = true ]; then
1516 cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
1517 cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr"
1518 INFO "ILMBASE_HOME=$INST/openexr"
1521 # Optional tests and cmd tools
1522 cmake_d="$cmake_d -D USE_QT=OFF"
1523 cmake_d="$cmake_d -D USE_PYTHON=OFF"
1524 cmake_d="$cmake_d -D USE_FFMPEG=OFF"
1525 cmake_d="$cmake_d -D BUILD_TESTING=OFF"
1526 cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
1527 cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
1528 #cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
1529 #cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
1531 if [ -d $INST/boost ]; then
1532 cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
1535 # Looks like we do not need ocio in oiio for now...
1536 # if [ -d $INST/ocio ]; then
1537 # cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio"
1539 cmake_d="$cmake_d -D USE_OCIO=OFF"
1541 if file /bin/cp | grep -q '32-bit'; then
1542 cflags="-fPIC -m32 -march=i686"
1547 cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ..
1549 make -j$THREADS && make install
1552 if [ -d $_inst ]; then
1553 _create_inst_shortcut
1555 ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
1559 magic_compile_set oiio-$OIIO_VERSION $oiio_magic
1562 INFO "Done compiling OpenImageIO-$OIIO_VERSION!"
1564 INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!"
1565 INFO "If you want to force rebuild of this lib, use the --force-oiio option."
1568 # Just always run it, much simpler this way!
1572 #### Build LLVM ####
1574 _src=$SRC/LLVM-$LLVM_VERSION
1575 _src_clang=$SRC/CLANG-$LLVM_VERSION
1577 _inst=$INST/llvm-$LLVM_VERSION
1578 _inst_shortcut=$INST/llvm
1587 # To be changed each time we make edits that would modify the compiled result!
1591 # Clean install if needed!
1592 magic_compile_check llvm-$LLVM_VERSION $llvm_magic
1593 if [ $? -eq 1 -o "$LLVM_FORCE_REBUILD" = true ]; then
1597 if [ ! -d $_inst ]; then
1598 INFO "Building LLVM-$LLVM_VERSION (CLANG included!)"
1600 # Rebuild dependecies as well!
1601 OSL_FORCE_BUILD=true
1602 OSL_FORCE_REBUILD=true
1606 if [ ! -d $_src -o true ]; then
1608 download LLVM_SOURCE[@] "$_src.tar.gz"
1609 download LLVM_CLANG_SOURCE[@] "$_src_clang.tar.gz"
1611 INFO "Unpacking LLVM-$LLVM_VERSION"
1612 tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
1614 INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang"
1615 # Stupid clang guys renamed 'clang' to 'cfe' for now handle both cases... :(
1616 tar -C $_src/tools \
1617 --transform "s,([^/]*/?)(clang|cfe)-[^/]*(.*),\1clang\3,x" \
1618 -xf $_src_clang.tar.gz
1622 # XXX Ugly patching hack!
1623 patch -p1 -i "$SCRIPT_DIR/install_deps_patches/llvm.patch"
1631 # Always refresh the whole build!
1632 if [ -d build ]; then
1638 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1639 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1640 cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
1641 cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
1642 cmake_d="$cmake_d -D LLVM_ENABLE_TERMINFO=OFF"
1644 if [ -d $_FFI_INCLUDE_DIR ]; then
1645 cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
1650 make -j$THREADS && make install
1653 if [ -d $_inst ]; then
1654 _create_inst_shortcut
1656 ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
1660 magic_compile_set llvm-$LLVM_VERSION $llvm_magic
1663 INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!"
1665 INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
1666 INFO "If you want to force rebuild of this lib, use the --force-llvm option."
1672 _src=$SRC/OpenShadingLanguage-$OSL_VERSION
1674 _inst=$INST/osl-$OSL_VERSION
1675 _inst_shortcut=$INST/osl
1684 # To be changed each time we make edits that would modify the compiled result!
1688 # Clean install if needed!
1689 magic_compile_check osl-$OSL_VERSION $osl_magic
1690 if [ $? -eq 1 -o "$OSL_FORCE_REBUILD" = true ]; then
1691 #~ rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically
1695 if [ ! -d $_inst ]; then
1696 INFO "Building OpenShadingLanguage-$OSL_VERSION"
1700 if [ ! -d $_src ]; then
1703 if [ "$OSL_USE_REPO" = true ]; then
1704 git clone ${OSL_SOURCE_REPO[0]} $_src
1706 download OSL_SOURCE[@] "$_src.tar.gz"
1707 INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
1708 tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
1715 if [ "$OSL_USE_REPO" = true ]; then
1716 git remote set-url origin ${OSL_SOURCE_REPO[0]}
1717 # XXX For now, always update from latest repo...
1718 git pull --no-edit -X theirs origin $OSL_SOURCE_REPO_BRANCH
1719 # Stick to same rev as windows' libs...
1720 git checkout $OSL_SOURCE_REPO_UID
1723 # XXX Ugly patching hack!
1724 patch -p1 -i "$SCRIPT_DIR/install_deps_patches/osl.patch"
1727 # Always refresh the whole build!
1728 if [ -d build ]; then
1734 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1735 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1736 cmake_d="$cmake_d -D BUILD_TESTING=OFF"
1737 cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
1738 cmake_d="$cmake_d -D BUILDSTATIC=OFF"
1739 cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
1740 cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
1741 cmake_d="$cmake_d -D USE_SIMD=sse2"
1743 #~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
1745 if [ "$_with_built_openexr" = true ]; then
1746 INFO "ILMBASE_HOME=$INST/openexr"
1747 cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
1748 # XXX Temp workaround... sigh, ILMBase really messed the things up by defining their custom names ON by default :(
1749 cmake_d="$cmake_d -D ILMBASE_CUSTOM=ON"
1750 cmake_d="$cmake_d -D ILMBASE_CUSTOM_LIBRARIES='Half;Iex;Imath;IlmThread'"
1753 if [ -d $INST/boost ]; then
1754 cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
1757 if [ -d $INST/oiio ]; then
1758 cmake_d="$cmake_d -D OPENIMAGEIOHOME=$INST/oiio"
1761 if [ ! -z $LLVM_VERSION_FOUND ]; then
1762 cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
1763 if [ -d $INST/llvm ]; then
1764 cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
1765 cmake_d="$cmake_d -D LLVM_STATIC=ON"
1769 #~ cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
1770 #~ cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
1774 make -j$THREADS && make install
1777 if [ -d $_inst ]; then
1778 _create_inst_shortcut
1780 ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
1784 magic_compile_set osl-$OSL_VERSION $osl_magic
1787 INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!"
1789 INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!"
1790 INFO "If you want to force rebuild of this lib, use the --force-osl option."
1798 _src=$SRC/OpenSubdiv-$OSD_VERSION
1800 _inst=$INST/osd-$OSD_VERSION
1801 _inst_shortcut=$INST/osd
1810 # To be changed each time we make edits that would modify the compiled result!
1814 # Clean install if needed!
1815 magic_compile_check osd-$OSD_VERSION $osd_magic
1816 if [ $? -eq 1 -o "$OSD_FORCE_REBUILD" = true ]; then
1820 if [ ! -d $_inst ]; then
1821 INFO "Building OpenSubdiv-$OSD_VERSION"
1825 if [ ! -d $_src ]; then
1828 if [ "$OSD_USE_REPO" = true ]; then
1829 git clone ${OSD_SOURCE_REPO[0]} $_src
1831 download OSD_SOURCE[@] "$_src.tar.gz"
1832 INFO "Unpacking OpenSubdiv-$OSD_VERSION"
1833 tar -C $SRC --transform "s,(.*/?)OpenSubdiv-[^/]*(.*),\1OpenSubdiv-$OSD_VERSION\2,x" \
1840 if [ "$OSD_USE_REPO" = true ]; then
1841 git remote set-url origin ${OSD_SOURCE_REPO[0]}
1842 # XXX For now, always update from latest repo...
1843 git pull --no-edit -X theirs origin $OSD_SOURCE_REPO_BRANCH
1844 # Stick to same rev as windows' libs...
1845 git checkout $OSD_SOURCE_REPO_UID
1849 # Always refresh the whole build!
1850 if [ -d build ]; then
1856 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1857 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1858 # ptex is only needed when nicholas bishop is ready
1859 cmake_d="$cmake_d -D NO_PTEX=1"
1860 cmake_d="$cmake_d -D NO_CLEW=1"
1861 # maya plugin, docs, tutorials, regression tests and examples are not needed
1862 cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1"
1866 make -j$THREADS && make install
1869 if [ -d $_inst ]; then
1870 _create_inst_shortcut
1872 ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
1876 magic_compile_set osd-$OSD_VERSION $osd_magic
1879 INFO "Done compiling OpenSubdiv-$OSD_VERSION!"
1881 INFO "Own OpenSubdiv-$OSD_VERSION is up to date, nothing to do!"
1882 INFO "If you want to force rebuild of this lib, use the --force-osd option."
1888 #### Build Blosc ####
1890 _src=$SRC/c-blosc-$OPENVDB_BLOSC_VERSION
1892 _inst=$INST/blosc-$OPENVDB_BLOSC_VERSION
1893 _inst_shortcut=$INST/blosc
1902 # To be changed each time we make edits that would modify the compiled result!
1906 # Clean install if needed!
1907 magic_compile_check blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
1908 if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then
1913 if [ ! -d $_inst ]; then
1914 INFO "Building Blosc-$OPENVDB_BLOSC_VERSION"
1916 # Rebuild dependecies as well!
1917 OPENVDB_FORCE_BUILD=true
1918 OPENVDB_FORCE_REBUILD=true
1922 if [ ! -d $_src ]; then
1923 INFO "Downloading Blosc-$OPENVDB_BLOSC_VERSION"
1925 download OPENVDB_BLOSC_SOURCE[@] $_src.tar.gz
1927 INFO "Unpacking Blosc-$OPENVDB_BLOSC_VERSION"
1928 tar -C $SRC -xf $_src.tar.gz
1932 # Always refresh the whole build!
1933 if [ -d build ]; then
1939 cmake_d="-D CMAKE_BUILD_TYPE=Release"
1940 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
1941 cmake_d="$cmake_d -D BUILD_STATIC=OFF"
1942 cmake_d="$cmake_d -D BUILD_TESTS=OFF"
1943 cmake_d="$cmake_d -D BUILD_BENCHMARKS=OFF"
1948 make -j$THREADS && make install
1952 if [ -d $_inst ]; then
1953 _create_inst_shortcut
1955 ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting"
1959 INFO "Done compiling Blosc-$OPENVDB_BLOSC_VERSION!"
1961 INFO "Own Blosc-$OPENVDB_BLOSC_VERSION is up to date, nothing to do!"
1962 INFO "If you want to force rebuild of this lib (and openexr), use the --force-openvdb option."
1965 magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
1967 run_ldconfig "blosc"
1970 #### Build OpenVDB ####
1972 _src=$SRC/openvdb-$OPENVDB_VERSION
1974 _inst=$INST/openvdb-$OPENVDB_VERSION
1975 _inst_shortcut=$INST/openvdb
1987 # To be changed each time we make edits that would modify the compiled result!
1991 # Clean install if needed!
1992 magic_compile_check openvdb-$OPENVDB_VERSION $openvdb_magic
1993 if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then
1997 if [ ! -d $_inst ]; then
1998 INFO "Building OpenVDB-$OPENVDB_VERSION"
2002 if [ ! -d $_src -o true ]; then
2004 download OPENVDB_SOURCE[@] "$_src.tar.gz"
2006 INFO "Unpacking OpenVDB-$OPENVDB_VERSION"
2007 #~ tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OPENVDB_VERSION\2,x" \
2009 tar -C $SRC -xf $_src.tar.gz
2014 #~ if [ "$OPENVDB_USE_REPO" = true ]; then
2015 #~ git remote set-url origin ${OPENVDB_SOURCE_REPO[0]}
2016 #~ # XXX For now, always update from latest repo...
2017 #~ git pull --no-edit -X theirs origin $OPENVDB_SOURCE_REPO_BRANCH
2018 #~ # Stick to same rev as windows' libs...
2019 #~ git checkout $OPENVDB_SOURCE_REPO_UID
2023 cd openvdb # Grrrrrr...
2025 # Always refresh the whole build!
2026 if [ -d build ]; then
2032 make_d="DESTDIR=$_inst"
2034 if [ -d $INST/boost ]; then
2035 make_d="$make_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
2038 #~ if [ "$_with_built_openexr" = true ]; then
2039 #~ cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
2040 #~ cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr"
2041 #~ INFO "ILMBASE_HOME=$INST/openexr"
2044 #~ cmake_d="-D CMAKE_BUILD_TYPE=Release"
2045 #~ cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
2046 #~ # ptex is only needed when nicholas bishop is ready
2047 #~ cmake_d="$cmake_d -D NO_PTEX=1"
2048 #~ cmake_d="$cmake_d -D NO_CLEW=1"
2049 #~ # maya plugin, docs, tutorials, regression tests and examples are not needed
2050 #~ cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1"
2052 #~ cmake $cmake_d ..
2054 #~ make -j$THREADS && make install
2057 #~ if [ -d $_inst ]; then
2058 #~ _create_inst_shortcut
2060 #~ ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
2064 #~ magic_compile_set osd-$OSD_VERSION $osd_magic
2067 INFO "Done compiling OpenVDB-$OPENVDB_VERSION!"
2069 INFO "Own OpenVDB-$OPENVDB_VERSION is up to date, nothing to do!"
2070 INFO "If you want to force rebuild of this lib, use the --force-openvdb option."
2073 run_ldconfig "openvdb"
2076 #### Build OpenCOLLADA ####
2077 _init_opencollada() {
2078 _src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
2080 _inst=$INST/opencollada-$OPENCOLLADA_VERSION
2081 _inst_shortcut=$INST/opencollada
2084 clean_OpenCOLLADA() {
2089 compile_OpenCOLLADA() {
2090 # To be changed each time we make edits that would modify the compiled results!
2094 # Clean install if needed!
2095 magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic
2096 if [ $? -eq 1 -o "$OPENCOLLADA_FORCE_REBUILD" = true ]; then
2100 if [ ! -d $_inst ]; then
2101 INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION"
2105 if [ ! -d $_src ]; then
2107 git clone $OPENCOLLADA_SOURCE $_src
2112 # XXX For now, always update from latest repo...
2113 git pull origin $OPENCOLLADA_REPO_BRANCH
2115 # Stick to same rev as windows' libs...
2116 git checkout $OPENCOLLADA_REPO_UID
2119 # Always refresh the whole build!
2120 if [ -d build ]; then
2126 cmake_d="-D CMAKE_BUILD_TYPE=Release"
2127 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
2128 cmake_d="$cmake_d -D USE_EXPAT=OFF"
2129 cmake_d="$cmake_d -D USE_LIBXML=ON"
2130 # XXX Does not work!
2131 # cmake_d="$cmake_d -D USE_STATIC=OFF"
2132 cmake_d="$cmake_d -D USE_STATIC=ON"
2136 make -j$THREADS && make install
2139 if [ -d $_inst ]; then
2140 _create_inst_shortcut
2142 ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
2146 magic_compile_set opencollada-$OPENCOLLADA_VERSION $opencollada_magic
2149 INFO "Done compiling OpenCOLLADA-$OPENCOLLADA_VERSION!"
2151 INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
2152 INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
2156 #### Build FFMPEG ####
2158 _src=$SRC/ffmpeg-$FFMPEG_VERSION
2159 _inst=$INST/ffmpeg-$FFMPEG_VERSION
2160 _inst_shortcut=$INST/ffmpeg
2169 # To be changed each time we make edits that would modify the compiled result!
2173 # Clean install if needed!
2174 magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
2175 if [ $? -eq 1 -o "$FFMPEG_FORCE_REBUILD" = true ]; then
2179 if [ ! -d $_inst ]; then
2180 INFO "Building ffmpeg-$FFMPEG_VERSION"
2184 if [ ! -d $_src ]; then
2185 INFO "Downloading ffmpeg-$FFMPEG_VERSION"
2187 download FFMPEG_SOURCE[@] "$_src.tar.bz2"
2189 INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
2190 tar -C $SRC -xf $_src.tar.bz2
2197 if [ "$VORBIS_USE" = true ]; then
2198 extra="$extra --enable-libvorbis"
2201 if [ "$THEORA_USE" = true ]; then
2202 extra="$extra --enable-libtheora"
2205 if [ "$XVID_USE" = true ]; then
2206 extra="$extra --enable-libxvid"
2209 if [ "$X264_USE" = true ]; then
2210 extra="$extra --enable-libx264"
2213 if [ "$VPX_USE" = true ]; then
2214 extra="$extra --enable-libvpx"
2217 if [ "$MP3LAME_USE" = true ]; then
2218 extra="$extra --enable-libmp3lame"
2221 if [ "$OPENJPEG_USE" = true ]; then
2222 extra="$extra --enable-libopenjpeg"
2225 ./configure --cc="gcc -Wl,--as-needed" \
2226 --extra-ldflags="-pthread -static-libgcc" \
2227 --prefix=$_inst --enable-static \
2228 --disable-ffplay --disable-ffserver --disable-doc \
2230 --enable-avfilter --disable-vdpau \
2231 --disable-bzlib --disable-libgsm --disable-libspeex \
2232 --enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
2233 --disable-vaapi --disable-libfaac --disable-nonfree --enable-gpl \
2234 --disable-postproc --disable-librtmp --disable-libopencore-amrnb \
2235 --disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
2237 --disable-outdev=xv \
2238 --disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
2239 --disable-indev=lavfi $extra
2241 make -j$THREADS && make install
2244 if [ -d $_inst ]; then
2245 _create_inst_shortcut
2247 ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
2251 magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
2254 INFO "Done compiling ffmpeg-$FFMPEG_VERSION!"
2256 INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
2257 INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
2262 #### Install on DEB-like ####
2263 get_package_version_DEB() {
2264 dpkg-query -W -f '${Version}' $1 | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'
2267 check_package_DEB() {
2268 r=`apt-cache show $1 | grep -c 'Package:'`
2270 if [ $r -ge 1 ]; then
2277 check_package_installed_DEB() {
2278 r=`dpkg-query -W -f='${Status}' $1 | grep -c "install ok"`
2280 if [ $r -ge 1 ]; then
2287 check_package_version_match_DEB() {
2288 v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'`
2290 if [ -z "$v" ]; then
2298 check_package_version_ge_DEB() {
2299 v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
2301 if [ -z "$v" ]; then
2309 check_package_version_ge_lt_DEB() {
2310 v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
2312 if [ -z "$v" ]; then
2316 version_ge_lt $v $2 $3
2320 install_packages_DEB() {
2321 if [ ! $SUDO ]; then
2322 WARNING "--no-sudo enabled, impossible to run apt-get install for $@, you'll have to do it yourself..."
2324 $SUDO apt-get install -y --force-yes $@
2325 if [ $? -ge 1 ]; then
2326 ERROR "apt-get failed to install requested packages, exiting."
2334 INFO "Installing dependencies for DEB-based distribution"
2336 PRINT "`eval _echo "$COMMON_INFO"`"
2339 if [ "$NO_CONFIRM" = false ]; then
2340 read -p "Do you want to continue (Y/n)?"
2341 [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
2344 if [ ! -z "`cat /etc/debian_version | grep ^6`" ]; then
2345 if [ -z "`cat /etc/apt/sources.list | grep backports.debian.org`" ]; then
2346 WARNING "Looks like you're using Debian Squeeze which does have broken CMake"
2347 PRINT "It is highly recommended to install cmake from backports, otherwise"
2348 PRINT "compilation of some libraries could fail"
2350 PRINT "You could install newer CMake from debian-backports repository"
2351 PRINT "Add this this line to your /etc/apt/sources.lixt:"
2353 PRINT "deb http://backports.debian.org/debian-backports squeeze-backports main"
2355 PRINT "and then run:"
2357 PRINT "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"
2359 PRINT "(you could also add this reporisotry using GUI like synaptic)"
2361 PRINT "Hit Enter to continue running the script, or hit Ctrl-C to abort the script"
2368 if [ ! $SUDO ]; then
2369 WARNING "--no-sudo enabled, impossible to run apt-get update, you'll have to do it yourself..."
2371 $SUDO apt-get update
2374 # These libs should always be available in debian/ubuntu official repository...
2375 OPENJPEG_DEV="libopenjpeg-dev"
2376 VORBIS_DEV="libvorbis-dev"
2377 OGG_DEV="libogg-dev"
2378 THEORA_DEV="libtheora-dev"
2380 _packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev \
2381 libfreetype6-dev libx11-dev \
2382 libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
2383 libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
2384 libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
2385 libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev"
2392 PRINT "$LIBYAML_CPP_VER"
2393 # Some not-so-old distro (ubuntu 12.4) do not have it, do not fail in this case, just warn.
2394 YAMLCPP_DEV="libyaml-cpp-dev"
2395 check_package_DEB $YAMLCPP_DEV
2396 if [ $? -eq 0 ]; then
2397 # Another Ubuntu hack - in 14.4, ocio uses (old) 0.3, while default is now 0.5... grrrrr.
2398 if $LIBYAML_CPP_VER_DEFINED; then
2399 YAMLCPP_VER_DEV="libyaml-cpp$LIBYAML_CPP_VER-dev"
2400 check_package_DEB $YAMLCPP_VER_DEV
2401 if [ $? -eq 0 ]; then
2402 YAMLCPP_DEV=$YAMLCPP_VER_DEV
2405 WARNING "libyaml-cpp$LIBYAML_CPP_VER-dev not found!"
2409 _packages="$_packages $YAMLCPP_DEV"
2412 WARNING "libyaml-cpp-dev not found, you may have to install it by hand to get Blender compiling..."
2416 # Install newest libtiff-dev in debian/ubuntu.
2418 check_package_DEB $TIFF
2419 if [ $? -eq 0 ]; then
2420 _packages="$_packages $TIFF-dev"
2423 check_package_DEB $TIFF
2424 if [ $? -eq 0 ]; then
2425 _packages="$_packages $TIFF-dev"
2427 TIFF="libtiff4" # Some old distro, like e.g. ubuntu 10.04 :/
2428 check_package_DEB $TIFF
2429 if [ $? -eq 0 ]; then
2430 _packages="$_packages $TIFF-dev"
2436 check_package_DEB $GIT
2437 if [ $? -eq 0 ]; then
2438 _packages="$_packages $GIT"
2440 GIT="git-core" # Some old distro, like e.g. ubuntu 10.04 :/
2441 check_package_DEB $GIT
2442 if [ $? -eq 0 ]; then
2443 _packages="$_packages $GIT"
2447 if [ "$WITH_ALL" = true ]; then
2448 _packages="$_packages libspnav-dev"
2449 # Only install jack if jack2 is not already installed!
2451 JACK2="libjack-jackd2-dev"
2452 check_package_installed_DEB $JACK2
2453 if [ $? -eq 0 ]; then
2454 _packages="$_packages $JACK2"
2456 _packages="$_packages $JACK"
2461 install_packages_DEB $_packages
2464 SNDFILE_DEV="libsndfile1-dev"
2465 check_package_DEB $SNDFILE_DEV
2466 if [ $? -eq 0 ]; then
2467 install_packages_DEB $SNDFILE_DEV
2471 X264_DEV="libx264-dev"
2472 check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN
2473 if [ $? -eq 0 ]; then
2474 install_packages_DEB $X264_DEV
2478 if [ "$WITH_ALL" = true ]; then
2480 # Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev!
2481 # Note: not since ubuntu 10.04
2482 XVID_DEV="libxvidcore-dev"
2483 check_package_DEB $XVID_DEV
2484 if [ $? -eq 0 ]; then
2485 install_packages_DEB $XVID_DEV
2488 XVID_DEV="libxvidcore4-dev"
2489 check_package_DEB $XVID_DEV
2490 if [ $? -eq 0 ]; then
2491 install_packages_DEB $XVID_DEV
2497 MP3LAME_DEV="libmp3lame-dev"
2498 check_package_DEB $MP3LAME_DEV
2499 if [ $? -eq 0 ]; then
2500 install_packages_DEB $MP3LAME_DEV
2505 VPX_DEV="libvpx-dev"
2506 check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN
2507 if [ $? -eq 0 ]; then
2508 install_packages_DEB $VPX_DEV
2515 _do_compile_python=false
2516 if [ "$PYTHON_SKIP" = true ]; then
2517 WARNING "Skipping Python/NumPy installation, as requested..."
2518 elif [ "$PYTHON_FORCE_BUILD" = true ]; then
2519 INFO "Forced Python/NumPy building, as requested..."
2520 _do_compile_python=true
2522 check_package_DEB python$PYTHON_VERSION_MIN-dev
2523 if [ $? -eq 0 ]; then
2524 install_packages_DEB python$PYTHON_VERSION_MIN-dev
2527 if [ "$NUMPY_SKIP" = true ]; then
2528 WARNING "Skipping NumPy installation, as requested..."
2530 check_package_DEB python3-numpy
2531 if [ $? -eq 0 ]; then
2532 install_packages_DEB python3-numpy
2534 WARNING "Sorry, using python package but no valid numpy package available!" \
2535 " Use --build-numpy to force building of both Python and NumPy."
2539 _do_compile_python=true
2543 if $_do_compile_python; then
2546 if [ "$NUMPY_SKIP" = true ]; then
2547 WARNING "Skipping NumPy installation, as requested..."
2555 if [ "$BOOST_SKIP" = true ]; then
2556 WARNING "Skipping Boost installation, as requested..."
2557 elif [ "$BOOST_FORCE_BUILD" = true ]; then
2558 INFO "Forced Boost building, as requested..."
2561 check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN
2562 if [ $? -eq 0 ]; then
2563 install_packages_DEB libboost-dev
2565 boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
2567 check_package_DEB libboost-locale$boost_version-dev
2568 if [ $? -eq 0 ]; then
2569 install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
2570 libboost-regex$boost_version-dev libboost-system$boost_version-dev \
2571 libboost-thread$boost_version-dev libboost-wave$boost_version-dev
2583 if [ "$OCIO_SKIP" = true ]; then
2584 WARNING "Skipping OpenColorIO installation, as requested..."
2585 elif [ "$OCIO_FORCE_BUILD" = true ]; then
2586 INFO "Forced OpenColorIO building, as requested..."
2589 # XXX Always force build of own OCIO, until linux distro guys update their package to default libyaml-cpp ver (0.5)!
2590 #check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
2591 #if [ $? -eq 0 ]; then
2592 #install_packages_DEB libopencolorio-dev
2601 if [ "$OPENEXR_SKIP" = true ]; then
2602 WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
2603 elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
2604 INFO "Forced ILMBase/OpenEXR building, as requested..."
2607 check_package_version_ge_DEB libopenexr-dev $OPENEXR_VERSION_MIN
2608 if [ $? -eq 0 ]; then
2609 install_packages_DEB libopenexr-dev
2610 OPENEXR_VERSION=`get_package_version_DEB libopenexr-dev`
2611 ILMBASE_VERSION=$OPENEXR_VERSION
2620 if [ "$OIIO_SKIP" = true ]; then
2621 WARNING "Skipping OpenImageIO installation, as requested..."
2622 elif [ "$OIIO_FORCE_BUILD" = true ]; then
2623 INFO "Forced OpenImageIO building, as requested..."
2626 check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
2627 if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then
2628 install_packages_DEB libopenimageio-dev
2638 _do_compile_llvm=false
2639 if [ "$LLVM_SKIP" = true ]; then
2640 WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
2641 elif [ "$LLVM_FORCE_BUILD" = true ]; then
2642 INFO "Forced LLVM building, as requested..."
2643 _do_compile_llvm=true
2645 check_package_DEB llvm-$LLVM_VERSION-dev
2646 if [ $? -eq 0 ]; then
2647 install_packages_DEB llvm-$LLVM_VERSION-dev clang-$LLVM_VERSION
2649 LLVM_VERSION_FOUND=$LLVM_VERSION
2652 check_package_version_ge_DEB llvm-dev $LLVM_VERSION_MIN
2653 if [ $? -eq 0 ]; then
2654 install_packages_DEB llvm-dev clang
2656 LLVM_VERSION_FOUND="" # Using default one, no need to specify it!
2659 _do_compile_llvm=true
2664 if [ "$_do_compile_llvm" = true ]; then
2665 install_packages_DEB libffi-dev
2666 # LLVM can't find the debian ffi header dir
2667 _FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
2671 LLVM_VERSION_FOUND=$LLVM_VERSION
2676 _do_compile_osl=false
2677 if [ "$OSL_SKIP" = true ]; then
2678 WARNING "Skipping OpenShadingLanguage installation, as requested..."
2679 elif [ "$OSL_FORCE_BUILD" = true ]; then
2680 INFO "Forced OpenShadingLanguage building, as requested..."
2681 _do_compile_osl=true
2683 # No package currently!
2684 _do_compile_osl=true
2687 if [ "$_do_compile_osl" = true ]; then
2688 if [ "$have_llvm" = true ]; then
2689 install_packages_DEB flex bison libtbb-dev
2693 WARNING "No LLVM available, cannot build OSL!"
2699 _do_compile_osd=false
2700 if [ "$OSD_SKIP" = true ]; then
2701 WARNING "Skipping OpenSubdiv installation, as requested..."
2702 elif [ "$OSD_FORCE_BUILD" = true ]; then
2703 INFO "Forced OpenSubdiv building, as requested..."
2704 _do_compile_osd=true
2706 # No package currently!
2707 _do_compile_osd=true
2710 if [ "$_do_compile_osd" = true ]; then
2711 install_packages_DEB flex bison libtbb-dev
2717 if [ "$WITH_OPENCOLLADA" = true ]; then
2718 _do_compile_collada=false
2720 if [ "$OPENCOLLADA_SKIP" = true ]; then
2721 WARNING "Skipping OpenCOLLADA installation, as requested..."
2722 elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
2723 INFO "Forced OpenCollada building, as requested..."
2724 _do_compile_collada=true
2726 # No package currently!
2727 _do_compile_collada=true
2730 if [ "$_do_compile_collada" = true ]; then
2731 install_packages_DEB libpcre3-dev
2732 # Find path to libxml shared lib...
2733 _XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"`
2742 if [ "$FFMPEG_SKIP" = true ]; then
2743 WARNING "Skipping FFMpeg installation, as requested..."
2744 elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
2745 INFO "Forced FFMpeg building, as requested..."
2748 # XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/
2749 # So for now, always build our own ffmpeg.
2750 # check_package_DEB ffmpeg
2751 # if [ $? -eq 0 ]; then
2752 # install_packages_DEB ffmpeg
2753 # ffmpeg_version=`get_package_version_DEB ffmpeg`
2754 # PRINT "ffmpeg version: $ffmpeg_version"
2755 # if [ ! -z "$ffmpeg_version" ]; then
2756 # if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then
2757 # install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
2769 #### Install on RPM-like ####
2771 if [ -f /etc/redhat-release ]; then
2772 if [ "`grep '6\.' /etc/redhat-release`" ]; then
2777 elif [ -f /etc/SuSE-release ]; then
2782 get_package_version_RPM() {
2784 if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
2785 yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
2786 elif [ "$RPM" = "SUSE" ]; then
2787 zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
2791 check_package_RPM() {
2793 if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
2794 r=`yum info $1 | grep -c 'Summary'`
2795 elif [ "$RPM" = "SUSE" ]; then
2796 r=`zypper info $1 | grep -c 'Summary'`
2799 if [ $r -ge 1 ]; then
2806 check_package_version_match_RPM() {
2807 v=`get_package_version_RPM $1`
2809 if [ -z "$v" ]; then
2817 check_package_version_ge_RPM() {
2818 v=`get_package_version_RPM $1`
2820 if [ -z "$v" ]; then
2828 check_package_version_ge_lt_RPM() {
2829 v=`get_package_version_RPM $1`
2831 if [ -z "$v" ]; then
2835 version_ge_lt $v $2 $3
2839 install_packages_RPM() {
2841 if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
2842 if [ ! $SUDO ]; then
2843 WARNING "--no-sudo enabled, impossible to run yum install for $@, you'll have to do it yourself..."
2845 $SUDO yum install -y $@
2846 if [ $? -ge 1 ]; then
2847 ERROR "yum failed to install requested packages, exiting."
2852 elif [ "$RPM" = "SUSE" ]; then
2853 if [ ! $SUDO ]; then
2854 WARNING "--no-sudo enabled, impossible to run zypper install for $@, you'll have to do it yourself..."
2856 $SUDO zypper --non-interactive install --auto-agree-with-licenses $@
2857 if [ $? -ge 1 ]; then
2858 ERROR "zypper failed to install requested packages, exiting."
2867 INFO "Installing dependencies for RPM-based distribution"
2869 PRINT "`eval _echo "$COMMON_INFO"`"
2872 if [ "$NO_CONFIRM" = false ]; then
2873 read -p "Do you want to continue (Y/n)?"
2874 [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
2877 # Enable non-free repositories for all flavours
2878 if [ ! $SUDO ]; then
2879 WARNING "--no-sudo enabled, impossible to install third party repositories, you'll have to do it yourself..."
2882 if [ "$RPM" = "FEDORA" ]; then
2883 _fedora_rel="`egrep "[0-9]{1,}" /etc/fedora-release -o`"
2884 $SUDO yum -y localinstall --nogpgcheck \
2885 http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$_fedora_rel.noarch.rpm \
2886 http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$_fedora_rel.noarch.rpm
2890 # Install cmake now because of difference with RHEL
2891 $SUDO yum -y install cmake
2893 elif [ "$RPM" = "RHEL" ]; then
2894 $SUDO yum -y localinstall --nogpgcheck \
2895 http://download.fedoraproject.org/pub/epel/6/$(uname -i)/epel-release-6-8.noarch.rpm \
2896 http://download1.rpmfusion.org/free/el/updates/6/$(uname -i)/rpmfusion-free-release-6-1.noarch.rpm \
2897 http://download1.rpmfusion.org/nonfree/el/updates/6/$(uname -i)/rpmfusion-nonfree-release-6-1.noarch.rpm
2901 # Install cmake 2.8 from other repo
2903 if [ -f $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm ]; then
2905 INFO "Special cmake already installed"
2907 curl -O ftp://ftp.pbone.net/mirror/atrpms.net/el6-$(uname -i)/atrpms/testing/cmake-2.8.8-4.el6.$(uname -m).rpm
2908 mv cmake-2.8.8-4.el6.$(uname -m).rpm $SRC/
2909 $SUDO rpm -ihv $SRC/cmake-2.8.8-4.el6.$(uname -m).rpm
2912 elif [ "$RPM" = "SUSE" ]; then
2913 # Install this now to avoid using the version from packman repository...
2914 if [ "$WITH_ALL" = true ]; then
2915 install_packages_RPM libjack-devel
2918 _suse_rel="`grep VERSION /etc/SuSE-release | gawk '{print $3}'`"
2921 INFO "About to add 'packman' repository from http://packman.inode.at/suse/openSUSE_$_suse_rel/"
2922 INFO "This is only needed if you do not already have a packman repository enabled..."
2923 read -p "Do you want to add this repo (Y/n)?"
2924 if [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" == "y" ]; then
2925 INFO " Installing packman..."
2926 $SUDO zypper ar --refresh --name 'Packman Repository' http://ftp.gwdg.de/pub/linux/packman/suse/openSUSE_$_suse_rel/ ftp.gwdg.de-suse
2929 INFO " Skipping packman installation."
2931 $SUDO zypper --non-interactive --gpg-auto-import-keys update --auto-agree-with-licenses
2935 # These libs should always be available in fedora/suse official repository...
2936 OPENJPEG_DEV="openjpeg-devel"
2937 VORBIS_DEV="libvorbis-devel"
2938 OGG_DEV="libogg-devel"
2939 THEORA_DEV="libtheora-devel"
2941 _packages="gcc gcc-c++ git make cmake libtiff-devel libjpeg-devel\
2942 libpng-devel libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
2943 wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
2944 glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
2945 libxml2-devel yaml-cpp-devel tinyxml-devel"
2952 if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
2953 OPENEXR_DEV="openexr-devel"
2955 _packages="$_packages freetype-devel libsqlite3x-devel fftw-devel SDL-devel"
2957 if [ "$WITH_ALL" = true ]; then
2958 _packages="$_packages jack-audio-connection-kit-devel"
2962 install_packages_RPM $_packages
2965 X264_DEV="x264-devel"
2966 check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
2967 if [ $? -eq 0 ]; then
2968 install_packages_RPM $X264_DEV
2972 if [ "$WITH_ALL" = true ]; then
2974 XVID_DEV="xvidcore-devel"
2975 check_package_RPM $XVID_DEV
2976 if [ $? -eq 0 ]; then
2977 install_packages_RPM $XVID_DEV
2982 MP3LAME_DEV="lame-devel"
2983 check_package_RPM $MP3LAME_DEV
2984 if [ $? -eq 0 ]; then
2985 install_packages_RPM $MP3LAME_DEV
2990 elif [ "$RPM" = "SUSE" ]; then
2991 OPENEXR_DEV="libopenexr-devel"
2993 _packages="$_packages cmake freetype2-devel sqlite3-devel fftw3-devel libSDL-devel"
2996 install_packages_RPM $_packages
2999 X264_DEV="libx264-devel"
3000 check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN
3001 if [ $? -eq 0 ]; then
3002 install_packages_RPM $X264_DEV
3006 if [ "$WITH_ALL" = true ]; then
3008 XVID_DEV="libxvidcore-devel"
3009 check_package_RPM $XVID_DEV
3010 if [ $? -eq 0 ]; then
3011 install_packages_RPM $XVID_DEV
3016 MP3LAME_DEV="libmp3lame-devel"
3017 check_package_RPM $MP3LAME_DEV
3018 if [ $? -eq 0 ]; then
3019 install_packages_RPM $MP3LAME_DEV
3026 SNDFILE_DEV="libsndfile-devel"
3027 check_package_RPM $SNDFILE_DEV
3028 if [ $? -eq 0 ]; then
3029 install_packages_RPM $SNDFILE_DEV
3032 if [ "$WITH_ALL" = true ]; then
3034 VPX_DEV="libvpx-devel"
3035 check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN
3036 if [ $? -eq 0 ]; then
3037 install_packages_RPM $VPX_DEV
3041 install_packages_RPM libspnav-devel
3046 _do_compile_python=false
3047 if [ "$PYTHON_SKIP" = true ]; then
3048 WARNING "Skipping Python installation, as requested..."
3049 elif [ "$PYTHON_FORCE_BUILD" = true ]; then
3050 INFO "Forced Python/NumPy building, as requested..."
3051 _do_compile_python=true
3053 check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
3054 if [ $? -eq 0 ]; then
3055 install_packages_RPM python3-devel
3058 if [ "$NUMPY_SKIP" = true ]; then
3059 WARNING "Skipping NumPy installation, as requested..."
3061 check_package_version_ge_RPM python3-numpy $NUMPY_VERSION_MIN
3062 if [ $? -eq 0 ]; then
3063 install_packages_RPM python3-numpy
3065 WARNING "Sorry, using python package but no valid numpy package available!" \
3066 " Use --build-numpy to force building of both Python and NumPy."
3070 _do_compile_python=true
3074 if [ "$_do_compile_python" = true ]; then
3077 if [ "$NUMPY_SKIP" = true ]; then
3078 WARNING "Skipping NumPy installation, as requested..."
3086 if [ "$BOOST_SKIP" = true ]; then
3087 WARNING "Skipping Boost installation, as requested..."
3088 elif [ "$BOOST_FORCE_BUILD" = true ]; then
3089 INFO "Forced Boost building, as requested..."
3092 check_package_version_ge_RPM boost-devel $BOOST_VERSION
3093 if [ $? -eq 0 ]; then
3094 install_packages_RPM boost-devel
3103 if [ "$OCIO_SKIP" = true ]; then
3104 WARNING "Skipping OpenColorIO installation, as requested..."
3105 elif [ "$OCIO_FORCE_BUILD" = true ]; then
3106 INFO "Forced OpenColorIO building, as requested..."
3109 # XXX Always force build of own OCIO, until linux distro guys update their package to default libyaml-cpp ver (0.5)!
3110 #check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
3111 #if [ $? -eq 0 ]; then
3112 #install_packages_RPM OpenColorIO-devel
3120 if [ "$OPENEXR_SKIP" = true ]; then
3121 WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
3122 elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
3123 INFO "Forced ILMBase/OpenEXR building, as requested..."
3126 check_package_version_ge_RPM $OPENEXR_DEV $OPENEXR_VERSION_MIN
3127 if [ $? -eq 0 ]; then
3128 install_packages_RPM $OPENEXR_DEV
3129 OPENEXR_VERSION=`get_package_version_RPM $OPENEXR_DEV`
3130 ILMBASE_VERSION=$OPENEXR_VERSION
3138 if [ "$OIIO_SKIP" = true ]; then
3139 WARNING "Skipping OpenImageIO installation, as requested..."
3140 elif [ "$OIIO_FORCE_BUILD" = true ]; then
3141 INFO "Forced OpenImageIO building, as requested..."
3144 check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
3145 if [ $? -eq 0 -a $_with_built_openexr == false ]; then
3146 install_packages_RPM OpenImageIO-devel
3156 _do_compile_llvm=false
3157 if [ "$LLVM_SKIP" = true ]; then
3158 WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
3159 elif [ "$LLVM_FORCE_BUILD" = true ]; then
3160 INFO "Forced LLVM building, as requested..."
3161 _do_compile_llvm=true
3163 # Problem compiling with LLVM 3.2 so match version 3.1 ...
3164 check_package_version_match_RPM llvm $LLVM_VERSION
3165 if [ $? -eq 0 ]; then
3166 if [ "$RPM" = "SUSE" ]; then
3167 install_packages_RPM llvm-devel llvm-clang-devel
3169 install_packages_RPM llvm-devel clang-devel
3172 LLVM_VERSION_FOUND=$LLVM_VERSION
3176 # Better to compile it than use minimum version from repo...
3178 _do_compile_llvm=true
3182 if [ "$_do_compile_llvm" = true ]; then
3183 install_packages_RPM libffi-devel
3184 # LLVM can't find the fedora ffi header dir...
3185 _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
3189 LLVM_VERSION_FOUND=$LLVM_VERSION
3194 _do_compile_osl=false
3195 if [ "$OSL_SKIP" = true ]; then
3196 WARNING "Skipping OpenShadingLanguage installation, as requested..."
3197 elif [ "$OSL_FORCE_BUILD" = true ]; then
3198 INFO "Forced OpenShadingLanguage building, as requested..."
3199 _do_compile_osl=true
3201 # No package currently!
3202 _do_compile_osl=true
3205 if [ "$_do_compile_osl" = true ]; then
3206 if [ "$have_llvm" = true ]; then
3207 install_packages_RPM flex bison
3208 if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
3209 install_packages_RPM tbb-devel
3214 WARNING "No LLVM available, cannot build OSL!"
3220 _do_compile_osd=false
3221 if [ "$OSD_SKIP" = true ]; then
3222 WARNING "Skipping OpenSubdiv installation, as requested..."
3223 elif [ "$OSD_FORCE_BUILD" = true ]; then
3224 INFO "Forced OpenSubdiv building, as requested..."
3225 _do_compile_osd=true
3227 # No package currently!
3228 _do_compile_osd=true
3231 if [ "$_do_compile_osd" = true ]; then
3232 install_packages_RPM flex bison
3233 if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then
3234 install_packages_RPM tbb-devel
3241 if [ "$WITH_OPENCOLLADA" = true ]; then
3243 _do_compile_collada=false
3244 if [ "$OPENCOLLADA_SKIP" = true ]; then
3245 WARNING "Skipping OpenCOLLADA installation, as requested..."
3246 elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
3247 INFO "Forced OpenCollada building, as requested..."
3248 _do_compile_collada=true
3251 _do_compile_collada=true
3254 if [ "$_do_compile_collada" = true ]; then
3255 install_packages_RPM pcre-devel
3256 # Find path to libxml shared lib...
3257 _XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"`
3265 if [ "$FFMPEG_SKIP" = true ]; then
3266 WARNING "Skipping FFMpeg installation, as requested..."
3267 elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
3268 INFO "Forced FFMpeg building, as requested..."
3271 check_package_version_ge_RPM ffmpeg $FFMPEG_VERSION_MIN
3272 if [ $? -eq 0 ]; then
3273 install_packages_RPM ffmpeg ffmpeg-devel
3282 #### Install on ARCH-like ####
3283 get_package_version_ARCH() {
3284 pacman -Si $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
3287 check_package_ARCH() {
3288 r=`pacman -Si $1 | grep -c 'Description'`
3290 if [ $r -ge 1 ]; then
3297 check_package_version_match_ARCH() {
3298 v=`get_package_version_ARCH $1`
3300 if [ -z "$v" ]; then
3308 check_package_version_ge_ARCH() {
3309 v=`get_package_version_ARCH $1`
3311 if [ -z "$v" ]; then
3319 check_package_version_ge_lt_ARCH() {
3320 v=`get_package_version_ARCH $1`
3322 if [ -z "$v" ]; then
3326 version_ge_lt $v $2 $3
3330 install_packages_ARCH() {
3331 if [ ! $SUDO ]; then
3332 WARNING "--no-sudo enabled, impossible to run pacman for $@, you'll have to do it yourself..."
3334 $SUDO pacman -S --needed --noconfirm $@
3335 if [ $? -ge 1 ]; then
3336 ERROR "pacman failed to install requested packages, exiting."
3344 INFO "Installing dependencies for ARCH-based distribution"
3346 PRINT "`eval _echo "$COMMON_INFO"`"
3349 if [ "$NO_CONFIRM" = false ]; then
3350 read -p "Do you want to continue (Y/n)?"
3351 [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
3356 if [ ! -x "/usr/bin/sudo" ]; then
3358 ERROR "This script requires sudo but it is not installed."
3359 PRINT "Please setup sudo according to:"
3360 PRINT "https://wiki.archlinux.org/index.php/Sudo"
3361 PRINT "and try again."
3367 if [ ! $SUDO ]; then
3368 WARNING "--no-sudo enabled, impossible to run pacman -Sy, you'll have to do it yourself..."
3373 # These libs should always be available in arch official repository...
3374 OPENJPEG_DEV="openjpeg"
3375 VORBIS_DEV="libvorbis"
3377 THEORA_DEV="libtheora"
3379 _packages="base-devel git cmake \
3380 libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
3381 $OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw \
3382 libxml2 yaml-cpp tinyxml"
3389 if [ "$WITH_ALL" = true ]; then
3390 # No libspacenav in official arch repos...
3391 _packages="$_packages jack"
3395 install_packages_ARCH $_packages
3398 SNDFILE_DEV="libsndfile"
3399 check_package_ARCH $SNDFILE_DEV
3400 if [ $? -eq 0 ]; then
3401 install_packages_ARCH $SNDFILE_DEV
3406 check_package_version_ge_ARCH $X264_DEV $X264_VERSION_MIN
3407 if [ $? -eq 0 ]; then
3408 install_packages_ARCH $X264_DEV
3412 if [ "$WITH_ALL" = true ]; then
3415 check_package_ARCH $XVID_DEV
3416 if [ $? -eq 0 ]; then
3417 install_packages_ARCH $XVID_DEV
3423 check_package_ARCH $MP3LAME_DEV
3424 if [ $? -eq 0 ]; then
3425 install_packages_ARCH $MP3LAME_DEV
3431 check_package_version_ge_ARCH $VPX_DEV $VPX_VERSION_MIN
3432 if [ $? -eq 0 ]; then
3433 install_packages_ARCH $VPX_DEV
3440 _do_compile_python=false
3441 if [ "$PYTHON_SKIP" = true ]; then
3442 WARNING "Skipping Python installation, as requested..."
3443 elif [ "$PYTHON_FORCE_BUILD" = true ]; then
3444 INFO "Forced Python/NumPy building, as requested..."
3445 _do_compile_python=true
3447 check_package_version_ge_ARCH python $PYTHON_VERSION_MIN
3448 if [ $? -eq 0 ]; then
3449 install_packages_ARCH python
3452 if [ "$WITH_NUMPY" = true ]; then
3453 if [ "$NUMPY_SKIP" = true ]; then
3454 WARNING "Skipping NumPy installation, as requested..."
3456 check_package_version_ge_ARCH python-numpy $NUMPY_VERSION_MIN
3457 if [ $? -eq 0 ]; then
3458 install_packages_ARCH python-numpy
3460 WARNING "Sorry, using python package but no valid numpy package available!" \
3461 " Use --build-numpy to force building of both Python and NumPy."
3466 _do_compile_python=true
3470 if [ "$_do_compile_python" = true ]; then
3473 if [ "$NUMPY_SKIP" = true ]; then
3474 WARNING "Skipping NumPy installation, as requested..."
3482 if [ "$BOOST_SKIP" = true ]; then
3483 WARNING "Skipping Boost installation, as requested..."
3484 elif [ "$BOOST_FORCE_BUILD" = true ]; then
3485 INFO "Forced Boost building, as requested..."
3488 check_package_version_ge_ARCH boost $BOOST_VERSION_MIN
3489 if [ $? -eq 0 ]; then
3490 install_packages_ARCH boost
3498 _do_compile_ocio=false
3499 if [ "$OCIO_SKIP" = true ]; then
3500 WARNING "Skipping OpenColorIO installation, as requested..."
3501 elif [ "$OCIO_FORCE_BUILD" = true ]; then
3502 INFO "Forced OpenColorIO building, as requested..."
3503 _do_compile_ocio=true
3505 # XXX Always force build of own OCIO, until linux distro guys update their package to default libyaml-cpp ver (0.5)!
3506 #check_package_version_ge_ARCH opencolorio $OCIO_VERSION_MIN
3507 #if [ $? -eq 0 ]; then
3508 #install_packages_ARCH opencolorio yaml-cpp tinyxml
3511 _do_compile_ocio=true
3515 if [ "$_do_compile_ocio" = true ]; then
3516 install_packages_ARCH yaml-cpp tinyxml
3522 if [ "$OPENEXR_SKIP" = true ]; then
3523 WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
3524 elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
3525 INFO "Forced ILMBase/OpenEXR building, as requested..."
3528 check_package_version_ge_ARCH openexr $OPENEXR_VERSION_MIN
3529 if [ $? -eq 0 ]; then
3530 install_packages_ARCH openexr
3531 OPENEXR_VERSION=`get_package_version_ARCH openexr`
3532 ILMBASE_VERSION=$OPENEXR_VERSION
3541 if [ "$OIIO_SKIP" = true ]; then
3542 WARNING "Skipping OpenImageIO installation, as requested..."
3543 elif [ "$OIIO_FORCE_BUILD" = true ]; then
3544 INFO "Forced OpenImageIO building, as requested..."
3547 check_package_version_ge_lt_ARCH openimageio $OIIO_VERSION_MIN $OIIO_VERSION_MAX
3548 if [ $? -eq 0 ]; then
3549 install_packages_ARCH openimageio
3559 _do_compile_llvm=false
3560 if [ "$LLVM_SKIP" = true ]; then
3561 WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
3562 elif [ "$LLVM_FORCE_BUILD" = true ]; then
3563 INFO "Forced LLVM building, as requested..."
3564 _do_compile_llvm=true
3566 check_package_version_ge_ARCH llvm $LLVM_VERSION_MIN
3567 if [ $? -eq 0 ]; then
3568 install_packages_ARCH llvm clang
3570 LLVM_VERSION=`check_package_version_ge_ARCH llvm $LLVM_VERSION_MIN`
3571 LLVM_VERSION_FOUND=$LLVM_VERSION
3574 _do_compile_llvm=true
3578 if [ "$_do_compile_llvm" = true ]; then
3579 install_packages_ARCH libffi
3580 # LLVM can't find the arch ffi header dir...
3581 _FFI_INCLUDE_DIR=`pacman -Ql libffi | grep -e ".*/ffi.h" | awk '{print $2}' | sed -r 's/(.*)\/ffi.h/\1/'`
3582 # LLVM 3.1 needs python2 to build and arch defaults to python3
3583 _PYTHON2_BIN="/usr/bin/python2"
3587 LLVM_VERSION_FOUND=$LLVM_VERSION
3592 _do_compile_osl=false
3593 if [ "$OSL_SKIP" = true ]; then
3594 WARNING "Skipping OpenShadingLanguage installation, as requested..."
3595 elif [ "$OSL_FORCE_BUILD" = true ]; then
3596 INFO "Forced OpenShadingLanguage building, as requested..."
3597 _do_compile_osl=true
3599 check_package_version_ge_ARCH openshadinglanguage $OSL_VERSION_MIN
3600 if [ $? -eq 0 ]; then
3601 install_packages_ARCH openshadinglanguage
3604 _do_compile_osl=true
3608 if [ "$_do_compile_osl" = true ]; then
3609 if [ "$have_llvm" = true ]; then
3610 #XXX Note: will fail to build with LLVM 3.2!
3611 install_packages_ARCH intel-tbb
3615 WARNING "No LLVM available, cannot build OSL!"
3621 _do_compile_osd=false
3622 if [ "$OSD_SKIP" = true ]; then
3623 WARNING "Skipping OpenSubdiv installation, as requested..."
3624 elif [ "$OSD_FORCE_BUILD" = true ]; then
3625 INFO "Forced OpenSubdiv building, as requested..."
3626 _do_compile_osd=true
3628 # No package currently? Just build for now!
3629 _do_compile_osd=true
3632 if [ "$_do_compile_osd" = true ]; then
3633 install_packages_ARCH intel-tbb
3639 if [ "$WITH_OPENCOLLADA" = true ]; then
3641 _do_compile_collada=false
3642 if [ "$OPENCOLLADA_SKIP" = true ]; then
3643 WARNING "Skipping OpenCOLLADA installation, as requested..."
3644 elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then
3645 INFO "Forced OpenCollada building, as requested..."
3646 _do_compile_collada=true
3648 check_package_ARCH opencollada
3649 if [ $? -eq 0 ]; then
3650 install_packages_ARCH opencollada
3653 _do_compile_collada=true
3657 if [ "$_do_compile_collada" = true ]; then
3658 install_packages_ARCH pcre
3659 # Find path to libxml shared lib...
3660 _XML2_LIB=`pacman -Ql libxml2 | grep -e ".*/libxml2.so$" | gawk '{print $2}'`
3668 if [ "$FFMPEG_SKIP" = true ]; then
3669 WARNING "Skipping FFMpeg installation, as requested..."
3670 elif [ "$FFMPEG_FORCE_BUILD" = true ]; then
3671 INFO "Forced FFMpeg building, as requested..."
3674 check_package_version_ge_ARCH ffmpeg $FFMPEG_VERSION_MIN
3675 if [ $? -eq 0 ]; then
3676 install_packages_ARCH ffmpeg
3685 #### Install on other distro (very limited!) ####
3689 WARNING "Attempt to build main dependencies for other linux distributions."
3691 PRINT "`eval _echo "$COMMON_INFO"`"
3694 ERROR "Failed to detect distribution type."
3696 PRINT "Your distribution is not supported by this script, you'll have to install dependencies and"
3697 PRINT "dev packages yourself. However, this script can still attempt to build main (complex) libraries for you,"
3698 PRINT "if you use '--build-foo' options (you can try '--build-all' one first)."
3700 PRINT "Quite obviously, it assumes dependencies from those libraries are already available, otherwise please"
3701 PRINT "install them (you can also use error messages printed out by build process to find missing libraries...)."
3703 PRINT "`eval _echo "$DEPS_COMMON_INFO"`"
3705 PRINT "`eval _echo "$DEPS_SPECIFIC_INFO"`"
3708 if [ "$NO_CONFIRM" = false ]; then
3709 read -p "Do you want to continue (Y/n)?"
3710 [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit
3714 _do_compile_python=false
3715 if [ "$PYTHON_SKIP" = true ]; then
3716 WARNING "Skipping Python/NumPy installation, as requested..."
3717 elif [ "$PYTHON_FORCE_BUILD" = true ]; then
3718 INFO "Forced Python/NumPy building, as requested..."
3719 _do_compile_python=true
3722 if [ "$_do_compile_python" = true ]; then
3725 if [ "$NUMPY_SKIP" = true ]; then
3726 WARNING "Skipping NumPy installation, as requested..."
3734 if [ "$BOOST_SKIP" = true ]; then
3735 WARNING "Skipping Boost installation, as requested..."
3736 elif [ "$BOOST_FORCE_BUILD" = true ]; then
3737 INFO "Forced Boost building, as requested..."
3743 if [ "$OCIO_SKIP" = true ]; then
3744 WARNING "Skipping OpenColorIO installation, as requested..."
3745 elif [ "$OCIO_FORCE_BUILD" = true ]; then
3746 INFO "Forced OpenColorIO building, as requested..."
3752 if [ "$OPENEXR_SKIP" = true ]; then
3753 WARNING "Skipping ILMBase/OpenEXR installation, as requested..."
3754 elif [ "$OPENEXR_FORCE_BUILD" = true ]; then
3755 INFO "Forced ILMBase/OpenEXR building, as requested..."
3761 if [ "$OIIO_SKIP" = true ]; then
3762 WARNING "Skipping OpenImageIO installation, as requested..."
3763 elif [ "$OIIO_FORCE_BUILD" = true ]; then
3764 INFO "Forced OpenImageIO building, as requested..."
3771 _do_compile_llvm=false
3772 if [ "$LLVM_SKIP" = true ]; then
3773 WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..."
3774 elif [ "$LLVM_FORCE_BUILD" = true ]; then
3775 INFO "Forced LLVM building, as requested..."
3776 _do_compile_llvm=true
3779 if [ "$_do_compile_llvm" = true ]; then
3780 install_packages_DEB libffi-dev
3781 # LLVM can't find the debian ffi header dir
3782 _FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
3786 LLVM_VERSION_FOUND=$LLVM_VERSION