diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh deleted file mode 100755 index 248a105d726..00000000000 --- a/build_files/build_environment/install_deps.sh +++ /dev/null @@ -1,6850 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-or-later - -# A shell script installing/building all needed dependencies to build Blender, for some Linux distributions. - -# ---------------------------------------------------------------------------- -# Debugging Helpers -# -# Use for developing this script (keep first). - -# Useful for debugging this script: -USE_DEBUG_TRAP=${USE_DEBUG_TRAP:-0} -USE_DEBUG_LOG=${USE_DEBUG_LOG:-0} - -# Print the line that exits. -if [ $USE_DEBUG_TRAP -ne 0 ]; then - err_report() { - echo "Error on line $1" - exit 1 - } - trap 'err_report $LINENO' ERR -fi - -# Noisy, show every line that runs with its line number. -if [ $USE_DEBUG_LOG -ne 0 ]; then - PS4='\e[0;33m$(printf %4d ${LINENO}):\e\033[0m ' - set -x -fi - -# ---------------------------------------------------------------------------- -# Args and Help Handling - -# Parse command line! -ARGS=$( \ -getopt \ --o s:i:t:h \ ---long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\ -with-all,with-opencollada,with-jack,with-pulseaudio,with-embree,with-oidn,with-nanovdb,\ -ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,ver-level-zero:\ -force-all,force-python,force-boost,force-tbb,\ -force-ocio,force-imath,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\ -force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,force-materialx,force-usd,\ -force-xr-openxr,force-level-zero,force-openpgl,\ -build-all,build-python,build-boost,build-tbb,\ -build-ocio,build-imath,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\ -build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-materialx,build-usd,\ -build-xr-openxr,build-level-zero,build-openpgl,\ -skip-python,skip-boost,skip-tbb,\ -skip-ocio,skip-imath,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\ -skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-materialx,skip-usd,\ -skip-xr-openxr,skip-level-zero,skip-openpgl \ --- "$@" \ -) - -COMMANDLINE=$@ - -DISTRO="" -RPM="" -SRC="$HOME/src/blender-deps" -INST="/opt/lib" -TMP="/tmp" -CWD=$PWD -INFO_PATH=$CWD -SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) - -# Do not install some optional, potentially conflicting libs by default... -WITH_ALL=false - -# Do not yet enable opencollada or embree, use --with-opencollada/--with-embree (or --with-all) option to try it. -WITH_OPENCOLLADA=false -WITH_EMBREE=false -WITH_OIDN=false - -THREADS=$(nproc) - -COMMON_INFO="\"Source code of dependencies needed to be compiled will be downloaded and extracted into '\$SRC'. -Built libs of dependencies needed to be compiled will be installed into '\$INST'. -Please edit \\\$SRC and/or \\\$INST variables at the beginning of this script, -or use --source/--install options, if you want to use other paths! - -Number of threads for building: \$THREADS (automatically detected, use --threads= to override it). -Full install: \$WITH_ALL (use --with-all option to enable it). -Building OpenCOLLADA: \$WITH_OPENCOLLADA (use --with-opencollada option to enable it). -Building Embree: \$WITH_EMBREE (use --with-embree option to enable it). -Building OpenImageDenoise: \$WITH_OIDN (use --with-oidn option to enable it). - -Example: -Full install without OpenCOLLADA: --with-all --skip-opencollada - -Use --help to show all available options!\"" - -ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: - -h, --help - Show this message and exit. - - --show-deps - Show main dependencies of Blender (including officially supported versions) and exit. - - -s , --source= - Use a specific path where to store downloaded libraries sources (defaults to '\$SRC'). - - -i , --install= - Use a specific path where to install built libraries (defaults to '\$INST'). - - --tmp= - Use a specific temp path (defaults to '\$TMP'). - - --info= - Use a specific info path (to store BUILD_NOTES.txt, defaults to '\$INFO_PATH'). - - -t n, --threads=n - Use a specific number of threads when building the libraries (auto-detected as '\$THREADS'). - - --no-sudo - Disable use of sudo (this script won't be able to do much though, will just print needed packages...). - - --no-build - Do not build (compile) anything, dependencies not installable with the package manager will remain missing. - - --no-confirm - Disable any interaction with user (suitable for automated run). - - --with-all - By default, a number of optional and not-so-often needed libraries are not installed. - This option will try to install them, at the cost of potential conflicts (depending on - how your package system is set…). - Note this option also implies all other (more specific) --with-foo options below. - - --with-opencollada - Build and install the OpenCOLLADA libraries. - - --with-embree - Build and install the Embree libraries. - - --with-oidn - Build and install the OpenImageDenoise libraries. - - --with-nanovdb - Build and install the NanoVDB branch of OpenVDB (instead of official release of OpenVDB). - - --with-jack - Install the jack libraries. - - --with-pulseaudio - Install the pulseaudio libraries. - - --ver-ocio= - Force version of OCIO library. - - --ver-oiio= - Force version of OIIO library. - - --ver-llvm= - Force version of LLVM library. - - --ver-osl= - Force version of OSL library. - - --ver-osd= - Force version of OSD library. - - --ver-openvdb= - Force version of OpenVDB library. - - --ver-xr-openxr= - Force version of OpenXR-SDK. - - --ver-level-zero= - Force version of OneAPI Level Zero library. - - Note about the --ver-foo options: - It may not always work as expected (some libs are actually checked out from a git rev...), yet it might help - to fix some build issues (like LLVM mismatch with the version used by your graphic system). - - --build-all - Force the build of all possible libraries. - - --build-python - Force the build of Python. - - --build-boost - Force the build of Boost. - - --build-tbb - Force the build of TBB. - - --build-ocio - Force the build of OpenColorIO. - - --build-imath - Force the build of Imath. - - --build-openexr - Force the build of OpenEXR. - - --build-oiio - Force the build of OpenImageIO. - - --build-llvm - Force the build of LLVM. - - --build-osl - Force the build of OpenShadingLanguage. - - --build-osd - Force the build of OpenSubdiv. - - --build-openvdb - Force the build of OpenVDB. - - --build-alembic - Force the build of Alembic. - - --build-opencollada - Force the build of OpenCOLLADA. - - --build-embree - Force the build of Embree. - - --build-oidn - Force the build of OpenImageDenoise. - - --build-ffmpeg - Force the build of FFMpeg. - - --build-materialx - Force the build of MaterialX. - - --build-usd - Force the build of Universal Scene Description. - - --build-xr-openxr - Force the build of OpenXR-SDK. - - --build-level-zero= - Force the build of OneAPI Level Zero library. - - --build-openpgl - Force the build of OpenPGL library. - - Note about the --build-foo options: - * They force the script to prefer building dependencies rather than using available packages. - This may make things simpler and allow working around some distribution bugs, but on the other hand it will - use much more space on your hard drive. - * Please be careful with the Blender building options if you have both 'official' dev packages and - install_deps' built ones on your system, by default CMake will prefer official packages, which may lead to - linking issues. Please ensure your CMake configuration always uses all correct library paths. - * If the “force-built” library is a dependency of others, it will force the build - of those libraries as well (e.g. --build-boost also implies --build-oiio and --build-osl...). - - --force-all - Force the rebuild of all built libraries. - - --force-python - Force the rebuild of Python. - - --force-boost - Force the rebuild of Boost. - - --force-tbb - Force the rebuild of TBB. - - --force-ocio - Force the rebuild of OpenColorIO. - - --force-imath - Force the rebuild of Imath. - - --force-openexr - Force the rebuild of OpenEXR. - - --force-oiio - Force the rebuild of OpenImageIO. - - --force-llvm - Force the rebuild of LLVM. - - --force-osl - Force the rebuild of OpenShadingLanguage. - - --force-osd - Force the rebuild of OpenSubdiv. - - --force-openvdb - Force the rebuild of OpenVDB. - - --force-alembic - Force the rebuild of Alembic. - - --force-opencollada - Force the rebuild of OpenCOLLADA. - - --force-embree - Force the rebuild of Embree. - - --force-oidn - Force the rebuild of OpenImageDenoise. - - --force-ffmpeg - Force the rebuild of FFMpeg. - - --force-materialx - Force the rebuild of MaterialX. - - --force-usd - Force the rebuild of Universal Scene Description. - - --force-xr-openxr - Force the rebuild of OpenXR-SDK. - - --force-level-zero= - Force the rebuild of OneAPI Level Zero library. - - --force-openpgl - Force the rebuild of OpenPGL library. - - Note about the --force-foo options: - * They obviously only have an effect if those libraries are built by this script - (i.e. if there is no available and satisfactory package)! - * If the “force-rebuilt” library is a dependency of others, it will force the rebuild - of those libraries too (e.g. --force-boost will also rebuild oiio and osl...). - - --skip-python - Unconditionally skip Python installation/building. - - --skip-boost - Unconditionally skip Boost installation/building. - - --skip-tbb - Unconditionally skip TBB installation/building. - - --skip-ocio - Unconditionally skip OpenColorIO installation/building. - - --skip-imath - Unconditionally skip IMath installation/building. - - --skip-openexr - Unconditionally skip OpenEXR installation/building. - - --skip-oiio - Unconditionally skip OpenImageIO installation/building. - - --skip-llvm - Unconditionally skip LLVM installation/building. - - --skip-osl - Unconditionally skip OpenShadingLanguage installation/building. - - --skip-osd - Unconditionally skip OpenSubdiv installation/building. - - --skip-openvdb - Unconditionally skip OpenVDB installation/building. - - --skip-alembic - Unconditionally skip Alembic installation/building. - - --skip-opencollada - Unconditionally skip OpenCOLLADA installation/building. - - --skip-Embree - Unconditionally skip Embree installation/building. - - --skip-oidn - Unconditionally skip OpenImageDenoise installation/building. - - --skip-ffmpeg - Unconditionally skip FFMpeg installation/building. - - --skip-materialx - Unconditionally skip MaterialX installation/building. - - --skip-usd - Unconditionally skip Universal Scene Description installation/building. - - --skip-xr-openxr - Unconditionally skip OpenXR-SDK installation/building. - - --skip-level-zero= - Unconditionally skip OneAPI Level Zero installation/building. - - --skip-openpgl - Unconditionally skip OpenPGL installation/building.\"" - -# ---------------------------------------------------------------------------- -# Main Vars - -DO_SHOW_DEPS=false - -SUDO="sudo" - -NO_BUILD=false -NO_CONFIRM=false -USE_CXX11=true - -# Note about versions: Min is inclusive, Mex is 'minimum exclusive' (i.e. XXX_VERSION_MIN <= ACTUAL_VERSION < XXX_VERSION_MEX) -# XXX_VERSION is officially supported/used version in official builds. -# XXX_VERSION_SHORT is used for various things, like preferred version (when distribution provides several of them), -# and to name shortcuts to built libraries' installation directories... - -CLANG_FORMAT_VERSION="10.0" -CLANG_FORMAT_VERSION_MIN="6.0" -CLANG_FORMAT_VERSION_MEX="14.0" - -PYTHON_VERSION="3.10.9" -PYTHON_VERSION_SHORT="3.10" -PYTHON_VERSION_MIN="3.10" -PYTHON_VERSION_MEX="3.12" -PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_SHORT -PYTHON_FORCE_BUILD=false -PYTHON_FORCE_REBUILD=false -PYTHON_SKIP=false -_with_built_python=false - -# Additional Python modules. -PYTHON_IDNA_VERSION="3.3" -PYTHON_IDNA_VERSION_MIN="2.0" -PYTHON_IDNA_VERSION_MEX="4.0" -PYTHON_IDNA_NAME="idna" - -PYTHON_CHARSET_NORMALIZER_VERSION="2.0.10" -PYTHON_CHARSET_NORMALIZER_VERSION_MIN="2.0.6" -PYTHON_CHARSET_NORMALIZER_VERSION_MEX="2.1.0" # requests uses `charset_normalizer~=2.0.0` -PYTHON_CHARSET_NORMALIZER_NAME="charset-normalizer" - -PYTHON_URLLIB3_VERSION="1.26.8" -PYTHON_URLLIB3_VERSION_MIN="1.0" -PYTHON_URLLIB3_VERSION_MEX="2.0" -PYTHON_URLLIB3_NAME="urllib3" - -PYTHON_CERTIFI_VERSION="2021.10.8" -PYTHON_CERTIFI_VERSION_MIN="2021.0" -PYTHON_CERTIFI_VERSION_MEX="2023.0" -PYTHON_CERTIFI_NAME="certifi" - -PYTHON_REQUESTS_VERSION="2.27.1" -PYTHON_REQUESTS_VERSION_MIN="2.0" -PYTHON_REQUESTS_VERSION_MEX="3.0" -PYTHON_REQUESTS_NAME="requests" - -PYTHON_ZSTANDARD_VERSION="0.16.0" -PYTHON_ZSTANDARD_VERSION_MIN="0.15.2" -PYTHON_ZSTANDARD_VERSION_MEX="0.20.0" -PYTHON_ZSTANDARD_NAME="zstandard" - -PYTHON_NUMPY_VERSION="1.23.5" -PYTHON_NUMPY_VERSION_MIN="1.14" -PYTHON_NUMPY_VERSION_MEX="2.0" -PYTHON_NUMPY_NAME="numpy" - -# As package-ready parameters (only used with distro packages). -PYTHON_MODULES_PACKAGES=( - "$PYTHON_IDNA_NAME $PYTHON_IDNA_VERSION_MIN $PYTHON_IDNA_VERSION_MEX" - "$PYTHON_CHARSET_NORMALIZER_NAME $PYTHON_CHARSET_NORMALIZER_VERSION_MIN $PYTHON_CHARSET_NORMALIZER_VERSION_MEX" - "$PYTHON_URLLIB3_NAME $PYTHON_URLLIB3_VERSION_MIN $PYTHON_URLLIB3_VERSION_MEX" - "$PYTHON_CERTIFI_NAME $PYTHON_CERTIFI_VERSION_MIN $PYTHON_CERTIFI_VERSION_MEX" - "$PYTHON_REQUESTS_NAME $PYTHON_REQUESTS_VERSION_MIN $PYTHON_REQUESTS_VERSION_MEX" - "$PYTHON_ZSTANDARD_NAME $PYTHON_ZSTANDARD_VERSION_MIN $PYTHON_ZSTANDARD_VERSION_MEX" - "$PYTHON_NUMPY_NAME $PYTHON_NUMPY_VERSION_MIN $PYTHON_NUMPY_VERSION_MEX" -) - -# As pip-ready parameters (only used when building python). -PYTHON_MODULES_PIP=( - "$PYTHON_IDNA_NAME==$PYTHON_IDNA_VERSION" - "$PYTHON_CHARSET_NORMALIZER_NAME==$PYTHON_CHARSET_NORMALIZER_VERSION" - "$PYTHON_URLLIB3_NAME==$PYTHON_URLLIB3_VERSION" - "$PYTHON_CERTIFI_NAME==$PYTHON_CERTIFI_VERSION" - "$PYTHON_REQUESTS_NAME==$PYTHON_REQUESTS_VERSION" - "$PYTHON_ZSTANDARD_NAME==$PYTHON_ZSTANDARD_VERSION" - "$PYTHON_NUMPY_NAME==$PYTHON_NUMPY_VERSION" -) - - -BOOST_VERSION="1.80.0" -BOOST_VERSION_SHORT="1.80" -BOOST_VERSION_MIN="1.49" -BOOST_VERSION_MEX="2.0" -# XXX Boost currently has an issue with python/tbb, see rB019b930 for details and patch used to fix it. -# So for now it has to be built, system packages are not usable. :( -BOOST_FORCE_BUILD=true -BOOST_FORCE_REBUILD=false -BOOST_SKIP=false - -TBB_VERSION="2020" -TBB_VERSION_SHORT="2020" -TBB_VERSION_UPDATE="_U3" # Used for source packages... -TBB_VERSION_MIN="2018" -TBB_VERSION_MEX="2021" # 2021 introduces 'oneTBB', which has lots of compatibility breakage with previous versions -TBB_FORCE_BUILD=false -TBB_FORCE_REBUILD=false -TBB_SKIP=false - -OCIO_VERSION="2.2.0" -OCIO_VERSION_SHORT="2.2" -OCIO_VERSION_MIN="2.0" -OCIO_VERSION_MEX="3.0" -OCIO_FORCE_BUILD=false -OCIO_FORCE_REBUILD=false -OCIO_SKIP=false - -IMATH_VERSION="3.1.5" -IMATH_VERSION_SHORT="3.1" -IMATH_VERSION_MIN="3.0" -IMATH_VERSION_MEX="4.0" -IMATH_FORCE_BUILD=false -IMATH_FORCE_REBUILD=false -IMATH_SKIP=false -_with_built_imath=false - -OPENEXR_VERSION="3.1.5" -OPENEXR_VERSION_SHORT="3.1" -OPENEXR_VERSION_MIN="3.0" -OPENEXR_VERSION_MEX="4.0" -OPENEXR_FORCE_BUILD=false -OPENEXR_FORCE_REBUILD=false -OPENEXR_SKIP=false -_with_built_openexr=false - -OIIO_VERSION="2.4.9.0" -OIIO_VERSION_SHORT="2.4" -OIIO_VERSION_MIN="2.2.0" -OIIO_VERSION_MEX="2.5.0" -OIIO_FORCE_BUILD=false -OIIO_FORCE_REBUILD=false -OIIO_SKIP=false - -LLVM_VERSION="12.0.0" -LLVM_VERSION_SHORT="12.0" -LLVM_VERSION_MIN="11.0" -LLVM_VERSION_MEX="14.0" -LLVM_VERSION_FOUND="" -LLVM_FORCE_BUILD=false -LLVM_FORCE_REBUILD=false -LLVM_SKIP=false - -# OSL needs to be compiled for now! -OSL_VERSION="1.13.0.2" -OSL_VERSION_SHORT="1.13" -OSL_VERSION_MIN="1.11" -OSL_VERSION_MEX="2.0" -OSL_FORCE_BUILD=false -OSL_FORCE_REBUILD=false -OSL_SKIP=false - -# OpenSubdiv needs to be compiled for now -OSD_VERSION="3.5.0" -OSD_VERSION_SHORT="3.5" -OSD_VERSION_MIN="3.5" -OSD_VERSION_MEX="4.0" -OSD_FORCE_BUILD=false -OSD_FORCE_REBUILD=false -OSD_SKIP=false - -# OpenVDB needs to be compiled for now -OPENVDB_BLOSC_VERSION="1.21.1" - -OPENVDB_VERSION="10.0.0" -OPENVDB_VERSION_SHORT="10.0" -OPENVDB_VERSION_MIN="10.0" -OPENVDB_VERSION_MEX="11.0" -OPENVDB_FORCE_BUILD=false -OPENVDB_FORCE_REBUILD=false -OPENVDB_SKIP=false - -# Alembic needs to be compiled for now -ALEMBIC_VERSION="1.8.3" -ALEMBIC_VERSION_SHORT="1.8" -ALEMBIC_VERSION_MIN="1.7" -ALEMBIC_VERSION_MEX="2.0" -ALEMBIC_FORCE_BUILD=false -ALEMBIC_FORCE_REBUILD=false -ALEMBIC_SKIP=false - -MATERIALX_VERSION="1.38.6" -MATERIALX_VERSION_SHORT="1.38" -MATERIALX_VERSION_MIN="1.38" -MATERIALX_VERSION_MEX="1.40" -MATERIALX_FORCE_BUILD=false -MATERIALX_FORCE_REBUILD=false -MATERIALX_SKIP=false - -USD_VERSION="22.11" -USD_VERSION_SHORT="22.11" -USD_VERSION_MIN="20.05" -USD_VERSION_MEX="23.00" -USD_FORCE_BUILD=false -USD_FORCE_REBUILD=false -USD_SKIP=false - -OPENCOLLADA_VERSION="1.6.68" -OPENCOLLADA_VERSION_SHORT="1.6" -OPENCOLLADA_VERSION_MIN="1.6.68" -OPENCOLLADA_VERSION_MEX="1.7" -OPENCOLLADA_FORCE_BUILD=false -OPENCOLLADA_FORCE_REBUILD=false -OPENCOLLADA_SKIP=false - -EMBREE_VERSION="3.13.4" -EMBREE_VERSION_SHORT="3.13" -EMBREE_VERSION_MIN="3.13" -EMBREE_VERSION_MEX="4.0" -EMBREE_FORCE_BUILD=false -EMBREE_FORCE_REBUILD=false -EMBREE_SKIP=false - -OIDN_VERSION="1.4.3" -OIDN_VERSION_SHORT="1.4" -OIDN_VERSION_MIN="1.4.0" -OIDN_VERSION_MEX="1.5" -OIDN_FORCE_BUILD=false -OIDN_FORCE_REBUILD=false -OIDN_SKIP=false - -ISPC_VERSION="1.17.0" - -LEVEL_ZERO_VERSION="1.7.15" -LEVEL_ZERO_VERSION_SHORT="1.7" -LEVEL_ZERO_VERSION_MIN="1.7" -LEVEL_ZERO_VERSION_MEX="2.0" -LEVEL_ZERO_FORCE_BUILD=false -LEVEL_ZERO_FORCE_REBUILD=false -LEVEL_ZERO_SKIP=false - -OPENPGL_VERSION="0.4.1" -OPENPGL_VERSION_SHORT="0.4" -OPENPGL_VERSION_MIN="0.4.1" -OPENPGL_VERSION_MEX="0.5" -OPENPGL_FORCE_BUILD=false -OPENPGL_FORCE_REBUILD=false -OPENPGL_SKIP=false - -XR_OPENXR_VERSION="1.0.22" -XR_OPENXR_VERSION_SHORT="1.0" -XR_OPENXR_VERSION_MIN="1.0.8" -XR_OPENXR_VERSION_MEX="2.0" -XR_OPENXR_FORCE_BUILD=false -XR_OPENXR_FORCE_REBUILD=false -XR_OPENXR_SKIP=false - -FFMPEG_VERSION="5.1.2" -FFMPEG_VERSION_SHORT="5.1" -FFMPEG_VERSION_MIN="4.0" -FFMPEG_VERSION_MEX="6.0" -FFMPEG_FORCE_BUILD=false -FFMPEG_FORCE_REBUILD=false -FFMPEG_SKIP=false -_ffmpeg_list_sep=";" - -# FFMPEG optional libs. -VORBIS_USE=false -VORBIS_DEV="" -OGG_USE=false -OGG_DEV="" -THEORA_USE=false -THEORA_DEV="" -XVID_USE=false -XVID_DEV="" -X264_USE=false -X264_DEV="" -X264_VERSION_MIN=0.118 -WEBP_USE=false -WEBP_DEV="" -VPX_USE=false -VPX_VERSION_MIN=0.9.7 -VPX_DEV="" -AOM_USE=false -AOM_VERSION_MIN=3.3.0 -AOM_DEV="" -OPUS_USE=false -OPUS_VERSION_MIN=1.1.1 -OPUS_DEV="" -MP3LAME_USE=false -MP3LAME_DEV="" -OPENJPEG_USE=false -OPENJPEG_DEV="" - -# Switch to english language, else some things (like check_package_DEB()) won't work! -LANG_BACK=$LANG -LANG="" -export LANG - -# ---------------------------------------------------------------------------- -# Generic Helpers - -BLACK=$(tput setaf 0) -RED=$(tput setaf 1) -GREEN=$(tput setaf 2) -YELLOW=$(tput setaf 3) -LIME_YELLOW=$(tput setaf 190) -POWDER_BLUE=$(tput setaf 153) -BLUE=$(tput setaf 4) -MAGENTA=$(tput setaf 5) -CYAN=$(tput setaf 6) -WHITE=$(tput setaf 7) -BRIGHT=$(tput bold) -NORMAL=$(tput sgr0) -BLINK=$(tput blink) -REVERSE=$(tput smso) -UNDERLINE=$(tput smul) - -_echo() { - if [ "X$1" = "X-n" ]; then - shift; printf "%s" "$@" - else - printf "%s\n" "$@" - fi -} - -ERROR() { - _echo "${BRIGHT}${RED}ERROR! ${NORMAL}${RED}$@${NORMAL}" -} - -WARNING() { - _echo "${BRIGHT}${YELLOW}WARNING! ${NORMAL}${YELLOW}$@${NORMAL}" -} - -INFO() { - _echo "${GREEN}$@${NORMAL}" -} - -PRINT() { - _echo "$@" -} - -# ---------------------------------------------------------------------------- -# Args Handling - -# Finish parsing the commandline args. -eval set -- "$ARGS" -while true; do - case $1 in - -s|--source) - SRC="$2"; shift; shift; continue - ;; - -i|--install) - INST="$2"; shift; shift; continue - ;; - --tmp) - TMP="$2"; shift; shift; continue - ;; - --info) - INFO_PATH="$2"; shift; shift; continue - ;; - -t|--threads) - THREADS="$2"; shift; shift; continue - ;; - -h|--help) - PRINT "" - PRINT "USAGE:" - PRINT "" - PRINT "`eval _echo "$COMMON_INFO"`" - PRINT "" - PRINT "`eval _echo "$ARGUMENTS_INFO"`" - PRINT "" - exit 0 - ;; - --show-deps) - # We have to defer... - DO_SHOW_DEPS=true; shift; continue - ;; - --no-sudo) - PRINT "" - WARNING "--no-sudo enabled, this script might not be able to do much..." - PRINT "" - SUDO=""; shift; continue - ;; - --no-build) - PRINT "" - WARNING "--no-build enabled, this script will not be able to install all dependencies..." - PRINT "" - NO_BUILD=true; shift; continue - ;; - --no-confirm) - NO_CONFIRM=true; shift; continue - ;; - --with-all) - WITH_ALL=true; shift; continue - ;; - --with-opencollada) - WITH_OPENCOLLADA=true; shift; continue - ;; - --with-embree) - WITH_EMBREE=true; shift; continue - ;; - --with-oidn) - WITH_OIDN=true; shift; continue - ;; - --with-nanovdb) - WITH_NANOVDB=true; - shift; continue - ;; - --with-jack) - WITH_JACK=true; shift; continue; - ;; - --with-pulseaudio) - WITH_PULSEAUDIO=true; shift; continue; - ;; - --ver-ocio) - OCIO_VERSION="$2" - OCIO_VERSION_MIN=$OCIO_VERSION - OCIO_VERSION_SHORT=$OCIO_VERSION - shift; shift; continue - ;; - --ver-oiio) - OIIO_VERSION="$2" - OIIO_VERSION_MIN=$OIIO_VERSION - OIIO_VERSION_SHORT=$OIIO_VERSION - shift; shift; continue - ;; - --ver-llvm) - LLVM_VERSION="$2" - LLVM_VERSION_MIN=$LLVM_VERSION - LLVM_VERSION_SHORT=$LLVM_VERSION - shift; shift; continue - ;; - --ver-osl) - OSL_VERSION="$2" - OSL_VERSION_MIN=$OSL_VERSION - OSL_VERSION_SHORT=$OSL_VERSION - shift; shift; continue - ;; - --ver-osd) - OSD_VERSION="$2" - OSD_VERSION_MIN=$OSD_VERSION - OSD_VERSION_SHORT=$OSD_VERSION - shift; shift; continue - ;; - --ver-openvdb) - OPENVDB_VERSION="$2" - OPENVDB_VERSION_MIN=$OPENVDB_VERSION - OPENVDB_VERSION_SHORT=$OPENVDB_VERSION - shift; shift; continue - ;; - --ver-xr-openxr) - XR_OPENXR_VERSION="$2" - XR_OPENXR_VERSION_MIN=$XR_OPENXR_VERSION - XR_OPENXR_VERSION_SHORT=$XR_OPENXR_VERSION - shift; shift; continue - ;; - --ver-level-zero) - LEVEL_ZERO_VERSION="$2" - LEVEL_ZERO_VERSION_MIN=$LEVEL_ZERO_VERSION - LEVEL_ZERO_VERSION_SHORT=$LEVEL_ZERO_VERSION - shift; shift; continue - ;; - --build-all) - PYTHON_FORCE_BUILD=true - BOOST_FORCE_BUILD=true - TBB_FORCE_BUILD=true - OCIO_FORCE_BUILD=true - IMATH_FORCE_BUILD=true - OPENEXR_FORCE_BUILD=true - OIIO_FORCE_BUILD=true - LLVM_FORCE_BUILD=true - OSL_FORCE_BUILD=true - OSD_FORCE_BUILD=true - OPENVDB_FORCE_BUILD=true - OPENCOLLADA_FORCE_BUILD=true - EMBREE_FORCE_BUILD=true - OIDN_FORCE_BUILD=true - FFMPEG_FORCE_BUILD=true - ALEMBIC_FORCE_BUILD=true - USD_FORCE_BUILD=true - XR_OPENXR_FORCE_BUILD=true - LEVEL_ZERO_FORCE_BUILD=true - OPENPGL_FORCE_BUILD=true - shift; continue - ;; - --build-python) - PYTHON_FORCE_BUILD=true - shift; continue - ;; - --build-boost) - BOOST_FORCE_BUILD=true; shift; continue - ;; - --build-tbb) - TBB_FORCE_BUILD=true; shift; continue - ;; - --build-ocio) - OCIO_FORCE_BUILD=true; shift; continue - ;; - --build-imath) - IMATH_FORCE_BUILD=true; shift; continue - ;; - --build-openexr) - OPENEXR_FORCE_BUILD=true; shift; continue - ;; - --build-oiio) - OIIO_FORCE_BUILD=true; shift; continue - ;; - --build-llvm) - LLVM_FORCE_BUILD=true; shift; continue - ;; - --build-osl) - OSL_FORCE_BUILD=true; shift; continue - ;; - --build-osd) - OSD_FORCE_BUILD=true; shift; continue - ;; - --build-openvdb) - OPENVDB_FORCE_BUILD=true; shift; continue - ;; - --build-opencollada) - OPENCOLLADA_FORCE_BUILD=true; shift; continue - ;; - --build-embree) - EMBREE_FORCE_BUILD=true; shift; continue - ;; - --build-oidn) - OIDN_FORCE_BUILD=true; shift; continue - ;; - --build-ffmpeg) - FFMPEG_FORCE_BUILD=true; shift; continue - ;; - --build-alembic) - ALEMBIC_FORCE_BUILD=true; shift; continue - ;; - --build-materialx) - MATERIALX_FORCE_BUILD=true; shift; continue - ;; - --build-usd) - USD_FORCE_BUILD=true; shift; continue - ;; - --build-xr-openxr) - XR_OPENXR_FORCE_BUILD=true; shift; continue - ;; - --build-level-zero) - LEVEL_ZERO_FORCE_BUILD=true; shift; continue - ;; - --build-openpgl) - OPENPGL_FORCE_BUILD=true; shift; continue - ;; - --force-all) - PYTHON_FORCE_REBUILD=true - BOOST_FORCE_REBUILD=true - TBB_FORCE_REBUILD=true - OCIO_FORCE_REBUILD=true - IMATH_FORCE_REBUILD=true - OPENEXR_FORCE_REBUILD=true - OIIO_FORCE_REBUILD=true - LLVM_FORCE_REBUILD=true - OSL_FORCE_REBUILD=true - OSD_FORCE_REBUILD=true - OPENVDB_FORCE_REBUILD=true - OPENCOLLADA_FORCE_REBUILD=true - EMBREE_FORCE_REBUILD=true - OIDN_FORCE_REBUILD=true - FFMPEG_FORCE_REBUILD=true - ALEMBIC_FORCE_REBUILD=true - MATERIALX_FORCE_REBUILD=true - USD_FORCE_REBUILD=true - XR_OPENXR_FORCE_REBUILD=true - LEVEL_ZERO_FORCE_REBUILD=true - OPENPGL_FORCE_REBUILD=true - shift; continue - ;; - --force-python) - PYTHON_FORCE_REBUILD=true - shift; continue - ;; - --force-boost) - BOOST_FORCE_REBUILD=true; shift; continue - ;; - --force-tbb) - TBB_FORCE_REBUILD=true; shift; continue - ;; - --force-ocio) - OCIO_FORCE_REBUILD=true; shift; continue - ;; - --force-imath) - IMATH_FORCE_REBUILD=true; shift; continue - ;; - --force-openexr) - OPENEXR_FORCE_REBUILD=true; shift; continue - ;; - --force-oiio) - OIIO_FORCE_REBUILD=true; shift; continue - ;; - --force-llvm) - LLVM_FORCE_REBUILD=true; shift; continue - ;; - --force-osl) - OSL_FORCE_REBUILD=true; shift; continue - ;; - --force-osd) - OSD_FORCE_REBUILD=true; shift; continue - ;; - --force-openvdb) - OPENVDB_FORCE_REBUILD=true; shift; continue - ;; - --force-opencollada) - OPENCOLLADA_FORCE_REBUILD=true; shift; continue - ;; - --force-embree) - EMBREE_FORCE_REBUILD=true; shift; continue - ;; - --force-oidn) - OIDN_FORCE_REBUILD=true; shift; continue - ;; - --force-ffmpeg) - FFMPEG_FORCE_REBUILD=true; shift; continue - ;; - --force-alembic) - ALEMBIC_FORCE_REBUILD=true; shift; continue - ;; - --force-materialx) - MATERIALX_FORCE_REBUILD=true; shift; continue - ;; - --force-usd) - USD_FORCE_REBUILD=true; shift; continue - ;; - --force-xr-openxr) - XR_OPENXR_FORCE_REBUILD=true; shift; continue - ;; - --force-level-zero) - LEVEL_ZERO_FORCE_REBUILD=true; shift; continue - ;; - --force-openpgl) - OPENPGL_FORCE_REBUILD=true; shift; continue - ;; - --skip-python) - PYTHON_SKIP=true; shift; continue - ;; - --skip-boost) - BOOST_SKIP=true; shift; continue - ;; - --skip-tbb) - TBB_SKIP=true; shift; continue - ;; - --skip-ocio) - OCIO_SKIP=true; shift; continue - ;; - --skip-imath) - IMATH_SKIP=true; shift; continue - ;; - --skip-openexr) - OPENEXR_SKIP=true; shift; continue - ;; - --skip-oiio) - OIIO_SKIP=true; shift; continue - ;; - --skip-llvm) - LLVM_SKIP=true; shift; continue - ;; - --skip-osl) - OSL_SKIP=true; shift; continue - ;; - --skip-osd) - OSD_SKIP=true; shift; continue - ;; - --skip-openvdb) - OPENVDB_SKIP=true; shift; continue - ;; - --skip-opencollada) - OPENCOLLADA_SKIP=true; shift; continue - ;; - --skip-embree) - EMBREE_SKIP=true; shift; continue - ;; - --skip-oidn) - OIDN_SKIP=true; shift; continue - ;; - --skip-ffmpeg) - FFMPEG_SKIP=true; shift; continue - ;; - --skip-alembic) - ALEMBIC_SKIP=true; shift; continue - ;; - --skip-usd) - USD_SKIP=true; shift; continue - ;; - --skip-materialx) - MATERIALX_SKIP=true; shift; continue - ;; - --skip-xr-openxr) - XR_OPENXR_SKIP=true; shift; continue - ;; - --skip-level-zero) - LEVEL_ZERO_SKIP=true; shift; continue - ;; - --skip-openpgl) - OPENPGL_SKIP=true; shift; continue - ;; - --) - # no more arguments to parse - break - ;; - *) - PRINT "" - ERROR "Wrong parameter '$1'; Usage:" - PRINT "" - PRINT "`eval _echo "$COMMON_INFO"`" - PRINT "" - exit 1 - ;; - esac -done - -if [ "$WITH_ALL" = true -a "$OPENCOLLADA_SKIP" = false ]; then - WITH_OPENCOLLADA=true -fi -if [ "$WITH_ALL" = true -a "$EMBREE_SKIP" = false ]; then - WITH_EMBREE=true -fi -if [ "$WITH_ALL" = true -a "$OIDN_SKIP" = false ]; then - WITH_OIDN=true -fi -if [ "$WITH_ALL" = true ]; then - WITH_JACK=true - WITH_NANOVDB=true - WITH_PULSEAUDIO=true -fi - -if [ "$WITH_NANOVDB" = true ]; then - OPENVDB_FORCE_BUILD=true -fi - - -WARNING "****WARNING****" -PRINT "If you are experiencing issues building Blender, _*TRY A FRESH, CLEAN BUILD FIRST*_!" -PRINT "The same goes for install_deps itself, if you encounter issues, please first erase everything in $SRC and $INST" -PRINT "(provided obviously you did not add anything yourself in those dirs!), and run install_deps.sh again!" -PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..." -PRINT "" -PRINT "You may also try to use the '--build-foo' options to bypass your distribution's packages" -PRINT "for some troublesome/buggy libraries..." -PRINT "" -PRINT "" -PRINT "Ran with:" -PRINT " install_deps.sh $COMMANDLINE" -PRINT "" -PRINT "" - - -# This has to be done here, because user might force some versions... -PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" ) - -_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'` -BOOST_SOURCE=( "https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" ) -BOOST_BUILD_MODULES="--with-filesystem --with-locale --with-thread --with-regex --with-system --with-date_time --with-wave --with-atomic --with-serialization --with-program_options --with-iostreams --with-python" -# Used by debian distros. -BOOST_DEB_PACKAGE_MODULES=( "libboost-filesystem" "libboost-locale" "libboost-thread" "libboost-regex" "libboost-system" "libboost-date-time" "libboost-wave" "libboost-atomic" "libboost-serialization" "libboost-program-options" "libboost-iostreams" "libboost-python" "libboost-numpy" ) - -TBB_SOURCE=( "https://github.com/oneapi-src/oneTBB/archive/$TBB_VERSION$TBB_VERSION_UPDATE.tar.gz" ) -TBB_SOURCE_CMAKE=( "https://raw.githubusercontent.com/wjakob/tbb/master/CMakeLists.txt" ) - -OCIO_USE_REPO=false -OCIO_SOURCE=( "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v$OCIO_VERSION.tar.gz") -#~ OCIO_SOURCE_REPO=( "https://github.com/imageworks/OpenColorIO.git" ) -#~ OCIO_SOURCE_REPO_UID="6de971097c7f552300f669ed69ca0b6cf5a70843" - -IMATH_USE_REPO=false -IMATH_SOURCE=( "https://github.com/AcademySoftwareFoundation/Imath/archive/refs/tags/v$OPENEXR_VERSION.tar.gz" ) -IMATH_SOURCE_REPO=( "https://github.com/AcademySoftwareFoundation/Imath.git" ) -IMATH_SOURCE_REPO_UID="42ad7e94ea0ddb9a1b420698bedebba9f5a99ac5" - -OPENEXR_USE_REPO=false -OPENEXR_SOURCE=( "https://github.com/AcademySoftwareFoundation/openexr/archive/v$OPENEXR_VERSION.tar.gz" ) -OPENEXR_SOURCE_REPO=( "https://github.com/AcademySoftwareFoundation/openexr.git" ) -OPENEXR_SOURCE_REPO_UID="0ac2ea34c8f3134148a5df4052e40f155b76f6fb" -#~ OPENEXR_SOURCE=( "https://github.com/openexr/openexr/archive/$OPENEXR_SOURCE_REPO_UID.tar.gz" ) - -OIIO_USE_REPO=false -OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio/archive/refs/tags/v$OIIO_VERSION.tar.gz" ) -#~ OIIO_SOURCE_REPO=( "https://github.com/OpenImageIO/oiio.git" ) -#~ OIIO_SOURCE_REPO_UID="c9e67275a0b248ead96152f6d2221cc0c0f278a4" - -_LLVM_SOURCE_ROOT="https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION" -LLVM_SOURCE=( "$_LLVM_SOURCE_ROOT/llvm-$LLVM_VERSION.src.tar.xz" ) -LLVM_CLANG_SOURCE=( "$_LLVM_SOURCE_ROOT/clang-$LLVM_VERSION.src.tar.xz" "$_LLVM_SOURCE_ROOT/cfe-$LLVM_VERSION.src.tar.xz" ) - -OSL_USE_REPO=true -OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage/archive/v$OSL_VERSION.tar.gz" ) -OSL_SOURCE_REPO=( "https://github.com/AcademySoftwareFoundation/OpenShadingLanguage.git" ) -OSL_SOURCE_REPO_BRANCH="main" -OSL_SOURCE_REPO_UID="1a7670600c8b08c2443a78d03c8c27e9a1149140" - -OSD_USE_REPO=false -# Script foo to make the version string compliant with the archive name: -# ${Varname//SearchForThisChar/ReplaceWithThisChar} -OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" ) -#~ OSD_SOURCE_REPO=( "https://github.com/PixarAnimationStudios/OpenSubdiv.git" ) -#~ OSD_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee" -#~ OSD_SOURCE_REPO_BRANCH="dev" - -OPENVDB_USE_REPO=false -OPENVDB_BLOSC_SOURCE=( "https://github.com/Blosc/c-blosc/archive/v${OPENVDB_BLOSC_VERSION}.tar.gz" ) -OPENVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v${OPENVDB_VERSION}.tar.gz" ) -#~ OPENVDB_SOURCE_REPO=( "https://github.com/AcademySoftwareFoundation/openvdb.git" ) -#~ OPENVDB_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee" -#~ OPENVDB_SOURCE_REPO_BRANCH="dev" - -ALEMBIC_USE_REPO=false -ALEMBIC_SOURCE=( "https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz" ) -# ALEMBIC_SOURCE_REPO=( "https://github.com/alembic/alembic.git" ) -# ALEMBIC_SOURCE_REPO_UID="e6c90d4faa32c4550adeaaf3f556dad4b73a92bb" -# ALEMBIC_SOURCE_REPO_BRANCH="master" - -MATERIALX_SOURCE=( "https://github.com/AcademySoftwareFoundation/MaterialX/archive/refs/tags/v${MATERIALX_VERSION}.tar.gz" ) - -USD_SOURCE=( "https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz" ) - -OPENCOLLADA_USE_REPO=false -OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA/archive/v${OPENCOLLADA_VERSION}.tar.gz" ) -#~ OPENCOLLADA_SOURCE_REPO=( "https://github.com/KhronosGroup/OpenCOLLADA.git" ) -#~ OPENCOLLADA_REPO_UID="e937c3897b86fc0da53cde97257f5156" -#~ OPENCOLLADA_REPO_BRANCH="master" - -EMBREE_USE_REPO=false -EMBREE_SOURCE=( "https://github.com/embree/embree/archive/v${EMBREE_VERSION}.tar.gz" ) -#~ EMBREE_SOURCE_REPO=( "https://github.com/embree/embree.git" ) -#~ EMBREE_REPO_UID="4a12bfed63c90e85b6eab98b8cdd8dd2a3ba5809" -#~ EMBREE_REPO_BRANCH="master" - -OIDN_USE_REPO=false -OIDN_SOURCE=( "https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz" ) -#~ OIDN_SOURCE_REPO=( "https://github.com/OpenImageDenoise/oidn.git" ) -#~ OIDN_REPO_UID="dabfd9c80101edae9d25a710160d12d6d963c591" -#~ OIDN_REPO_BRANCH="master" - -ISPC_BINARY=( "https://github.com/ispc/ispc/releases/download/v${ISPC_VERSION}/ispc-v${ISPC_VERSION}-linux.tar.gz" ) - -XR_OPENXR_USE_REPO=false -XR_OPENXR_SOURCE=("https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_VERSION}.tar.gz") -XR_OPENXR_SOURCE_REPO=("https://github.com/KhronosGroup/OpenXR-SDK.git") -XR_OPENXR_REPO_UID="458984d7f59d1ae6dc1b597d94b02e4f7132eaba" -XR_OPENXR_REPO_BRANCH="master" - -LEVEL_ZERO_SOURCE=("https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz") - -OPENPGL_USE_REPO=false -OPENPGL_SOURCE=( "https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/v${OPENPGL_VERSION}-beta.tar.gz" ) - -FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" ) - -# C++11 is required now -CXXFLAGS_BACK=$CXXFLAGS -CXXFLAGS="$CXXFLAGS -std=c++11" -export CXXFLAGS - -# ---------------------------------------------------------------------------- -# Show Dependencies - -# Need those to be after we defined versions... -DEPS_COMMON_INFO="\"COMMON DEPENDENCIES: - -Those libraries should be available as packages in all recent distributions (optional ones are [between brackets]): - - * Basics of dev environment (cmake, gcc, svn , git, ...). - * libjpeg, libpng, libtiff, [openjpeg2], [libopenal]. - * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed). - * libwayland-client0, libdecor, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland) - * libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex, pybind11. - * libsdl2, libepoxy, libpugixml, libpotrace, [libgmp], fontconfig, [libharu/libhpdf]. - * [libvulkan/vulkan-loader]. - * [libfribidi], [libharfbuzz].\"" - -DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES: - -The following libraries will probably not all be available as packages in your distribution -(install_deps will by default try to install packages, and fall back to building missing ones). -You can force install_deps to build those with '--build-all' or relevant 'build-foo' options, see '--help' message. -You may also want to build them yourself (optional ones are [between brackets]): - - * Python $PYTHON_VERSION (from $PYTHON_SOURCE). - ** [IDNA $PYTHON_IDNA_VERSION] (use pip). - ** [Charset Normalizer $PYTHON_CHARSET_NORMALIZER_VERSION] (use pip). - ** [Urllib3 $PYTHON_URLLIB3_VERSION] (use pip). - ** [Certifi $PYTHON_CERTIFI_VERSION] (use pip). - ** [Requests $PYTHON_REQUESTS_VERSION] (use pip). - ** [ZStandard $PYTHON_ZSTANDARD_VERSION] (use pip). - ** [NumPy $PYTHON_NUMPY_VERSION] (use pip). - * Boost $BOOST_VERSION (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES). - * TBB $TBB_VERSION (from $TBB_SOURCE). - * [FFMpeg $FFMPEG_VERSION (needs libvorbis, libogg, libtheora, libx264, libmp3lame, libxvidcore, libvpx, libaom, libwebp, ...)] (from $FFMPEG_SOURCE). - * [OpenColorIO $OCIO_VERSION] (from $OCIO_SOURCE). - * Imath $IMATH_VERSION (from $IMATH_SOURCE). - * OpenEXR $OPENEXR_VERSION (from $OPENEXR_SOURCE). - * OpenImageIO $OIIO_VERSION (from $OIIO_SOURCE). - * [LLVM $LLVM_VERSION (with clang)] (from $LLVM_SOURCE, and $LLVM_CLANG_SOURCE). - * [OpenShadingLanguage $OSL_VERSION] (from $OSL_SOURCE_REPO, branch $OSL_SOURCE_REPO_BRANCH, commit $OSL_SOURCE_REPO_UID). - * [OpenSubDiv $OSD_VERSION] (from $OSD_SOURCE_REPO, branch $OSD_SOURCE_REPO_BRANCH, commit $OSD_SOURCE_REPO_UID). - * [OpenVDB $OPENVDB_VERSION] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE). - * [OpenCollada $OPENCOLLADA_VERSION] (from $OPENCOLLADA_SOURCE). - * [Embree $EMBREE_VERSION] (from $EMBREE_SOURCE). - * [OpenImageDenoise $OIDN_VERSION] (from $OIDN_SOURCE). - * [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE). - * [Universal Scene Description $USD_VERSION] (from $USD_SOURCE). - * [OpenXR-SDK $XR_OPENXR_VERSION] (from $XR_OPENXR_SOURCE). - * [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE). - * [OpenPGL $OPENPGL_VERSION] (from $OPENPGL_SOURCE).\"" - -if [ "$DO_SHOW_DEPS" = true ]; then - PRINT "" - PRINT "Blender dependencies (libraries needed to build it):" - PRINT "" - PRINT "`eval _echo "$DEPS_COMMON_INFO"`" - PRINT "" - PRINT "`eval _echo "$DEPS_SPECIFIC_INFO"`" - PRINT "" - exit 0 -fi - -# ---------------------------------------------------------------------------- -# Generic Helpers - -# Check return code of wget for success... -download() { - declare -a sources=("${!1}") - sources_count=${#sources[@]} - error=1 - - for (( i=0; $i < $sources_count; i++ )) - do - wget -c ${sources[$i]} -O $2 - if [ $? -eq 0 ]; then - error=0 - break - fi - done - - if [ $error -eq 1 ]; then - ERROR "wget could not find ${sources[@]}, or could not write it to $2, exiting" - exit 1 - fi -} - -version_sanitize() { - # Remove suffix such as '1.3_RC2', keeping only '1.3'. - # Needed for numeric comparisons. - local val=$(sed -r 's/^([^_]+).*/\1/' <<< "$1") - # Remove trailing punctuation such as '1.0.', keeping only '1.0'. - val=$(sed -r 's/[[:punct:]]*$//g' <<< "$val") - echo $val -} - -# Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1. -# $1 and $2 should be version numbers made of numbers only. -version_eq() { - local VER_1=$(version_sanitize "$1") - local VER_2=$(version_sanitize "$2") - local IFS='.' - - # Split both version numbers into their numeric elements. - arr1=( $VER_1 ) - arr2=( $VER_2 ) - - ret=1 - - count1=${#arr1[@]} - count2=${#arr2[@]} - if [ $count2 -ge $count1 ]; then - _t=$count1 - count1=$count2 - count2=$_t - arr1=( $VER_2 ) - arr2=( $VER_1 ) - fi - - ret=0 - for (( i=0; $i < $count2; i++ )) - do - if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then - ret=1 - break - fi - done - - for (( i=$count2; $i < $count1; i++ )) - do - if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then - ret=1 - break - fi - done - - return $ret -} - -# Return 0 if $1 >= $2, else 1. -# $1 and $2 should be version numbers made of numbers only. -version_ge() { - version_eq $1 $2 - if [ $? -eq 1 -a $(_echo "$1" "$2" | sort --version-sort | head --lines=1) = "$1" ]; then - return 1 - else - return 0 - fi -} - -# Return 0 if $3 > $1 >= $2, else 1. -# $1 and $2 should be version numbers made of numbers only. -version_ge_lt() { - version_ge $1 $3 - if [ $? -eq 0 ]; then - return 1 - else - version_ge $1 $2 - return $? - fi -} - -# 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. -# $1 and $2 should be version numbers made of numbers only. -# $1 should be at least as long as $2! -version_match() { - local VER_1=$(version_sanitize "$1") - local VER_2=$(version_sanitize "$2") - local IFS='.' - - # Split both version numbers into their numeric elements. - arr1=( $VER_1 ) - arr2=( $VER_2 ) - - ret=1 - - count1=${#arr1[@]} - count2=${#arr2[@]} - if [ $count1 -ge $count2 ]; then - ret=0 - for (( i=0; $i < $count2; i++ )) - do - if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then - ret=1 - break - fi - done - fi - - return $ret -} - -# ---------------------------------------------------------------------------- -# Generic compile helpers - -prepare_inst() { - INFO "Ensuring $INST exists and is writable by us" - if [ ! $SUDO ]; then - WARNING "--no-sudo enabled, might be impossible to create install dir..." - fi - - if [ ! -d $INST ]; then - # Try to create normal user directory first to possibly avoid excessive - # system operations - mkdir -p $INST || $SUDO mkdir -p $INST - fi - - if [ ! -w $INST ]; then - $SUDO chown $USER $INST - $SUDO chmod 775 $INST - fi -} - -# Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name... -magic_compile_check() { - if [ -f $INST/.$1-magiccheck-$2-$USE_CXX11 ]; then - return 0 - else - return 1 - fi -} - -magic_compile_set() { - rm -f $INST/.$1-magiccheck-* - touch $INST/.$1-magiccheck-$2-$USE_CXX11 -} - -# Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib... -_clean() { - if [ $_inst_shortcut ]; then - rm -rf `readlink -f $_inst_shortcut` - rm -rf $_inst_shortcut - fi - # Only remove $_src dir when not using git repo (avoids to re-clone the whole repo every time!!!). - if [ $_git == false ]; then - rm -rf $_src - fi - rm -rf $_inst -} - -_create_inst_shortcut() { - if [ $_inst_shortcut ]; then - rm -f $_inst_shortcut - ln -s $_inst $_inst_shortcut - fi -} - -# ldconfig -run_ldconfig() { - _lib_path="$INST/$1/lib" - _lib64_path="$INST/$1/lib64" - _ldconf_path="/etc/ld.so.conf.d/$1.conf" - PRINT "" - if [ ! $SUDO ]; then - WARNING "--no-sudo enabled, impossible to run ldconfig for $1, you'll have to do it yourself..." - else - INFO "Running ldconfig for $1..." - $SUDO sh -c "/bin/echo -e \"$_lib_path\n$_lib64_path\" > $_ldconf_path" - $SUDO /sbin/ldconfig # XXX OpenSuse does not include sbin in command path with sudo!!! - fi - PRINT "" -} - -# ---------------------------------------------------------------------------- -# Build Python - -_init_python() { - _src=$SRC/Python-$PYTHON_VERSION - _git=false - _inst=$INST/python-$PYTHON_VERSION - _inst_shortcut=$INST/python-$PYTHON_VERSION_SHORT -} - -_update_deps_python() { - if [ "$1" = true ]; then - BOOST_FORCE_BUILD=true - OCIO_FORCE_BUILD=true - OIIO_FORCE_BUILD=true - OPENVDB_FORCE_BUILD=true - USD_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - BOOST_FORCE_REBUILD=true - OCIO_FORCE_REBUILD=true - OIIO_FORCE_REBUILD=true - OPENVDB_FORCE_REBUILD=true - USD_FORCE_REBUILD=true - fi -} - -clean_Python() { - _init_python - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_python false true - fi - _clean -} - -compile_Python() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, Python will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - py_magic=3 - _init_python - - # Force having own builds for the dependencies. - _update_deps_python true false - - # Clean install if needed! - magic_compile_check python-$PYTHON_VERSION $py_magic - if [ $? -eq 1 -o "$PYTHON_FORCE_REBUILD" = true ]; then - clean_Python - fi - - if [ ! -d $_inst ]; then - INFO "Building Python-$PYTHON_VERSION" - - # Force rebuilding the dependencies. - _update_deps_python true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - download PYTHON_SOURCE[@] $_src.tgz - - INFO "Unpacking Python-$PYTHON_VERSION" - tar -C $SRC -xf $_src.tgz - fi - - cd $_src - - ./configure --prefix=$_inst --libdir=$_inst/lib --enable-ipv6 \ - --enable-loadable-sqlite-extensions --with-dbmliborder=bdb \ - --with-computed-gotos --with-pymalloc --enable-shared - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "Python--$PYTHON_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set python-$PYTHON_VERSION $py_magic - - PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_SHORT - - cd $CWD - INFO "Done compiling Python-$PYTHON_VERSION!" - else - INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-python option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "python-$PYTHON_VERSION_SHORT" - - # Extra step: install required modules with pip. - _python="$_inst/bin/python3" - $_python -m pip install --upgrade pip - for module in "${PYTHON_MODULES_PIP[@]}" - do - PRINT "" - $_python -m pip install $module --no-binary :all: - done - - _with_built_python=true - _with_built_python_execpath="$INST/python-$PYTHON_VERSION_SHORT/bin/python3" -} - -# ---------------------------------------------------------------------------- -# Build Boost - -_init_boost() { - _src=$SRC/boost-$BOOST_VERSION - _git=false - _inst=$INST/boost-$BOOST_VERSION_SHORT - _inst_shortcut=$INST/boost -} - -_update_deps_boost() { - if [ "$1" = true ]; then - OIIO_FORCE_BUILD=true - OSL_FORCE_BUILD=true - OPENVDB_FORCE_BUILD=true - ALEMBIC_FORCE_BUILD=true - USD_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - OIIO_FORCE_REBUILD=true - OSL_FORCE_REBUILD=true - OPENVDB_FORCE_REBUILD=true - ALEMBIC_FORCE_REBUILD=true - USD_FORCE_REBUILD=true - fi -} - -clean_Boost() { - _init_boost - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_boost false true - fi - _clean -} - -compile_Boost() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, Boost will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - boost_magic=15 - - _init_boost - - # Force having own builds for the dependencies. - _update_deps_boost true false - - # Clean install if needed! - magic_compile_check boost-$BOOST_VERSION $boost_magic - if [ $? -eq 1 -o "$BOOST_FORCE_REBUILD" = true ]; then - clean_Boost - fi - - if [ ! -d $_inst ]; then - INFO "Building Boost-$BOOST_VERSION" - - # Force rebuilding the dependencies. - _update_deps_boost true true - - prepare_inst - - if [ ! -d $_src ]; then - INFO "Downloading Boost-$BOOST_VERSION" - mkdir -p $SRC - download BOOST_SOURCE[@] $_src.tar.bz2 - tar -C $SRC --transform "s,\w*,boost-$BOOST_VERSION,x" -xf $_src.tar.bz2 - - patch -d $_src -p1 < $SCRIPT_DIR/patches/boost.diff - fi - - cd $_src - if [ ! -f $_src/b2 ]; then - if [ -d $_with_built_python ]; then - ./bootstrap.sh --with-python-root="$INST/python-$PYTHON_VERSION_INSTALLED" - else - ./bootstrap.sh - fi - fi - ./b2 -j$THREADS -a $BOOST_BUILD_MODULES \ - --prefix=$_inst --disable-icu boost.locale.icu=off install - ./b2 --clean - - if [ ! -d $_inst ]; then - ERROR "Boost-$BOOST_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set boost-$BOOST_VERSION $boost_magic - - cd $CWD - INFO "Done compiling Boost-$BOOST_VERSION!" - else - INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-boost option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "boost" -} - -# ---------------------------------------------------------------------------- -# Build TBB - -_init_tbb() { - _src=$SRC/TBB-$TBB_VERSION - _git=false - _inst=$INST/tbb-$TBB_VERSION_SHORT - _inst_shortcut=$INST/tbb -} - -_update_deps_tbb() { - if [ "$1" = true ]; then - OSD_FORCE_BUILD=true - OPENVDB_FORCE_BUILD=true - USD_FORCE_BUILD=true - EMBREE_FORCE_BUILD=true - OIDN_FORCE_BUILD=true - OPENPGL_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - OSD_FORCE_REBUILD=true - OPENVDB_FORCE_REBUILD=true - USD_FORCE_REBUILD=true - EMBREE_FORCE_REBUILD=true - OIDN_FORCE_REBUILD=true - OPENPGL_FORCE_REBUILD=true - fi -} - -clean_TBB() { - _init_tbb - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_tbb false true - fi - _clean -} - -compile_TBB() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, TBB will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - tbb_magic=1 - _init_tbb - - # Force having own builds for the dependencies. - _update_deps_tbb true false - - # Clean install if needed! - magic_compile_check tbb-$TBB_VERSION $tbb_magic - if [ $? -eq 1 -o "$TBB_FORCE_REBUILD" = true ]; then - clean_TBB - fi - - if [ ! -d $_inst ]; then - INFO "Building TBB-$TBB_VERSION$TBB_VERSION_UPDATE" - - # Force rebuilding the dependencies. - _update_deps_tbb true true - - prepare_inst - - if [ ! -d $_src ]; then - INFO "Downloading TBB-$TBB_VERSION$TBB_VERSION_UPDATE" - mkdir -p $SRC - - download TBB_SOURCE[@] $_src.tar.gz - INFO "Unpacking TBB-$TBB_VERSION$TBB_VERSION_UPDATE" - tar -C $SRC --transform "s,(.*/?)oneTBB[^/]*(.*),\1TBB-$TBB_VERSION\2,x" \ - -xf $_src.tar.gz - - INFO - - # Super-hack: Add some cmake builder to tbb... since they don't even have an install target by default, sic. - download TBB_SOURCE_CMAKE[@] $_src/CMakeLists.txt - cp $_src/build/vs2013/version_string.ver $_src/build/version_string.ver.in - fi - - cd $_src - - # Always refresh the whole build! - if [ -d cmake_build ]; then - rm -rf cmake_build - fi - mkdir cmake_build - cd cmake_build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D TBB_BUILD_SHARED=ON" - cmake_d="$cmake_d -D TBB_BUILD_STATIC=OFF" - cmake_d="$cmake_d -D TBB_BUILD_TBBMALLOC=ON" - cmake_d="$cmake_d -D TBB_BUILD_TBBMALLOC_PROXY=OFF" - cmake_d="$cmake_d -D TBB_BUILD_TESTS=OFF" - - if file /bin/cp | grep -q '32-bit'; then - cflags="-fPIC -m32 -march=i686" - else - cflags="-fPIC" - fi - - cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" .. - - make -j$THREADS && make install - - make clean - - if [ ! -d $_inst ]; then - ERROR "TBB-$TBB_VERSION$TBB_VERSION_UPDATE failed to compile, exiting" - exit 1 - fi - - magic_compile_set tbb-$TBB_VERSION $tbb_magic - - cd $CWD - INFO "Done compiling TBB-$TBB_VERSION$TBB_VERSION_UPDATE!" - else - INFO "Own TBB-$TBB_VERSION$TBB_VERSION_UPDATE is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-tbb option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "tbb" -} - -# ---------------------------------------------------------------------------- -# Build OCIO - -_init_ocio() { - _src=$SRC/OpenColorIO-$OCIO_VERSION - if [ "$OCIO_USE_REPO" = true ]; then - _git=true - else - _git=false - fi - _inst=$INST/ocio-$OCIO_VERSION_SHORT - _inst_shortcut=$INST/ocio -} - -_update_deps_ocio() { - : -} - -clean_OCIO() { - _init_ocio - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_ocio false true - fi - _clean -} - -compile_OCIO() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenColorIO will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - ocio_magic=5 - _init_ocio - - # Force having own builds for the dependencies. - _update_deps_ocio true false - - # Clean install if needed! - magic_compile_check ocio-$OCIO_VERSION $ocio_magic - if [ $? -eq 1 -o "$OCIO_FORCE_REBUILD" = true ]; then - clean_OCIO - fi - - if [ ! -d $_inst ]; then - INFO "Building OpenColorIO-$OCIO_VERSION" - - # Force rebuilding the dependencies. - _update_deps_ocio true true - - prepare_inst - - if [ ! -d $_src ]; then - INFO "Downloading OpenColorIO-$OCIO_VERSION" - mkdir -p $SRC - - if [ "$OCIO_USE_REPO" = true ]; then - git clone ${OCIO_SOURCE_REPO[0]} $_src - else - download OCIO_SOURCE[@] $_src.tar.gz - INFO "Unpacking OpenColorIO-$OCIO_VERSION" - tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \ - -xf $_src.tar.gz - fi - - fi - - cd $_src - - if [ "$OCIO_USE_REPO" = true ]; then - # XXX For now, always update from latest repo... - git pull origin master - git checkout $OCIO_SOURCE_REPO_UID - git reset --hard - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D OCIO_BUILD_APPS=OFF" - cmake_d="$cmake_d -D OCIO_BUILD_PYTHON=ON" - cmake_d="$cmake_d -D OCIO_BUILD_GPU_TESTS=OFF" - - if [ "$_with_built_python" = true ]; then - cmake_d="$cmake_d -D Python_EXECUTABLE=$_with_built_python_execpath" - fi - - if [ $(uname -m) == "aarch64" ]; then - cmake_d="$cmake_d -D OCIO_USE_SSE=OFF" - fi - - if file /bin/cp | grep -q '32-bit'; then - cflags="-fPIC -m32 -march=i686" - else - cflags="-fPIC" - fi - cflags="$cflags -Wno-error=unused-function -Wno-error=deprecated-declarations" - - cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" .. - - make -j$THREADS && make install - - # Force linking against static libs - #rm -f $_inst/lib/*.so* - - # Additional dependencies - #cp ext/dist/lib/libtinyxml.a $_inst/lib - #cp ext/dist/lib/libyaml-cpp.a $_inst/lib - - make clean - - if [ ! -d $_inst ]; then - ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set ocio-$OCIO_VERSION $ocio_magic - - cd $CWD - INFO "Done compiling OpenColorIO-$OCIO_VERSION!" - else - INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-ocio option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "ocio" -} - -# ---------------------------------------------------------------------------- -# Build Imath. - -_init_imath() { - _src=$SRC/Imath-$IMATH_VERSION - _git=false - _inst=$INST/imath-$IMATH_VERSION_SHORT - _inst_shortcut=$INST/imath -} - -_update_deps_imath() { - if [ "$1" = true ]; then - OPENEXR_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - OPENEXR_FORCE_REBUILD=true - fi -} - -clean_IMATH() { - _init_imath - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_imath false true - fi - _clean -} - -compile_IMATH() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, Imath will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - imath_magic=1 - _init_imath - - # Force having own builds for the dependencies. - _update_deps_imath true false - - # Clean install if needed! - magic_compile_check imath-$IMATH_VERSION $imath_magic - if [ $? -eq 1 -o "$IMATH_FORCE_REBUILD" = true ]; then - clean_IMATH - fi - - PRINT "" - - if [ ! -d $_inst ]; then - INFO "Building Imath-$IMATH_VERSION" - - # Force rebuilding the dependencies. - _update_deps_imath true true - - prepare_inst - - if [ ! -d $_src ]; then - INFO "Downloading Imath-$IMATH_VERSION" - mkdir -p $SRC - - if [ "$IMATH_USE_REPO" = true ]; then - git clone ${IMATH_SOURCE_REPO[0]} $_src - else - download IMATH_SOURCE[@] $_src.tar.gz - INFO "Unpacking Imath-$IMATH_VERSION" - tar -C $SRC --transform "s,(.*/?)imath[^/]*(.*),\1Imath-$IMATH_VERSION\2,x" -xf $_src.tar.gz - fi - - fi - - cd $_src - - if [ "$IMATH_USE_REPO" = true ]; then - # XXX For now, always update from latest repo... - git pull origin master - git checkout $IMATH_SOURCE_REPO_UID - git reset --hard - imath_src_path="../Imath" - else - imath_src_path=".." - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D CMAKE_INSTALL_DOCDIR=/dev/null" # Hack, there is no option to disable that currently... - cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON" - cmake_d="$cmake_d -D BUILD_TESTING=OFF" - cmake_d="$cmake_d -D PYIMATH_ENABLE=OFF" - - if file /bin/cp | grep -q '32-bit'; then - cflags="-fPIC -m32 -march=i686" - else - cflags="-fPIC" - fi - - cmake $cmake_d -D CMAKE_BUILD_TYPE=Release -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" $imath_src_path - - make -j$THREADS && make install - - make clean - - if [ ! -d $_inst ]; then - ERROR "Imath-$IMATH_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set imath-$IMATH_VERSION $imath_magic - - cd $CWD - INFO "Done compiling Imath-$imath_VERSION!" - else - INFO "Own Imath-$IMATH_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-imath option." - fi - - _with_built_imath=true - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "openexr" -} - -# ---------------------------------------------------------------------------- -# Build OpenEXR. - -_init_openexr() { - _src=$SRC/OpenEXR-$OPENEXR_VERSION - _git=false - _inst=$INST/openexr-$OPENEXR_VERSION_SHORT - _inst_shortcut=$INST/openexr -} - -_update_deps_openexr() { - if [ "$1" = true ]; then - OIIO_FORCE_BUILD=true - OPENVDB_FORCE_BUILD=true - ALEMBIC_FORCE_BUILD=true - USD_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - OIIO_FORCE_REBUILD=true - OPENVDB_FORCE_REBUILD=true - ALEMBIC_FORCE_REBUILD=true - USD_FORCE_REBUILD=true - fi -} - -clean_OPENEXR() { - _init_openexr - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_openexr false true - fi - _clean -} - -compile_OPENEXR() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenEXR will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - openexr_magic=16 - _init_openexr - - # Force having own builds for the dependencies. - _update_deps_openexr true false - - # Clean install if needed! - magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic - if [ $? -eq 1 -o "$OPENEXR_FORCE_REBUILD" = true ]; then - clean_OPENEXR - fi - - PRINT "" - - if [ ! -d $_inst ]; then - INFO "Building OpenEXR-$OPENEXR_VERSION" - - # Force rebuilding the dependencies. - _update_deps_openexr true true - - prepare_inst - - if [ ! -d $_src ]; then - INFO "Downloading OpenEXR-$OPENEXR_VERSION" - mkdir -p $SRC - - if [ "$OPENEXR_USE_REPO" = true ]; then - git clone ${OPENEXR_SOURCE_REPO[0]} $_src - else - download OPENEXR_SOURCE[@] $_src.tar.gz - INFO "Unpacking OpenEXR-$OPENEXR_VERSION" - tar -C $SRC --transform "s,([^/]*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" -xf $_src.tar.gz - fi - - fi - - cd $_src - - if [ "$OPENEXR_USE_REPO" = true ]; then - # XXX For now, always update from latest repo... - git pull origin master - git checkout $OPENEXR_SOURCE_REPO_UID - git reset --hard - openexr_src_path="../OpenEXR" - else - openexr_src_path=".." - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - #cmake_d="$cmake_d -D CMAKE_INSTALL_DOCDIR=/dev/null" # Hack, there is no option to disable that currently... - cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON" - cmake_d="$cmake_d -D BUILD_TESTING=OFF" - cmake_d="$cmake_d -D DOCS=OFF" - cmake_d="$cmake_d -D PYTHON=OFF" - - if file /bin/cp | grep -q '32-bit'; then - cflags="-fPIC -m32 -march=i686" - else - cflags="-fPIC" - fi - - cmake $cmake_d -D CMAKE_BUILD_TYPE=Release -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" $openexr_src_path - - make -j$THREADS && make install - - make clean - - if [ ! -d $_inst ]; then - ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set openexr-$OPENEXR_VERSION $openexr_magic - - cd $CWD - INFO "Done compiling OpenEXR-$OPENEXR_VERSION!" - else - INFO "Own OpenEXR-$OPENEXR_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-openexr option." - fi - - _with_built_openexr=true - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "openexr" -} - -# ---------------------------------------------------------------------------- -# Build OIIO - -_init_oiio() { - _src=$SRC/OpenImageIO-$OIIO_VERSION - _git=true - _inst=$INST/oiio-$OIIO_VERSION_SHORT - _inst_shortcut=$INST/oiio -} - -_update_deps_oiio() { - if [ "$1" = true ]; then - OSL_FORCE_BUILD=true - USD_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - OSL_FORCE_REBUILD=true - USD_FORCE_REBUILD=true - fi -} - -clean_OIIO() { - _init_oiio - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_oiio false true - fi - _clean -} - -compile_OIIO() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenImageIO will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - oiio_magic=20 - _init_oiio - - # Force having own builds for the dependencies. - _update_deps_oiio true false - - # Clean install if needed! - magic_compile_check oiio-$OIIO_VERSION $oiio_magic - if [ $? -eq 1 -o "$OIIO_FORCE_REBUILD" = true ]; then - clean_OIIO - fi - - if [ ! -d $_inst ]; then - INFO "Building OpenImageIO-$OIIO_VERSION" - - # Force rebuilding the dependencies. - _update_deps_oiio true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - - if [ "$OIIO_USE_REPO" = true ]; then - git clone ${OIIO_SOURCE_REPO[0]} $_src - else - download OIIO_SOURCE[@] "$_src.tar.gz" - INFO "Unpacking OpenImageIO-$OIIO_VERSION" - tar -C $SRC --transform "s,(.*/?)oiio-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" -xf $_src.tar.gz - fi - fi - - cd $_src - - if [ "$OIIO_USE_REPO" = true ]; then - # XXX For now, always update from latest repo... - git pull origin master - # Stick to same rev as windows' libs... - git checkout $OIIO_SOURCE_REPO_UID - git reset --hard - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D STOP_ON_WARNING=OFF" - cmake_d="$cmake_d -D LINKSTATIC=OFF" - cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON" - - if [ $(uname -m) != "aarch64" ]; then - cmake_d="$cmake_d -D USE_SIMD=sse2" - fi - - cmake_d="$cmake_d -D OPENEXR_VERSION=$OPENEXR_VERSION" - - if [ "$_with_built_imath" = true ]; then - cmake_d="$cmake_d -D Imath_ROOT=$INST/imath" - INFO "Ilmbase_ROOT=$INST/imath" - fi - if [ "$_with_built_openexr" = true ]; then - cmake_d="$cmake_d -D OpenEXR_ROOT=$INST/openexr" - fi - - cmake_d="$cmake_d -D USE_PYTHON=ON" - if [ "$_with_built_python" = true ]; then - cmake_d="$cmake_d -D Python_EXECUTABLE=$_with_built_python_execpath" - fi - - # Optional tests and cmd tools - cmake_d="$cmake_d -D USE_QT=OFF" - cmake_d="$cmake_d -D USE_QT5=OFF" - cmake_d="$cmake_d -D USE_OPENGL=OFF" - cmake_d="$cmake_d -D USE_TBB=OFF" - cmake_d="$cmake_d -D USE_BZIP2=OFF" - cmake_d="$cmake_d -D USE_FREETYPE=OFF" - cmake_d="$cmake_d -D USE_OPENCOLORIO=OFF" - - cmake_d="$cmake_d -D USE_WEBP=ON" - cmake_d="$cmake_d -D USE_OPENJPEG=ON" - - cmake_d="$cmake_d -D USE_FFMPEG=OFF" - cmake_d="$cmake_d -D USE_OPENCV=OFF" - cmake_d="$cmake_d -D USE_OPENVDB=OFF" - cmake_d="$cmake_d -D USE_NUKE=OFF" - cmake_d="$cmake_d -D USE_DCMTK=OFF" - cmake_d="$cmake_d -D USE_LIBHEIF=OFF" - cmake_d="$cmake_d -D USE_GIF=OFF" - cmake_d="$cmake_d -D USE_LIBRAW=OFF" - cmake_d="$cmake_d -D USE_LIBSQUISH=OFF" - - cmake_d="$cmake_d -D BUILD_TESTING=OFF" - cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF" - cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=ON" - cmake_d="$cmake_d -D TXT2MAN=" - - if [ -d $INST/boost ]; then - cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON -D Boost_NO_BOOST_CMAKE=ON" - fi - - # Looks like we do not need ocio in oiio for now... -# if [ -d $INST/ocio ]; then -# cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio" -# fi - - if file /bin/cp | grep -q '32-bit'; then - cflags="-fPIC -m32 -march=i686" - else - cflags="-fPIC" - fi - - cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" .. - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set oiio-$OIIO_VERSION $oiio_magic - - cd $CWD - INFO "Done compiling OpenImageIO-$OIIO_VERSION!" - else - INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-oiio option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "oiio" -} - -# ---------------------------------------------------------------------------- -# Build LLVM - -_init_llvm() { - _src=$SRC/LLVM-$LLVM_VERSION - _src_clang=$SRC/CLANG-$LLVM_VERSION - _git=false - _inst=$INST/llvm-$LLVM_VERSION_SHORT - _inst_shortcut=$INST/llvm -} - -_update_deps_llvm() { - if [ "$1" = true ]; then - OSL_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - OSL_FORCE_REBUILD=true - fi -} - -clean_LLVM() { - _init_llvm - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_llvm false true - fi - _clean -} - -compile_LLVM() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, LLVM will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - llvm_magic=4 - _init_llvm - - # Force having own builds for the dependencies. - _update_deps_llvm true false - - # Clean install if needed! - magic_compile_check llvm-$LLVM_VERSION $llvm_magic - if [ $? -eq 1 -o "$LLVM_FORCE_REBUILD" = true ]; then - clean_LLVM - fi - - if [ ! -d $_inst ]; then - INFO "Building LLVM-$LLVM_VERSION (CLANG included!)" - - # Force rebuilding the dependencies. - _update_deps_llvm true true - - prepare_inst - - if [ ! -d $_src -o true ]; then - mkdir -p $SRC - download LLVM_SOURCE[@] "$_src.tar.xz" - download LLVM_CLANG_SOURCE[@] "$_src_clang.tar.xz" - - INFO "Unpacking LLVM-$LLVM_VERSION" - tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \ - -xf $_src.tar.xz - INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang" - # Stupid clang guys renamed 'clang' to 'cfe' for now handle both cases... :( - tar -C $_src/tools \ - --transform "s,([^/]*/?)(clang|cfe)-[^/]*(.*),\1clang\3,x" \ - -xf $_src_clang.tar.xz - - cd $_src - - cd $CWD - - fi - - cd $_src - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - LLVM_TARGETS="X86;NVPTX" - if [ $(uname -m) == "aarch64" ]; then - LLVM_TARGETS="AArch64;NVPTX" - fi - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON" - cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=$LLVM_TARGETS" - cmake_d="$cmake_d -D LLVM_ENABLE_TERMINFO=OFF" - - if [ -d $_FFI_INCLUDE_DIR ]; then - cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR" - fi - - cmake $cmake_d .. - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "LLVM-$LLVM_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set llvm-$LLVM_VERSION $llvm_magic - - cd $CWD - INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!" - else - INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-llvm option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi -} - -# ---------------------------------------------------------------------------- -# Build OSL - -_init_osl() { - _src=$SRC/OpenShadingLanguage-$OSL_VERSION - _git=true - _inst=$INST/osl-$OSL_VERSION_SHORT - _inst_shortcut=$INST/osl -} - -_update_deps_osl() { - : -} - -clean_OSL() { - _init_osl - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_osl false true - fi - _clean -} - -compile_OSL() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenShadingLanguage will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - osl_magic=22 - _init_osl - - # Force having own builds for the dependencies. - _update_deps_osl true false - - # Clean install if needed! - magic_compile_check osl-$OSL_VERSION $osl_magic - if [ $? -eq 1 -o "$OSL_FORCE_REBUILD" = true ]; then - #~ rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically - clean_OSL - fi - - if [ ! -d $_inst ]; then - INFO "Building OpenShadingLanguage-$OSL_VERSION" - - # Force rebuilding the dependencies. - _update_deps_osl true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - - if [ "$OSL_USE_REPO" = true ]; then - git clone ${OSL_SOURCE_REPO[0]} $_src - else - download OSL_SOURCE[@] "$_src.tar.gz" - INFO "Unpacking OpenShadingLanguage-$OSL_VERSION" - tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \ - -xf $_src.tar.gz - - patch -d $_src -p1 < $SCRIPT_DIR/patches/osl.diff - fi - fi - - cd $_src - - if [ "$OSL_USE_REPO" = true ]; then - git remote set-url origin ${OSL_SOURCE_REPO[0]} - # XXX For now, always update from latest repo... - git pull --no-edit -X theirs origin $OSL_SOURCE_REPO_BRANCH - # Stick to same rev as windows' libs... - git checkout $OSL_SOURCE_REPO_UID - git reset --hard - - patch -d $_src -p1 < $SCRIPT_DIR/patches/osl.diff - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D STOP_ON_WARNING=OFF" - cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF" - cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF" - cmake_d="$cmake_d -D USE_LLVM_BITCODE=OFF" - cmake_d="$cmake_d -D USE_PARTIO=OFF" - cmake_d="$cmake_d -D OSL_BUILD_MATERIALX=OFF" - cmake_d="$cmake_d -D USE_QT=OFF" - cmake_d="$cmake_d -D USE_Qt5=OFF" - cmake_d="$cmake_d -D USE_PYTHON=OFF" - cmake_d="$cmake_d -D USE_PARTIO=OFF" - cmake_d="$cmake_d -D INSTALL_DOCS=OFF" - - if [ $(uname -m) != "aarch64" ]; then - cmake_d="$cmake_d -D USE_SIMD=sse2" - fi - - cmake_d="$cmake_d -D CMAKE_CXX_STANDARD=14" - - #~ cmake_d="$cmake_d -D IMATH_VERSION=$IMATH_VERSION" - - if [ "$_with_built_imath" = true ]; then - cmake_d="$cmake_d -D Imath_ROOT=$INST/imath" - INFO "Imath_ROOT=$INST/imath" - fi - if [ "$_with_built_openexr" = true ]; then - cmake_d="$cmake_d -D OpenEXR_ROOT=$INST/openexr" - fi - - if [ -d $INST/boost ]; then - cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON -D Boost_NO_BOOST_CMAKE=ON" - fi - - if [ -d $INST/oiio ]; then - cmake_d="$cmake_d -D OpenImageIO_ROOT=$INST/oiio" - fi - - if [ ! -z $LLVM_VERSION_FOUND ]; then - cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND" - if [ -d $INST/llvm ]; then - cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm" - cmake_d="$cmake_d -D LLVM_STATIC=ON" - fi - fi - - #~ cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON" - #~ cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON" - - cmake $cmake_d .. - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set osl-$OSL_VERSION $osl_magic - - cd $CWD - INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!" - else - INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-osl option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "osl" -} - -# ---------------------------------------------------------------------------- -# Build OSD - -_init_osd() { - _src=$SRC/OpenSubdiv-$OSD_VERSION - _git=true - _inst=$INST/osd-$OSD_VERSION_SHORT - _inst_shortcut=$INST/osd -} - -_update_deps_osd() { - : -} - -clean_OSD() { - _init_osd - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_osd false true - fi - _clean -} - -compile_OSD() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenSubdiv will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - osd_magic=2 - _init_osd - - # Force having own builds for the dependencies. - _update_deps_osd true false - - # Clean install if needed! - magic_compile_check osd-$OSD_VERSION $osd_magic - if [ $? -eq 1 -o "$OSD_FORCE_REBUILD" = true ]; then - clean_OSD - fi - - if [ ! -d $_inst ]; then - INFO "Building OpenSubdiv-$OSD_VERSION" - - # Force rebuilding the dependencies. - _update_deps_osd true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - - if [ "$OSD_USE_REPO" = true ]; then - git clone ${OSD_SOURCE_REPO[0]} $_src - else - download OSD_SOURCE[@] "$_src.tar.gz" - INFO "Unpacking OpenSubdiv-$OSD_VERSION" - tar -C $SRC --transform "s,(.*/?)OpenSubdiv-[^/]*(.*),\1OpenSubdiv-$OSD_VERSION\2,x" \ - -xf $_src.tar.gz - fi - fi - - cd $_src - - if [ "$OSD_USE_REPO" = true ]; then - git remote set-url origin ${OSD_SOURCE_REPO[0]} - # XXX For now, always update from latest repo... - git pull --no-edit -X theirs origin $OSD_SOURCE_REPO_BRANCH - # Stick to same rev as windows' libs... - git checkout $OSD_SOURCE_REPO_UID - git reset --hard - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - if [ -d $INST/tbb ]; then - cmake_d="$cmake_d -D TBB_LOCATION=$INST/tbb" - fi - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D NO_PTEX=1" - cmake_d="$cmake_d -D NO_CLEW=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_GLEW=1" - # maya plugin, docs, tutorials, regression tests and examples are not needed - cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1" - - cmake $cmake_d .. - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set osd-$OSD_VERSION $osd_magic - - cd $CWD - INFO "Done compiling OpenSubdiv-$OSD_VERSION!" - else - INFO "Own OpenSubdiv-$OSD_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-osd option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "osd" -} - -# ---------------------------------------------------------------------------- -# Build Blosc - -_init_blosc() { - _src=$SRC/c-blosc-$OPENVDB_BLOSC_VERSION - _git=false - _inst=$INST/blosc-$OPENVDB_BLOSC_VERSION - _inst_shortcut=$INST/blosc -} - -_update_deps_blosc() { - if [ "$1" = true ]; then - OPENVDB_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - OPENVDB_FORCE_REBUILD=true - fi -} - -clean_BLOSC() { - _init_blosc - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_blosc false true - fi - _clean -} - -compile_BLOSC() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, Blosc will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - blosc_magic=0 - _init_blosc - - # Force having own builds for the dependencies. - _update_deps_blosc true false - - # Clean install if needed! - magic_compile_check blosc-$OPENVDB_BLOSC_VERSION $blosc_magic - if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then - clean_BLOSC - rm -rf $_inst - fi - - if [ ! -d $_inst ]; then - INFO "Building Blosc-$OPENVDB_BLOSC_VERSION" - - # Force rebuilding the dependencies. - _update_deps_blosc true true - - prepare_inst - - if [ ! -d $_src ]; then - INFO "Downloading Blosc-$OPENVDB_BLOSC_VERSION" - mkdir -p $SRC - download OPENVDB_BLOSC_SOURCE[@] $_src.tar.gz - - INFO "Unpacking Blosc-$OPENVDB_BLOSC_VERSION" - tar -C $SRC -xf $_src.tar.gz - fi - - cd $_src - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D BUILD_STATIC=OFF" - cmake_d="$cmake_d -D BUILD_TESTS=OFF" - cmake_d="$cmake_d -D BUILD_BENCHMARKS=OFF" - INFO "$cmake_d" - - cmake $cmake_d .. - - make -j$THREADS && make install - - make clean - - if [ ! -d $_inst ]; then - ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting" - exit 1 - fi - cd $CWD - INFO "Done compiling Blosc-$OPENVDB_BLOSC_VERSION!" - else - INFO "Own Blosc-$OPENVDB_BLOSC_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib (and openvdb), use the --force-openvdb option." - fi - - magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "blosc" -} - -# ---------------------------------------------------------------------------- -# Build OpenVDB - -_init_openvdb() { - _src=$SRC/openvdb-$OPENVDB_VERSION - _git=false - _inst=$INST/openvdb-$OPENVDB_VERSION_SHORT - _inst_shortcut=$INST/openvdb -} - -_update_deps_openvdb() { - if [ "$1" = true ]; then - USD_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - USD_FORCE_REBUILD=true - fi -} - -clean_OPENVDB() { - _init_openvdb - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_openvdb false true - fi - _clean -} - -compile_OPENVDB() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenVDB will not be compiled!" - return - fi - - compile_BLOSC - PRINT "" - - # To be changed each time we make edits that would modify the compiled result! - openvdb_magic=5 - _init_openvdb - - # Force having own builds for the dependencies. - _update_deps_openvdb true false - - # Clean install if needed! - magic_compile_check openvdb-$OPENVDB_VERSION $openvdb_magic - if [ $? -eq 1 -o "$OPENVDB_FORCE_REBUILD" = true ]; then - clean_OPENVDB - fi - - if [ ! -d $_inst ]; then - INFO "Building OpenVDB-$OPENVDB_VERSION (with NanoVDB: $WITH_NANOVDB)" - - # Force rebuilding the dependencies. - _update_deps_openvdb true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - download OPENVDB_SOURCE[@] "$_src.tar.gz" - - INFO "Unpacking OpenVDB-$OPENVDB_VERSION" - tar -C $SRC -xf $_src.tar.gz - fi - - cd $_src - - #~ if [ "$OPENVDB_USE_REPO" = true ]; then - #~ git remote set-url origin ${OPENVDB_SOURCE_REPO[0]} - #~ # XXX For now, always update from latest repo... - #~ git pull --no-edit -X theirs origin $OPENVDB_SOURCE_REPO_BRANCH - #~ # Stick to same rev as windows' libs... - #~ git checkout $OPENVDB_SOURCE_REPO_UID - #~ git reset --hard - #~ fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF" - cmake_d="$cmake_d -D OPENVDB_CORE_SHARED=ON" - cmake_d="$cmake_d -D OPENVDB_CORE_STATIC=OFF" - cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF" - - if [ "$WITH_NANOVDB" = true ]; then - cmake_d="$cmake_d -D USE_NANOVDB=ON" - cmake_d="$cmake_d -D OPENVDB_BUILD_NANOVDB=ON" - cmake_d="$cmake_d -D NANOVDB_BUILD_TOOLS=OFF" - else - cmake_d="$cmake_d -D USE_NANOVDB=OFF" - cmake_d="$cmake_d -D OPENVDB_BUILD_NANOVDB=OFF" - cmake_d="$cmake_d -D NANOVDB_BUILD_TOOLS=OFF" - fi - - if [ -d $INST/boost ]; then - cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost" - cmake_d="$cmake_d -D Boost_USE_MULTITHREADED=ON" - cmake_d="$cmake_d -D Boost_NO_SYSTEM_PATHS=ON" - cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON" - cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON" - fi - if [ -d $INST/tbb ]; then - cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb" - # Work around until we use oneTBB, otherwise OpenVDB forcefully - # uses oneTBB if it can find it on the system. - cmake_d="$cmake_d -D Tbb_INCLUDE_DIR=$INST/tbb/include" - fi - - if [ "$_with_built_imath" = true ]; then - cmake_d="$cmake_d -D Imath_ROOT=$INST/imath" - fi - if [ "$_with_built_openexr" = true ]; then - cmake_d="$cmake_d -D OpenEXR_ROOT=$INST/openexr" - fi - - if [ -d $INST/blosc ]; then - cmake_d="$cmake_d -D Blosc_ROOT=$INST/blosc" - fi - - cmake_d="$cmake_d -D OPENVDB_BUILD_PYTHON_MODULE=ON" - cmake_d="$cmake_d -D OPENVDB_PYTHON_WRAP_ALL_GRID_TYPES=ON" - cmake_d="$cmake_d -D USE_NUMPY=ON" - if [ "$_with_built_python" = true ]; then - cmake_d="$cmake_d -D Python_EXECUTABLE=$_with_built_python_execpath" - fi - - cmake $cmake_d .. - - make -j$THREADS install - make clean - - if [ ! -d $_inst ]; then - ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set openvdb-$OPENVDB_VERSION $openvdb_magic - - cd $CWD - INFO "Done compiling OpenVDB-$OPENVDB_VERSION!" - else - INFO "Own OpenVDB-$OPENVDB_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-openvdb option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "openvdb" -} - -# ---------------------------------------------------------------------------- -# Build Alembic - -_init_alembic() { - _src=$SRC/alembic-$ALEMBIC_VERSION - _git=false - _inst=$INST/alembic-$ALEMBIC_VERSION_SHORT - _inst_shortcut=$INST/alembic -} - -_update_deps_alembic() { - : -} - -clean_ALEMBIC() { - _init_alembic - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_alembic false true - fi - _clean -} - -compile_ALEMBIC() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, Alembic will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - alembic_magic=3 - _init_alembic - - # Force having own builds for the dependencies. - _update_deps_alembic true false - - # Clean install if needed! - magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic - if [ $? -eq 1 -o "$ALEMBIC_FORCE_REBUILD" = true ]; then - clean_ALEMBIC - fi - - if [ ! -d $_inst ]; then - INFO "Building Alembic-$ALEMBIC_VERSION" - - # Force rebuilding the dependencies. - _update_deps_alembic true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - download ALEMBIC_SOURCE[@] "$_src.tar.gz" - - INFO "Unpacking Alembic-$ALEMBIC_VERSION" - tar -C $SRC -xf $_src.tar.gz - fi - - cd $_src - - cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst" - - if [ -d $INST/boost ]; then - if [ -d $INST/boost ]; then - cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost" - fi - cmake_d="$cmake_d -D USE_STATIC_BOOST=ON" - else - cmake_d="$cmake_d -D USE_STATIC_BOOST=OFF" - fi - - if [ "$_with_built_imath" = true ]; then - cmake_d="$cmake_d -D Imath_ROOT=$INST/imath" - cmake_d="$cmake_d -D ALEMBIC_IMATH_LINK_STATIC=OFF" - INFO "Imath_ROOT=$INST/imath" - fi - if [ "$_with_built_openexr" = true ]; then - cmake_d="$cmake_d -D USE_ARNOLD=OFF" - cmake_d="$cmake_d -D USE_BINARIES=ON" # Tests use some Alembic binaries... - cmake_d="$cmake_d -D USE_EXAMPLES=OFF" - cmake_d="$cmake_d -D USE_HDF5=OFF" - cmake_d="$cmake_d -D USE_MAYA=OFF" - cmake_d="$cmake_d -D USE_PRMAN=OFF" - cmake_d="$cmake_d -D USE_PYALEMBIC=OFF" - cmake_d="$cmake_d -D USE_STATIC_HDF5=OFF" - cmake_d="$cmake_d -D ALEMBIC_SHARED_LIBS=OFF" - fi - - cmake $cmake_d ./ - make -j$THREADS install - make clean - - if [ ! -d $_inst ]; then - ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set alembic-$ALEMBIC_VERSION $alembic_magic - - cd $CWD - INFO "Done compiling Alembic-$ALEMBIC_VERSION!" - else - INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-alembic option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "alembic" -} - -#### Build materialX #### -_init_materialx() { - _src=$SRC/MaterialX-$MATERIALX_VERSION - _git=false - _inst=$INST/materialx-$MATERIALX_VERSION_SHORT - _inst_shortcut=$INST/materialx -} - -_update_deps_materialx() { - : -} - -clean_MATERIALX() { - _init_materialx - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_materialx false true - fi - _clean -} - -compile_MATERIALX() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, MaterialX will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - materialx_magic=1 - _init_materialx - - # Force having own builds for the dependencies. - _update_deps_materialx true false - - # Clean install if needed! - magic_compile_check materialx-$MATERIALX_VERSION $materialx_magic - if [ $? -eq 1 -o "$MATERIALX_FORCE_REBUILD" = true ]; then - clean_MATERIALX - fi - - if [ ! -d $_inst ]; then - INFO "Building MaterialX-$MATERIALX_VERSION" - - # Force rebuilding the dependencies. - _update_deps_materialx true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - download MATERIALX_SOURCE[@] "$_src.tar.gz" - - INFO "Unpacking MaterialX-$MATERIALX_VERSION" - tar -C $SRC -xf $_src.tar.gz - - patch -d $_src -p1 < $SCRIPT_DIR/patches/materialx.diff - fi - - cd $_src - - cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst" - - cmake_d="$cmake_d -DMATERIALX_BUILD_SHARED_LIBS=ON" - cmake_d="$cmake_d -DCMAKE_DEBUG_POSTFIX=_d" - - cmake_d="$cmake_d -DMATERIALX_BUILD_RENDER=OFF" - - cmake_d="$cmake_d -DMATERIALX_BUILD_PYTHON=ON" - cmake_d="$cmake_d -DMATERIALX_INSTALL_PYTHON=OFF" - if [ "$_with_built_python" = true ]; then - cmake_d="$cmake_d -D Python_EXECUTABLE=$_with_built_python_execpath" - fi - - cmake $cmake_d ./ - make -j$THREADS install - make clean - - if [ ! -d $_inst ]; then - ERROR "MaterialX-$MATERIALX_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set materialx-$MATERIALX_VERSION $materialx_magic - - cd $CWD - INFO "Done compiling MaterialX-$MATERIALX_VERSION!" - else - INFO "Own MaterialX-$MATERIALX_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-materialx option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "materialx" -} - -#### Build USD #### -_init_usd() { - _src=$SRC/USD-$USD_VERSION - _git=false - _inst=$INST/usd-$USD_VERSION_SHORT - _inst_shortcut=$INST/usd -} - -_update_deps_usd() { - : -} - -clean_USD() { - _init_usd - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_usd false true - fi - _clean -} - -compile_USD() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, USD will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - usd_magic=2 - _init_usd - - # Force having own builds for the dependencies. - _update_deps_usd true false - - # Clean install if needed! - magic_compile_check usd-$USD_VERSION $usd_magic - if [ $? -eq 1 -o "$USD_FORCE_REBUILD" = true ]; then - clean_USD - fi - - if [ ! -d $_inst ]; then - INFO "Building USD-$USD_VERSION" - - # Force rebuilding the dependencies. - _update_deps_usd true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - download USD_SOURCE[@] "$_src.tar.gz" - - INFO "Unpacking USD-$USD_VERSION" - tar -C $SRC -xf $_src.tar.gz - patch -d $_src -p1 < $SCRIPT_DIR/patches/usd.diff - fi - - cd $_src - - cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst" - # For the reasoning behind these options, please see usd.cmake. - if [ -d $INST/boost ]; then - cmake_d="$cmake_d -DBOOST_ROOT=$INST/boost" - fi - - if [ -d $INST/tbb ]; then - cmake_d="$cmake_d -DTBB_ROOT_DIR=$INST/tbb" - fi - - cmake_d="$cmake_d -DPXR_ENABLE_PYTHON_SUPPORT=ON" - cmake_d="$cmake_d -DPXR_USE_PYTHON_3=ON" - if [ "$_with_built_python" = true ]; then - cmake_d="$cmake_d -D PYTHON_EXECUTABLE=$_with_built_python_execpath" - fi - - cmake_d="$cmake_d -DPXR_BUILD_IMAGING=ON" - cmake_d="$cmake_d -DPXR_BUILD_OPENIMAGEIO_PLUGIN=ON" - if [ -d $INST/openexr ]; then - cmake_d="$cmake_d -DOPENEXR_LOCATION=$INST/openexr" - fi - if [ -d $INST/oiio ]; then - cmake_d="$cmake_d -DOpenImageIO_ROOT=$INST/oiio" - fi - - cmake_d="$cmake_d -DPXR_ENABLE_OPENVDB_SUPPORT=ON" - if [ -d $INST/openvdb ]; then - cmake_d="$cmake_d -DOPENVDB_LOCATION=$INST/openvdb" - fi - - cmake_d="$cmake_d -DPXR_ENABLE_GL_SUPPORT=ON" - - cmake_d="$cmake_d -DPXR_BUILD_TESTS=OFF" - cmake_d="$cmake_d -DPXR_BUILD_EXAMPLES=OFF" - cmake_d="$cmake_d -DPXR_BUILD_TUTORIALS=OFF" - - cmake_d="$cmake_d -DPXR_BUILD_USD_TOOLS=OFF" - cmake_d="$cmake_d -DPXR_ENABLE_HDF5_SUPPORT=OFF" - cmake_d="$cmake_d -DPXR_ENABLE_MATERIALX_SUPPORT=OFF" - cmake_d="$cmake_d -DPXR_BUILD_USDVIEW=OFF" - - cmake_d="$cmake_d -DPXR_BUILD_MONOLITHIC=ON" - cmake_d="$cmake_d -DBUILD_SHARED_LIBS=ON" - cmake_d="$cmake_d -DCMAKE_DEBUG_POSTFIX=_d" - - cmake $cmake_d ./ - make -j$THREADS install - make clean - - if [ ! -d $_inst ]; then - ERROR "USD-$USD_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set usd-$USD_VERSION $usd_magic - - cd $CWD - INFO "Done compiling USD-$USD_VERSION!" - else - INFO "Own USD-$USD_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-usd option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "usd" -} - -# ---------------------------------------------------------------------------- -# Build OpenCOLLADA -_init_opencollada() { - _src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION - _git=true - _inst=$INST/opencollada-$OPENCOLLADA_VERSION_SHORT - _inst_shortcut=$INST/opencollada -} - -_update_deps_collada() { - : -} - -clean_OpenCOLLADA() { - _init_opencollada - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_collada false true - fi - _clean -} - -compile_OpenCOLLADA() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenCOLLADA will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled results! - opencollada_magic=9 - _init_opencollada - - # Force having own builds for the dependencies. - _update_deps_opencollada true false - - # Clean install if needed! - magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic - if [ $? -eq 1 -o "$OPENCOLLADA_FORCE_REBUILD" = true ]; then - clean_OpenCOLLADA - fi - - if [ ! -d $_inst ]; then - INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION" - - # Force rebuilding the dependencies. - _update_deps_collada true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - if [ "$OPENCOLLADA_USE_REPO" = true ]; then - git clone $OPENCOLLADA_SOURCE_REPO $_src - else - download OPENCOLLADA_SOURCE[@] "$_src.tar.gz" - INFO "Unpacking OpenCOLLADA-$OPENCOLLADA_VERSION" - tar -C $SRC -xf $_src.tar.gz - fi - fi - - cd $_src - - if [ "$OPENCOLLADA_USE_REPO" = true ]; then - git pull origin $OPENCOLLADA_REPO_BRANCH - - # Stick to same rev as windows' libs... - git checkout $OPENCOLLADA_REPO_UID - git reset --hard - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D USE_EXPAT=OFF" - cmake_d="$cmake_d -D USE_LIBXML=ON" - # XXX Does not work! -# cmake_d="$cmake_d -D USE_STATIC=OFF" - cmake_d="$cmake_d -D USE_STATIC=ON" - - cmake $cmake_d ../ - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set opencollada-$OPENCOLLADA_VERSION $opencollada_magic - - cd $CWD - INFO "Done compiling OpenCOLLADA-$OPENCOLLADA_VERSION!" - else - INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-opencollada option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi -} - -# ---------------------------------------------------------------------------- -# Build Embree - -_init_embree() { - _src=$SRC/embree-$EMBREE_VERSION - _git=true - _inst=$INST/embree-$EMBREE_VERSION_SHORT - _inst_shortcut=$INST/embree -} - -_update_deps_embree() { - if [ "$1" = true ]; then - OPENPGL_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - OPENPGL_FORCE_REBUILD=true - fi -} - -clean_Embree() { - _init_embree - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_embree false true - fi - _clean -} - -compile_Embree() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, Embree will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled results! - embree_magic=12 - _init_embree - - # Force having own builds for the dependencies. - _update_deps_embree true false - - # Clean install if needed! - magic_compile_check embree-$EMBREE_VERSION $embree_magic - if [ $? -eq 1 -o "$EMBREE_FORCE_REBUILD" = true ]; then - clean_Embree - fi - - if [ ! -d $_inst ]; then - INFO "Building Embree-$EMBREE_VERSION" - - # Force rebuilding the dependencies. - _update_deps_embree true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - if [ "EMBREE_USE_REPO" = true ]; then - git clone $EMBREE_SOURCE_REPO $_src - else - download EMBREE_SOURCE[@] "$_src.tar.gz" - INFO "Unpacking Embree-$EMBREE_VERSION" - tar -C $SRC -xf $_src.tar.gz - fi - fi - - cd $_src - - if [ "$EMBREE_USE_REPO" = true ]; then - git pull origin $EMBREE_REPO_BRANCH - - # Stick to same rev as windows' libs... - git checkout $EMBREE_REPO_UID - git reset --hard - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D EMBREE_ISPC_SUPPORT=OFF" - cmake_d="$cmake_d -D EMBREE_TUTORIALS=OFF" - cmake_d="$cmake_d -D EMBREE_STATIC_LIB=ON" - cmake_d="$cmake_d -D EMBREE_RAY_MASK=ON" - cmake_d="$cmake_d -D EMBREE_FILTER_FUNCTION=ON" - cmake_d="$cmake_d -D EMBREE_BACKFACE_CULLING=OFF" - cmake_d="$cmake_d -D EMBREE_MAX_ISA=AVX2" - - cmake_d="$cmake_d -D EMBREE_TASKING_SYSTEM=TBB" - if [ -d $INST/tbb ]; then - cmake_d="$cmake_d -D EMBREE_TBB_ROOT=$INST/tbb" - fi - - cmake $cmake_d ../ - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "Embree-$EMBREE_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set embree-$EMBREE_VERSION $embree_magic - - cd $CWD - INFO "Done compiling Embree-$EMBREE_VERSION!" - else - INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-embree option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi -} - -# ---------------------------------------------------------------------------- -# Build OpenImageDenoise - -_init_ispc() { - _src=$SRC/ispc-v$ISPC_VERSION - _inst=$INST/ispc-v$ISPC_VERSION - _inst_shortcut=$INST/ispc -} - -_update_deps_ispc() { - if [ "$1" = true ]; then - OIDN_FORCE_BUILD=true - fi - if [ "$2" = true ]; then - OIDN_FORCE_REBUILD=true - fi -} - -clean_ispc() { - _init_ispc - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_ispc false true - fi - _clean -} - -install_ISPC() { - # To be changed each time we make edits that would modify the compiled results! - ispc_magic=0 - _init_ispc - - # Force having own builds for the dependencies. - _update_deps_ispc true false - - # Clean install if needed! - magic_compile_check ispc-$ISPC_VERSION $ispc_magic - if [ $? -eq 1 ]; then - clean_ispc - fi - - if [ ! -d $_inst ]; then - INFO "Installing Implicit SPMD Program Compiler v$ISPC_VERSION" - - # Force rebuilding the dependencies. - _update_deps_ispc true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - download ISPC_BINARY[@] "$_src.tar.gz" - INFO "Unpacking ISPC-v$ISPC_VERSION" - tar -C $SRC --transform "s,(.*/?)ispc-v$ISPC_VERSION-linux[^/]*(.*),\1ispc-v$ISPC_VERSION\2,x" \ - -xf $_src.tar.gz - fi - - mkdir -p $_inst - cp -r $_src/bin $_inst/bin - - if [ ! -d $_inst ]; then - ERROR "ISPC-v$ISPC_VERSION failed to install, exiting" - exit 1 - fi - - magic_compile_set ispc-$ISPC_VERSION $ispc_magic - - cd $CWD - INFO "Done compiling ISPC-v$ISPC_VERSION!" - else - INFO "Own ISPC-v$ISPC_VERSION is up to date, nothing to do!" - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - - _ispc_path_bin=$_inst/bin - run_ldconfig "ispc" -} - - -_init_oidn() { - _src=$SRC/oidn-$OIDN_VERSION - _git=true - _inst=$INST/oidn-$OIDN_VERSION_SHORT - _inst_shortcut=$INST/oidn -} - -_update_deps_oidn() { - : -} - -clean_oidn() { - _init_oidn - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_oidn false true - fi - _clean -} - -compile_OIDN() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenImageDenoise will not be compiled!" - return - fi - - # Latest OIDN requires ISPC compiler tool... - install_ISPC - - # To be changed each time we make edits that would modify the compiled results! - oidn_magic=10 - _init_oidn - - # Force having own builds for the dependencies. - _update_deps_oidn true false - - # Clean install if needed! - magic_compile_check oidn-$OIDN_VERSION $oidn_magic - if [ $? -eq 1 -o "$OIDN_FORCE_REBUILD" = true ]; then - clean_oidn - fi - - if [ ! -d $_inst ]; then - INFO "Building OpenImageDenoise-$OIDN_VERSION" - - # Force rebuilding the dependencies. - _update_deps_oidn true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - if [ "OIDN_USE_REPO" = true ]; then - git clone $OIDN_SOURCE_REPO $_src - else - download OIDN_SOURCE[@] "$_src.tar.gz" - INFO "Unpacking OpenImageDenoise-$OIDN_VERSION" - tar -C $SRC -xf $_src.tar.gz - fi - fi - - cd $_src - - if [ "$OIDN_USE_REPO" = true ]; then - git pull origin $OIDN_REPO_BRANCH - - # Stick to same rev as windows' libs... - git checkout $OIDN_REPO_UID - git reset --hard - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D WITH_EXAMPLE=OFF" - cmake_d="$cmake_d -D WITH_TEST=OFF" - cmake_d="$cmake_d -D OIDN_STATIC_LIB=ON" - cmake_d="$cmake_d -D ISPC_DIR_HINT=$_ispc_path_bin" - - if [ -d $INST/tbb ]; then - cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb" - fi - - cmake $cmake_d ../ - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "OpenImageDenoise-$OIDN_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set oidn-$OIDN_VERSION $oidn_magic - - cd $CWD - INFO "Done compiling OpenImageDenoise-$OIDN_VERSION!" - else - INFO "Own OpenImageDenoise-$OIDN_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-oidn option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "oidn" -} - -# ---------------------------------------------------------------------------- -# Build FFMPEG - -_init_ffmpeg() { - _src=$SRC/ffmpeg-$FFMPEG_VERSION - _inst=$INST/ffmpeg-$FFMPEG_VERSION_SHORT - _inst_shortcut=$INST/ffmpeg -} - -_update_deps_ffmpeg() { - : -} - -clean_FFmpeg() { - _init_ffmpeg - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_ffmpeg false true - fi - _clean -} - -compile_FFmpeg() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, ffmpeg will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - ffmpeg_magic=6 - _init_ffmpeg - - # Force having own builds for the dependencies. - _update_deps_ffmpeg true false - - # Clean install if needed! - magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic - if [ $? -eq 1 -o "$FFMPEG_FORCE_REBUILD" = true ]; then - clean_FFmpeg - fi - - if [ ! -d $_inst ]; then - INFO "Building ffmpeg-$FFMPEG_VERSION" - - # Force rebuilding the dependencies. - _update_deps_ffmpeg true true - - prepare_inst - - if [ ! -d $_src ]; then - INFO "Downloading ffmpeg-$FFMPEG_VERSION" - mkdir -p $SRC - download FFMPEG_SOURCE[@] "$_src.tar.bz2" - - INFO "Unpacking ffmpeg-$FFMPEG_VERSION" - tar -C $SRC -xf $_src.tar.bz2 - fi - - cd $_src - - extra="" - - if [ "$VORBIS_USE" = true ]; then - extra="$extra --enable-libvorbis" - fi - - if [ "$THEORA_USE" = true ]; then - extra="$extra --enable-libtheora" - fi - - if [ "$XVID_USE" = true ]; then - extra="$extra --enable-libxvid" - fi - - if [ "$X264_USE" = true ]; then - extra="$extra --enable-libx264" - fi - - if [ "$VPX_USE" = true ]; then - extra="$extra --enable-libvpx" - fi - - if [ "$AOM_USE" = true ]; then - extra="$extra --enable-libaom" - fi - - if [ "$WEBP_USE" = true ]; then - extra="$extra --enable-libwebp" - fi - - if [ "$OPUS_USE" = true ]; then - extra="$extra --enable-libopus" - fi - - if [ "$MP3LAME_USE" = true ]; then - extra="$extra --enable-libmp3lame" - fi - - if [ "$OPENJPEG_USE" = true ]; then - extra="$extra --enable-libopenjpeg" - fi - - ./configure --cc="gcc -Wl,--as-needed" \ - --extra-ldflags="-pthread" \ - --prefix=$_inst --enable-shared \ - --disable-ffplay --disable-doc \ - --enable-gray \ - --enable-avfilter --disable-vdpau \ - --disable-bzlib --disable-libgsm --disable-libspeex \ - --enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \ - --disable-vaapi --disable-nonfree --enable-gpl \ - --disable-postproc --disable-librtmp --disable-libopencore-amrnb \ - --disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \ - --disable-libxcb \ - --disable-outdev=xv --disable-indev=sndio --disable-outdev=sndio \ - --disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \ - --disable-indev=lavfi $extra - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic - - cd $CWD - INFO "Done compiling ffmpeg-$FFMPEG_VERSION!" - else - INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi -} - -# ---------------------------------------------------------------------------- -# Build OpenXR SDK - -_init_xr_openxr_sdk() { - _src=$SRC/XR-OpenXR-SDK-$XR_OPENXR_VERSION - _git=true - _inst=$INST/xr-openxr-sdk-$XR_OPENXR_VERSION_SHORT - _inst_shortcut=$INST/xr-openxr-sdk -} - -_update_deps_xr_openxr_sdk() { - : -} - -clean_XR_OpenXR_SDK() { - _init_xr_openxr_sdk - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_xr_openxr_sdk false true - fi - _clean -} - -compile_XR_OpenXR_SDK() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenXR will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - xr_openxr_magic=2 - _init_xr_openxr_sdk - - # Force having own builds for the dependencies. - _update_deps_xr_openxr_sdk true false - - # Clean install if needed! - magic_compile_check xr-openxr-$XR_OPENXR_VERSION $xr_openxr_magic - if [ $? -eq 1 -o "$XR_OPENXR_FORCE_REBUILD" = true ]; then - clean_XR_OpenXR_SDK - fi - - if [ ! -d $_inst ]; then - INFO "Building XR-OpenXR-SDK-$XR_OPENXR_VERSION" - - # Force rebuilding the dependencies. - _update_deps_xr_openxr_sdk true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - - if [ "$XR_OPENXR_USE_REPO" = true ]; then - git clone $XR_OPENXR_SOURCE_REPO $_src - else - download XR_OPENXR_SOURCE[@] "$_src.tar.gz" - INFO "Unpacking XR-OpenXR-SDK-$XR_OPENXR_VERSION" - tar -C $SRC --transform "s,(.*/?)OpenXR-SDK-[^/]*(.*),\1XR-OpenXR-SDK-$XR_OPENXR_VERSION\2,x" \ - -xf $_src.tar.gz - fi - fi - - cd $_src - - if [ "$XR_OPENXR_USE_REPO" = true ]; then - git pull origin $XR_OPENXR_REPO_BRANCH - - # Stick to same rev as windows' libs... - git checkout $XR_OPENXR_REPO_UID - git reset --hard - fi - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - # Keep flags in sync with XR_OPENXR_SDK_EXTRA_ARGS in xr_openxr.cmake! - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D BUILD_FORCE_GENERATION=OFF" - cmake_d="$cmake_d -D BUILD_LOADER=ON" - cmake_d="$cmake_d -D DYNAMIC_LOADER=OFF" - cmake_d="$cmake_d -D BUILD_WITH_WAYLAND_HEADERS=OFF" - cmake_d="$cmake_d -D BUILD_WITH_XCB_HEADERS=OFF" - cmake_d="$cmake_d -D BUILD_WITH_XLIB_HEADERS=ON" - cmake_d="$cmake_d -D BUILD_WITH_SYSTEM_JSONCPP=OFF" - - cmake $cmake_d "-DCMAKE_CXX_FLAGS=-DDISABLE_STD_FILESYSTEM=1" .. - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "XR-OpenXR-SDK-$XR_OPENXR_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set xr-openxr-$XR_OPENXR_VERSION $xr_openxr_magic - - cd $CWD - INFO "Done compiling XR-OpenXR-SDK-$XR_OPENXR_VERSION!" - else - INFO "Own XR-OpenXR-SDK-$XR_OPENXR_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-xr-openxr option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "xr-openxr-sdk" -} - - -# ---------------------------------------------------------------------------- -# Build OneAPI Level Zero library. - -_init_level_zero() { - _src=$SRC/level-zero-$LEVEL_ZERO_VERSION - _git=false - _inst=$INST/level-zero-$LEVEL_ZERO_VERSION_SHORT - _inst_shortcut=$INST/level-zero -} - -_update_deps_level_zero() { - : -} - -clean_Level_Zero() { - _init_level_zero - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_level_zero false true - fi - _clean -} - -compile_Level_Zero() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, Level Zero will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled result! - level_zero_magic=1 - _init_level_zero - - # Force having own builds for the dependencies. - _update_deps_level_zero true false - - # Clean install if needed! - magic_compile_check level-zero-$LEVEL_ZERO_VERSION $level_zero_magic - if [ $? -eq 1 -o "$LEVEL_ZERO_FORCE_REBUILD" = true ]; then - clean_Level_Zero - fi - - if [ ! -d $_inst ]; then - INFO "Building Level-Zero-$LEVEL_ZERO_VERSION" - - # Force rebuilding the dependencies. - _update_deps_level_zero true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - - download LEVEL_ZERO_SOURCE[@] "$_src.tar.gz" - INFO "Unpacking Level-Zero-$LEVEL_ZERO_VERSION" - tar -C $SRC -xf $_src.tar.gz - fi - - cd $_src - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - # Keep flags in sync with LEVEL_ZERO_EXTRA_ARGS in level-zero.cmake! - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - - cmake $cmake_d .. - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "Level-Zero-$LEVEL_ZERO_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set level-zero-$LEVEL_ZERO_VERSION $level_zero_magic - - cd $CWD - INFO "Done compiling Level-Zero-$LEVEL_ZERO_VERSION!" - else - INFO "Own Level-Zero-$LEVEL_ZERO_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-level-zero option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - run_ldconfig "level-zero" -} - - -# ---------------------------------------------------------------------------- -# Build OpenPGL - -_init_openpgl() { - _src=$SRC/openpgl-$OPENPGL_VERSION - _git=false - _inst=$INST/openpgl-$OPENPGL_VERSION_SHORT - _inst_shortcut=$INST/openpgl -} - -_update_deps_openpgl() { - : -} - -clean_OpenPGL() { - _init_openpgl - if [ -d $_inst ]; then - # Force rebuilding the dependencies if needed. - _update_deps_openpgl false true - fi - _clean -} - -compile_OpenPGL() { - if [ "$NO_BUILD" = true ]; then - WARNING "--no-build enabled, OpenPGL will not be compiled!" - return - fi - - # To be changed each time we make edits that would modify the compiled results! - openpgl_magic=1 - _init_openpgl - - # Force having own builds for the dependencies. - _update_deps_openpgl true false - - # Clean install if needed! - magic_compile_check openpgl-$OPENPGL_VERSION $openpgl_magic - if [ $? -eq 1 -o "$OPENPGL_FORCE_REBUILD" = true ]; then - clean_OpenPGL - fi - - if [ ! -d $_inst ]; then - INFO "Building OpenPGL-$OPENPGL_VERSION" - - # Force rebuilding the dependencies. - _update_deps_openpgl true true - - prepare_inst - - if [ ! -d $_src ]; then - mkdir -p $SRC - download OPENPGL_SOURCE[@] "$_src.tar.gz" - INFO "Unpacking OpenPGL-$OPENPGL_VERSION" - tar -C $SRC --transform "s,(.*/?)openpgl-$OPENPGL_VERSION-beta[^/]*(.*),\1openpgl-$OPENPGL_VERSION\2,x" \ - -xf $_src.tar.gz - fi - - cd $_src - - INFO "$_src" - - # Always refresh the whole build! - if [ -d build ]; then - rm -rf build - fi - mkdir build - cd build - - cmake_d="-D CMAKE_BUILD_TYPE=Release" - cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" - cmake_d="$cmake_d -D OPENPGL_BUILD_STATIC=OFF" - cmake_d="$cmake_d -D OPENPGL_BUILD_PYTHON=OFF" - cmake_d="$cmake_d -D EMBREE_ISPC_SUPPORT=OFF" - if [ -d $INST/tbb ]; then - cmake_d="$cmake_d -D OPENPGL_TBB_ROOT=$INST/tbb" - cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb" - fi - - cmake $cmake_d ../ - - make -j$THREADS && make install - make clean - - if [ ! -d $_inst ]; then - ERROR "OpenPGL-$OPENPGL_VERSION failed to compile, exiting" - exit 1 - fi - - magic_compile_set openpgl-$OPENPGL_VERSION $openpgl_magic - - cd $CWD - INFO "Done compiling OpenPGL-$OPENPGL_VERSION!" - else - INFO "Own OpenPGL-$OPENPGL_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, use the --force-openpgl option." - fi - - if [ -d $_inst ]; then - _create_inst_shortcut - fi - - run_ldconfig "openpgl" -} - - -# ---------------------------------------------------------------------------- -# Install on DEB-like - -get_package_version_DEB() { - dpkg-query -W -f '${Version}' $1 | sed -r 's/([0-9]+:)?(([0-9]+\.?)+([0-9]+)).*/\2/' -} - -check_package_DEB() { - r=`apt-cache show $1 | grep -c 'Package:'` - - if [ $r -ge 1 ]; then - return 0 - else - return 1 - fi -} - -check_package_installed_DEB() { - r=`dpkg-query -W -f='${Status}' $1 | grep -c "install ok"` - - if [ $r -ge 1 ]; then - return 0 - else - return 1 - fi -} - -check_package_version_match_DEB() { - v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'` - - if [ -z "$v" ]; then - return 1 - fi - - version_match $v $2 - return $? -} - -check_package_version_ge_DEB() { - v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'` - - if [ -z "$v" ]; then - return 1 - fi - - version_ge $v $2 - return $? -} - -check_package_version_ge_lt_DEB() { - v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'` - - if [ -z "$v" ]; then - return 1 - fi - - version_ge_lt $v $2 $3 - return $? -} - -install_packages_DEB() { - if [ ! $SUDO ]; then - WARNING "--no-sudo enabled, impossible to run apt-get install for $@, you'll have to do it yourself..." - else - $SUDO apt-get install -y $@ - if [ $? -ge 1 ]; then - ERROR "apt-get failed to install requested packages, exiting." - exit 1 - fi - fi -} - -install_DEB() { - PRINT "" - INFO "Installing dependencies for DEB-based distribution" - PRINT "" - PRINT "`eval _echo "$COMMON_INFO"`" - PRINT "" - - if [ "$NO_CONFIRM" = false ]; then - read -p "Do you want to continue (Y/n)?" - [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit - fi - - if [ ! $SUDO ]; then - WARNING "--no-sudo enabled, impossible to run apt-get update, you'll have to do it yourself..." - else - $SUDO apt-get update - fi - - # These libs should always be available in debian/ubuntu official repository... - VORBIS_DEV="libvorbis-dev" - OGG_DEV="libogg-dev" - THEORA_DEV="libtheora-dev" - - _packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \ - git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \ - libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \ - libwayland-dev libdecor-0-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \ - libvulkan-dev libshaderc-dev \ - libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \ - libopenal-dev libepoxy-dev yasm pybind11-dev \ - libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \ - libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev \ - libglfw3-dev libfribidi-dev libharfbuzz-dev" - - VORBIS_USE=true - OGG_USE=true - THEORA_USE=true - - PRINT "" - # We need openjp2, libopenjpeg is an old version - OPENJPEG_DEV="libopenjp2-7-dev" - check_package_DEB $OPENJPEG_DEV - if [ $? -eq 0 ]; then - _packages="$_packages $OPENJPEG_DEV" - OPENJPEG_USE=true - fi - - PRINT "" - # Some not-so-old distro (ubuntu 12.4) do not have it, do not fail in this case, just warn. - YAMLCPP_DEV="libyaml-cpp-dev" - check_package_DEB $YAMLCPP_DEV - if [ $? -eq 0 ]; then - _packages="$_packages $YAMLCPP_DEV" - else - PRINT "" - WARNING "libyaml-cpp-dev not found, you may have to install it by hand to get Blender compiling..." - PRINT "" - fi - - PRINT "" - CLANG_FORMAT="clang-format" - check_package_version_ge_DEB $CLANG_FORMAT $CLANG_FORMAT_VERSION - if [ $? -eq 0 ]; then - _packages="$_packages $CLANG_FORMAT" - else - check_package_version_ge_DEB $CLANG_FORMAT $CLANG_FORMAT_VERSION_MIN - if [ $? -eq 0 ]; then - _packages="$_packages $CLANG_FORMAT" - else - PRINT "" - WARNING "clang-format $CLANG_FORMAT_VERSION_MIN or higher not found, this is NOT needed to get Blender compiling..." - PRINT "" - fi - fi - - if [ "$WITH_JACK" = true ]; then - _packages="$_packages libspnav-dev" - # Only install jack if jack2 is not already installed! - JACK="libjack-dev" - JACK2="libjack-jackd2-dev" - check_package_installed_DEB $JACK2 - if [ $? -eq 0 ]; then - _packages="$_packages $JACK2" - else - _packages="$_packages $JACK" - fi - fi - - if [ "$WITH_PULSEAUDIO" = true ]; then - _packages="$_packages libpulse-dev" - fi - - PRINT "" - install_packages_DEB $_packages - - PRINT"" - LIBSNDFILE_DEV="libsndfile1-dev" - check_package_DEB $LIBSNDFILE_DEV - if [ $? -eq 0 ]; then - install_packages_DEB $LIBSNDFILE_DEV - fi - - X264_DEV="libx264-dev" - check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN - if [ $? -eq 0 ]; then - X264_USE=true - fi - - WEBP_DEV="libwebp-dev" - check_package_DEB $WEBP_DEV - if [ $? -eq 0 ]; then - install_packages_DEB $WEBP_DEV - WEBP_USE=true - fi - - XVID_DEV="libxvidcore-dev" - check_package_DEB $XVID_DEV - if [ $? -eq 0 ]; then - XVID_USE=true - fi - - MP3LAME_DEV="libmp3lame-dev" - check_package_DEB $MP3LAME_DEV - if [ $? -eq 0 ]; then - MP3LAME_USE=true - fi - - VPX_DEV="libvpx-dev" - check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN - if [ $? -eq 0 ]; then - VPX_USE=true - fi - - AOM_DEV="libaom-dev" - check_package_version_ge_DEB $AOM_DEV $AOM_VERSION_MIN - if [ $? -eq 0 ]; then - AOM_USE=true - fi - - OPUS_DEV="libopus-dev" - check_package_version_ge_DEB $OPUS_DEV $OPUS_VERSION_MIN - if [ $? -eq 0 ]; then - OPUS_USE=true - fi - - # Check cmake version and disable features for older distros. - # This is so Blender can at least compile. - PRINT "" - _cmake=`get_package_version_DEB cmake` - version_ge $_cmake "2.8.10" - if [ $? -eq 1 ]; then - version_ge $_cmake "2.8.8" - if [ $? -eq 1 ]; then - WARNING "OpenVDB and OpenCOLLADA disabled because cmake-$_cmake is not enough" - OPENVDB_SKIP=true - OPENCOLLADA_SKIP=true - else - WARNING "OpenVDB disabled because cmake-$_cmake is not enough" - OPENVDB_SKIP=true - fi - fi - - PRINT "" - _do_compile_python=false - if [ "$PYTHON_SKIP" = true ]; then - WARNING "Skipping Python installation, as requested..." - elif [ "$PYTHON_FORCE_BUILD" = true ]; then - INFO "Forced Python building, as requested..." - _do_compile_python=true - else - check_package_version_ge_lt_DEB python${PYTHON_VERSION_SHORT}-dev $PYTHON_VERSION_MIN $PYTHON_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_DEB python${PYTHON_VERSION_SHORT}-dev - clean_Python - PRINT "" - - PYTHON_VERSION_INSTALLED=$(echo `get_package_version_DEB python${PYTHON_VERSION_SHORT}-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') - - for module in "${PYTHON_MODULES_PACKAGES[@]}" - do - module=($module) - package="python3-${module[0]}" - package_vmin=${module[1]} - package_vmex=${module[2]} - check_package_version_ge_lt_DEB "$package" $package_vmin $package_vmex - if [ $? -eq 0 ]; then - install_packages_DEB "$package" - else - WARNING "Sorry, using python package but no valid $package package available!" \ - " Use --build-python to force building of Python and use pip to get the packages." - fi - done - else - _do_compile_python=true - fi - fi - - if $_do_compile_python; then - install_packages_DEB libffi-dev - compile_Python - fi - - - PRINT "" - if [ "$BOOST_SKIP" = true ]; then - WARNING "Skipping Boost installation, as requested..." - elif [ "$BOOST_FORCE_BUILD" = true ]; then - INFO "Forced Boost building, as requested..." - compile_Boost - else - check_package_version_ge_lt_DEB libboost-dev $BOOST_VERSION_MIN $BOOST_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_DEB libboost-dev - - boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') - - install_packages_DEB ${BOOST_DEB_PACKAGE_MODULES[@]/%/$boost_version-dev} - clean_Boost - else - compile_Boost - fi - fi - - - PRINT "" - if [ "$TBB_SKIP" = true ]; then - WARNING "Skipping TBB installation, as requested..." - elif [ "$TBB_FORCE_BUILD" = true ]; then - INFO "Forced TBB building, as requested..." - compile_TBB - else - check_package_version_ge_lt_DEB libtbb-dev $TBB_VERSION_MIN $TBB_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_DEB libtbb-dev - clean_TBB - else - compile_TBB - fi - fi - - - PRINT "" - if [ "$OCIO_SKIP" = true ]; then - WARNING "Skipping OpenColorIO installation, as requested..." - elif [ "$OCIO_FORCE_BUILD" = true ]; then - INFO "Forced OpenColorIO building, as requested..." - compile_OCIO - else - check_package_version_ge_lt_DEB libopencolorio-dev $OCIO_VERSION_MIN $OCIO_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_DEB libopencolorio-dev - clean_OCIO - else - compile_OCIO - fi - fi - - PRINT "" - if [ "$IMATH_SKIP" = true ]; then - WARNING "Skipping Imath installation, as requested..." - elif [ "$IMATH_FORCE_BUILD" = true ]; then - INFO "Forced Imath building, as requested..." - compile_IMATH - else - check_package_version_ge_lt_DEB libimath-dev $IMATH_VERSION_MIN $IMATH_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_DEB libimath-dev - IMATH_VERSION=`get_package_version_DEB libimath-dev` - clean_IMATH - else - compile_IMATH - fi - fi - - PRINT "" - if [ "$OPENEXR_SKIP" = true ]; then - WARNING "Skipping OpenEXR installation, as requested..." - elif [ "$OPENEXR_FORCE_BUILD" = true ]; then - INFO "Forced OpenEXR building, as requested..." - compile_OPENEXR - else - check_package_version_ge_lt_DEB libopenexr-dev $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MEX - if [ $? -eq 0 -a "$_with_built_imath" = false ]; then - install_packages_DEB libopenexr-dev - OPENEXR_VERSION=`get_package_version_DEB libopenexr-dev` - clean_OPENEXR - else - compile_OPENEXR - fi - fi - - PRINT "" - # Debian OIIO includes again libopencv, without even properly dealing with this dependency... - OIIO_FORCE_BUILD=true - if [ "$OIIO_SKIP" = true ]; then - WARNING "Skipping OpenImageIO installation, as requested..." - elif [ "$OIIO_FORCE_BUILD" = true ]; then - INFO "Forced OpenImageIO building, as requested..." - compile_OIIO - else - check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MEX - if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then - install_packages_DEB libopenimageio-dev openimageio-tools - clean_OIIO - else - compile_OIIO - fi - fi - - - PRINT "" - have_llvm=false - _do_compile_llvm=false - if [ "$LLVM_SKIP" = true ]; then - WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..." - OSL_SKIP=true - elif [ "$LLVM_FORCE_BUILD" = true ]; then - INFO "Forced LLVM building, as requested..." - _do_compile_llvm=true - else - check_package_version_ge_lt_DEB llvm-dev $LLVM_VERSION_MIN $LLVM_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_DEB llvm-dev clang libclang-dev - have_llvm=true - LLVM_VERSION=`llvm-config --version` - LLVM_VERSION_FOUND=$LLVM_VERSION - clean_LLVM - else - _do_compile_llvm=true - fi - fi - - if [ "$_do_compile_llvm" = true ]; then - install_packages_DEB libffi-dev - # LLVM can't find the debian ffi header dir - _FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'` - PRINT "" - compile_LLVM - have_llvm=true - LLVM_VERSION_FOUND=$LLVM_VERSION - fi - - - PRINT "" - _do_compile_osl=false - if [ "$OSL_SKIP" = true ]; then - WARNING "Skipping OpenShadingLanguage installation, as requested..." - elif [ "$OSL_FORCE_BUILD" = true ]; then - INFO "Forced OpenShadingLanguage building, as requested..." - _do_compile_osl=true - else - check_package_version_ge_lt_DEB libopenshadinglanguage-dev $OSL_VERSION_MIN $OSL_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_DEB libopenshadinglanguage-dev - clean_OSL - else - _do_compile_osl=true - fi - fi - - if [ "$_do_compile_osl" = true ]; then - if [ "$have_llvm" = true ]; then - PRINT "" - compile_OSL - else - WARNING "No LLVM available, cannot build OSL!" - fi - fi - - - PRINT "" - if [ "$OSD_SKIP" = true ]; then - WARNING "Skipping OpenSubdiv installation, as requested..." - elif [ "$OSD_FORCE_BUILD" = true ]; then - INFO "Forced OpenSubdiv building, as requested..." - compile_OSD - else - # No package currently! - PRINT "" - compile_OSD - fi - - PRINT "" - if [ "$OPENVDB_SKIP" = true ]; then - WARNING "Skipping OpenVDB installation, as requested..." - elif [ "$OPENVDB_FORCE_BUILD" = true ]; then - INFO "Forced OpenVDB building, as requested..." - compile_OPENVDB - else - check_package_version_ge_lt_DEB libopenvdb-dev $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_DEB libopenvdb-dev libblosc-dev - clean_OPENVDB - else - compile_OPENVDB - fi - fi - - PRINT "" - if [ "$ALEMBIC_SKIP" = true ]; then - WARNING "Skipping Alembic installation, as requested..." - elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then - INFO "Forced Alembic building, as requested..." - compile_ALEMBIC - else - compile_ALEMBIC - fi - - PRINT "" - if [ "$MATERIALX_SKIP" = true ]; then - WARNING "Skipping MaterialX installation, as requested..." - elif [ "$MATERIALX_FORCE_BUILD" = true ]; then - INFO "Forced MaterialX building, as requested..." - compile_MATERIALX - else - compile_MATERIALX - fi - - PRINT "" - if [ "$USD_SKIP" = true ]; then - WARNING "Skipping USD installation, as requested..." - elif [ "$USD_FORCE_BUILD" = true ]; then - INFO "Forced USD building, as requested..." - compile_USD - else - compile_USD - fi - - if [ "$WITH_OPENCOLLADA" = true ]; then - _do_compile_collada=false - PRINT "" - if [ "$OPENCOLLADA_SKIP" = true ]; then - WARNING "Skipping OpenCOLLADA installation, as requested..." - elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then - INFO "Forced OpenCollada building, as requested..." - _do_compile_collada=true - else - # No package currently! - _do_compile_collada=true - fi - - if [ "$_do_compile_collada" = true ]; then - install_packages_DEB libpcre3-dev - # Find path to libxml shared lib... - _XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"` - # No package - PRINT "" - compile_OpenCOLLADA - fi - fi - - if [ "$WITH_EMBREE" = true ]; then - _do_compile_embree=false - PRINT "" - if [ "$EMBREE_SKIP" = true ]; then - WARNING "Skipping Embree installation, as requested..." - elif [ "$EMBREE_FORCE_BUILD" = true ]; then - INFO "Forced Embree building, as requested..." - _do_compile_embree=true - else - # There is a package, but it does not provide everything that Blender needs... - #~ check_package_version_ge_lt_DEB libembree-dev $EMBREE_VERSION_MIN $EMBREE_VERSION_MEX - #~ if [ $? -eq 0 ]; then - #~ install_packages_DEB libembree-dev - #~ clean_Embree - #~ else - _do_compile_embree=true - #~ fi - fi - - if [ "$_do_compile_embree" = true ]; then - compile_Embree - fi - fi - - if [ "$WITH_OIDN" = true ]; then - _do_compile_oidn=false - PRINT "" - if [ "$OIDN_SKIP" = true ]; then - WARNING "Skipping OpenImgeDenoise installation, as requested..." - elif [ "$OIDN_FORCE_BUILD" = true ]; then - INFO "Forced OpenImageDenoise building, as requested..." - _do_compile_oidn=true - else - # No package currently! - _do_compile_oidn=true - fi - - if [ "$_do_compile_oidn" = true ]; then - compile_OIDN - fi - fi - - PRINT "" - _do_compile_ffmpeg=false - if [ "$FFMPEG_SKIP" = true ]; then - WARNING "Skipping FFMpeg installation, as requested..." - elif [ "$FFMPEG_FORCE_BUILD" = true ]; then - INFO "Forced FFMpeg building, as requested..." - _do_compile_ffmpeg=true - else - # XXX Debian Testing / Ubuntu 16.04 finally includes FFmpeg, so check as usual - check_package_DEB ffmpeg - if [ $? -eq 0 ]; then - check_package_version_ge_lt_DEB ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_DEB libavdevice-dev - clean_FFmpeg - else - _do_compile_ffmpeg=true - fi - else - _do_compile_ffmpeg=true - fi - fi - if [ "$_do_compile_ffmpeg" = true ]; then - _packages="" - if [ "$VORBIS_USE" = true ]; then - _packages="$_packages $VORBIS_DEV" - fi - if [ "$THEORA_USE" = true ]; then - _packages="$_packages $THEORA_DEV" - fi - if [ "$OGG_USE" = true ]; then - _packages="$_packages $OGG_DEV" - fi - if [ "$XVID_USE" = true ]; then - _packages="$_packages $XVID_DEV" - fi - if [ "$X264_USE" = true ]; then - _packages="$_packages $X264_DEV" - fi - if [ "$VPX_USE" = true ]; then - _packages="$_packages $VPX_DEV" - fi - if [ "$AOM_USE" = true ]; then - _packages="$_packages $AOM_DEV" - fi - if [ "$OPUS_USE" = true ]; then - _packages="$_packages $OPUS_DEV" - fi - if [ "$MP3LAME_USE" = true ]; then - _packages="$_packages $MP3LAME_DEV" - fi - install_packages_DEB $_packages - - compile_FFmpeg - fi - - PRINT "" - if [ "$XR_OPENXR_SKIP" = true ]; then - WARNING "Skipping OpenXR-SDK installation, as requested..." - elif [ "$XR_OPENXR_FORCE_BUILD" = true ]; then - INFO "Forced OpenXR-SDK building, as requested..." - compile_XR_OpenXR_SDK - else - # No package currently! - PRINT "" - compile_XR_OpenXR_SDK - fi - - PRINT "" - if [ "$LEVEL_ZERO_SKIP" = true ]; then - WARNING "Skipping Level Zero installation, as requested..." - elif [ "$LEVEL_ZERO_FORCE_BUILD" = true ]; then - INFO "Forced Level Zero building, as requested..." - compile_Level_Zero - else - # No package currently! - PRINT "" - compile_Level_Zero - fi - - PRINT "" - if [ "$OPENPGL_SKIP" = true ]; then - WARNING "Skipping OpenPGL installation, as requested..." - elif [ "$OPENPGL_FORCE_BUILD" = true ]; then - INFO "Forced OpenPGL building, as requested..." - compile_OpenPGL - else - # No package currently! - PRINT "" - compile_OpenPGL - fi -} - - -# ---------------------------------------------------------------------------- -# Install on RPM-like - -rpm_flavour() { - if [ -f /etc/redhat-release ]; then - if [ "`grep '[6-7]\.' /etc/redhat-release`" ]; then - RPM="RHEL" - else - RPM="FEDORA" - fi - elif [ -f /etc/SuSE-release ]; then - RPM="SUSE" - fi -} - -get_package_version_RPM() { - rpm_flavour - if [ "$RPM" = "RHEL" ]; then - yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/' - elif [ "$RPM" = "FEDORA" ]; then - dnf info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/' - elif [ "$RPM" = "SUSE" ]; then - zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/' - fi -} - -check_package_RPM() { - rpm_flavour - if [ "$RPM" = "RHEL" ]; then - r=`yum info $1 | grep -c 'Summary'` - elif [ "$RPM" = "FEDORA" ]; then - r=`dnf info $1 | grep -c 'Summary'` - elif [ "$RPM" = "SUSE" ]; then - r=`zypper info $1 | grep -c 'Summary'` - fi - - if [ $r -ge 1 ]; then - return 0 - else - return 1 - fi -} - -check_package_version_match_RPM() { - v=`get_package_version_RPM $1` - - if [ -z "$v" ]; then - return 1 - fi - - version_match $v $2 - return $? -} - -check_package_version_ge_RPM() { - v=`get_package_version_RPM $1` - - if [ -z "$v" ]; then - return 1 - fi - - version_ge $v $2 - return $? -} - -check_package_version_ge_lt_RPM() { - v=`get_package_version_RPM $1` - - if [ -z "$v" ]; then - return 1 - fi - - version_ge_lt $v $2 $3 - return $? -} - -install_packages_RPM() { - rpm_flavour - if [ ! $SUDO ]; then - WARNING "--no-sudo enabled, impossible to install $@, you'll have to do it yourself..." - fi - if [ "$RPM" = "RHEL" ]; then - $SUDO yum install -y $@ - if [ $? -ge 1 ]; then - ERROR "yum failed to install requested packages, exiting." - exit 1 - fi - - elif [ "$RPM" = "FEDORA" ]; then - $SUDO dnf install -y $@ - if [ $? -ge 1 ]; then - ERROR "dnf failed to install requested packages, exiting." - exit 1 - fi - - elif [ "$RPM" = "SUSE" ]; then - $SUDO zypper --non-interactive install --auto-agree-with-licenses $@ - if [ $? -ge 1 ]; then - ERROR "zypper failed to install requested packages, exiting." - exit 1 - fi - fi -} - -install_RPM() { - PRINT "" - INFO "Installing dependencies for RPM-based distribution" - PRINT "" - PRINT "`eval _echo "$COMMON_INFO"`" - PRINT "" - - if [ "$NO_CONFIRM" = false ]; then - read -p "Do you want to continue (Y/n)?" - [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit - fi - - # Enable non-free repositories for all flavours - if [ ! $SUDO ]; then - WARNING "--no-sudo enabled, impossible to install third party repositories, you'll have to do it yourself..." - else - rpm_flavour - if [ "$RPM" = "FEDORA" ]; then - _fedora_rel="`egrep "[0-9]{1,}" /etc/fedora-release -o`" - $SUDO dnf -y install --nogpgcheck \ - http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$_fedora_rel.noarch.rpm \ - http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$_fedora_rel.noarch.rpm - - $SUDO dnf -y update - - elif [ "$RPM" = "RHEL" ]; then - if [ "`grep '[^.]6\.' /etc/redhat-release`" ]; then - ERROR "Building with GCC 4.4 is not supported!" - exit 1 - else - $SUDO yum -y install --nogpgcheck \ - http://download.fedoraproject.org/pub/epel/7/$(uname -i)/e/epel-release-7-6.noarch.rpm \ - http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm - - $SUDO yum -y update - fi - - elif [ "$RPM" = "SUSE" ]; then - # Packman repo now includes name in link... - _suse_rel="`grep -w VERSION /etc/os-release | sed 's/[^0-9.]*//g'`" - _suse_name="`grep -w NAME /etc/os-release | gawk '{print $2}' | sed 's/\"//'`" - if [ $_suse_name ]; then - _suse_rel="${_suse_name}_${_suse_rel}" - fi - - PRINT "" - INFO "About to add 'packman' repository from http://packman.inode.at/suse/openSUSE_$_suse_rel/" - INFO "This is only needed if you do not already have a packman repository enabled..." - read -p "Do you want to add this repo (Y/n)?" - if [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" == "y" ]; then - INFO " Installing packman..." - $SUDO zypper ar -f -n packman http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_$_suse_rel/ packman - INFO " Done." - else - INFO " Skipping packman installation." - fi - $SUDO zypper --non-interactive --gpg-auto-import-keys update --auto-agree-with-licenses - fi - fi - - # These libs should always be available in fedora/suse official repository... - OPENJPEG_DEV="openjpeg2-devel" - VORBIS_DEV="libvorbis-devel" - OGG_DEV="libogg-devel" - THEORA_DEV="libtheora-devel" - - _packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \ - libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \ - libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \ - wayland-devel libdecor-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \ - vulkan-loader-devel libshaderc-devel \ - wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \ - libepoxy-devel yasm patch pybind11-devel \ - libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \ - gmp-devel pugixml-devel potrace-devel libharu-devel libzstd-devel pystring-devel \ - fribidi-devel harfbuzz-devel" - - OPENJPEG_USE=true - VORBIS_USE=true - OGG_USE=true - THEORA_USE=true - - if [ "$RPM" = "FEDORA" -o "$RPM" = "RHEL" ]; then - _packages="$_packages freetype-devel" - - if [ "$WITH_JACK" = true ]; then - _packages="$_packages jack-audio-connection-kit-devel" - fi - - if [ "$WITH_PULSEAUDIO" = true ]; then - _packages="$_packages pulseaudio-libs-devel" - fi - - PRINT "" - install_packages_RPM $_packages - - X264_DEV="x264-devel" - check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN - if [ $? -eq 0 ]; then - X264_USE=true - fi - - if [ "$WITH_ALL" = true ]; then - XVID_DEV="xvidcore-devel" - check_package_RPM $XVID_DEV - if [ $? -eq 0 ]; then - XVID_USE=true - fi - - MP3LAME_DEV="lame-devel" - check_package_RPM $MP3LAME_DEV - if [ $? -eq 0 ]; then - MP3LAME_USE=true - fi - fi - - elif [ "$RPM" = "SUSE" ]; then - _packages="$_packages freetype2-devel" - - if [ "$WITH_PULSEAUDIO" = true ]; then - _packages="$_packages libpulse-devel" - fi - - PRINT "" - install_packages_RPM $_packages - - X264_DEV="libx264-devel" - check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN - if [ $? -eq 0 ]; then - X264_USE=true - fi - - if [ "$WITH_ALL" = true ]; then - XVID_DEV="libxvidcore-devel" - check_package_RPM $XVID_DEV - if [ $? -eq 0 ]; then - XVID_USE=true - fi - - MP3LAME_DEV="libmp3lame-devel" - check_package_RPM $MP3LAME_DEV - if [ $? -eq 0 ]; then - MP3LAME_USE=true - fi - fi - fi - - PRINT"" - LIBSNDFILE_DEV="libsndfile-devel" - check_package_RPM $LIBSNDFILE_DEV - if [ $? -eq 0 ]; then - install_packages_RPM $LIBSNDFILE_DEV - fi - - WEBP_DEV="libwebp-devel" - check_package_RPM $WEBP_DEV - if [ $? -eq 0 ]; then - install_packages_RPM $WEBP_DEV - WEBP_USE=true - fi - - VPX_DEV="libvpx-devel" - check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN - if [ $? -eq 0 ]; then - VPX_USE=true - fi - - AOM_DEV="libaom-devel" - check_package_version_ge_RPM $AOM_DEV $AOM_VERSION_MIN - if [ $? -eq 0 ]; then - AOM_USE=true - fi - - OPUS_DEV="libopus-devel" - check_package_version_ge_RPM $OPUS_DEV $OPUS_VERSION_MIN - if [ $? -eq 0 ]; then - OPUS_USE=true - fi - - if [ "$WITH_ALL" = true ]; then - PRINT "" - install_packages_RPM libspnav-devel - fi - - PRINT "" - CLANG_FORMAT="clang" # Yeah, on fedora/suse clang-format is part of main clang package... - check_package_version_ge_RPM $CLANG_FORMAT $CLANG_FORMAT_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_RPM $CLANG_FORMAT - else - PRINT "" - WARNING "clang-format $CLANG_FORMAT_VERSION_MIN or higher not found, this is NOT needed to get Blender compiling..." - PRINT "" - fi - - PRINT "" - _do_compile_python=false - if [ "$PYTHON_SKIP" = true ]; then - WARNING "Skipping Python installation, as requested..." - elif [ "$PYTHON_FORCE_BUILD" = true ]; then - INFO "Forced Python building, as requested..." - _do_compile_python=true - else - check_package_version_ge_lt_RPM python3-devel $PYTHON_VERSION_MIN $PYTHON_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_RPM python3-devel - clean_Python - - PYTHON_VERSION_INSTALLED=$(echo `get_package_version_RPM python3-devel` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') - - for module in "${PYTHON_MODULES_PACKAGES[@]}" - do - module=($module) - package="python3-${module[0]}" - package_vmin=${module[1]} - package_vmex=${module[2]} - check_package_version_ge_lt_RPM "$package" $package_vmin $package_vmex - if [ $? -eq 0 ]; then - install_packages_RPM "$package" - else - WARNING "Sorry, using python package but no valid $package package available!" \ - " Use --build-python to force building of Python and use pip to get the packages." - fi - done - else - _do_compile_python=true - fi - fi - - if [ "$_do_compile_python" = true ]; then - install_packages_RPM libffi-devel - compile_Python - fi - - - PRINT "" - _do_compile_boost=false - if [ "$BOOST_SKIP" = true ]; then - WARNING "Skipping Boost installation, as requested..." - elif [ "$BOOST_FORCE_BUILD" = true ]; then - INFO "Forced Boost building, as requested..." - _do_compile_boost=true - else - check_package_version_ge_lt_RPM boost-devel $BOOST_VERSION_MIN $BOOST_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_RPM boost-devel - clean_Boost - else - _do_compile_boost=true - fi - fi - - if [ "$_do_compile_boost" = true ]; then - if [ "$RPM" = "SUSE" ]; then - install_packages_RPM gcc-fortran - else - install_packages_RPM libquadmath-devel bzip2-devel - fi - PRINT "" - compile_Boost - fi - - - PRINT "" - if [ "$TBB_SKIP" = true ]; then - WARNING "Skipping TBB installation, as requested..." - elif [ "$TBB_FORCE_BUILD" = true ]; then - INFO "Forced TBB building, as requested..." - compile_TBB - else - check_package_version_ge_lt_RPM tbb-devel $TBB_VERSION_MIN $TBB_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_RPM tbb-devel - clean_TBB - else - compile_TBB - fi - fi - - - PRINT "" - if [ "$OCIO_SKIP" = true ]; then - WARNING "Skipping OpenColorIO installation, as requested..." - elif [ "$OCIO_FORCE_BUILD" = true ]; then - INFO "Forced OpenColorIO building, as requested..." - compile_OCIO - else - if [ "$RPM" = "SUSE" ]; then - check_package_version_ge_lt_RPM OpenColorIO-devel $OCIO_VERSION_MIN $OCIO_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_RPM OpenColorIO-devel - clean_OCIO - else - compile_OCIO - fi - # XXX Fedora/RHEL OCIO still depends on libyaml-cpp v0.3 even when system default is v0.5! - else - compile_OCIO - fi - fi - - PRINT "" - if [ "$IMATH_SKIP" = true ]; then - WARNING "Skipping Imath installation, as requested..." - elif [ "$IMATH_FORCE_BUILD" = true ]; then - INFO "Forced Imath building, as requested..." - compile_IMATH - else - check_package_version_ge_lt_RPM imath-devel $IMATH_VERSION_MIN $IMATH_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_RPM imath-devel - IMATH_VERSION=`get_package_version_RPM imath-devel` - clean_IMATH - else - compile_IMATH - fi - fi - - PRINT "" - if [ "$OPENEXR_SKIP" = true ]; then - WARNING "Skipping OpenEXR installation, as requested..." - elif [ "$OPENEXR_FORCE_BUILD" = true ]; then - INFO "Forced OpenEXR building, as requested..." - compile_OPENEXR - else - check_package_version_ge_lt_RPM openexr-devel $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MEX - if [ $? -eq 0 -a $_with_built_imath == false ]; then - install_packages_RPM openexr-devel - OPENEXR_VERSION=`get_package_version_RPM openexr-devel` - clean_OPENEXR - else - compile_OPENEXR - fi - fi - - PRINT "" - if [ "$OIIO_SKIP" = true ]; then - WARNING "Skipping OpenImageIO installation, as requested..." - elif [ "$OIIO_FORCE_BUILD" = true ]; then - INFO "Forced OpenImageIO building, as requested..." - compile_OIIO - else - check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MEX - if [ $? -eq 0 -a $_with_built_openexr == false ]; then - install_packages_RPM OpenImageIO-devel OpenImageIO-utils - clean_OIIO - else - compile_OIIO - fi - fi - - - PRINT "" - have_llvm=false - _do_compile_llvm=false - if [ "$LLVM_SKIP" = true ]; then - WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..." - OSL_SKIP=true - elif [ "$LLVM_FORCE_BUILD" = true ]; then - INFO "Forced LLVM building, as requested..." - _do_compile_llvm=true - else - if [ "$RPM" = "SUSE" ]; then - CLANG_DEV="llvm-clang-devel" - else - CLANG_DEV="clang-devel" - fi - check_package_version_ge_lt_RPM llvm-devel $LLVM_VERSION_MIN $LLVM_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_RPM llvm-devel $CLANG_DEV - have_llvm=true - LLVM_VERSION=`llvm-config --version` - LLVM_VERSION_FOUND=$LLVM_VERSION - clean_LLVM - else - _do_compile_llvm=true - fi - fi - - if [ "$_do_compile_llvm" = true ]; then - install_packages_RPM libffi-devel - # LLVM can't find the fedora ffi header dir... - _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'` - PRINT "" - compile_LLVM - have_llvm=true - LLVM_VERSION_FOUND=$LLVM_VERSION - fi - - - PRINT "" - _do_compile_osl=false - if [ "$OSL_SKIP" = true ]; then - WARNING "Skipping OpenShadingLanguage installation, as requested..." - elif [ "$OSL_FORCE_BUILD" = true ]; then - INFO "Forced OpenShadingLanguage building, as requested..." - _do_compile_osl=true - else - if [ "$RPM" = "SUSE" ]; then - OSL_DEV="OpenShadingLanguage-devel" - else - OSL_DEV="openshadinglanguage-devel" - fi - check_package_version_ge_lt_RPM $OSL_DEV $OSL_VERSION_MIN $OSL_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_RPM $OSL_DEV - clean_OSL - else - _do_compile_osl=true - fi - fi - - if [ "$_do_compile_osl" = true ]; then - if [ "$have_llvm" = true ]; then - PRINT "" - compile_OSL - else - WARNING "No LLVM available, cannot build OSL!" - fi - fi - - - PRINT "" - if [ "$OSD_SKIP" = true ]; then - WARNING "Skipping OpenSubdiv installation, as requested..." - elif [ "$OSD_FORCE_BUILD" = true ]; then - INFO "Forced OpenSubdiv building, as requested..." - compile_OSD - else - # No package currently! - compile_OSD - fi - - - PRINT "" - if [ "$OPENVDB_SKIP" = true ]; then - WARNING "Skipping OpenVDB installation, as requested..." - elif [ "$OPENVDB_FORCE_BUILD" = true ]; then - INFO "Forced OpenVDB building, as requested..." - compile_OPENVDB - else - # No package currently! - compile_OPENVDB - fi - - PRINT "" - if [ "$ALEMBIC_SKIP" = true ]; then - WARNING "Skipping Alembic installation, as requested..." - elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then - INFO "Forced Alembic building, as requested..." - compile_ALEMBIC - else - # No package currently! - compile_ALEMBIC - fi - - PRINT "" - if [ "$MATERIALX_SKIP" = true ]; then - WARNING "Skipping MaterialX installation, as requested..." - elif [ "$MATERIALX_FORCE_BUILD" = true ]; then - INFO "Forced MaterialX building, as requested..." - compile_MATERIALX - else - compile_MATERIALX - fi - - PRINT "" - if [ "$USD_SKIP" = true ]; then - WARNING "Skipping USD installation, as requested..." - elif [ "$USD_FORCE_BUILD" = true ]; then - INFO "Forced USD building, as requested..." - compile_USD - else - compile_USD - fi - - if [ "$WITH_OPENCOLLADA" = true ]; then - PRINT "" - _do_compile_collada=false - if [ "$OPENCOLLADA_SKIP" = true ]; then - WARNING "Skipping OpenCOLLADA installation, as requested..." - elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then - INFO "Forced OpenCollada building, as requested..." - _do_compile_collada=true - else - # No package... - _do_compile_collada=true - fi - - if [ "$_do_compile_collada" = true ]; then - install_packages_RPM pcre-devel - # Find path to libxml shared lib... - _XML2_LIB=`rpm -ql libxml2-devel | grep -e ".*/libxml2.so"` - PRINT "" - compile_OpenCOLLADA - fi - fi - - if [ "$WITH_EMBREE" = true ]; then - PRINT "" - _do_compile_embree=false - if [ "$OPENCOLLADA_SKIP" = true ]; then - WARNING "Skipping Embree installation, as requested..." - elif [ "$EMBREE_FORCE_BUILD" = true ]; then - INFO "Forced Embree building, as requested..." - _do_compile_embree=true - else - # There is a package, but it does not provide everything that Blender needs... - #~ check_package_version_ge_lt_RPM embree-devel $EMBREE_VERSION_MIN $EMBREE_VERSION_MEX - #~ if [ $? -eq 0 ]; then - #~ install_packages_RPM embree-devel - #~ clean_Embree - #~ else - _do_compile_embree=true - #~ fi - fi - - if [ "$_do_compile_embree" = true ]; then - compile_Embree - fi - fi - - if [ "$WITH_OIDN" = true ]; then - _do_compile_oidn=false - PRINT "" - if [ "$OIDN_SKIP" = true ]; then - WARNING "Skipping OpenImgeDenoise installation, as requested..." - elif [ "$OIDN_FORCE_BUILD" = true ]; then - INFO "Forced OpenImageDenoise building, as requested..." - _do_compile_oidn=true - else - # No package currently! - _do_compile_oidn=true - fi - - if [ "$_do_compile_oidn" = true ]; then - compile_OIDN - fi - fi - - PRINT "" - _do_compile_ffmpeg=false - if [ "$FFMPEG_SKIP" = true ]; then - WARNING "Skipping FFMpeg installation, as requested..." - elif [ "$FFMPEG_FORCE_BUILD" = true ]; then - INFO "Forced FFMpeg building, as requested..." - _do_compile_ffmpeg=true - else - check_package_version_ge_lt_RPM ffmpeg-devel $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_RPM ffmpeg ffmpeg-devel - clean_FFmpeg - else - _do_compile_ffmpeg=true - fi - fi - if [ "$_do_compile_ffmpeg" = true ]; then - _packages="" - if [ "$VORBIS_USE" = true ]; then - _packages="$_packages $VORBIS_DEV" - fi - if [ "$THEORA_USE" = true ]; then - _packages="$_packages $THEORA_DEV" - fi - if [ "$OGG_USE" = true ]; then - _packages="$_packages $OGG_DEV" - fi - if [ "$XVID_USE" = true ]; then - _packages="$_packages $XVID_DEV" - fi - if [ "$X264_USE" = true ]; then - _packages="$_packages $X264_DEV" - fi - if [ "$VPX_USE" = true ]; then - _packages="$_packages $VPX_DEV" - fi - if [ "$AOM_USE" = true ]; then - _packages="$_packages $AOM_DEV" - fi - if [ "$OPUS_USE" = true ]; then - _packages="$_packages $OPUS_DEV" - fi - if [ "$MP3LAME_USE" = true ]; then - _packages="$_packages $MP3LAME_DEV" - fi - install_packages_RPM $_packages - - compile_FFmpeg - fi - - PRINT "" - if [ "$XR_OPENXR_SKIP" = true ]; then - WARNING "Skipping OpenXR-SDK installation, as requested..." - elif [ "$XR_OPENXR_FORCE_BUILD" = true ]; then - INFO "Forced OpenXR-SDK building, as requested..." - compile_XR_OpenXR_SDK - else - # No package currently! - compile_XR_OpenXR_SDK - fi - - PRINT "" - if [ "$LEVEL_ZERO_SKIP" = true ]; then - WARNING "Skipping Level Zero installation, as requested..." - elif [ "$LEVEL_ZERO_FORCE_BUILD" = true ]; then - INFO "Forced Level Zero building, as requested..." - compile_Level_Zero - else - # No package currently! - PRINT "" - compile_Level_Zero - fi - - PRINT "" - if [ "$OPENPGL_SKIP" = true ]; then - WARNING "Skipping OpenPGL installation, as requested..." - elif [ "$OPENPGL_FORCE_BUILD" = true ]; then - INFO "Forced OpenPGL building, as requested..." - compile_OpenPGL - else - # No package currently! - PRINT "" - compile_OpenPGL - fi -} - - -# ---------------------------------------------------------------------------- -# Install on ARCH-like - -get_package_version_ARCH() { - pacman -Si $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+?(([0-9]+\.?)+).*/\1/' -} - -check_package_ARCH() { - r=`pacman -Si $1 | grep -c 'Description'` - - if [ $r -ge 1 ]; then - return 0 - else - return 1 - fi -} - -check_package_version_match_ARCH() { - v=`get_package_version_ARCH $1` - - if [ -z "$v" ]; then - return 1 - fi - - version_match $v $2 - return $? -} - -check_package_version_ge_ARCH() { - v=`get_package_version_ARCH $1` - - if [ -z "$v" ]; then - return 1 - fi - - version_ge $v $2 - return $? -} - -check_package_version_ge_lt_ARCH() { - v=`get_package_version_ARCH $1` - - if [ -z "$v" ]; then - return 1 - fi - - version_ge_lt $v $2 $3 - return $? -} - -install_packages_ARCH() { - if [ ! $SUDO ]; then - WARNING "--no-sudo enabled, impossible to run pacman for $@, you'll have to do it yourself..." - else - $SUDO pacman -S --needed --noconfirm $@ - if [ $? -ge 1 ]; then - ERROR "pacman failed to install requested packages, exiting." - exit 1 - fi - fi -} - -install_ARCH() { - PRINT "" - INFO "Installing dependencies for ARCH-based distribution" - PRINT "" - PRINT "`eval _echo "$COMMON_INFO"`" - PRINT "" - - if [ "$NO_CONFIRM" = false ]; then - read -p "Do you want to continue (Y/n)?" - [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit - fi - - # Check for sudo... - if [ $SUDO ]; then - if [ ! -x "/usr/bin/sudo" ]; then - PRINT "" - ERROR "This script requires sudo but it is not installed." - PRINT "Please setup sudo according to:" - PRINT "https://wiki.archlinux.org/index.php/Sudo" - PRINT "and try again." - PRINT "" - exit - fi - fi - - if [ ! $SUDO ]; then - WARNING "--no-sudo enabled, impossible to run pacman -Sy, you'll have to do it yourself..." - else - $SUDO pacman -Sy - fi - - # These libs should always be available in arch official repository... - OPENJPEG_DEV="openjpeg2" - VORBIS_DEV="libvorbis" - OGG_DEV="libogg" - THEORA_DEV="libtheora" - - BASE_DEVEL="base-devel" - - # Avoid conflicts when gcc-multilib is installed - pacman -Qi gcc-multilib &>/dev/null - if [ $? -eq 0 ]; then - BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '` - fi - - _packages="$BASE_DEVEL git cmake fontconfig flex \ - libxi libxcursor libxrandr libxinerama libepoxy libdecor libpng libtiff wget openal \ - vulkan-icd-loader vulkan-headers shaderc \ - $OPENJPEG_DEV yasm sdl2 fftw pybind11 \ - libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu \ - zstd pystring fribidi harfbuzz" - - OPENJPEG_USE=true - VORBIS_USE=true - OGG_USE=true - THEORA_USE=true - - if [ "$WITH_ALL" = true ]; then - _packages="$_packages libspnav" - fi - - if [ "$WITH_JACK" = true ]; then - _packages="$_packages jack2" - fi - - if [ "$WITH_PULSEAUDIO" = true ]; then - _packages="$_packages libpulse" - fi - - PRINT "" - install_packages_ARCH $_packages - - PRINT"" - LIBSNDFILE_DEV="libsndfile" - check_package_ARCH $LIBSNDFILE_DEV - if [ $? -eq 0 ]; then - install_packages_ARCH $LIBSNDFILE_DEV - fi - - X264_DEV="x264" - check_package_version_ge_ARCH $X264_DEV $X264_VERSION_MIN - if [ $? -eq 0 ]; then - X264_USE=true - fi - - WEBP_DEV="libwebp" - check_package_ARCH $WEBP_DEV - if [ $? -eq 0 ]; then - install_packages_ARCH $WEBP_DEV - WEBP_USE=true - fi - - XVID_DEV="xvidcore" - check_package_ARCH $XVID_DEV - if [ $? -eq 0 ]; then - XVID_USE=true - fi - - MP3LAME_DEV="lame" - check_package_ARCH $MP3LAME_DEV - if [ $? -eq 0 ]; then - MP3LAME_USE=true - fi - - VPX_DEV="libvpx" - check_package_version_ge_ARCH $VPX_DEV $VPX_VERSION_MIN - if [ $? -eq 0 ]; then - VPX_USE=true - fi - - AOM_DEV="libaom" - check_package_version_ge_ARCH $AOM_DEV $AOM_VERSION_MIN - if [ $? -eq 0 ]; then - AOM_USE=true - fi - - OPUS_DEV="opus" - check_package_version_ge_ARCH $OPUS_DEV $OPUS_VERSION_MIN - if [ $? -eq 0 ]; then - OPUS_USE=true - fi - - - PRINT "" - CLANG_FORMAT="clang" # Yeah, on arch clang-format is part of main clang package... - check_package_version_ge_ARCH $CLANG_FORMAT $CLANG_FORMAT_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_ARCH $CLANG_FORMAT - else - PRINT "" - WARNING "clang-format $CLANG_FORMAT_VERSION_MIN or higher not found, this is NOT needed to get Blender compiling..." - PRINT "" - fi - - - PRINT "" - _do_compile_python=false - if [ "$PYTHON_SKIP" = true ]; then - WARNING "Skipping Python installation, as requested..." - elif [ "$PYTHON_FORCE_BUILD" = true ]; then - INFO "Forced Python building, as requested..." - _do_compile_python=true - else - check_package_version_ge_lt_ARCH python $PYTHON_VERSION_MIN $PYTHON_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH python - clean_Python - PRINT "" - - PYTHON_VERSION_INSTALLED=$(echo `get_package_version_ARCH python` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') - - for module in "${PYTHON_MODULES_PACKAGES[@]}" - do - module=($module) - package="python-${module[0]}" - package_vmin=${module[1]} - package_vmex=${module[2]} - check_package_version_ge_lt_ARCH "$package" $package_vmin $package_vmex - if [ $? -eq 0 ]; then - install_packages_ARCH "$package" - else - WARNING "Sorry, using python package but no valid $package package available!" \ - " Use --build-python to force building of Python and use pip to get the packages." - fi - done - else - _do_compile_python=true - fi - fi - - if [ "$_do_compile_python" = true ]; then - install_packages_ARCH libffi - compile_Python - fi - - - PRINT "" - if [ "$BOOST_SKIP" = true ]; then - WARNING "Skipping Boost installation, as requested..." - elif [ "$BOOST_FORCE_BUILD" = true ]; then - INFO "Forced Boost building, as requested..." - compile_Boost - else - check_package_version_ge_lt_ARCH boost $BOOST_VERSION_MIN $BOOST_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH boost - clean_Boost - else - compile_Boost - fi - fi - - - PRINT "" - if [ "$TBB_SKIP" = true ]; then - WARNING "Skipping TBB installation, as requested..." - elif [ "$TBB_FORCE_BUILD" = true ]; then - INFO "Forced TBB building, as requested..." - compile_TBB - else - check_package_version_ge_lt_ARCH intel-tbb $TBB_VERSION_MIN $TBB_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH intel-tbb - clean_TBB - else - compile_TBB - fi - fi - - - PRINT "" - if [ "$OCIO_SKIP" = true ]; then - WARNING "Skipping OpenColorIO installation, as requested..." - elif [ "$OCIO_FORCE_BUILD" = true ]; then - INFO "Forced OpenColorIO building, as requested..." - compile_OCIO - else - check_package_version_ge_lt_ARCH opencolorio $OCIO_VERSION_MIN $OCIO_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH opencolorio - clean_OCIO - else - compile_OCIO - fi - fi - - PRINT "" - if [ "$IMATH_SKIP" = true ]; then - WARNING "Skipping Imath installation, as requested..." - elif [ "$IMATH_FORCE_BUILD" = true ]; then - INFO "Forced Imath building, as requested..." - compile_IMATH - else - check_package_version_ge_lt_ARCH imath $IMATH_VERSION_MIN $IMATH_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH imath - IMATH_VERSION=`get_package_version_ARCH imath` - clean_IMATH - else - compile_IMATH - fi - fi - - PRINT "" - if [ "$OPENEXR_SKIP" = true ]; then - WARNING "Skipping OpenEXR installation, as requested..." - elif [ "$OPENEXR_FORCE_BUILD" = true ]; then - INFO "Forced OpenEXR building, as requested..." - compile_OPENEXR - else - check_package_version_ge_lt_ARCH openexr $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH openexr - OPENEXR_VERSION=`get_package_version_ARCH openexr` - IMATH_VERSION=$OPENEXR_VERSION - clean_OPENEXR - else - compile_OPENEXR - fi - fi - - - PRINT "" - if [ "$OIIO_SKIP" = true ]; then - WARNING "Skipping OpenImageIO installation, as requested..." - elif [ "$OIIO_FORCE_BUILD" = true ]; then - INFO "Forced OpenImageIO building, as requested..." - compile_OIIO - else - check_package_version_ge_lt_ARCH openimageio $OIIO_VERSION_MIN $OIIO_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH openimageio - clean_OIIO - else - compile_OIIO - fi - fi - - - PRINT "" - have_llvm=false - _do_compile_llvm=false - if [ "$LLVM_SKIP" = true ]; then - WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..." - OSL_SKIP=true - elif [ "$LLVM_FORCE_BUILD" = true ]; then - INFO "Forced LLVM building, as requested..." - _do_compile_llvm=true - else - check_package_version_ge_lt_ARCH llvm $LLVM_VERSION_MIN $LLVM_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH llvm clang - have_llvm=true - LLVM_VERSION=`llvm-config --version` - LLVM_VERSION_FOUND=$LLVM_VERSION - clean_LLVM - else - _do_compile_llvm=true - fi - fi - - if [ "$_do_compile_llvm" = true ]; then - install_packages_ARCH libffi - # LLVM can't find the arch ffi header dir... - _FFI_INCLUDE_DIR=`pacman -Ql libffi | grep -e ".*/ffi.h" | awk '{print $2}' | sed -r 's/(.*)\/ffi.h/\1/'` - PRINT "" - compile_LLVM - have_llvm=true - LLVM_VERSION_FOUND=$LLVM_VERSION - fi - - - PRINT "" - _do_compile_osl=false - if [ "$OSL_SKIP" = true ]; then - WARNING "Skipping OpenShadingLanguage installation, as requested..." - elif [ "$OSL_FORCE_BUILD" = true ]; then - INFO "Forced OpenShadingLanguage building, as requested..." - _do_compile_osl=true - else - check_package_version_ge_lt_ARCH openshadinglanguage $OSL_VERSION_MIN $OSL_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH openshadinglanguage - clean_OSL - else - _do_compile_osl=true - fi - fi - - if [ "$_do_compile_osl" = true ]; then - if [ "$have_llvm" = true ]; then - PRINT "" - compile_OSL - else - WARNING "No LLVM available, cannot build OSL!" - fi - fi - - - PRINT "" - if [ "$OSD_SKIP" = true ]; then - WARNING "Skipping OpenSubdiv installation, as requested..." - elif [ "$OSD_FORCE_BUILD" = true ]; then - INFO "Forced OpenSubdiv building, as requested..." - compile_OSD - else - check_package_version_ge_lt_ARCH opensubdiv $OSD_VERSION_MIN $OSD_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH opensubdiv - clean_OSD - else - compile_OSD - fi - fi - - - PRINT "" - if [ "$OPENVDB_SKIP" = true ]; then - WARNING "Skipping OpenVDB installation, as requested..." - elif [ "$OPENVDB_FORCE_BUILD" = true ]; then - INFO "Forced OpenVDB building, as requested..." - compile_OPENVDB - else - check_package_version_ge_lt_ARCH openvdb $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH openvdb - clean_OPENVDB - else - compile_OPENVDB - fi - fi - - PRINT "" - if [ "$ALEMBIC_SKIP" = true ]; then - WARNING "Skipping Alembic installation, as requested..." - elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then - INFO "Forced Alembic building, as requested..." - compile_ALEMBIC - else - compile_ALEMBIC - fi - - PRINT "" - if [ "$MATERIALX_SKIP" = true ]; then - WARNING "Skipping MaterialX installation, as requested..." - elif [ "$MATERIALX_FORCE_BUILD" = true ]; then - INFO "Forced MaterialX building, as requested..." - compile_MATERIALX - else - compile_MATERIALX - fi - - PRINT "" - if [ "$USD_SKIP" = true ]; then - WARNING "Skipping USD installation, as requested..." - elif [ "$USD_FORCE_BUILD" = true ]; then - INFO "Forced USD building, as requested..." - compile_USD - else - compile_USD - fi - - if [ "$WITH_OPENCOLLADA" = true ]; then - PRINT "" - _do_compile_collada=false - if [ "$OPENCOLLADA_SKIP" = true ]; then - WARNING "Skipping OpenCOLLADA installation, as requested..." - elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then - INFO "Forced OpenCollada building, as requested..." - _do_compile_collada=true - else - check_package_ARCH opencollada - if [ $? -eq 0 ]; then - install_packages_ARCH opencollada - clean_OpenCOLLADA - else - _do_compile_collada=true - fi - fi - - if [ "$_do_compile_collada" = true ]; then - install_packages_ARCH pcre - # Find path to libxml shared lib... - _XML2_LIB=`pacman -Ql libxml2 | grep -e ".*/libxml2.so$" | gawk '{print $2}'` - PRINT "" - compile_OpenCOLLADA - fi - fi - - if [ "$WITH_EMBREE" = true ]; then - PRINT "" - _do_compile_embree=false - if [ "$EMBREE_SKIP" = true ]; then - WARNING "Skipping Embree installation, as requested..." - elif [ "$EMBREE_FORCE_BUILD" = true ]; then - INFO "Forced Embree building, as requested..." - _do_compile_embree=true - else - # There is a package, but it does not provide everything that Blender needs... - #~ check_package_version_ge_lt_ARCH embree $EMBREE_VERSION_MIN $EMBREE_VERSION_MEX - #~ if [ $? -eq 0 ]; then - #~ install_packages_ARCH embree - #~ clean_Embree - #~ else - _do_compile_embree=true - #~ fi - fi - - if [ "$_do_compile_embree" = true ]; then - compile_Embree - fi - fi - - if [ "$WITH_OIDN" = true ]; then - _do_compile_oidn=false - PRINT "" - if [ "$OIDN_SKIP" = true ]; then - WARNING "Skipping OpenImgeDenoise installation, as requested..." - elif [ "$OIDN_FORCE_BUILD" = true ]; then - INFO "Forced OpenImageDenoise building, as requested..." - _do_compile_oidn=true - else - # No package currently! - _do_compile_oidn=true - fi - - if [ "$_do_compile_oidn" = true ]; then - compile_OIDN - fi - fi - - PRINT "" - _do_compile_ffmpeg=false - if [ "$FFMPEG_SKIP" = true ]; then - WARNING "Skipping FFMpeg installation, as requested..." - elif [ "$FFMPEG_FORCE_BUILD" = true ]; then - INFO "Forced FFMpeg building, as requested..." - _do_compile_ffmpeg=true - else - check_package_version_ge_lt_ARCH ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MEX - if [ $? -eq 0 ]; then - install_packages_ARCH ffmpeg - clean_FFmpeg - else - _do_compile_ffmpeg=true - fi - fi - if [ "$_do_compile_ffmpeg" = true ]; then - _packages="" - if [ "$VORBIS_USE" = true ]; then - _packages="$_packages $VORBIS_DEV" - fi - if [ "$THEORA_USE" = true ]; then - _packages="$_packages $THEORA_DEV" - fi - if [ "$OGG_USE" = true ]; then - _packages="$_packages $OGG_DEV" - fi - if [ "$XVID_USE" = true ]; then - _packages="$_packages $XVID_DEV" - fi - if [ "$X264_USE" = true ]; then - _packages="$_packages $X264_DEV" - fi - if [ "$VPX_USE" = true ]; then - _packages="$_packages $VPX_DEV" - fi - if [ "$AOM_USE" = true ]; then - _packages="$_packages $AOM_DEV" - fi - if [ "$OPUS_USE" = true ]; then - _packages="$_packages $OPUS_DEV" - fi - if [ "$MP3LAME_USE" = true ]; then - _packages="$_packages $MP3LAME_DEV" - fi - - compile_FFmpeg - fi - - PRINT "" - if [ "$XR_OPENXR_SKIP" = true ]; then - WARNING "Skipping OpenXR-SDK installation, as requested..." - elif [ "$XR_OPENXR_FORCE_BUILD" = true ]; then - INFO "Forced OpenXR-SDK building, as requested..." - compile_XR_OpenXR_SDK - else - # No package currently! - compile_XR_OpenXR_SDK - fi - - PRINT "" - if [ "$LEVEL_ZERO_SKIP" = true ]; then - WARNING "Skipping Level Zero installation, as requested..." - elif [ "$LEVEL_ZERO_FORCE_BUILD" = true ]; then - INFO "Forced Level Zero building, as requested..." - compile_Level_Zero - else - # No package currently! - PRINT "" - compile_Level_Zero - fi - - PRINT "" - if [ "$OPENPGL_SKIP" = true ]; then - WARNING "Skipping OpenPGL installation, as requested..." - elif [ "$OPENPGL_FORCE_BUILD" = true ]; then - INFO "Forced OpenPGL building, as requested..." - compile_OpenPGL - else - # No package currently! - PRINT "" - compile_OpenPGL - fi -} - - -# ---------------------------------------------------------------------------- -# Install on other distro (very limited!) - -install_OTHER() { - PRINT "" - WARNING "Attempt to build main dependencies for other linux distributions." - PRINT "" - PRINT "`eval _echo "$COMMON_INFO"`" - PRINT "" - - ERROR "Failed to detect distribution type." - PRINT "" - PRINT "Your distribution is not supported by this script, you'll have to install dependencies and" - PRINT "dev packages yourself. However, this script can still attempt to build main (complex) libraries for you," - PRINT "if you use '--build-foo' options (you can try '--build-all' one first)." - PRINT "" - PRINT "Quite obviously, it assumes dependencies from those libraries are already available, otherwise please" - PRINT "install them (you can also use error messages printed out by build process to find missing libraries...)." - PRINT "" - PRINT "`eval _echo "$DEPS_COMMON_INFO"`" - PRINT "" - PRINT "`eval _echo "$DEPS_SPECIFIC_INFO"`" - PRINT "" - - if [ "$NO_CONFIRM" = false ]; then - read -p "Do you want to continue (Y/n)?" - [ "$(echo ${REPLY:=Y} | tr [:upper:] [:lower:])" != "y" ] && exit - fi - - PRINT "" - if [ "$PYTHON_SKIP" = true ]; then - WARNING "Skipping Python installation, as requested..." - elif [ "$PYTHON_FORCE_BUILD" = true ]; then - INFO "Forced Python building, as requested..." - compile_Python - fi - - - PRINT "" - if [ "$BOOST_SKIP" = true ]; then - WARNING "Skipping Boost installation, as requested..." - elif [ "$BOOST_FORCE_BUILD" = true ]; then - INFO "Forced Boost building, as requested..." - compile_Boost - fi - - - PRINT "" - if [ "$TBB_SKIP" = true ]; then - WARNING "Skipping TBB installation, as requested..." - elif [ "$TBB_FORCE_BUILD" = true ]; then - INFO "Forced TBB building, as requested..." - compile_TBB - fi - - - PRINT "" - if [ "$OCIO_SKIP" = true ]; then - WARNING "Skipping OpenColorIO installation, as requested..." - elif [ "$OCIO_FORCE_BUILD" = true ]; then - INFO "Forced OpenColorIO building, as requested..." - compile_OCIO - fi - - - PRINT "" - if [ "$IMATH_SKIP" = true ]; then - WARNING "Skipping Imath installation, as requested..." - elif [ "$IMATH_FORCE_BUILD" = true ]; then - INFO "Forced Imath building, as requested..." - compile_IMATH - fi - - PRINT "" - if [ "$OPENEXR_SKIP" = true ]; then - WARNING "Skipping OpenEXR installation, as requested..." - elif [ "$OPENEXR_FORCE_BUILD" = true ]; then - INFO "Forced OpenEXR building, as requested..." - compile_OPENEXR - fi - - - PRINT "" - if [ "$OIIO_SKIP" = true ]; then - WARNING "Skipping OpenImageIO installation, as requested..." - elif [ "$OIIO_FORCE_BUILD" = true ]; then - INFO "Forced OpenImageIO building, as requested..." - compile_OIIO - fi - - - PRINT "" - have_llvm=false - if [ "$LLVM_SKIP" = true ]; then - WARNING "Skipping LLVM installation, as requested (this also implies skipping OSL!)..." - elif [ "$LLVM_FORCE_BUILD" = true ]; then - INFO "Forced LLVM building, as requested..." - compile_LLVM - have_llvm=true - LLVM_VERSION_FOUND=$LLVM_VERSION - fi - - - PRINT "" - if [ "$OSL_SKIP" = true ]; then - WARNING "Skipping OpenShadingLanguage installation, as requested..." - elif [ "$OSL_FORCE_BUILD" = true ]; then - INFO "Forced OpenShadingLanguage building, as requested..." - if [ "$have_llvm" = true ]; then - PRINT "" - compile_OSL - else - WARNING "No LLVM available, cannot build OSL!" - fi - fi - - - PRINT "" - if [ "$OSD_SKIP" = true ]; then - WARNING "Skipping OpenSubdiv installation, as requested..." - elif [ "$OSD_FORCE_BUILD" = true ]; then - INFO "Forced OpenSubdiv building, as requested..." - compile_OSD - fi - - - PRINT "" - if [ "$MATERIALX_SKIP" = true ]; then - WARNING "Skipping MaterialX installation, as requested..." - elif [ "$MATERIALX_FORCE_BUILD" = true ]; then - INFO "Forced MaterialX building, as requested..." - compile_MATERIALX - else - compile_MATERIALX - fi - - PRINT "" - if [ "$USD_SKIP" = true ]; then - WARNING "Skipping USD installation, as requested..." - elif [ "$USD_FORCE_BUILD" = true ]; then - INFO "Forced USD building, as requested..." - compile_USD - else - compile_USD - fi - - - if [ "$WITH_OPENCOLLADA" = true ]; then - PRINT "" - if [ "$OPENCOLLADA_SKIP" = true ]; then - WARNING "Skipping OpenCOLLADA installation, as requested..." - elif [ "$OPENCOLLADA_FORCE_BUILD" = true ]; then - INFO "Forced OpenCollada building, as requested..." - compile_OpenCOLLADA - fi - fi - - if [ "$WITH_EMBREE" = true ]; then - PRINT "" - if [ "$EMBREE_SKIP" = true ]; then - WARNING "Skipping Embree installation, as requested..." - elif [ "$EMBREE_FORCE_BUILD" = true ]; then - INFO "Forced Embree building, as requested..." - compile_Embree - fi - fi - - if [ "$WITH_OIDN" = true ]; then - PRINT "" - if [ "$OIDN_SKIP" = true ]; then - WARNING "Skipping OpenImgeDenoise installation, as requested..." - elif [ "$OIDN_FORCE_BUILD" = true ]; then - INFO "Forced OpenImageDenoise building, as requested..." - compile_OIDN - fi - fi - - PRINT "" - if [ "$FFMPEG_SKIP" = true ]; then - WARNING "Skipping FFMpeg installation, as requested..." - elif [ "$FFMPEG_FORCE_BUILD" = true ]; then - INFO "Forced FFMpeg building, as requested..." - compile_FFmpeg - fi - - PRINT "" - if [ "$XR_OPENXR_SKIP" = true ]; then - WARNING "Skipping OpenXR-SDK installation, as requested..." - elif [ "$XR_OPENXR_FORCE_BUILD" = true ]; then - INFO "Forced OpenXR-SDK building, as requested..." - compile_XR_OpenXR_SDK - fi - - PRINT "" - if [ "$LEVEL_ZERO_SKIP" = true ]; then - WARNING "Skipping Level Zero installation, as requested..." - elif [ "$LEVEL_ZERO_FORCE_BUILD" = true ]; then - INFO "Forced Level Zero building, as requested..." - compile_Level_Zero - fi - - PRINT "" - if [ "$OPENPGL_SKIP" = true ]; then - WARNING "Skipping OpenPGL installation, as requested..." - elif [ "$OPENPGL_FORCE_BUILD" = true ]; then - INFO "Forced OpenPGL building, as requested..." - compile_OpenPGL - fi -} - -# ---------------------------------------------------------------------------- -# Printing User Info - -print_info() { - PRINT "" - PRINT "" - PRINT "Ran with:" - PRINT " install_deps.sh $COMMANDLINE" - PRINT "" - PRINT "" - PRINT "If you're using CMake add this to your configuration flags:" - - _buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost* -U *TBB*" - _buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CLANG* -U *CYCLES*" - _buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *BLOSC* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*" - _buildargs="$_buildargs -U *MATERIALX* -U *USD*" - _buildargs="$_buildargs -U *EMBREE* -U *OPENIMAGEDENOISE* -U *OPENXR* -U *OPENPGL*" - - _1="-D WITH_CODEC_SNDFILE=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - - _1="-D PYTHON_VERSION=$PYTHON_VERSION_INSTALLED" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d "$INST/python-$PYTHON_VERSION_INSTALLED" ]; then - _1="-D PYTHON_ROOT_DIR=$INST/python-$PYTHON_VERSION_INSTALLED" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - - if [ -d $INST/boost ]; then - _1="-D BOOST_ROOT=$INST/boost" - _2="-D Boost_NO_SYSTEM_PATHS=ON" - _3="-D Boost_NO_BOOST_CMAKE=ON" - PRINT " $_1" - PRINT " $_2" - PRINT " $_3" - _buildargs="$_buildargs $_1 $_2 $_3" - fi - - if [ -d $INST/tbb ]; then - _1="-D TBB_ROOT_DIR=$INST/tbb" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - - if [ "$OCIO_SKIP" = false ]; then - _1="-D WITH_OPENCOLORIO=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/ocio ]; then - _1="-D OPENCOLORIO_ROOT_DIR=$INST/ocio" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - if [ "$WEBP_USE" = true ]; then - _1="-D WITH_IMAGE_WEBP=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - - if [ -d $INST/openexr ]; then - _1="-D OPENEXR_ROOT_DIR=$INST/openexr" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - - if [ -d $INST/oiio ]; then - _1="-D OPENIMAGEIO_ROOT_DIR=$INST/oiio" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - - if [ "$OSL_SKIP" = false ]; then - _1="-D WITH_CYCLES_OSL=ON" - _2="-D WITH_LLVM=ON" - _3="-D LLVM_VERSION=$LLVM_VERSION_FOUND" - PRINT " $_1" - PRINT " $_2" - PRINT " $_3" - _buildargs="$_buildargs $_1 $_2 $_3" - if [ -d $INST/osl ]; then - _1="-D OSL_ROOT_DIR=$INST/osl" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - if [ -d $INST/llvm ]; then - _1="-D LLVM_ROOT_DIR=$INST/llvm" - _2="-D LLVM_STATIC=ON" - PRINT " $_1" - PRINT " $_2" - _buildargs="$_buildargs $_1 $_2" - fi - else - _1="-D WITH_CYCLES_OSL=OFF" - _2="-D WITH_LLVM=OFF" - PRINT " $_1" - PRINT " $_2" - _buildargs="$_buildargs $_1 $_2" - fi - - if [ "$OSD_SKIP" = false ]; then - _1="-D WITH_OPENSUBDIV=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/osd ]; then - _1="-D OPENSUBDIV_ROOT_DIR=$INST/osd" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - if [ "$OPENVDB_SKIP" = false ]; then - _1="-D WITH_OPENVDB=ON" - _2="-D WITH_OPENVDB_BLOSC=ON" - PRINT " $_1" - PRINT " $_2" - _buildargs="$_buildargs $_1 $_2" - if [ -d $INST/openvdb ]; then - _1="-D OPENVDB_ROOT_DIR=$INST/openvdb" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - if [ -d $INST/blosc ]; then - _1="-D BLOSC_ROOT_DIR=$INST/blosc" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - if [ -d $INST/nanovdb ]; then - _1="-D WITH_NANOVDB=ON" - _2="-D NANOVDB_ROOT_DIR=$INST/nanovdb" - PRINT " $_1" - PRINT " $_2" - _buildargs="$_buildargs $_1 $_2" - fi - fi - - if [ "$WITH_OPENCOLLADA" = true ]; then - _1="-D WITH_OPENCOLLADA=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/opencollada ]; then - _1="-D OPENCOLLADA_ROOT_DIR=$INST/opencollada" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - if [ "$WITH_EMBREE" = true ]; then - _1="-D WITH_CYCLES_EMBREE=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/embree ]; then - _1="-D EMBREE_ROOT_DIR=$INST/embree" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - if [ "$WITH_OIDN" = true ]; then - _1="-D WITH_OPENIMAGEDENOISE=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/oidn ]; then - _1="-D OPENIMAGEDENOISE_ROOT_DIR=$INST/oidn" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - if [ "$WITH_JACK" = true ]; then - _1="-D WITH_JACK=ON" - _2="-D WITH_JACK_DYNLOAD=ON" - PRINT " $_1" - PRINT " $_2" - _buildargs="$_buildargs $_1 $_2" - fi - - if [ "$WITH_PULSEAUDIO" = true ]; then - _1="-D WITH_PULSEAUDIO=ON" - _2="-D WITH_PULSEAUDIO_DYNLOAD=ON" - PRINT " $_1" - PRINT " $_2" - _buildargs="$_buildargs $_1 $_2" - fi - - if [ "$ALEMBIC_SKIP" = false ]; then - _1="-D WITH_ALEMBIC=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/alembic ]; then - _1="-D ALEMBIC_ROOT_DIR=$INST/alembic" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - if [ "$MATERIALX_SKIP" = false ]; then - _1="-D WITH_MATERIALX=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/materialx ]; then - _1="-D MaterialX_DIR=$INST/materialx/lib/cmake/MaterialX" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - if [ "$USD_SKIP" = false ]; then - _1="-D WITH_USD=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/usd ]; then - _1="-D USD_ROOT_DIR=$INST/usd" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - if [ "$FFMPEG_SKIP" = false ]; then - _1="-D WITH_CODEC_FFMPEG=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/ffmpeg ]; then - _1="-D FFMPEG_ROOT_DIR=$INST/ffmpeg" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - if [ "$XR_OPENXR_SKIP" = false ]; then - _1="-D WITH_XR_OPENXR=ON" - PRINT " $_1" - _buildargs="$_buildargs $_1" - if [ -d $INST/xr-openxr-sdk ]; then - _1="-D XR_OPENXR_SDK_ROOT_DIR=$INST/xr-openxr-sdk" - PRINT " $_1" - _buildargs="$_buildargs $_1" - fi - fi - - # Not yet available in Blender. - #~ if [ "$LEVEL_ZERO_SKIP" = false ]; then - #~ _1="-D WITH_LEVEL_ZERO=ON" - #~ PRINT " $_1" - #~ _buildargs="$_buildargs $_1" - #~ if [ -d $INST/level-zero ]; then - #~ _1="-D LEVEL_ZERO_ROOT_DIR=$INST/level-zero" - #~ PRINT " $_1" - #~ _buildargs="$_buildargs $_1" - #~ fi - #~ fi - - if [ "$OPENPGL_SKIP" = false ]; then - if [ -d $INST/openpgl ]; then - _1="-D openpgl_DIR=$INST/openpgl/lib/cmake/openpgl-$OPENPGL_VERSION" - _2="-D WITH_CYCLES_PATH_GUIDING=ON" - PRINT " $_1" - PRINT " $_2" - _buildargs="$_buildargs $_1 $_2" - fi - fi - - PRINT "" - PRINT "Or even simpler, just run (in your blender-source dir):" - PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\"" - - PRINT "" - PRINT "Or in all your build directories:" - PRINT " cmake $_buildargs ." -} - -# ---------------------------------------------------------------------------- -# "Main" - -# Detect distribution type used on this machine -if [ -f /etc/debian_version ]; then - DISTRO="DEB" - install_DEB -elif [ -f /etc/arch-release ]; then - DISTRO="ARCH" - install_ARCH -elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then - DISTRO="RPM" - install_RPM -else - DISTRO="OTHER" - install_OTHER -fi - -print_info | tee $INFO_PATH/BUILD_NOTES.txt -PRINT "" -PRINT "This information has been written to $INFO_PATH/BUILD_NOTES.txt" -PRINT "" - -# Switch back to user language. -LANG=LANG_BACK -export LANG - -CXXFLAGS=$CXXFLAGS_BACK -export CXXFLAGS diff --git a/build_files/build_environment/install_linux_packages.py b/build_files/build_environment/install_linux_packages.py new file mode 100755 index 00000000000..a53b60cc2d8 --- /dev/null +++ b/build_files/build_environment/install_linux_packages.py @@ -0,0 +1,1656 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later + +import logging +import re +import subprocess +import sys +import time + + +DISTRO_ID_DEBIAN = "debian" +DISTRO_ID_FEDORA = "fedora" +DISTRO_ID_SUSE = "suse" +DISTRO_ID_ARCH = "arch" + + +class LoggingColoredFormatter(logging.Formatter): + """ + Logging colored formatter,. + Based on https://alexandra-zaharia.github.io/posts/make-your-own-custom-color-formatter-with-python-logging/ + """ + GREY = '\x1b[38;21m' + BLUE = '\x1b[38;5;39m' + YELLOW = '\x1b[38;5;226m' + RED = '\x1b[38;5;196m' + BOLD_RED = '\x1b[31;1m' + RESET = '\x1b[0m' + + def __init__(self, fmt=None): + super().__init__(fmt=fmt) + self.FORMATS = { + logging.DEBUG: self.GREY + "DEBUG: " + self.RESET + self._fmt, + logging.INFO: self.BLUE + "INFO: " + self.RESET + self._fmt, + logging.WARNING: self.YELLOW + "WARNING: " + self.RESET + self._fmt, + logging.ERROR: self.RED + "ERROR: " + self.RESET + self._fmt, + logging.CRITICAL: self.BOLD_RED + "CRITICAL: " + self.RESET + self._fmt, + } + + def format(self, record): + log_fmt = self.FORMATS.get(record.levelno) + formatter = logging.Formatter(log_fmt) + return formatter.format(record) + + +class Package: + __slots__ = ( + # User-friendly name for the package. + "name", + # This is a fake package used to bulk-install a group of packages. + # There is no version check performed here, and a single missing package will fail the whole thing. + # Used for the basic sets of build packages and dependencies that can be assumed always available, + # with stable enough API that the version does not matter (to some extent, it is expected to work with + # any recent distro version at least). + "is_group", + # Whether Blender can build without this package or not. + # Note: In case of group packages, all sub-packages inherit from the value of the root group package. + "is_mandatory", + # Exact version currently used for pre-built libraries and buildbot builds. + "version", + # Ideal version of the package (if possible, prioritize a package of that version), `version` shoudl match it. + "version_short", + # Minimal (included)/maximal (excluded) assumed supported version range. + # Package outside of that range won't be installed. + "version_min", "version_mex", + # Actual installed package version. + "version_installed", + # Other Packages that depend/are only installed if the 'parent' one is valid. + "sub_packages", + # A mapping from distro name key to distro package name value. + # Value may either be: + # - A package name string. + # - A callback taking the Package and an iterable of its parents as parameters, and returning a string. + # - None to indicate that there is no known package for that distribution. + # - ... to indicate that this package can be skipped for that distribution + # (typically, because it is included in a parent package already). + "distro_package_names", + ) + def __init__(self, name, is_group=False, is_mandatory=False, + version=None, version_short=None, version_min=None, version_mex=None, + sub_packages=(), distro_package_names={}): + self.name = name + self.is_group = is_group + self.is_mandatory = is_mandatory + self.version = version + self.version_short = version_short + self.version_min = version_min + self.version_mex = version_mex + self.version_installed = ... + self.sub_packages = sub_packages + self.distro_package_names = distro_package_names + + +# Absolute minimal required tools to build Blender. +BASICS_BUILD_MANDATORY_SUBPACKAGES = ( + Package(name="Build Essentials", is_group=True, + sub_packages=( + Package(name="GCC", + distro_package_names={DISTRO_ID_DEBIAN: ..., + DISTRO_ID_FEDORA: "gcc", + DISTRO_ID_SUSE: "gcc", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="GCC-C++", + distro_package_names={DISTRO_ID_DEBIAN: ..., + DISTRO_ID_FEDORA: "gcc-c++", + DISTRO_ID_SUSE: "gcc-c++", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="make", + distro_package_names={DISTRO_ID_DEBIAN: ..., + DISTRO_ID_FEDORA: "make", + DISTRO_ID_SUSE: "make", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="glibc", + distro_package_names={DISTRO_ID_DEBIAN: ..., + DISTRO_ID_FEDORA: "glibc-devel", + DISTRO_ID_SUSE: "glibc-devel", + DISTRO_ID_ARCH: ..., + }, + ), + ), + distro_package_names={DISTRO_ID_DEBIAN: "build-essential", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: ..., + DISTRO_ID_ARCH: "base-devel", + }, + ), + Package(name="Git", + distro_package_names={DISTRO_ID_DEBIAN: "git", + DISTRO_ID_FEDORA: "git", + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "git", + }, + ), + Package(name="Subversion (aka svn)", + distro_package_names={DISTRO_ID_DEBIAN: "subversion", + DISTRO_ID_FEDORA: "subversion", + DISTRO_ID_SUSE: "subversion", + DISTRO_ID_ARCH: "subversion", + }, + ), + Package(name="CMake", + distro_package_names={DISTRO_ID_DEBIAN: "cmake", + DISTRO_ID_FEDORA: "cmake", + DISTRO_ID_SUSE: "cmake", + DISTRO_ID_ARCH: "cmake", + }, + ), +) + + +# Fairly common additional tools useful to build Blender. +BASICS_BUILD_OPTIONAL_SUBPACKAGES = ( + Package(name="Ninja Builder", + distro_package_names={DISTRO_ID_DEBIAN: "ninja-build", + DISTRO_ID_FEDORA: "ninja-build", + DISTRO_ID_SUSE: "ninja", + DISTRO_ID_ARCH: "ninja", + }, + ), + Package(name="CMake commandline GUI", + distro_package_names={DISTRO_ID_DEBIAN: "cmake-curses-gui", + DISTRO_ID_FEDORA: None, + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: None, + }, + ), + Package(name="CMake GUI", + distro_package_names={DISTRO_ID_DEBIAN: "cmake-gui", + DISTRO_ID_FEDORA: "cmake-gui", + DISTRO_ID_SUSE: "cmake-gui", + DISTRO_ID_ARCH: None, + }, + ), + Package(name="Patch", + distro_package_names={DISTRO_ID_DEBIAN: "patch", + DISTRO_ID_FEDORA: "patch", + DISTRO_ID_SUSE: "patch", + DISTRO_ID_ARCH: "patch", + }, + ), +) + + +# Library dependencies that are not provided by precompiled libraries. +BASIC_DEPS_CRITICAL_SUBPACKAGES = ( + Package(name="X11 library", + distro_package_names={DISTRO_ID_DEBIAN: "libx11-dev", + DISTRO_ID_FEDORA: "libX11-devel", + DISTRO_ID_SUSE: "libX11-devel", + DISTRO_ID_ARCH: "libx11", + }, + ), + Package(name="Xxf86vm Library", + distro_package_names={DISTRO_ID_DEBIAN: "libxxf86vm-dev", + DISTRO_ID_FEDORA: "libXxf86vm-devel", + DISTRO_ID_SUSE: "libXxf86vm-devel", + DISTRO_ID_ARCH: "libxxf86vm", + }, + ), + Package(name="XCursor Library", + distro_package_names={DISTRO_ID_DEBIAN: "libxcursor-dev", + DISTRO_ID_FEDORA: "libXcursor-devel", + DISTRO_ID_SUSE: "libXcursor-devel", + DISTRO_ID_ARCH: "libxcursor", + }, + ), + Package(name="Xi Library", + distro_package_names={DISTRO_ID_DEBIAN: "libxi-dev", + DISTRO_ID_FEDORA: "libXi-devel", + DISTRO_ID_SUSE: "libXi-devel", + DISTRO_ID_ARCH: "libxi", + }, + ), + Package(name="XRandr Library", + distro_package_names={DISTRO_ID_DEBIAN: "libxrandr-dev", + DISTRO_ID_FEDORA: "libXrandr-devel", + DISTRO_ID_SUSE: "libXrandr-devel", + DISTRO_ID_ARCH: "libxrandr", + }, + ), + Package(name="Xinerama Library", + distro_package_names={DISTRO_ID_DEBIAN: "libxinerama-dev", + DISTRO_ID_FEDORA: "libXinerama-devel", + DISTRO_ID_SUSE: "libXinerama-devel", + DISTRO_ID_ARCH: "libxinerama", + }, + ), + Package(name="XKbCommon Library", + distro_package_names={DISTRO_ID_DEBIAN: "libxkbcommon-dev", + DISTRO_ID_FEDORA: "libxkbcommon-devel", + DISTRO_ID_SUSE: "libxkbcommon-devel", + DISTRO_ID_ARCH: "libxkbcommon", + }, + ), + Package(name="Wayland Library", + distro_package_names={DISTRO_ID_DEBIAN: "libwayland-dev", + DISTRO_ID_FEDORA: "wayland-devel", + DISTRO_ID_SUSE: "wayland-devel", + DISTRO_ID_ARCH: "wayland", + }, + ), + Package(name="Decor Library", + distro_package_names={DISTRO_ID_DEBIAN: "libdecor-0-dev", + DISTRO_ID_FEDORA: "libdecor-devel", + DISTRO_ID_SUSE: "libdecor-devel", + DISTRO_ID_ARCH: "libdecor", + }, + ), + Package(name="Wayland Protocols", + distro_package_names={DISTRO_ID_DEBIAN: "wayland-protocols", + DISTRO_ID_FEDORA: "wayland-protocols-devel", + DISTRO_ID_SUSE: "wayland-protocols-devel", + DISTRO_ID_ARCH: "wayland-protocols", + }, + ), + Package(name="DBus Library", + distro_package_names={DISTRO_ID_DEBIAN: "libdbus-1-dev", + DISTRO_ID_FEDORA: "dbus-devel", + DISTRO_ID_SUSE: "dbus-1-devel", + DISTRO_ID_ARCH: "dbus", + }, + ), +) + + +# Basic mandatory set of common libraries to build Blender, which are also available as pre-conmpiled libraries. +BASIC_DEPS_MANDATORY_SUBPACKAGES = ( + Package(name="JPEG Library", + distro_package_names={DISTRO_ID_DEBIAN: "libjpeg-dev", + DISTRO_ID_FEDORA: "libjpeg-turbo-devel", + DISTRO_ID_SUSE: "libjpeg8-devel", + DISTRO_ID_ARCH: "libjpeg-turbo", + }, + ), + Package(name="PNG Library", + distro_package_names={DISTRO_ID_DEBIAN: "libpng-dev", + DISTRO_ID_FEDORA: "libpng-devel", + DISTRO_ID_SUSE: "libpng16-compat-devel", + DISTRO_ID_ARCH: "libpng", + }, + ), + Package(name="FreeType Library", + distro_package_names={DISTRO_ID_DEBIAN: "libfreetype6-dev", + DISTRO_ID_FEDORA: "freetype-devel", + DISTRO_ID_SUSE: "freetype2-devel", + DISTRO_ID_ARCH: "freetype2", + }, + ), + Package(name="FontConfig Library", + distro_package_names={DISTRO_ID_DEBIAN: "libfontconfig-dev", + DISTRO_ID_FEDORA: "fontconfig", + DISTRO_ID_SUSE: "fontconfig", + DISTRO_ID_ARCH: "fontconfig", + }, + ), + Package(name="ZStandard Library", + distro_package_names={DISTRO_ID_DEBIAN: "libzstd-dev", + DISTRO_ID_FEDORA: "libzstd-devel", + DISTRO_ID_SUSE: "libzstd-devel", + DISTRO_ID_ARCH: "zstd", + }, + ), + Package(name="BZ2 Library", + distro_package_names={DISTRO_ID_DEBIAN: "libbz2-dev", + DISTRO_ID_FEDORA: "bzip2-devel", + DISTRO_ID_SUSE: "libbz2-devel", + DISTRO_ID_ARCH: "bzip2", + }, + ), + Package(name="LZMA Library", + distro_package_names={DISTRO_ID_DEBIAN: "liblzma-dev", + DISTRO_ID_FEDORA: "lzma-sdk-devel", # ??? + DISTRO_ID_SUSE: "lzma-sdk-devel", # ??? + DISTRO_ID_ARCH: "xz", # ??? + }, + ), + Package(name="SDL2 Library", + distro_package_names={DISTRO_ID_DEBIAN: "libsdl2-dev", + DISTRO_ID_FEDORA: "SDL2-devel", + DISTRO_ID_SUSE: "SDL2-devel", + DISTRO_ID_ARCH: "sdl2", + }, + ), + Package(name="ShaderC Library", + distro_package_names={DISTRO_ID_DEBIAN: "libshaderc-dev", + DISTRO_ID_FEDORA: "libshaderc-devel", + DISTRO_ID_SUSE: "shaderc-devel", + DISTRO_ID_ARCH: "shaderc", + }, + ), + Package(name="Epoxy Library", + distro_package_names={DISTRO_ID_DEBIAN: "libepoxy-dev", + DISTRO_ID_FEDORA: "libepoxy-devel", + DISTRO_ID_SUSE: "libepoxy-devel", + DISTRO_ID_ARCH: "libepoxy", + }, + ), + Package(name="XML2 Library", + distro_package_names={DISTRO_ID_DEBIAN: "libxml2-dev", + DISTRO_ID_FEDORA: "libxml2-devel", + DISTRO_ID_SUSE: "libxml2-devel", + DISTRO_ID_ARCH: "libxml2", + }, + ), + Package(name="Haru Library", + distro_package_names={DISTRO_ID_DEBIAN: "libhpdf-dev", + DISTRO_ID_FEDORA: "libharu-devel", + DISTRO_ID_SUSE: "libharu-devel", + DISTRO_ID_ARCH: "libharu", + }, + ), + Package(name="PyString Library", + distro_package_names={DISTRO_ID_DEBIAN: "libpystring-dev", + DISTRO_ID_FEDORA: "pystring-devel", + DISTRO_ID_SUSE: "pystring-devel", + DISTRO_ID_ARCH: "pystring", + }, + ), +) + + +# Basic optional set of common libraries to build Blender, which are also available as pre-conmpiled libraries. +BASIC_DEPS_OPTIONAL_SUBPACKAGES = ( + Package(name="OpenJPG Library", + distro_package_names={DISTRO_ID_DEBIAN: "libopenjp2-7-dev", + DISTRO_ID_FEDORA: "openjpeg2-devel", + DISTRO_ID_SUSE: "openjpeg2-devel", + DISTRO_ID_ARCH: "openjpeg2", + }, + ), + Package(name="TIFF Library", + distro_package_names={DISTRO_ID_DEBIAN: "libtiff-dev", + DISTRO_ID_FEDORA: "libtiff-devel", + DISTRO_ID_SUSE: "libtiff-devel", + DISTRO_ID_ARCH: "libtiff", + }, + ), + Package(name="Jack2 Library", + distro_package_names={DISTRO_ID_DEBIAN: "libjack-jackd2-dev", + DISTRO_ID_FEDORA: "jack-audio-connection-kit-devel", + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "jack2", + }, + ), + Package(name="Pulse Library", + distro_package_names={DISTRO_ID_DEBIAN: "libpulse-dev", + DISTRO_ID_FEDORA: "pulseaudio-libs-devel", + DISTRO_ID_SUSE: "libpulse-devel", + DISTRO_ID_ARCH: "libpulse", + }, + ), + Package(name="OpenAL Library", + distro_package_names={DISTRO_ID_DEBIAN: "libopenal-dev", + DISTRO_ID_FEDORA: "openal-soft-devel", + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "openal", + }, + ), + Package(name="SndFile Library", + distro_package_names={DISTRO_ID_DEBIAN: "libsndfile1-dev", + DISTRO_ID_FEDORA: "libsndfile-devel", + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "libsndfile", + }, + ), + Package(name="JEMalloc Library", + distro_package_names={DISTRO_ID_DEBIAN: "libjemalloc-dev", + DISTRO_ID_FEDORA: "jemalloc-devel", + DISTRO_ID_SUSE: "jemalloc-devel", + DISTRO_ID_ARCH: "jemalloc", + }, + ), + Package(name="Vulkan Library", + distro_package_names={DISTRO_ID_DEBIAN: "libvulkan-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: ..., + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="Vulkan Headers", + distro_package_names={DISTRO_ID_DEBIAN: ..., + DISTRO_ID_FEDORA: "vulkan-headers", + DISTRO_ID_SUSE: "vulkan-headers", + DISTRO_ID_ARCH: "vulkan-headers", + }, + ), + Package(name="Vulkan ICD Loader", + distro_package_names={DISTRO_ID_DEBIAN: ..., + DISTRO_ID_FEDORA: "vulkan-loader-devel", + DISTRO_ID_SUSE: ..., + DISTRO_ID_ARCH: "vulkan-icd-loader", + }, + ), + Package(name="GMP Library", + distro_package_names={DISTRO_ID_DEBIAN: "libgmp-dev", + DISTRO_ID_FEDORA: "gmp-devel", + DISTRO_ID_SUSE: "gmp-devel", + DISTRO_ID_ARCH: "gmp", + }, + ), + Package(name="PugiXML Library", + distro_package_names={DISTRO_ID_DEBIAN: "libpugixml-dev", + DISTRO_ID_FEDORA: "pugixml-devel", + DISTRO_ID_SUSE: "pugixml-devel", + DISTRO_ID_ARCH: "pugixml", + }, + ), + Package(name="FFTW3 Library", + distro_package_names={DISTRO_ID_DEBIAN: "libfftw3-dev", + DISTRO_ID_FEDORA: "fftw-devel", + DISTRO_ID_SUSE: "fftw-devel", + DISTRO_ID_ARCH: "fftw", + }, + ), + Package(name="POTrace Library", + distro_package_names={DISTRO_ID_DEBIAN: "libpotrace-dev", + DISTRO_ID_FEDORA: "potrace-devel", + DISTRO_ID_SUSE: "potrace-devel", + DISTRO_ID_ARCH: "potrace", + }, + ), + Package(name="Yaml CPP Library", + distro_package_names={DISTRO_ID_DEBIAN: "libyaml-cpp-dev", + DISTRO_ID_FEDORA: "yaml-cpp-devel", + DISTRO_ID_SUSE: "yaml-cpp-devel", + DISTRO_ID_ARCH: "yaml-cpp", + }, + ), + Package(name="Pcre Library Devel", + sub_packages=( + Package(name="Pcre Library", is_mandatory=False, + distro_package_names={DISTRO_ID_DEBIAN: ..., + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libpcre1", # this is... a dependency joke? + DISTRO_ID_ARCH: ..., + }, + ), + ), + distro_package_names={DISTRO_ID_DEBIAN: ..., + DISTRO_ID_FEDORA: "pcre-devel", # Missing dependency of collada package? + DISTRO_ID_SUSE: "pcre-devel", # Missing dependency of collada package? + DISTRO_ID_ARCH: ..., + }, + ), +) + + +# Python packages that should be available for Blender pyscripts. +# Suse uses names like `python310-Cython` for its python module packages... +def suse_pypackages_name_gen(name): + def _gen(package, parent_packages): + pp = parent_packages[-1] + if pp is not None and pp.version_installed is not ...: + v = "".join(str(i) for i in PackageInstaller.version_tokenize(pp.version_installed)[0][:2]) + return "python" + v + "-" + name + return _gen +PYTHON_SUBPACKAGES = ( + Package(name="Cython", version="0.29", version_short="0.29", version_min="0.20", version_mex="1.0", + distro_package_names={DISTRO_ID_DEBIAN: "cython3", + DISTRO_ID_FEDORA: "python3-Cython", + DISTRO_ID_SUSE: suse_pypackages_name_gen("Cython"), + DISTRO_ID_ARCH: "cython", + }, + ), + Package(name="IDNA", version="3.3", version_short="3.3", version_min="2.0", version_mex="4.0", + distro_package_names={DISTRO_ID_DEBIAN: "python3-idna", + DISTRO_ID_FEDORA: "python3-idna", + DISTRO_ID_SUSE: suse_pypackages_name_gen("idna"), + DISTRO_ID_ARCH: "python-idna", + }, + ), + Package(name="Charset Normalizer", version="2.0.10", version_short="2.0", version_min="2.0.6", version_mex="4.0.0", + distro_package_names={DISTRO_ID_DEBIAN: "python3-charset-normalizer", + DISTRO_ID_FEDORA: "python3-charset-normalizer", + DISTRO_ID_SUSE: suse_pypackages_name_gen("charset-normalizer"), + DISTRO_ID_ARCH: "python-charset-normalizer", + }, + ), + Package(name="URLLib", version="1.26.8", version_short="1.26", version_min="1.0", version_mex="2.0", + distro_package_names={DISTRO_ID_DEBIAN: "python3-urllib3", + DISTRO_ID_FEDORA: "python3-urllib3", + DISTRO_ID_SUSE: suse_pypackages_name_gen("urllib3"), + DISTRO_ID_ARCH: "python-urllib3", + }, + ), + Package(name="Certifi", version="2021.10.08", version_short="2021.10", version_min="2021.0", version_mex="2023.0", + distro_package_names={DISTRO_ID_DEBIAN: "python3-certifi", + DISTRO_ID_FEDORA: "python3-certifi", + DISTRO_ID_SUSE: suse_pypackages_name_gen("certifi"), + DISTRO_ID_ARCH: "python-certifi", + }, + ), + Package(name="Requests", version="2.27.1", version_short="2.27", version_min="2.0", version_mex="3.0", + distro_package_names={DISTRO_ID_DEBIAN: "python3-requests", + DISTRO_ID_FEDORA: "python3-requests", + DISTRO_ID_SUSE: suse_pypackages_name_gen("requests"), + DISTRO_ID_ARCH: "python-requests", + }, + ), + Package(name="ZStandard", version="0.16.0", version_short="0.16", version_min="0.15.2", version_mex="1.0.0", + distro_package_names={DISTRO_ID_DEBIAN: "python3-zstandard", + DISTRO_ID_FEDORA: "python3-zstandard", + DISTRO_ID_SUSE: suse_pypackages_name_gen("zstandard"), + DISTRO_ID_ARCH: "python-zstandard", + }, + ), + Package(name="NumPy", version="1.23.5", version_short="1.23", version_min="1.14", version_mex="2.0", + distro_package_names={DISTRO_ID_DEBIAN: "python3-numpy", + DISTRO_ID_FEDORA: "python3-numpy", + DISTRO_ID_SUSE: suse_pypackages_name_gen("numpy"), + DISTRO_ID_ARCH: "python-numpy", + }, + ), + Package(name="NumPy Devel", version="1.23.5", version_short="1.23", version_min="1.14", version_mex="2.0", + distro_package_names={DISTRO_ID_DEBIAN: ..., + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: suse_pypackages_name_gen("numpy-devel"), + DISTRO_ID_ARCH: ..., + }, + ), +) + + +# List of boost individual libraries, some distro do not install everything anymore with the generic boost package. +BOOST_SUBPACKAGES = ( + Package(name="LibBoost FileSystem", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-filesystem-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_filesystem-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost Locale", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-locale-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_locale-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost Thread", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-thread-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_thread-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost Regex", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-regex-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_regex-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost System", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-system-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_system-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost Date/Time", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-date-time-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_date_time-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost Wave", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-wave-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_wave-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost Atomic", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-atomic-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_atomic-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost Serialization", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-serialization-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_serialization-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost ProgramOptions", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-program-options-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_program_options-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost IOStreams", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-iostreams-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_iostreams-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost Python", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-python-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_python3-devel", + DISTRO_ID_ARCH: ..., + }, + ), + Package(name="LibBoost Numpy", is_mandatory=True, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-numpy-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: "libboost_numpy3-devel", + DISTRO_ID_ARCH: ..., + }, + ), +) + + +# Packages required to build Blender, which are not included in the precompiled libraries. +PACKAGES_BASICS_BUILD = ( + Package(name="Basics Mandatory Build", is_group=True, is_mandatory=True, sub_packages=BASICS_BUILD_MANDATORY_SUBPACKAGES), + Package(name="Basics Optional Build", is_group=True, is_mandatory=False, sub_packages=BASICS_BUILD_OPTIONAL_SUBPACKAGES), + Package(name="Basic Critical Dependencies", is_group=True, is_mandatory=True, sub_packages=BASIC_DEPS_CRITICAL_SUBPACKAGES), +) + + +# All packages, required or 'nice to have', to build Blender. +# Also covers (as best as possible) the dependencies provided by the precompiled libraries. +PACKAGES_ALL = ( + Package(name="Basics Mandatory Build", is_group=True, is_mandatory=True, sub_packages=BASICS_BUILD_MANDATORY_SUBPACKAGES), + Package(name="Basics Optional Build", is_group=True, is_mandatory=False, sub_packages=BASICS_BUILD_OPTIONAL_SUBPACKAGES), + Package(name="Basic Critical Dependencies", is_group=True, is_mandatory=True, sub_packages=BASIC_DEPS_CRITICAL_SUBPACKAGES), + Package(name="Basic Mandatory Dependencies", is_group=True, is_mandatory=True, sub_packages=BASIC_DEPS_MANDATORY_SUBPACKAGES), + Package(name="Basic Optional Dependencies", is_group=True, is_mandatory=False, sub_packages=BASIC_DEPS_OPTIONAL_SUBPACKAGES), + + Package(name="Clang Format", version="10.0", version_short="10.0", version_min="6.0", version_mex="15.0", + distro_package_names={DISTRO_ID_DEBIAN: "clang-format", + DISTRO_ID_FEDORA: "clang", # On Fedora clang-format is part of the main clang package. + DISTRO_ID_SUSE: "clang", # On Suse clang-format is part of the main clang package. + DISTRO_ID_ARCH: "clang", # On Arch clang-format is part of the main clang package. + }, + ), + Package(name="Python", is_mandatory=True, version="3.10.9", version_short="3.10", version_min="3.10", version_mex="3.12", + sub_packages=PYTHON_SUBPACKAGES, + distro_package_names={DISTRO_ID_DEBIAN: "python3-dev", + DISTRO_ID_FEDORA: "python3-devel", + DISTRO_ID_SUSE: "python3-devel", + DISTRO_ID_ARCH: "python", + }, + ), + Package(name="Boost Libraries", is_mandatory=True, version="1.80.0", version_short="1.80", version_min="1.49", version_mex="2.0", + sub_packages=BOOST_SUBPACKAGES, + distro_package_names={DISTRO_ID_DEBIAN: "libboost-dev", + DISTRO_ID_FEDORA: "boost-devel", + DISTRO_ID_SUSE: "boost-devel", + DISTRO_ID_ARCH: "boost", + }, + ), + Package(name="TBB Library", is_mandatory=True, version="2020", version_short="2020", version_min="2018", version_mex="2022", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: "libtbb-dev", + DISTRO_ID_FEDORA: "tbb-devel", + DISTRO_ID_SUSE: "tbb-devel", + DISTRO_ID_ARCH: "intel-oneapi-tbb", + }, + ), + Package(name="OpenColorIO Library", is_mandatory=False, version="2.2.0", version_short="2.2", version_min="2.0", version_mex="3.0", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: "libopencolorio-dev", + DISTRO_ID_FEDORA: "OpenColorIO-devel", + DISTRO_ID_SUSE: "OpenColorIO-devel", + DISTRO_ID_ARCH: "opencolorio", + }, + ), + Package(name="IMath Library", is_mandatory=False, version="3.1.5", version_short="3.1", version_min="3.0", version_mex="4.0", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: "libimath-dev", + DISTRO_ID_FEDORA: "imath-devel", + DISTRO_ID_SUSE: "Imath-devel", + DISTRO_ID_ARCH: "imath", + }, + ), + Package(name="OpenEXR Library", is_mandatory=False, version="3.1.5", version_short="3.1", version_min="3.0", version_mex="4.0", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: "libopenexr-dev", + DISTRO_ID_FEDORA: "openexr-devel", + DISTRO_ID_SUSE: "openexr-devel", + DISTRO_ID_ARCH: "openexr", + }, + ), + Package(name="OpenImageIO Library", is_mandatory=True, version="2.4.9.0", version_short="2.4", version_min="2.2.0", version_mex="2.5.0", + sub_packages=( + Package(name="OpenImageIO Tools", is_mandatory=False, + distro_package_names={DISTRO_ID_DEBIAN: "openimageio-tools", + DISTRO_ID_FEDORA: "OpenImageIO-utils", + DISTRO_ID_SUSE: "OpenImageIO", # ??? + DISTRO_ID_ARCH: ..., + }, + ), + ), + distro_package_names={DISTRO_ID_DEBIAN: "libopenimageio-dev", + DISTRO_ID_FEDORA: "OpenImageIO-devel", + DISTRO_ID_SUSE: "OpenImageIO-devel", + DISTRO_ID_ARCH: "openimageio", + }, + ), + Package(name="LLVM Library", is_mandatory=False, version="12.0.0", version_short="12.0", version_min="11.0", version_mex="16.0", + sub_packages=( + Package(name="Clang Compiler", is_mandatory=False, + distro_package_names={DISTRO_ID_DEBIAN: "clang", + DISTRO_ID_FEDORA: "clang-devel", + DISTRO_ID_SUSE: "clang-devel", + DISTRO_ID_ARCH: "clang", + }, + ), + Package(name="Clang Library", is_mandatory=False, + distro_package_names={DISTRO_ID_DEBIAN: "libclang-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: ..., + DISTRO_ID_ARCH: ..., + }, + ), + ), + distro_package_names={DISTRO_ID_DEBIAN: "llvm-dev", + DISTRO_ID_FEDORA: "llvm-devel", + DISTRO_ID_SUSE: "llvm-devel", + DISTRO_ID_ARCH: "llvm", + }, + ), + Package(name="OpenShadingLanguage Library", is_mandatory=False, version="1.13.0.2", version_short="1.13", version_min="1.11", version_mex="2.0", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: None, # No package currently. + DISTRO_ID_FEDORA: "openshadinglanguage-devel", + DISTRO_ID_SUSE: "OpenShadingLanguage-devel", + DISTRO_ID_ARCH: "openshadinglanguage", + }, + ), + Package(name="OpenSubDiv Library", is_mandatory=False, version="3.5.0", version_short="3.5", version_min="3.5", version_mex="4.0", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: "libosd-dev", + DISTRO_ID_FEDORA: "opensubdiv-devel", + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "opensubdiv", + }, + ), + Package(name="OpenVDB Library", is_mandatory=False, version="10.0.0", version_short="10.0", version_min="10.0", version_mex="11.0", + sub_packages=( + # Assume packaged versions of the dependencies are compatible with OpenVDB package. + Package(name="OpenVDB Dependencies", is_mandatory=False, is_group=True, + sub_packages=( + Package(name="Blosc Library", is_mandatory=False, + distro_package_names={DISTRO_ID_DEBIAN: "libblosc-dev", + DISTRO_ID_FEDORA: "blosc-devel", + DISTRO_ID_SUSE: "blosc-devel", + DISTRO_ID_ARCH: "blosc", + }, + ), + Package(name="NanoVDB Library", is_mandatory=False, + distro_package_names={DISTRO_ID_DEBIAN: "libnanovdb-dev", + DISTRO_ID_FEDORA: ..., # Part of openvdb package. + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: ..., # Part of openvdb package. + }, + ), + ), + ), + ), + distro_package_names={DISTRO_ID_DEBIAN: "libopenvdb-dev", + DISTRO_ID_FEDORA: "openvdb-devel", + DISTRO_ID_SUSE: None, # No known package yet. + DISTRO_ID_ARCH: "openvdb", + }, + ), + Package(name="Alembic Library", is_mandatory=False, version="1.8.3", version_short="1.8", version_min="1.7", version_mex="2.0", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: None, + DISTRO_ID_FEDORA: "alembic-devel", + DISTRO_ID_SUSE: "alembic-devel", + DISTRO_ID_ARCH: "alembic", + }, + ), + Package(name="MaterialX Library", is_mandatory=False, version="1.38.6", version_short="1.38", version_min="1.38", version_mex="1.40", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: None, + DISTRO_ID_FEDORA: None, + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "materialx-git", + }, + ), + Package(name="USD Library", is_mandatory=False, version="22.11", version_short="22.11", version_min="20.05", version_mex="23.00", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: None, + DISTRO_ID_FEDORA: "usd-devel", + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "usd", # No official package, in AUR only currently. + }, + ), + Package(name="OpenCollada Library", is_mandatory=False, version="1.6.68", version_short="1.6", version_min="1.6.68", version_mex="1.7", + distro_package_names={DISTRO_ID_DEBIAN: "opencollada-dev", # Useless, very old! + DISTRO_ID_FEDORA: "openCOLLADA-devel", + DISTRO_ID_SUSE: "libopenCOLLADA-devel", + DISTRO_ID_ARCH: "opencollada", + }, + ), + Package(name="Embree Library", is_mandatory=False, version="3.13.4", version_short="3.13", version_min="3.13", version_mex="5.0", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: "libembree-dev", + DISTRO_ID_FEDORA: "embree-devel", + DISTRO_ID_SUSE: "embree-devel", + DISTRO_ID_ARCH: "embree", + }, + ), + Package(name="OpenImageDenoiser Library", is_mandatory=False, version="1.4.3", version_short="1.4", version_min="1.4.0", version_mex="1.5", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: None, + DISTRO_ID_FEDORA: "oidn-devel", + DISTRO_ID_SUSE: "OpenImageDenoise-devel", + DISTRO_ID_ARCH: "openimagedenoise", + }, + ), + Package(name="Level Zero Library", is_mandatory=False, version="1.7.15", version_short="1.7", version_min="1.7", version_mex="2.0", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: None, + DISTRO_ID_FEDORA: "oneapi-level-zero-devel", + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "level-zero-headers", # ??? + }, + ), + Package(name="OpenPGL Library", is_mandatory=False, version="0.4.1", version_short="0.4", version_min="0.4.1", version_mex="0.5", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: None, + DISTRO_ID_FEDORA: "openpgl-devel", + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "openpgl", + }, + ), + Package(name="XROpenXR Library", is_mandatory=False, version="1.0.22", version_short="1.0", version_min="1.0.8", version_mex="2.0", + sub_packages=(), + distro_package_names={DISTRO_ID_DEBIAN: "libopenxr-dev", + DISTRO_ID_FEDORA: None, + DISTRO_ID_SUSE: None, + DISTRO_ID_ARCH: "openxr", + }, + ), + Package(name="FFMPEG Library", is_mandatory=False, version="5.1.2", version_short="5.1", version_min="4.0", version_mex="7.0", + sub_packages=( + Package(name="AVDevice FFMPEG Library", is_mandatory=False, + distro_package_names={DISTRO_ID_DEBIAN: "libavdevice-dev", + DISTRO_ID_FEDORA: ..., + DISTRO_ID_SUSE: ..., + DISTRO_ID_ARCH: ..., + }, + ), + ), + distro_package_names={DISTRO_ID_DEBIAN: "ffmpeg", + DISTRO_ID_FEDORA: "ffmpeg-free-devel", + DISTRO_ID_SUSE: "ffmpeg-devel", + DISTRO_ID_ARCH: "ffmpeg", + }, + ), +) + + +class ProgressBar: + """Very basic progress bar printing in the console.""" + def __init__(self, min_value=0, max_value=100, print_len=80, is_known_limit=True): + self.value = 0 + self.min_value = min_value + self.max_value = max_value + self.print_len = print_len + self.is_known_limit = is_known_limit + self.print_stdout() + + def update(self, steps=1): + self.value += steps + self.print_stdout() + + def finish(self): + print("\033[2K\r", end="") + + def print_stdout(self): + print("\r", self, end="") + + def __repr__(self): + value_print_len = self.print_len - 2 + range_value = self.max_value - self.min_value + diff_to_min = self.value - self.min_value + value = (self.value % range_value) / range_value * value_print_len + if (diff_to_min // range_value) % 2 == 0: + value_str = "*" * int(value) + " " * (value_print_len - int(value)) + else: + value_str = " " * int(value) + "*" * (value_print_len - int(value)) + if self.is_known_limit: + return f"[{value_str}]" + return f">{value_str}<" + + +class PackageInstaller: + """Parent class of all package installers, does nothing but printing list of packages and defining the 'interface'. + """ + _instance = None + + def __new__(cls, settings): + if cls._instance is None: + cls._instance = super(PackageInstaller, cls).__new__(cls) + cls._instance.settings = settings + return cls._instance + + def run_command(self, command): + """Basic wrapper around `subprocess.Popen`, mimicking `subprocess.run` with a basic progress bar.""" + # First dummy call to get user password for sudo. Otherwise the progress bar on actuall commands + # makes it impossible for users to enter their password. + if not self.settings.no_sudo: + subprocess.run(["sudo", "echo"], capture_output=True) + + p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + pbar = ProgressBar(is_known_limit=False) + while p.poll() is None: + pbar.update(steps=2) + time.sleep(0.05) + pbar.finish() + return subprocess.CompletedProcess(args=command, returncode=p.returncode, stdout=p.stdout.read(), stderr=p.stderr.read()) + + @property + def can_install(self): + return not self.settings.no_sudo and self.__class__ != PackageInstaller + + # Version utils, should not need to be redefined in each sub-class. + # ---------- + _re_version_sanitize = re.compile(r"(?P([0-9]+\.?)+([0-9]+)).*") + + @classmethod + def version_sanitize(cls, version): + """ + Sanitize a version string by removing 'extras' like `_RC2` in `1.2_RC2`. + Note that the version string is expected to start with at least two numbers + separated by a dot. + """ + version = cls._re_version_sanitize.search(version) + return version["version"] if version is not None else version + + @classmethod + def version_tokenize(cls, *args): + """ + Tokenize an iterable of sanitized version strings into tuples of integers of a same length, + filling missing items with zero values. + """ + versions = tuple(tuple(int(i) for i in cls.version_sanitize(v).split(".")) for v in args) + maxlen = max(len(v) for v in versions) + return tuple(v + (0,) * (maxlen - len(v)) for v in versions) + + @classmethod + def version_match(cls, version, ref_version): + """ + Return True if the `version` string falls into the version range covered by the `ref_version` string. + `version` should be at least as long as `ref_version` (in term of version number items). + E.g. 3.3.2: + - matches 3.3 + - matches 3.3.2 + - does not match 3.4 + - does not match 3.3.0 + - does not match 3.3.2.5 + """ + version = cls.version_tokenize(version)[0] + ref_version = cls.version_tokenize(ref_version)[0] + len_ref_version = len(ref_version) + return (len(version) >= len_ref_version) and version[:len_ref_version] == ref_version + + @classmethod + def versions_range_gen(cls, package, versions_set): + def do_yield(version, versions_set): + if version not in versions_set: + versions_set.add(version) + yield version + MEX_RANGE_DIFF = 5 + + version = cls.version_tokenize(package.version)[0][:2] + version_min = cls.version_tokenize(package.version_min)[0][:2] + version_mex = cls.version_tokenize(package.version_mex)[0][:2] + + version_major = version[0] + version_major_min = version_min[0] + version_major_mex = version_mex[0] + if version_major_mex - version_major_min > 1: + yield from do_yield(str(version_major), versions_set) + for i in range(1, MEX_RANGE_DIFF): + if version_major + i < version_major_mex: + yield from do_yield(str(version_major + i), versions_set) + for i in range(1, MEX_RANGE_DIFF): + if version_major - i >= version_major_min: + yield from do_yield(str(version_major - i), versions_set) + return + if len(version) < 2: + yield from do_yield(str(version_major), versions_set) + return + + version_minor_fac = 1 + version_minor = version[1] + version_minor_min = 0 if len(version_min) < 2 else version_min[1] + version_minor_mex = 0 if len(version_mex) < 2 else version_mex[0] + if ((version_minor >= 100 or version_minor_min >= 100 or version_minor_mex >= 100) and + (version_major_min != version_major_mex or version_minor_mex - version_minor_min >= 200) + and version_minor // 100 == 0): + version_minor_fac = 100 + elif ((version_minor >= 10 or version_minor_min >= 10 or version_minor_mex >= 10) and + (version_major_min != version_major_mex or version_minor_mex - version_minor_min >= 20) + and version_minor // 10 == 0): + version_minor_fac = 10 + yield from do_yield(str(version_major) + "." + str(version_minor), versions_set) + yield from do_yield(str(version_major) + str(version_minor), versions_set) + for i in range(1, MEX_RANGE_DIFF): + i *= version_minor_fac + if version_minor + i < version_minor_mex or version_major_mex > version_major: + yield from do_yield(str(version_major) + "." + str(version_minor + i), versions_set) + yield from do_yield(str(version_major) + str(version_minor + i), versions_set) + for i in range(1, MEX_RANGE_DIFF): + i *= version_minor_fac + if version_minor - i >= version_minor_min or (version_minor - i >= 0 and version_major_min < version_major): + yield from do_yield(str(version_major) + "." + str(version_minor - i), versions_set) + yield from do_yield(str(version_major) + str(version_minor - i), versions_set) + return + + # Generic package handling, should not need to be redefined in each sub-class. + # Note that they may depend on some non-generic functions defined below though. + # ---------- + + def package_query_version_get(self, package_distro_name): + """Return the available, potentially cached if already looked-up, version of the given package.""" + if not hasattr(self, "_package_versions_cache"): + self._package_versions_cache = {} + return self._package_versions_cache.setdefault(package_distro_name, + self.package_query_version_get_impl(package_distro_name)) + + def package_query_version_match(self, package_distro_name, ref_version): + """Check if given package name matches given reference version.""" + version = self.package_query_version_get(package_distro_name) + if version is None: + return False + if version is ...: + # Only from PackageInstaller base class. + assert self.__class__ is PackageInstaller + return True + return self.version_match(version, ref_version) + + def package_query_version_ge_lt(self, package_distro_name, ref_version_min, ref_version_mex): + """Check if given package name fits inbetween given minimal and maximal excluded versions.""" + version = self.package_query_version_get(package_distro_name) + if version is None: + return False + if version is ...: + # Only from PackageInstaller base class. + assert self.__class__ is PackageInstaller + return True + version, ref_version_min, ref_version_mex = self.version_tokenize(version, ref_version_min, ref_version_mex) + return ref_version_min <= version < ref_version_mex + + def packages_database_update(self): + """Ensure that data-base of available packages is up-to-date.""" + if self._update_command is ...: + # Only from PackageInstaller base class. + assert self.__class__ is PackageInstaller + return True + + if self.settings.no_sudo: + self.settings.logger.debug("\t--no-sudo enabled, no update of packages info.") + return True + + self.settings.logger.info("Trying to update packages info.") + result = self.run_command(self._update_command) + if result.returncode != 0: + self.settings.logger.critical(f"\tFailed to update packages info:\n\t{repr(result)}\n") + exit(1) + self.settings.logger.info("Done.\n") + self.settings.logger.debug(repr(result)) + return result.returncode == 0 + + def package_find(self, package, package_distro_name): + """ + Generic euristics to try and find 'best macthing version' for a given package. + For most packages it just ensures given package name version matches the exact version from the `package`, + or at least fits within the [version_min, version_mex[ range. + But some, like e.g. python, llvm or boost, can have packages available for several versions, + with complex naming (like 'python3.10', 'llvm-9-dev', etc.). + This code attempts to find the best matching one possible, based on a set of 'possible names' + generated by the distro-specific `package_name_version_gen` generator. + """ + # Check 'exact' version match on given name. + if self.package_query_version_match(package_distro_name, package.version_short): + return package_distro_name + # Check exact version match on special 'versioned' names (like `python3.10-dev' e.g.). + for pn in self.package_name_version_gen(package, package_distro_name): + if self.package_query_version_match(pn, package.version_short): + return pn + # Check version in supported range. + if self.package_query_version_ge_lt(package_distro_name, package.version_min, package.version_mex): + return package_distro_name + # Check version in supported range on special 'versioned' names (like `llvm-11-dev' e.g.). + for pn in self.package_name_version_gen(package, package_distro_name, do_range_version_names=True): + if self.package_query_version_ge_lt(pn, package.version_min, package.version_mex): + return pn + return None + + def package_distro_name(self, package, parent_packages): + """ + Generate a collection of distro-specific package names from given package. + Typically only one name, unless given package is a group one, in which case all its + sub-packages' distro-specific names are returned in the list. + """ + distro_id = self.settings.distro_id + + packages_distro_names = [] + if package.is_group: + for p in package.sub_packages: + p.is_mandatory = package.is_mandatory + if distro_id is ...: + packages_distro_names.append(p.name) + else: + package_name = p.distro_package_names[distro_id] + if callable(package_name): + package_name = package_name(p, parent_packages) + if package_name not in {None, ...}: + packages_distro_names.append(package_name) + if p.is_group: + packages_distro_names += self.package_distro_name(p, parent_packages + (package,)) + return packages_distro_names + + if distro_id is ...: + package_name = package.name + else: + package_name = package.distro_package_names[distro_id] + if callable(package_name): + package_name = package_name(package, parent_packages) + return [package_name] + + def packages_install(self, packages, parent_packages=()): + """ + Install all given packages and their sub-packages. + This call is recursive, parent_packages is a tuple of the ancestors of current `package`, in calling order + (grand-parent, parent). + """ + def package_info_name(package, parent_packages): + packages = parent_packages + (package,) + return " ".join(p.name for p in packages) + + distro_id = self.settings.distro_id + for package in packages: + if not package.name: + continue + info_name = package_info_name(package, parent_packages) + + if package.is_group: + if self.can_install: + self.settings.logger.info(f"Trying to install group of packages {info_name}.") + if not package.sub_packages: + self.settings.logger.critical(f"Invalid group of packages {info_name}") + exit(1) + success = self.group_package_install(package, parent_packages) + if self.can_install: + if not success: + self.settings.logger.info("Failed.\n") + else: + self.settings.logger.info("Done.\n") + continue + + package_distro_name = self.package_distro_name(package, parent_packages)[0] + if package_distro_name is None: + if package.is_mandatory: + self.settings.logger.warning(f"Mandatory package {info_name} is not defined for {distro_id} distribution, " + "Blender will likely not build at all without it.\n") + else: + self.settings.logger.info(f"Package {info_name} is not defined for {distro_id} distribution.\n") + continue + if package_distro_name is ...: + self.settings.logger.debug(f"Package {info_name} is not required for {distro_id} distribution.\n") + continue + + # Inherit parent version info if needed and possible. + if package.version is None: + if not parent_packages: + self.settings.logger.critical(f"Package {info_name} ({package_distro_name}) has no version information.") + exit(1) + package.version = parent_packages[-1].version + package.version_short = parent_packages[-1].version_short + package.version_min = parent_packages[-1].version_min + package.version_mex = parent_packages[-1].version_mex + + if self.can_install: + self.settings.logger.info(f"Trying to install package {info_name} ({package_distro_name}).") + success = self.single_package_install(package, parent_packages) + if not success: + if self.can_install: + self.settings.logger.info("Failed.\n") + continue + + if self.can_install: + self.settings.logger.info("Done.\n") + if package.sub_packages: + self.packages_install(package.sub_packages, parent_packages + (package,)) + + def single_package_install(self, package, parent_packages=()): + """Install a normal, single package.""" + package_distro_name = self.package_distro_name(package, parent_packages)[0] + package_name = self.package_find(package, package_distro_name) + if package_name is None: + if package.is_mandatory: + self.settings.logger.critical(f"\tFailed to find a matching mandatory {package_distro_name} " + f"(withing versions range [{package.version_min}, {package.version_mex}[).") + exit(1) + self.settings.logger.warning(f"\tFailed to find a matching {package_distro_name} " + f"(withing versions range [{package.version_min}, {package.version_mex}[).") + return False + + if self._install_command is ...: + # Only from PackageInstaller base class. + assert self.__class__ is PackageInstaller + self.settings.logger.info(f"\tWould install {package_distro_name}.") + return True + + if self.settings.no_sudo: + self.settings.logger.warning(f"\t--no-sudo enabled, impossible to run apt-get install for {package_name}.") + return True + + package_version = self.package_query_version_get(package_name) + self.settings.logger.info(f"\tInstalling package {package_name} ({package_version}).") + cmd = self._install_command + [package_name] + result = self.run_command(cmd) + if result.returncode != 0: + self.settings.logger.critical(f"\tFailed to install {package_name}:\n\t{repr(result)}") + exit(1) + + package_version_installed = self.package_installed_version_get(package_name) + if package_version_installed != package_version: + self.settings.logger.critical(f"\tInstalled version of {package_name} does not match expected value " + f"({package_version_installed} vs {package_version})") + exit(1) + self.settings.logger.debug(repr(result)) + package.version_installed = package_version_installed + return result.returncode == 0 + + def group_package_install(self, package, parent_packages=()): + """Install a group package and all of its sub-packages.""" + packages_distro_names = self.package_distro_name(package, parent_packages) + if self._install_command is ...: + # Only from PackageInstaller base class. + assert self.__class__ is PackageInstaller + packages_info_names = ',\n\t\t\t'.join(packages_distro_names) + self.settings.logger.info(f"\tWould install group of packages {package.name}:\n\t\t\t{packages_info_names}.") + return True + + if self.settings.no_sudo: + self.settings.logger.warning(f"\t--no-sudo enabled, impossible to run apt-get install for {packages_distro_names}.") + return True + + if not packages_distro_names: + return True + + self.settings.logger.info(f"\tInstalling packages {', '.join(packages_distro_names)}.") + cmd = self._install_command + [*packages_distro_names] + result = self.run_command(cmd) + if result.returncode != 0: + if package.is_mandatory: + self.settings.logger.critical(f"\tFailed to install packages:\n\t{repr(result)}") + exit(1) + else: + self.settings.logger.warning(f"\tFailed to find install all of {packages_distro_names}:\n\t{repr(result)}") + self.settings.logger.debug(repr(result)) + return result.returncode == 0 + + # Implementation-specific, will most likely need to be re-defined in sub-classes. + # ---------- + + # Command and options to pass to install packages in specific distro (as a list, for `subprocess.run`). + # Will be appended with package or list of packages to install. + _install_command = ... + + # Command and options to pass to update packages data-base in specific distro (as a list, for `subprocess.run`). + _update_command = ... + + def package_installed_version_get(self, package_distro_name): + """Return the installed version of the given package.""" + return ... + + def package_query_version_get_impl(self, package_distro_name): + """Return the available version of the given package.""" + return ... + + def package_name_version_gen(self, package, package_distro_name, version, suffix="", do_range_version_names=False): + """Generator for all potential names for a given package 'base name'.""" + yield package_distro_name + + +class PackageInstallerDebian(PackageInstaller): + """Debian-like package installer, using apt and dpkg-query.""" + _instance = None + + def __new__(cls, settings): + if cls._instance is None: + cls._instance = super(PackageInstallerDebian, cls).__new__(cls, settings) + return cls._instance + + _version_regex_base_pattern = r"(?:[0-9]+:)?(?P([0-9]+\.?)+([0-9]+)).*" + _re_version = re.compile(_version_regex_base_pattern) + _re_version_candidate = re.compile(r"Candidate:\s*" + _version_regex_base_pattern) + + _install_command = ["sudo", "apt", "install", "-y"] + _update_command = ["sudo", "apt", "update"] + + def package_installed_version_get(self, package_distro_name): + cmd = ["dpkg-query", "-W", "-f", "${Version}", package_distro_name] + result = self.run_command(cmd) + version = self._re_version.search(str(result.stdout)) + return version["version"] if version is not None else None + + def package_query_version_get_impl(self, package_distro_name): + cmd = ["apt-cache", "policy", package_distro_name] + result = self.run_command(cmd) + version = self._re_version_candidate.search(str(result.stdout)) + return version["version"] if version is not None else None + + def package_name_version_gen(self, package, package_distro_name, version=..., suffix="", do_range_version_names=False): + if version is ...: + version = package.version_short + # Generate versions variants with version between main name and '-dev' suffix, if any. + tmp_package_name = package_distro_name.removesuffix("-dev") + if tmp_package_name != package_distro_name: + for pn in self.package_name_version_gen(package, tmp_package_name, version, suffix="-dev" + suffix, do_range_version_names=do_range_version_names): + yield pn + # Strip any 'version-like' numbers at the end of the package name (already stripped of '-dev' suffix) + # and generate versions variants out of it. + tmp_package_name = tmp_package_name.rstrip("0123456789.-") + if tmp_package_name != package_distro_name: + for pn in self.package_name_version_gen(package, tmp_package_name, version, suffix=suffix, do_range_version_names=do_range_version_names): + yield pn + # Generate version variants from given package name. + versions = [version] + if do_range_version_names: + # Also search for major version numbers around the target one, within to allowed range. + # Necessary for packages like llvm e.g. + versions += [*self.versions_range_gen(package, set(versions))] + for v in versions: + yield package_distro_name + v + suffix + yield package_distro_name + "-" + v + suffix + + +class PackageInstallerFedora(PackageInstaller): + """Fedora-like package installer, using dnf.""" + _instance = None + + def __new__(cls, settings): + if cls._instance is None: + cls._instance = super(PackageInstallerFedora, cls).__new__(cls, settings) + return cls._instance + + _re_version = re.compile(r"Version\s*:\s*(?:[0-9]+:)?(?P([0-9]+\.?)+([0-9]+)).*") + + _install_command = ["sudo", "dnf", "install", "-y"] + _update_command = ["sudo", "dnf", "check-update"] + + def package_version_get(self, command): + result = self.run_command(command) + version = self._re_version.search(str(result.stdout)) + return version["version"] if version is not None else None + + def package_installed_version_get(self, package_distro_name): + return self.package_version_get(["sudo", "dnf", "info", "--installed", package_distro_name]) + + def package_query_version_get_impl(self, package_distro_name): + return self.package_version_get(["sudo", "dnf", "info", "--all", package_distro_name]) + + def package_name_version_gen(self, package, package_distro_name, version=..., suffix="", do_range_version_names=False): + if version is ...: + version = package.version_short + # Generate versions variants with version between main name and '-devel' suffix, if any. + tmp_package_name = package_distro_name.removesuffix("-devel") + if tmp_package_name != package_distro_name: + for pn in self.package_name_version_gen(package, tmp_package_name, version, suffix="-devel" + suffix, do_range_version_names=do_range_version_names): + yield pn + # Strip any 'version-like' numbers at the end of the package name (already stripped of '-devel' suffix) + # and generate versions variants out of it. + tmp_package_name = tmp_package_name.rstrip("0123456789.-") + if tmp_package_name != package_distro_name: + for pn in self.package_name_version_gen(package, tmp_package_name, version, suffix=suffix, do_range_version_names=do_range_version_names): + yield pn + # Generate version variants from given package name. + versions = [version] + if do_range_version_names: + # Also search for major version numbers around the target one, within to allowed range. + # Necessary for packages like llvm e.g. + versions += [*self.versions_range_gen(package, set(versions))] + for v in versions: + yield package_distro_name + v + suffix + yield package_distro_name + "-" + v + suffix + + +class PackageInstallerSuse(PackageInstaller): + """Suse-like package installer, using zypper.""" + _instance = None + + def __new__(cls, settings): + if cls._instance is None: + cls._instance = super(PackageInstallerSuse, cls).__new__(cls, settings) + return cls._instance + + _re_version = re.compile(r"Version\s*:\s*(?:[0-9]+:)?(?P([0-9]+\.?)+([0-9]+)).*") + _re_installed = re.compile(r"Installed\s*:\s*Yes") + + _install_command = ["sudo", "zypper", "--non-interactive", "install"] + _update_command = ["sudo", "zypper", "refresh"] + + def package_version_get(self, command_result): + version = self._re_version.search(str(command_result.stdout)) + return version["version"] if version is not None else None + + def package_installed_version_get(self, package_distro_name): + result = self.run_command(["sudo", "zypper", "info", package_distro_name]) + is_installed = self._re_installed.search(str(result.stdout)) + return self.package_version_get(result) if is_installed is not None else None + + def package_query_version_get_impl(self, package_distro_name): + result = self.run_command(["sudo", "zypper", "info", package_distro_name]) + return self.package_version_get(result) + + def package_name_version_gen(self, package, package_distro_name, version=..., suffix="", do_range_version_names=False): + if version is ...: + version = package.version_short + # Generate versions variants with version between main name and '-devel' suffix, if any. + tmp_package_name = package_distro_name.removesuffix("-devel") + if tmp_package_name != package_distro_name: + for pn in self.package_name_version_gen(package, tmp_package_name, version, suffix="-devel" + suffix, do_range_version_names=do_range_version_names): + yield pn + # Strip any 'version-like' numbers at the end of the package name (already stripped of '-devel' suffix) + # and generate versions variants out of it. + tmp_package_name = tmp_package_name.rstrip("0123456789.-") + if tmp_package_name != package_distro_name: + for pn in self.package_name_version_gen(package, tmp_package_name, version, suffix=suffix, do_range_version_names=do_range_version_names): + yield pn + # Generate version variants from given package name. + versions = [version] + if do_range_version_names: + # Also search for major version numbers around the target one, within to allowed range. + # Necessary for packages like llvm e.g. + versions += [*self.versions_range_gen(package, set(versions))] + for v in versions: + yield package_distro_name + v + suffix + yield package_distro_name + "-" + v + suffix + + +class PackageInstallerArch(PackageInstaller): + """Arch-like package installer, using pacman.""" + _instance = None + + def __new__(cls, settings): + if cls._instance is None: + cls._instance = super(PackageInstallerArch, cls).__new__(cls, settings) + return cls._instance + + _re_version = re.compile(r"Version\s*:\s*(?:[0-9]+:)?(?P([0-9]+\.?)+([0-9]+)).*") + + _install_command = ["sudo", "pacman", "-S", "--needed", "--noconfirm"] + _update_command = ["sudo", "pacman", "-Sy"] + + def package_version_get(self, command): + result = self.run_command(command) + version = self._re_version.search(str(result.stdout)) + return version["version"] if version is not None else None + + def package_installed_version_get(self, package_distro_name): + return self.package_version_get(["pacman", "-Qi", package_distro_name]) + + def package_query_version_get_impl(self, package_distro_name): + return self.package_version_get(["pacman", "-Si", package_distro_name]) + + def package_name_version_gen(self, package, package_distro_name, version=..., suffix="", do_range_version_names=False): + if version is ...: + version = package.version_short + # Generate versions variants with version after the main name. + tmp_package_name = package_distro_name + # Strip any 'version-like' numbers at the end of the package name (already stripped of '-dev' suffix) + # and generate versions variants out of it. + tmp_package_name = tmp_package_name.rstrip("0123456789.-") + if tmp_package_name != package_distro_name: + for pn in self.package_name_version_gen(package, tmp_package_name, version, suffix=suffix, do_range_version_names=do_range_version_names): + yield pn + # Generate version variants from given package name. + versions = [version] + if do_range_version_names: + # Also search for major version numbers around the target one, within to allowed range. + # Necessary for packages like llvm e.g. + versions += [*self.versions_range_gen(package, set(versions))] + for v in versions: + yield package_distro_name + v + suffix + yield package_distro_name + "-" + v + suffix + + +DISTRO_IDS_INSTALLERS = { + ...: PackageInstaller, + DISTRO_ID_DEBIAN: PackageInstallerDebian, + DISTRO_ID_FEDORA: PackageInstallerFedora, + DISTRO_ID_SUSE: PackageInstallerSuse, + DISTRO_ID_ARCH: PackageInstallerArch, +} + + +def get_distro(settings): + if settings.distro_id is not ...: + settings.logger.info(f"Distribution identifier forced by user to {settings.distro_id}.") + return + import platform + info = platform.freedesktop_os_release() + ids = [info["ID"]] + if "ID_LIKE" in info: + # ids are space separated and ordered by precedence. + ids.extend(info["ID_LIKE"].split()) + for distro_id in ids: + if distro_id in DISTRO_IDS_INSTALLERS: + settings.distro_id = distro_id + return distro_id + settings.logger.warning(f"Distribution IDs do not match any supported one by this script ({ids})") + settings.distro_id = ... + return ... + + +def get_distro_package_installer(settings): + return DISTRO_IDS_INSTALLERS[get_distro(settings)](settings) + + +def argparse_create(): + import argparse + + # When --help or no args are given, print this help + usage_text = ( + "Attempt to install dependencies to build Blender from current linux distribution's packages only.\n" + "\n" + "By default, only installs critical tools and dependencies to build Blender, excluding any library provided\n" + "by the precompiled SVN repository.\n" + "`make update` should then be ran after this script to download all precompiled libraries.\n" + "\n" + "When ran with the `--all` option, this tool will try to install all mandatory and optional dependencies\n" + "from the distribution packages.\n" + "\n" + "NOTE: Many distributions do not provide packages for all libraries used by Blender, or have no\n" + "version-compatible packages. In some cases, mandatory dependencies cannot be satisfied, and Blender\n" + "won't be able to build at all.\n" + "\n" + "NOTE: To build with system package libraries instead of the precompiled ones when both are available,\n" + "the `WITH_LIBS_PRECOMPILED` option must be disabled in CMake.\n" + "\n" + "See https://wiki.blender.org/wiki/Building_Blender for more details.\n" + "\n" + ) + + parser = argparse.ArgumentParser(description=usage_text, formatter_class=argparse.RawDescriptionHelpFormatter) + + parser.add_argument( + "--show-deps", + dest="show_deps", + action='store_true', + help="Show main dependencies of Blender (including officially supported versions) and exit.", + ) + parser.add_argument( + "--no-sudo", + dest="no_sudo", + action='store_true', + help="Disable use of sudo (this script won't be able to do much then, will just print needed packages).", + ) + parser.add_argument( + "--all", + dest="all", + action='store_true', + help="Install all dependencies from the distribution packages, including these also provided as " + "precompiled libraries.", + ) + parser.add_argument( + "--distro-id", + dest="distro_id", + default=..., + choices=set(DISTRO_IDS_INSTALLERS.keys()) - set((...,)), + help="Force the linux distribution identifier to a specific value instead of relying on automatic detection.", + ) + parser.add_argument( + "--debug", + dest="debug", + action='store_true', + help="Enable all debug info messages.", + ) + + return parser + + +def main(): + settings = argparse_create().parse_args() + + logger = logging.getLogger(__name__) + logger.setLevel(logging.DEBUG if settings.debug else logging.INFO) + stdout_handler = logging.StreamHandler(stream=sys.stdout) + stdout_handler.setFormatter(LoggingColoredFormatter()) + logger.addHandler(stdout_handler) + settings.logger = logger + + distro_package_installer = PackageInstaller(settings) if settings.show_deps else get_distro_package_installer(settings) + distro_package_installer.packages_database_update() + + if settings.all: + distro_package_installer.packages_install(PACKAGES_ALL) + else: + distro_package_installer.packages_install(PACKAGES_BASICS_BUILD) + + +if __name__ == "__main__": + main()