Some cleanup/reorganisation, and:

* Script should now remove relevant dirs in $INST when a package becomes suitable
* Script systematically runs relevant ldconfig commands when building boost/oiio
This commit is contained in:
Bastien Montagne 2013-05-25 14:49:29 +00:00
parent 24321d4891
commit 7c9f7e7566

@ -19,6 +19,8 @@
# A shell script installing/building all needed dependencies to build Blender, for some Linux distributions. # A shell script installing/building all needed dependencies to build Blender, for some Linux distributions.
##### Args and Help Handling #####
# Parse command line! # Parse command line!
ARGS=$( \ ARGS=$( \
getopt \ getopt \
@ -172,6 +174,8 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--skip-ffmpeg --skip-ffmpeg
Unconditionally skip FFMpeg installation/building.\"" Unconditionally skip FFMpeg installation/building.\""
##### Main Vars #####
PYTHON_VERSION="3.3.0" PYTHON_VERSION="3.3.0"
PYTHON_VERSION_MIN="3.3" PYTHON_VERSION_MIN="3.3"
PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2" PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2"
@ -190,6 +194,7 @@ BOOST_SOURCE="http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/b
BOOST_VERSION_MIN="1.49" BOOST_VERSION_MIN="1.49"
BOOST_FORCE_REBUILD=false BOOST_FORCE_REBUILD=false
BOOST_SKIP=false BOOST_SKIP=false
_need_boost_ldconfig=false
OCIO_VERSION="1.0.7" OCIO_VERSION="1.0.7"
OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
@ -211,6 +216,7 @@ OIIO_SOURCE="https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.t
OIIO_VERSION_MIN="1.1" OIIO_VERSION_MIN="1.1"
OIIO_FORCE_REBUILD=false OIIO_FORCE_REBUILD=false
OIIO_SKIP=false OIIO_SKIP=false
_need_oiio_ldconfig=false
LLVM_VERSION="3.1" LLVM_VERSION="3.1"
LLVM_VERSION_MIN="3.0" LLVM_VERSION_MIN="3.0"
@ -262,6 +268,7 @@ LANG_BACK=$LANG
LANG="" LANG=""
export LANG export LANG
##### Generic Helpers #####
_echo() { _echo() {
if [ "X$1" = "X-n" ]; then if [ "X$1" = "X-n" ]; then
@ -279,6 +286,8 @@ INFO() {
_echo "$@" _echo "$@"
} }
##### Args Handling #####
# Finish parsing the commandline args. # Finish parsing the commandline args.
eval set -- "$ARGS" eval set -- "$ARGS"
while true; do while true; do
@ -414,6 +423,8 @@ if $WITH_ALL; then
WITH_OPENCOLLADA=true WITH_OPENCOLLADA=true
fi fi
##### Generic Helpers #####
# Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1. # 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. # $1 and $2 should be version numbers made of numbers only.
version_eq() { version_eq() {
@ -498,28 +509,7 @@ version_match() {
return $ret return $ret
} }
detect_distro() { ##### Generic compile helpers #####
if [ -f /etc/debian_version ]; then
DISTRO="DEB"
elif [ -f /etc/arch-release ]; then
DISTRO="ARCH"
elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
DISTRO="RPM"
fi
}
rpm_flavour() {
if [ -f /etc/redhat-release ]; then
if [ "`grep '6\.' /etc/redhat-release`" ]; then
RPM="RHEL"
else
RPM="FEDORA"
fi
elif [ -f /etc/SuSE-release ]; then
RPM="SUSE"
fi
}
prepare_opt() { prepare_opt() {
INFO "Ensuring $INST exists and is writable by us" INFO "Ensuring $INST exists and is writable by us"
if [ ! -d $INST ]; then if [ ! -d $INST ]; then
@ -546,17 +536,41 @@ magic_compile_set() {
touch $INST/.$1-magiccheck-$2 touch $INST/.$1-magiccheck-$2
} }
# Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib...
_clean() {
rm -rf `readlink -f $_inst_shortcut`
rm -rf $_src
rm -rf $_inst
rm -rf $_inst_shortcut
}
_create_inst_shortcut() {
rm -f $_inst_shortcut
ln -s $_inst $_inst_shortcut
}
#### Build Python ####
_init_python() {
_src=$SRC/Python-$PYTHON_VERSION
_inst=$INST/python-$PYTHON_VERSION
_inst_shortcut=$INST/python-3.3
}
clean_Python() {
clean_Numpy
_init_python
_clean
}
compile_Python() { compile_Python() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
py_magic=0 py_magic=0
_init_python
_src=$SRC/Python-$PYTHON_VERSION
_inst=$INST/python-$PYTHON_VERSION
# Clean install if needed! # Clean install if needed!
magic_compile_check python-$PYTHON_VERSION $py_magic magic_compile_check python-$PYTHON_VERSION $py_magic
if [ $? -eq 1 -o $PYTHON_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $PYTHON_FORCE_REBUILD == true ]; then
rm -rf $_inst clean_Python
fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
@ -582,8 +596,7 @@ compile_Python() {
make clean make clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $INST/python-3.3 _create_inst_shortcut
ln -s python-$PYTHON_VERSION $INST/python-3.3
else else
ERROR "Python--$PYTHON_VERSION failed to compile, exiting" ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
exit 1 exit 1
@ -599,19 +612,29 @@ compile_Python() {
fi fi
} }
compile_Numpy() { ##### Build Numpy #####
# To be changed each time we make edits that would modify the compiled result! _init_numpy() {
py_magic=0
_src=$SRC/numpy-$NUMPY_VERSION _src=$SRC/numpy-$NUMPY_VERSION
_inst=$INST/numpy-$NUMPY_VERSION _inst=$INST/numpy-$NUMPY_VERSION
_python=$INST/python-$PYTHON_VERSION _python=$INST/python-$PYTHON_VERSION
_site=lib/python3.3/site-packages _site=lib/python3.3/site-packages
_inst_shortcut=$_python/$_site/numpy
}
clean_Numpy() {
_init_numpy
_clean
}
compile_Numpy() {
# To be changed each time we make edits that would modify the compiled result!
py_magic=0
_init_numpy
# Clean install if needed! # Clean install if needed!
magic_compile_check numpy-$NUMPY_VERSION $py_magic magic_compile_check numpy-$NUMPY_VERSION $py_magic
if [ $? -eq 1 -o $NUMPY_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $NUMPY_FORCE_REBUILD == true ]; then
rm -rf $_inst clean_Numpy
fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
@ -632,8 +655,9 @@ compile_Numpy() {
$_python/bin/python3 setup.py install --prefix=$_inst $_python/bin/python3 setup.py install --prefix=$_inst
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $_python/$_site/numpy # Can't use _create_inst_shortcut here...
ln -s $_inst/$_site/numpy $_python/$_site/numpy rm -f $_inst_shortcut
ln -s $_inst/$_site/numpy $_inst_shortcut
else else
ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting" ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting"
exit 1 exit 1
@ -649,17 +673,28 @@ compile_Numpy() {
fi fi
} }
#### Build Boost ####
_init_boost() {
_src=$SRC/boost-$BOOST_VERSION
_inst=$INST/boost-$BOOST_VERSION
_inst_shortcut=$INST/boost
}
clean_Boost() {
_init_boost
_clean
}
compile_Boost() { compile_Boost() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
boost_magic=7 boost_magic=7
_src=$SRC/boost-$BOOST_VERSION _init_boost
_inst=$INST/boost-$BOOST_VERSION
# Clean install if needed! # Clean install if needed!
magic_compile_check boost-$BOOST_VERSION $boost_magic magic_compile_check boost-$BOOST_VERSION $boost_magic
if [ $? -eq 1 -o $BOOST_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $BOOST_FORCE_REBUILD == true ]; then
rm -rf $_inst clean_Boost
fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
@ -687,8 +722,7 @@ compile_Boost() {
./b2 --clean ./b2 --clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $INST/boost _create_inst_shortcut
ln -s boost-$BOOST_VERSION $INST/boost
else else
ERROR "Boost-$BOOST_VERSION failed to compile, exiting" ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
exit 1 exit 1
@ -696,6 +730,9 @@ compile_Boost() {
magic_compile_set boost-$BOOST_VERSION $boost_magic magic_compile_set boost-$BOOST_VERSION $boost_magic
# Just always run it, much simpler this way!
_need_boost_ldconfig=true
cd $CWD cd $CWD
INFO "Done compiling Boost-$BOOST_VERSION!" INFO "Done compiling Boost-$BOOST_VERSION!"
else else
@ -704,17 +741,27 @@ compile_Boost() {
fi fi
} }
#### Build OCIO ####
_init_ocio() {
_src=$SRC/OpenColorIO-$OCIO_VERSION
_inst=$INST/ocio-$OCIO_VERSION
_inst_shortcut=$INST/ocio
}
clean_OCIO() {
_init_ocio
_clean
}
compile_OCIO() { compile_OCIO() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
ocio_magic=1 ocio_magic=1
_init_ocio
_src=$SRC/OpenColorIO-$OCIO_VERSION
_inst=$INST/ocio-$OCIO_VERSION
# Clean install if needed! # Clean install if needed!
magic_compile_check ocio-$OCIO_VERSION $ocio_magic magic_compile_check ocio-$OCIO_VERSION $ocio_magic
if [ $? -eq 1 -o $OCIO_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $OCIO_FORCE_REBUILD == true ]; then
rm -rf $_inst clean_OCIO
fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
@ -767,8 +814,7 @@ compile_OCIO() {
make clean make clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $INST/ocio _create_inst_shortcut
ln -s ocio-$OCIO_VERSION $INST/ocio
else else
ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting" ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
exit 1 exit 1
@ -784,20 +830,29 @@ compile_OCIO() {
fi fi
} }
#### Build ILMBase ####
_init_ilmbase() {
_src=$SRC/ILMBase-$ILMBASE_VERSION
_inst=$TMP/ilmbase-$ILMBASE_VERSION
_inst_shortcut=$TMP/ilmbase
}
clean_ILMBASE() {
_init_ilmbase
_clean
}
compile_ILMBASE() { compile_ILMBASE() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
ilmbase_magic=5 ilmbase_magic=5
_init_ilmbase
_src=$SRC/ILMBase-$ILMBASE_VERSION
_inst=$TMP/ilmbase-$ILMBASE_VERSION
# Clean install if needed! # Clean install if needed!
magic_compile_check ilmbase-$ILMBASE_VERSION $ilmbase_magic magic_compile_check ilmbase-$ILMBASE_VERSION $ilmbase_magic
if [ $? -eq 1 -o $OPENEXR_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $OPENEXR_FORCE_REBUILD == true ]; then
rm -rf $_src clean_ILMBASE
rm -rf $_openexr_inst rm -rf $_openexr_inst
rm -rf $_inst
fi fi
if [ ! -d $_openexr_inst ]; then if [ ! -d $_openexr_inst ]; then
@ -862,8 +917,7 @@ EOF
make clean make clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $TMP/ilmbase _create_inst_shortcut
ln -s ilmbase-$ILMBASE_VERSION $TMP/ilmbase
else else
ERROR "ILMBase-$ILMBASE_VERSION failed to compile, exiting" ERROR "ILMBase-$ILMBASE_VERSION failed to compile, exiting"
exit 1 exit 1
@ -879,23 +933,34 @@ EOF
INFO "Done compiling ILMBase-$ILMBASE_VERSION!" INFO "Done compiling ILMBase-$ILMBASE_VERSION!"
} }
compile_OPENEXR() { #### Build OpenEXR ####
_openexr_inst=$INST/openexr-$OPENEXR_VERSION _init_openexr() {
compile_ILMBASE
# To be changed each time we make edits that would modify the compiled result!
openexr_magic=10
_src=$SRC/OpenEXR-$OPENEXR_VERSION _src=$SRC/OpenEXR-$OPENEXR_VERSION
_inst=$_openexr_inst _inst=$_openexr_inst
_inst_shortcut=$INST/openexr
}
clean_OPENEXR() {
clean_ILMBASE
_init_openexr
_clean
}
compile_OPENEXR() {
# To be changed each time we make edits that would modify the compiled result!
openexr_magic=10
# Clean install if needed! # Clean install if needed!
magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic
if [ $? -eq 1 -o $OPENEXR_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $OPENEXR_FORCE_REBUILD == true ]; then
rm -rf $_src clean_OPENEXR
rm -rf $_inst
fi fi
_openexr_inst=$INST/openexr-$OPENEXR_VERSION
compile_ILMBASE
_ilmbase_inst=$_inst_shortcut
_init_openexr
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
INFO "Building OpenEXR-$OPENEXR_VERSION" INFO "Building OpenEXR-$OPENEXR_VERSION"
@ -1039,7 +1104,7 @@ EOF
cmake_d="-D CMAKE_BUILD_TYPE=Release" cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst" cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$TMP/ilmbase" cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst"
if file /bin/cp | grep -q '32-bit'; then if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686" cflags="-fPIC -m32 -march=i686"
@ -1057,10 +1122,9 @@ EOF
make clean make clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $INST/openexr _create_inst_shortcut
ln -s openexr-$OPENEXR_VERSION $INST/openexr
# Copy ilmbase files here (blender expects same dir for ilmbase and openexr :/). # Copy ilmbase files here (blender expects same dir for ilmbase and openexr :/).
cp -Lrn $TMP/ilmbase/* $INST/openexr cp -Lrn $_ilmbase_inst/* $_inst_shortcut
else else
ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting" ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
exit 1 exit 1
@ -1078,18 +1142,27 @@ EOF
_with_built_openexr=true _with_built_openexr=true
} }
#### Build OIIO ####
_init_oiio() {
_src=$SRC/OpenImageIO-$OIIO_VERSION
_inst=$INST/oiio-$OIIO_VERSION
_inst_shortcut=$INST/oiio
}
clean_OIIO() {
_init_oiio
_clean
}
compile_OIIO() { compile_OIIO() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
oiio_magic=11 oiio_magic=11
_init_oiio
_src=$SRC/OpenImageIO-$OIIO_VERSION
_inst=$INST/oiio-$OIIO_VERSION
# Clean install if needed! # Clean install if needed!
magic_compile_check oiio-$OIIO_VERSION $oiio_magic magic_compile_check oiio-$OIIO_VERSION $oiio_magic
if [ $? -eq 1 -o $OIIO_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $OIIO_FORCE_REBUILD == true ]; then
rm -rf $_src clean_OIIO
rm -rf $_inst
fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
@ -1311,8 +1384,7 @@ EOF
make clean make clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $INST/oiio _create_inst_shortcut
ln -s oiio-$OIIO_VERSION $INST/oiio
else else
ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting" ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
exit 1 exit 1
@ -1320,6 +1392,9 @@ EOF
magic_compile_set oiio-$OIIO_VERSION $oiio_magic magic_compile_set oiio-$OIIO_VERSION $oiio_magic
# Just always run it, much simpler this way!
_need_oiio_ldconfig=true
cd $CWD cd $CWD
INFO "Done compiling OpenImageIO-$OIIO_VERSION!" INFO "Done compiling OpenImageIO-$OIIO_VERSION!"
else else
@ -1328,19 +1403,28 @@ EOF
fi fi
} }
#### Build LLVM ####
_init_llvm() {
_src=$SRC/LLVM-$LLVM_VERSION
_src_clang=$SRC/CLANG-$LLVM_VERSION
_inst=$INST/llvm-$LLVM_VERSION
_inst_shortcut=$INST/llvm
}
clean_LLVM() {
_init_llvm
_clean
}
compile_LLVM() { compile_LLVM() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
llvm_magic=1 llvm_magic=1
_init_llvm
_src=$SRC/LLVM-$LLVM_VERSION
_inst=$INST/llvm-$LLVM_VERSION
_src_clang=$SRC/CLANG-$LLVM_VERSION
# Clean install if needed! # Clean install if needed!
magic_compile_check llvm-$LLVM_VERSION $llvm_magic magic_compile_check llvm-$LLVM_VERSION $llvm_magic
if [ $? -eq 1 -o $LLVM_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $LLVM_FORCE_REBUILD == true ]; then
rm -rf $_inst clean_LLVM
rm -rf $_inst_clang
fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
@ -1387,7 +1471,7 @@ EOF
# Always refresh the whole build! # Always refresh the whole build!
if [ -d build ]; then if [ -d build ]; then
rm -rf build rm -rf build
fi fi
mkdir build mkdir build
cd build cd build
@ -1406,8 +1490,7 @@ EOF
make clean make clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $INST/llvm _create_inst_shortcut
ln -s llvm-$LLVM_VERSION $INST/llvm
else else
ERROR "LLVM-$LLVM_VERSION failed to compile, exiting" ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
exit 1 exit 1
@ -1426,18 +1509,27 @@ EOF
fi fi
} }
#### Build OSL ####
_init_osl() {
_src=$SRC/OpenShadingLanguage-$OSL_VERSION
_inst=$INST/osl-$OSL_VERSION
_inst_shortcut=$INST/osl
}
clean_OSL() {
_init_osl
_clean
}
compile_OSL() { compile_OSL() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
osl_magic=9 osl_magic=9
_init_osl
_src=$SRC/OpenShadingLanguage-$OSL_VERSION
_inst=$INST/osl-$OSL_VERSION
# Clean install if needed! # Clean install if needed!
magic_compile_check osl-$OSL_VERSION $osl_magic magic_compile_check osl-$OSL_VERSION $osl_magic
if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
rm -rf $_src clean_OSL
rm -rf $_inst
fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
@ -1459,8 +1551,6 @@ compile_OSL() {
fi fi
cd $_src cd $_src
# XXX For now, always update from latest repo...
git pull origin
# Always refresh the whole build! # Always refresh the whole build!
if [ -d build ]; then if [ -d build ]; then
@ -1476,7 +1566,7 @@ compile_OSL() {
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF" cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
if [ $_with_built_openexr == true ]; then if [ $_with_built_openexr == true ]; then
#cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr" #cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr" # XXX Not used!
cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr" cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
fi fi
@ -1505,8 +1595,7 @@ compile_OSL() {
make clean make clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $INST/osl _create_inst_shortcut
ln -s osl-$OSL_VERSION $INST/osl
else else
ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting" ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
exit 1 exit 1
@ -1522,17 +1611,27 @@ compile_OSL() {
fi fi
} }
#### Build OpenCOLLADA ####
_init_opencollada() {
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
_inst=$INST/opencollada-$OPENCOLLADA_VERSION
_inst_shortcut=$INST/opencollada
}
clean_OpenCOLLADA() {
_init_opencollada
_clean
}
compile_OpenCOLLADA() { compile_OpenCOLLADA() {
# To be changed each time we make edits that would modify the compiled results! # To be changed each time we make edits that would modify the compiled results!
opencollada_magic=6 opencollada_magic=6
_init_opencollada
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
_inst=$INST/opencollada-$OPENCOLLADA_VERSION
# Clean install if needed! # Clean install if needed!
magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic
if [ $? -eq 1 -o $OPENCOLLADA_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $OPENCOLLADA_FORCE_REBUILD == true ]; then
rm -rf $_inst clean_OpenCOLLADA
fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
@ -1573,8 +1672,7 @@ compile_OpenCOLLADA() {
make clean make clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $INST/opencollada _create_inst_shortcut
ln -s opencollada-$OPENCOLLADA_VERSION $INST/opencollada
else else
ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting" ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
exit 1 exit 1
@ -1590,17 +1688,27 @@ compile_OpenCOLLADA() {
fi fi
} }
#### Build FFMPEG ####
_init_ffmpeg() {
_src=$SRC/ffmpeg-$FFMPEG_VERSION
_inst=$INST/ffmpeg-$FFMPEG_VERSION
_inst_shortcut=$INST/ffmpeg
}
clean_FFmpeg() {
_init_ffmpeg
_clean
}
compile_FFmpeg() { compile_FFmpeg() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
ffmpeg_magic=3 ffmpeg_magic=3
_init_ffmpeg
_src=$SRC/ffmpeg-$FFMPEG_VERSION
_inst=$INST/ffmpeg-$FFMPEG_VERSION
# Clean install if needed! # Clean install if needed!
magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
if [ $? -eq 1 -o $FFMPEG_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $FFMPEG_FORCE_REBUILD == true ]; then
rm -rf $_inst clean_FFmpeg
fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
@ -1667,8 +1775,7 @@ compile_FFmpeg() {
make clean make clean
if [ -d $_inst ]; then if [ -d $_inst ]; then
rm -f $INST/ffmpeg _create_inst_shortcut
ln -s ffmpeg-$FFMPEG_VERSION $INST/ffmpeg
else else
ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting" ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
exit 1 exit 1
@ -1685,7 +1792,7 @@ compile_FFmpeg() {
} }
#### Install on DEB-like ####
get_package_version_DEB() { get_package_version_DEB() {
dpkg-query -W -f '${Version}' $1 | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/' dpkg-query -W -f '${Version}' $1 | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'
} }
@ -1882,6 +1989,7 @@ install_DEB() {
INFO "WARNING! Sorry, using python package but no numpy package available!" INFO "WARNING! Sorry, using python package but no numpy package available!"
fi fi
fi fi
clean_Python
else else
compile_Python compile_Python
INFO "" INFO ""
@ -1908,6 +2016,7 @@ install_DEB() {
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \ install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
libboost-regex$boost_version-dev libboost-system$boost_version-dev \ libboost-regex$boost_version-dev libboost-system$boost_version-dev \
libboost-thread$boost_version-dev libboost-thread$boost_version-dev
clean_Boost
else else
compile_Boost compile_Boost
fi fi
@ -1923,6 +2032,7 @@ install_DEB() {
check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libopencolorio-dev install_packages_DEB libopencolorio-dev
clean_OCIO
else else
compile_OCIO compile_OCIO
fi fi
@ -1935,6 +2045,7 @@ install_DEB() {
check_package_version_ge_DEB libopenexr-dev $OPENEXR_VERSION_MIN check_package_version_ge_DEB libopenexr-dev $OPENEXR_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libopenexr-dev install_packages_DEB libopenexr-dev
clean_OPENEXR
else else
compile_OPENEXR compile_OPENEXR
fi fi
@ -1947,6 +2058,7 @@ install_DEB() {
check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN
if [ $? -eq 0 -a $_with_built_openexr == false ]; then if [ $? -eq 0 -a $_with_built_openexr == false ]; then
install_packages_DEB libopenimageio-dev install_packages_DEB libopenimageio-dev
clean_OIIO
else else
compile_OIIO compile_OIIO
fi fi
@ -1964,12 +2076,14 @@ install_DEB() {
install_packages_DEB llvm-$LLVM_VERSION-dev clang install_packages_DEB llvm-$LLVM_VERSION-dev clang
have_llvm=true have_llvm=true
LLVM_VERSION_FOUND=$LLVM_VERSION LLVM_VERSION_FOUND=$LLVM_VERSION
clean_LLVM
else else
check_package_DEB llvm-$LLVM_VERSION_MIN-dev check_package_DEB llvm-$LLVM_VERSION_MIN-dev
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB llvm-$LLVM_VERSION_MIN-dev clang install_packages_DEB llvm-$LLVM_VERSION_MIN-dev clang
have_llvm=true have_llvm=true
LLVM_VERSION_FOUND=$LLVM_VERSION_MIN LLVM_VERSION_FOUND=$LLVM_VERSION_MIN
clean_LLVM
else else
install_packages_DEB libffi-dev install_packages_DEB libffi-dev
# LLVM can't find the debian ffi header dir # LLVM can't find the debian ffi header dir
@ -2023,6 +2137,7 @@ install_DEB() {
# if [ ! -z "$ffmpeg_version" ]; then # if [ ! -z "$ffmpeg_version" ]; then
# if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then # if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then
# install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev # install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
# clean_FFmpeg
# else # else
# compile_FFmpeg # compile_FFmpeg
# fi # fi
@ -2033,6 +2148,18 @@ install_DEB() {
} }
#### Install on RPM-like ####
rpm_flavour() {
if [ -f /etc/redhat-release ]; then
if [ "`grep '6\.' /etc/redhat-release`" ]; then
RPM="RHEL"
else
RPM="FEDORA"
fi
elif [ -f /etc/SuSE-release ]; then
RPM="SUSE"
fi
}
get_package_version_RPM() { get_package_version_RPM() {
rpm_flavour rpm_flavour
@ -2269,6 +2396,7 @@ install_RPM() {
INFO "WARNING! Sorry, using python package but no numpy package available!" INFO "WARNING! Sorry, using python package but no numpy package available!"
fi fi
fi fi
clean_Python
else else
compile_Python compile_Python
INFO "" INFO ""
@ -2287,6 +2415,7 @@ install_RPM() {
check_package_version_ge_RPM boost-devel $BOOST_VERSION check_package_version_ge_RPM boost-devel $BOOST_VERSION
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM boost-devel install_packages_RPM boost-devel
clean_Boost
else else
compile_Boost compile_Boost
fi fi
@ -2299,6 +2428,7 @@ install_RPM() {
check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM OpenColorIO-devel install_packages_RPM OpenColorIO-devel
clean_OCIO
else else
compile_OCIO compile_OCIO
fi fi
@ -2311,6 +2441,7 @@ install_RPM() {
check_package_version_ge_RPM $OPENEXR_DEV $OPENEXR_VERSION_MIN check_package_version_ge_RPM $OPENEXR_DEV $OPENEXR_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM $OPENEXR_DEV install_packages_RPM $OPENEXR_DEV
clean_OPENEXR
else else
compile_OPENEXR compile_OPENEXR
fi fi
@ -2323,6 +2454,7 @@ install_RPM() {
check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN
if [ $? -eq 0 -a $_with_built_openexr == false ]; then if [ $? -eq 0 -a $_with_built_openexr == false ]; then
install_packages_RPM OpenImageIO-devel install_packages_RPM OpenImageIO-devel
clean_OIIO
else else
compile_OIIO compile_OIIO
fi fi
@ -2345,6 +2477,7 @@ install_RPM() {
fi fi
have_llvm=true have_llvm=true
LLVM_VERSION_FOUND=$LLVM_VERSION LLVM_VERSION_FOUND=$LLVM_VERSION
clean_LLVM
else else
# #
# Better to compile it than use minimum version from repo... # Better to compile it than use minimum version from repo...
@ -2396,6 +2529,7 @@ install_RPM() {
check_package_version_ge_RPM ffmpeg $FFMPEG_VERSION_MIN check_package_version_ge_RPM ffmpeg $FFMPEG_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM ffmpeg ffmpeg-devel install_packages_RPM ffmpeg ffmpeg-devel
clean_FFmpeg
else else
INFO "" INFO ""
compile_FFmpeg compile_FFmpeg
@ -2404,6 +2538,7 @@ install_RPM() {
} }
#### Install on ARCH-like ####
get_package_version_ARCH() { get_package_version_ARCH() {
pacman -Si $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/' pacman -Si $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
} }
@ -2545,6 +2680,7 @@ install_ARCH() {
fi fi
fi fi
fi fi
clean_Python
else else
compile_Python compile_Python
INFO "" INFO ""
@ -2565,6 +2701,7 @@ install_ARCH() {
check_package_version_ge_ARCH boost $BOOST_VERSION_MIN check_package_version_ge_ARCH boost $BOOST_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH boost install_packages_ARCH boost
clean_Boost
else else
compile_Boost compile_Boost
fi fi
@ -2577,6 +2714,7 @@ install_ARCH() {
check_package_version_ge_ARCH opencolorio $OCIO_VERSION_MIN check_package_version_ge_ARCH opencolorio $OCIO_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH opencolorio yaml-cpp tinyxml install_packages_ARCH opencolorio yaml-cpp tinyxml
clean_OCIO
else else
install_packages_ARCH yaml-cpp tinyxml install_packages_ARCH yaml-cpp tinyxml
compile_OCIO compile_OCIO
@ -2590,6 +2728,7 @@ install_ARCH() {
check_package_version_ge_ARCH openimageio $OIIO_VERSION_MIN check_package_version_ge_ARCH openimageio $OIIO_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH openimageio install_packages_ARCH openimageio
clean_OIIO
else else
compile_OIIO compile_OIIO
fi fi
@ -2608,6 +2747,7 @@ install_ARCH() {
have_llvm=true have_llvm=true
LLVM_VERSION=`check_package_version_ge_ARCH llvm` LLVM_VERSION=`check_package_version_ge_ARCH llvm`
LLVM_VERSION_FOUND=$LLVM_VERSION LLVM_VERSION_FOUND=$LLVM_VERSION
clean_LLVM
else else
install_packages_ARCH libffi install_packages_ARCH libffi
# LLVM can't find the arch ffi header dir... # LLVM can't find the arch ffi header dir...
@ -2629,6 +2769,7 @@ install_ARCH() {
check_package_version_ge_ARCH openshadinglanguage $OSL_VERSION_MIN check_package_version_ge_ARCH openshadinglanguage $OSL_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH openshadinglanguage install_packages_ARCH openshadinglanguage
clean_OSL
else else
#XXX Note: will fail to build with LLVM 3.2! #XXX Note: will fail to build with LLVM 3.2!
INFO "" INFO ""
@ -2649,6 +2790,7 @@ install_ARCH() {
check_package_ARCH opencollada check_package_ARCH opencollada
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH opencollada install_packages_ARCH opencollada
clean_OpenCOLLADA
else else
install_packages_ARCH pcre git install_packages_ARCH pcre git
INFO "" INFO ""
@ -2666,6 +2808,7 @@ install_ARCH() {
check_package_version_ge_ARCH ffmpeg $FFMPEG_VERSION_MIN check_package_version_ge_ARCH ffmpeg $FFMPEG_VERSION_MIN
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH ffmpeg install_packages_ARCH ffmpeg
clean_FFmpeg
else else
compile_FFmpeg compile_FFmpeg
fi fi
@ -2673,6 +2816,8 @@ install_ARCH() {
} }
#### Printing User Info ####
print_info_ffmpeglink_DEB() { print_info_ffmpeglink_DEB() {
if $ALL_STATIC; then if $ALL_STATIC; then
dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }' dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
@ -2900,31 +3045,44 @@ print_info() {
INFO "WITH_BF_3DMOUSE = False" INFO "WITH_BF_3DMOUSE = False"
fi fi
INFO "" #INFO ""
INFO "" #INFO ""
INFO "WARNING: If this script had to build boost and/or OIIO into $INST, and you are dynamically linking " #INFO "WARNING: If this script had to build boost and/or OIIO into $INST, and you are dynamically linking "
INFO " blender against it, you will have to run those commands as root user:" #INFO " blender against it, you will have to run those commands as root user:"
INFO "" #INFO ""
INFO " echo \"$INST/boost/lib\" > /etc/ld.so.conf.d/boost.conf" #INFO " echo \"$INST/boost/lib\" > /etc/ld.so.conf.d/boost.conf"
INFO " echo \"$INST/oiio/lib\" > /etc/ld.so.conf.d/oiio.conf" #INFO " echo \"$INST/oiio/lib\" > /etc/ld.so.conf.d/oiio.conf"
INFO " ldconfig" #INFO " ldconfig"
INFO "" #INFO ""
} }
#### "Main" ####
# Detect distribution type used on this machine # Detect distribution type used on this machine
detect_distro if [ -f /etc/debian_version ]; then
DISTRO="DEB"
if [ -z "$DISTRO" ]; then 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
ERROR "Failed to detect distribution type" ERROR "Failed to detect distribution type"
exit 1 exit 1
elif [ "$DISTRO" = "DEB" ]; then
install_DEB
elif [ "$DISTRO" = "RPM" ]; then
install_RPM
elif [ "$DISTRO" = "ARCH" ]; then
install_ARCH
fi fi
INFO ""
INFO "Running ldconfig..."
if [ _need_boost_ldconfig == true ]; then
sudo sh -c 'echo "$INST/boost/lib" > /etc/ld.so.conf.d/boost.conf'
fi
if [ _need_oiio_ldconfig == true ]; then
sudo sh -c 'echo "$INST/oiio/lib" > /etc/ld.so.conf.d/oiio.conf'
fi
sudo ldconfig
INFO ""
print_info | tee BUILD_NOTES.txt print_info | tee BUILD_NOTES.txt
INFO "" INFO ""
INFO "This information has been written to BUILD_NOTES.txt" INFO "This information has been written to BUILD_NOTES.txt"