2012-11-12 19:39:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
DISTRO=""
|
|
|
|
SRC="$HOME/src/blender-deps"
|
2012-11-15 17:31:18 +00:00
|
|
|
INST="/opt/lib"
|
2012-11-12 19:39:09 +00:00
|
|
|
CWD=$PWD
|
|
|
|
|
2012-11-17 11:57:10 +00:00
|
|
|
# OSL is horror for manual building even
|
|
|
|
# i would want it to be setteled for manual build first,
|
|
|
|
# and only then do it automatically
|
|
|
|
BUILD_OSL=false
|
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
THREADS=`cat /proc/cpuinfo | grep cores | uniq | sed -e "s/.*: *\(.*\)/\\1/"`
|
2012-11-18 14:27:19 +00:00
|
|
|
if [ -z "$THREADS" ]; then
|
2012-11-17 14:41:18 +00:00
|
|
|
THREADS=1
|
|
|
|
fi
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
PYTHON_VERSION="3.3.0"
|
2012-11-15 17:31:18 +00:00
|
|
|
PYTHON_VERSION_MIN="3.3"
|
|
|
|
PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2"
|
|
|
|
|
|
|
|
BOOST_VERSION="1.51.0"
|
|
|
|
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
|
|
|
|
BOOST_SOURCE="http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download"
|
|
|
|
BOOST_VERSION_MIN="1.49"
|
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
OCIO_VERSION="1.0.7"
|
2012-11-15 17:31:18 +00:00
|
|
|
OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
|
|
|
|
OCIO_VERSION_MIN="1.0"
|
|
|
|
|
2012-11-17 11:35:13 +00:00
|
|
|
OIIO_VERSION="1.1.1"
|
2012-11-15 17:31:18 +00:00
|
|
|
OIIO_SOURCE="https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_VERSION"
|
|
|
|
OIIO_VERSION_MIN="1.1"
|
|
|
|
|
|
|
|
LLVM_VERSION="3.1"
|
|
|
|
LLVM_VERSION_MIN="3.0"
|
|
|
|
|
|
|
|
# OSL needs to be compiled for now!
|
|
|
|
OSL_VERSION="1.2.0"
|
2012-11-16 17:14:01 +00:00
|
|
|
OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage/archive/blender-fixes.tar.gz"
|
2012-11-15 17:31:18 +00:00
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
FFMPEG_VERSION="1.0"
|
2012-11-15 17:31:18 +00:00
|
|
|
FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
|
|
|
|
FFMPEG_VERSION_MIN="0.7.6"
|
2012-11-13 16:42:36 +00:00
|
|
|
_ffmpeg_list_sep=";"
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# FFMPEG optional libs.
|
|
|
|
VORBIS_USE=false
|
|
|
|
VORBIS_DEV=""
|
|
|
|
SCHRO_USE=false
|
|
|
|
SCRHO_DEV=""
|
|
|
|
THEORA_USE=false
|
|
|
|
THEORA_DEV=""
|
|
|
|
XVID_USE=false
|
|
|
|
XVID_DEV=""
|
|
|
|
X264_USE=false
|
|
|
|
X264_DEV=""
|
2012-11-17 17:58:15 +00:00
|
|
|
X264_VERSION_MIN=0.118
|
2012-11-15 17:31:18 +00:00
|
|
|
VPX_USE=false
|
|
|
|
VPX_VERSION_MIN=0.9.7
|
|
|
|
VPX_DEV=""
|
|
|
|
MP3LAME_USE=false
|
|
|
|
MP3LAME_DEV=""
|
|
|
|
OPENJPEG_USE=false
|
|
|
|
OPENJPEG_DEV=""
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-13 10:49:55 +00:00
|
|
|
# Switch to english language, else some things (like check_package_DEB()) won't work!
|
|
|
|
LANG_BACK=$LANG
|
|
|
|
LANG=""
|
|
|
|
export LANG
|
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
ERROR() {
|
|
|
|
echo "${@}"
|
|
|
|
}
|
|
|
|
|
|
|
|
INFO() {
|
|
|
|
echo "${@}"
|
|
|
|
}
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# Return 0 if $1 >= $2, else 1.
|
2012-11-14 21:57:47 +00:00
|
|
|
# $1 and $2 should be version numbers made of numbers only.
|
|
|
|
version_ge() {
|
|
|
|
if [ $(echo -e "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then
|
|
|
|
return 1
|
2012-11-15 17:31:18 +00:00
|
|
|
else
|
|
|
|
return 0
|
2012-11-14 21:57:47 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# 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.
|
2012-11-14 21:57:47 +00:00
|
|
|
# $1 and $2 should be version numbers made of numbers only.
|
|
|
|
# $1 should be at least as long as $2!
|
|
|
|
version_match() {
|
|
|
|
backIFS=$IFS
|
2012-11-14 23:20:16 +00:00
|
|
|
IFS='.'
|
2012-11-14 21:57:47 +00:00
|
|
|
|
|
|
|
# Split both version numbers into their numeric elements.
|
|
|
|
arr1=( $1 )
|
|
|
|
arr2=( $2 )
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
ret=1
|
2012-11-14 21:57:47 +00:00
|
|
|
|
|
|
|
count1=${#arr1[@]}
|
|
|
|
count2=${#arr2[@]}
|
|
|
|
if [ $count1 -ge $count2 ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
ret=0
|
2012-11-14 21:57:47 +00:00
|
|
|
for (( i=0; $i < $count2; i++ ))
|
|
|
|
do
|
|
|
|
if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
ret=1
|
2012-11-14 21:57:47 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2012-11-14 23:20:16 +00:00
|
|
|
IFS=$backIFS
|
2012-11-14 21:57:47 +00:00
|
|
|
return $ret
|
|
|
|
}
|
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
detect_distro() {
|
|
|
|
if [ -f /etc/debian_version ]; then
|
|
|
|
DISTRO="DEB"
|
|
|
|
elif [ -f /etc/redhat-release ]; then
|
2012-11-13 09:29:22 +00:00
|
|
|
DISTRO="RPM"
|
|
|
|
elif [ -f /etc/SuSE-release ]; then
|
|
|
|
DISTRO="SUSE"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
prepare_opt() {
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Ensuring $INST exists and is writable by us"
|
|
|
|
sudo mkdir -p $INST
|
|
|
|
sudo chown $USER $INST
|
|
|
|
sudo chmod 775 $INST
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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 ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
magic_compile_set() {
|
|
|
|
rm -f $INST/.$1-magiccheck-*
|
|
|
|
touch $INST/.$1-magiccheck-$2
|
2012-11-12 19:39:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
compile_Python() {
|
2012-11-15 17:31:18 +00:00
|
|
|
# To be changed each time we make edits that would modify the compiled result!
|
|
|
|
py_magic=0
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
_src=$SRC/Python-$PYTHON_VERSION
|
|
|
|
_inst=$INST/python-$PYTHON_VERSION
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# Clean install if needed!
|
|
|
|
magic_compile_check python-$PYTHON_VERSION $py_magic
|
|
|
|
if [ $? -eq 1 ]; then
|
2012-11-16 17:14:01 +00:00
|
|
|
rm -rf $_inst
|
2012-11-15 17:31:18 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_inst ]; then
|
2012-11-12 19:39:09 +00:00
|
|
|
INFO "Building Python-$PYTHON_VERSION"
|
|
|
|
|
|
|
|
prepare_opt
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_src ]; then
|
2012-11-12 19:39:09 +00:00
|
|
|
mkdir -p $SRC
|
2012-11-16 17:14:01 +00:00
|
|
|
wget -c $PYTHON_SOURCE -O $_src.tar.bz2
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
INFO "Unpacking Python-$PYTHON_VERSION"
|
2012-11-16 17:14:01 +00:00
|
|
|
tar -C $SRC -xf $_src.tar.bz2
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
cd $_src
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
./configure --prefix=$_inst --enable-ipv6 \
|
2012-11-12 19:39:09 +00:00
|
|
|
--enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
|
|
|
|
--with-computed-gotos --with-pymalloc
|
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
make -j$THREADS && make install
|
2012-11-12 19:39:09 +00:00
|
|
|
make clean
|
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
if [ -d $_inst ]; then
|
|
|
|
rm -f $INST/python-3.3
|
|
|
|
ln -s python-$PYTHON_VERSION $INST/python-3.3
|
2012-11-17 12:10:35 +00:00
|
|
|
else
|
|
|
|
ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
|
|
|
|
exit 1
|
2012-11-17 11:42:37 +00:00
|
|
|
fi
|
2012-11-15 17:31:18 +00:00
|
|
|
|
|
|
|
magic_compile_set python-$PYTHON_VERSION $py_magic
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
cd $CWD
|
2012-11-15 17:31:18 +00:00
|
|
|
else
|
|
|
|
INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories."
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
compile_Boost() {
|
2012-11-15 17:31:18 +00:00
|
|
|
# To be changed each time we make edits that would modify the compiled result!
|
|
|
|
boost_magic=7
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
_src=$SRC/boost-$BOOST_VERSION
|
|
|
|
_inst=$INST/boost-$BOOST_VERSION
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# Clean install if needed!
|
|
|
|
magic_compile_check boost-$BOOST_VERSION $boost_magic
|
|
|
|
if [ $? -eq 1 ]; then
|
2012-11-16 17:14:01 +00:00
|
|
|
rm -rf $_inst
|
2012-11-15 17:31:18 +00:00
|
|
|
fi
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_inst ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Building Boost-$BOOST_VERSION"
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
prepare_opt
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_src ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Downloading Boost-$BOOST_VERSION"
|
2012-11-12 19:39:09 +00:00
|
|
|
mkdir -p $SRC
|
2012-11-16 17:14:01 +00:00
|
|
|
wget -c $BOOST_SOURCE -O $_src.tar.bz2
|
|
|
|
tar -C $SRC --transform "s,(.*/?)boost_1_[^/]+(.*),\1boost-$BOOST_VERSION\2,x" -xf $_src.tar.bz2
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
cd $_src
|
|
|
|
if [ ! -f $_src/b2 ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
./bootstrap.sh
|
|
|
|
fi
|
2012-11-17 05:16:54 +00:00
|
|
|
./b2 -j$THREADS -a --with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time \
|
2012-11-16 17:14:01 +00:00
|
|
|
--prefix=$_inst --disable-icu boost.locale.icu=off install
|
2012-11-12 19:39:09 +00:00
|
|
|
./b2 --clean
|
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
if [ -d $_inst ]; then
|
|
|
|
rm -f $INST/boost
|
|
|
|
ln -s boost-$BOOST_VERSION $INST/boost
|
2012-11-17 12:10:35 +00:00
|
|
|
else
|
|
|
|
ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
|
|
|
|
exit 1
|
2012-11-17 11:42:37 +00:00
|
|
|
fi
|
2012-11-15 17:31:18 +00:00
|
|
|
|
|
|
|
magic_compile_set boost-$BOOST_VERSION $boost_magic
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
cd $CWD
|
2012-11-15 17:31:18 +00:00
|
|
|
else
|
|
|
|
INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!"
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories."
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
compile_OCIO() {
|
2012-11-15 17:31:18 +00:00
|
|
|
# To be changed each time we make edits that would modify the compiled result!
|
|
|
|
ocio_magic=1
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
_src=$SRC/OpenColorIO-$OCIO_VERSION
|
|
|
|
_inst=$INST/ocio-$OCIO_VERSION
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# Clean install if needed!
|
|
|
|
magic_compile_check ocio-$OCIO_VERSION $ocio_magic
|
|
|
|
if [ $? -eq 1 ]; then
|
2012-11-16 17:14:01 +00:00
|
|
|
rm -rf $_inst
|
2012-11-15 17:31:18 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_inst ]; then
|
2012-11-12 19:39:09 +00:00
|
|
|
INFO "Building OpenColorIO-$OCIO_VERSION"
|
|
|
|
|
|
|
|
prepare_opt
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_src ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Downloading OpenColorIO-$OCIO_VERSION"
|
|
|
|
mkdir -p $SRC
|
2012-11-16 17:14:01 +00:00
|
|
|
wget -c $OCIO_SOURCE -O $_src.tar.gz
|
2012-11-15 17:31:18 +00:00
|
|
|
|
|
|
|
INFO "Unpacking OpenColorIO-$OCIO_VERSION"
|
|
|
|
tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
|
2012-11-16 17:14:01 +00:00
|
|
|
-xf $_src.tar.gz
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
cd $_src
|
2012-11-15 17:31:18 +00:00
|
|
|
# Always refresh the whole build!
|
|
|
|
if [ -d build ]; then
|
|
|
|
rm -rf build
|
|
|
|
fi
|
2012-11-12 19:39:09 +00:00
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
if file /bin/cp | grep -q '32-bit'; then
|
|
|
|
cflags="-fPIC -m32 -march=i686"
|
|
|
|
else
|
|
|
|
cflags="-fPIC"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmake -D CMAKE_BUILD_TYPE=Release \
|
2012-11-16 17:14:01 +00:00
|
|
|
-D CMAKE_PREFIX_PATH=$_inst \
|
|
|
|
-D CMAKE_INSTALL_PREFIX=$_inst \
|
2012-11-16 12:42:01 +00:00
|
|
|
-D CMAKE_CXX_FLAGS="$cflags" \
|
|
|
|
-D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" \
|
|
|
|
..
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
make -j$THREADS && make install
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# Force linking against static libs
|
2012-11-16 17:14:01 +00:00
|
|
|
rm -f $_inst/lib/*.so*
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
# Additional depencencies
|
2012-11-16 17:14:01 +00:00
|
|
|
cp ext/dist/lib/libtinyxml.a $_inst/lib
|
|
|
|
cp ext/dist/lib/libyaml-cpp.a $_inst/lib
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
make clean
|
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
if [ -d $_inst ]; then
|
|
|
|
rm -f $INST/ocio
|
|
|
|
ln -s ocio-$OCIO_VERSION $INST/ocio
|
2012-11-17 12:10:35 +00:00
|
|
|
else
|
|
|
|
ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
|
|
|
|
exit 1
|
2012-11-17 11:42:37 +00:00
|
|
|
fi
|
2012-11-15 17:31:18 +00:00
|
|
|
|
|
|
|
magic_compile_set ocio-$OCIO_VERSION $ocio_magic
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
cd $CWD
|
2012-11-15 17:31:18 +00:00
|
|
|
else
|
|
|
|
INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!"
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories."
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
compile_OIIO() {
|
2012-11-15 17:31:18 +00:00
|
|
|
# To be changed each time we make edits that would modify the compiled result!
|
2012-11-16 12:42:01 +00:00
|
|
|
oiio_magic=5
|
2012-11-15 17:31:18 +00:00
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
_src=$SRC/OpenImageIO-$OIIO_VERSION
|
|
|
|
_inst=$INST/oiio-$OIIO_VERSION
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# Clean install if needed!
|
|
|
|
magic_compile_check oiio-$OIIO_VERSION $oiio_magic
|
|
|
|
if [ $? -eq 1 ]; then
|
2012-11-16 17:14:01 +00:00
|
|
|
rm -rf $_inst
|
2012-11-15 17:31:18 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_inst ]; then
|
2012-11-12 19:39:09 +00:00
|
|
|
INFO "Building OpenImageIO-$OIIO_VERSION"
|
|
|
|
|
|
|
|
prepare_opt
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_src ]; then
|
|
|
|
wget -c $OIIO_SOURCE -O "$_src.tar.gz"
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
INFO "Unpacking OpenImageIO-$OIIO_VERSION"
|
2012-11-15 17:31:18 +00:00
|
|
|
tar -C $SRC --transform "s,(.*/?)OpenImageIO-oiio[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \
|
2012-11-16 17:14:01 +00:00
|
|
|
-xf $_src.tar.gz
|
2012-11-17 12:59:24 +00:00
|
|
|
|
|
|
|
cd $_src
|
2012-11-18 14:27:19 +00:00
|
|
|
|
|
|
|
# XXX Ugly patching hack!
|
2012-11-17 12:59:24 +00:00
|
|
|
cat << EOF | patch -p1
|
|
|
|
diff --git a/src/libutil/SHA1.cpp b/src/libutil/SHA1.cpp
|
|
|
|
index b9e6c8b..c761185 100644
|
|
|
|
--- a/src/libutil/SHA1.cpp
|
|
|
|
+++ b/src/libutil/SHA1.cpp
|
|
|
|
@@ -8,9 +8,9 @@
|
|
|
|
|
|
|
|
// If compiling with MFC, you might want to add #include "StdAfx.h"
|
|
|
|
|
|
|
|
+#include "SHA1.h"
|
|
|
|
#include "hash.h"
|
|
|
|
#include "dassert.h"
|
|
|
|
-#include "SHA1.h"
|
|
|
|
|
|
|
|
#ifdef SHA1_UTILITY_FUNCTIONS
|
|
|
|
#define SHA1_MAX_FILE_BUFFER 8000
|
|
|
|
EOF
|
2012-11-18 14:27:19 +00:00
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
cd $_src
|
2012-11-15 17:31:18 +00:00
|
|
|
# Always refresh the whole build!
|
|
|
|
if [ -d build ]; then
|
|
|
|
rm -rf build
|
|
|
|
fi
|
2012-11-12 19:39:09 +00:00
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
|
2012-11-16 12:42:01 +00:00
|
|
|
cmake_d="-D CMAKE_BUILD_TYPE=Release \
|
2012-11-16 17:14:01 +00:00
|
|
|
-D CMAKE_PREFIX_PATH=$_inst \
|
|
|
|
-D CMAKE_INSTALL_PREFIX=$_inst \
|
2012-11-16 12:42:01 +00:00
|
|
|
-D BUILDSTATIC=ON"
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ -d $INST/boost ]; then
|
2012-11-17 11:28:12 +00:00
|
|
|
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 12:42:01 +00:00
|
|
|
# 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
|
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
if file /bin/cp | grep -q '32-bit'; then
|
|
|
|
cflags="-fPIC -m32 -march=i686"
|
|
|
|
else
|
|
|
|
cflags="-fPIC"
|
|
|
|
fi
|
|
|
|
|
2012-11-16 12:42:01 +00:00
|
|
|
cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ../src
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
make -j$THREADS && make install
|
2012-11-12 19:39:09 +00:00
|
|
|
make clean
|
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
if [ -d $_inst ]; then
|
|
|
|
rm -f $INST/oiio
|
|
|
|
ln -s oiio-$OIIO_VERSION $INST/oiio
|
2012-11-17 12:10:35 +00:00
|
|
|
else
|
|
|
|
ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
|
|
|
|
exit 1
|
2012-11-17 11:42:37 +00:00
|
|
|
fi
|
2012-11-15 17:31:18 +00:00
|
|
|
|
|
|
|
magic_compile_set oiio-$OIIO_VERSION $oiio_magic
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
cd $CWD
|
2012-11-15 17:31:18 +00:00
|
|
|
else
|
|
|
|
INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!"
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories."
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-11-16 12:42:01 +00:00
|
|
|
compile_OSL() {
|
|
|
|
# To be changed each time we make edits that would modify the compiled result!
|
2012-11-16 17:14:01 +00:00
|
|
|
osl_magic=4
|
|
|
|
|
|
|
|
_src=$SRC/OpenShadingLanguage-$OSL_VERSION
|
|
|
|
_inst=$INST/osl-$OSL_VERSION
|
2012-11-16 12:42:01 +00:00
|
|
|
|
|
|
|
# Clean install if needed!
|
|
|
|
magic_compile_check osl-$OSL_VERSION $osl_magic
|
|
|
|
if [ $? -eq 1 ]; then
|
2012-11-16 17:14:01 +00:00
|
|
|
rm -rf $_inst
|
2012-11-16 12:42:01 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_inst ]; then
|
2012-11-16 12:42:01 +00:00
|
|
|
INFO "Building OpenShadingLanguage-$OSL_VERSION"
|
|
|
|
|
|
|
|
prepare_opt
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_src ]; then
|
|
|
|
# XXX Using git on my own repo for now, looks like archives are not updated immediately... :/
|
|
|
|
# wget -c $OSL_SOURCE -O "$_src.tar.gz"
|
|
|
|
|
|
|
|
# INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
|
|
|
|
# tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
|
|
|
|
# -xf $_src.tar.gz
|
|
|
|
git clone https://github.com/mont29/OpenShadingLanguage.git $_src
|
|
|
|
cd $_src
|
|
|
|
git checkout blender-fixes
|
|
|
|
cd $CWD
|
2012-11-16 12:42:01 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
cd $_src
|
|
|
|
# XXX For now, always update from latest repo...
|
|
|
|
git checkout .
|
|
|
|
|
2012-11-16 12:42:01 +00:00
|
|
|
# Always refresh the whole build!
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ -d build ]; then
|
|
|
|
rm -rf build
|
|
|
|
fi
|
|
|
|
mkdir build
|
2012-11-16 12:42:01 +00:00
|
|
|
cd build
|
|
|
|
|
|
|
|
cmake_d="-D CMAKE_BUILD_TYPE=Release \
|
2012-11-16 17:14:01 +00:00
|
|
|
-D CMAKE_INSTALL_PREFIX=$_inst
|
2012-11-16 12:42:01 +00:00
|
|
|
-D BUILDSTATIC=ON \
|
|
|
|
-D BUILD_TESTING=OFF"
|
|
|
|
|
|
|
|
if [ -d $INST/boost ]; then
|
|
|
|
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d $INST/oiio ]; then
|
|
|
|
cmake_d="$cmake_d -D OPENIMAGEIOHOME=$INST/oiio"
|
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
cmake $cmake_d ../src
|
2012-11-16 12:42:01 +00:00
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
make -j$THREADS && make install
|
2012-11-16 12:42:01 +00:00
|
|
|
make clean
|
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
if [ -d $_inst ]; then
|
|
|
|
rm -f $INST/osl
|
|
|
|
ln -s osl-$OSL_VERSION $INST/osl
|
2012-11-17 12:10:35 +00:00
|
|
|
else
|
|
|
|
ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
|
|
|
|
exit 1
|
2012-11-17 11:42:37 +00:00
|
|
|
fi
|
2012-11-16 12:42:01 +00:00
|
|
|
|
|
|
|
magic_compile_set osl-$OSL_VERSION $osl_magic
|
|
|
|
|
|
|
|
cd $CWD
|
|
|
|
else
|
|
|
|
INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!"
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories."
|
2012-11-16 12:42:01 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
compile_FFmpeg() {
|
2012-11-15 17:31:18 +00:00
|
|
|
# To be changed each time we make edits that would modify the compiled result!
|
|
|
|
ffmpeg_magic=0
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
_src=$SRC/ffmpeg-$FFMPEG_VERSION
|
|
|
|
_inst=$INST/ffmpeg-$FFMPEG_VERSION
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# Clean install if needed!
|
|
|
|
magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
|
|
|
|
if [ $? -eq 1 ]; then
|
2012-11-16 17:14:01 +00:00
|
|
|
rm -rf $_inst
|
2012-11-15 17:31:18 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_inst ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Building ffmpeg-$FFMPEG_VERSION"
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
prepare_opt
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ ! -d $_src ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Downloading ffmpeg-$FFMPEG_VERSION"
|
2012-11-16 17:14:01 +00:00
|
|
|
wget -c $FFMPEG_SOURCE -O "$_src.tar.bz2"
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Unpacking ffmpeg-$FFMPEG_VERSION"
|
2012-11-16 17:14:01 +00:00
|
|
|
tar -C $SRC -xf $_src.tar.bz2
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
cd $_src
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
extra=""
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $VORBIS_USE; then
|
|
|
|
extra="$extra --enable-libvorbis"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $THEORA_USE; then
|
|
|
|
extra="$extra --enable-libtheora"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $SCHRO_USE; then
|
|
|
|
extra="$extra --enable-libschroedinger"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $XVID_USE; then
|
|
|
|
extra="$extra --enable-libxvid"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $X264_USE; then
|
2012-11-12 19:39:09 +00:00
|
|
|
extra="$extra --enable-libx264"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $VPX_USE; then
|
|
|
|
extra="$extra --enable-libvpx"
|
2012-11-13 09:29:22 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $MP3LAME_USE; then
|
|
|
|
extra="$extra --enable-libmp3lame"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $OPENJPEG_USE; then
|
|
|
|
extra="$extra --enable-libopenjpeg"
|
2012-11-13 09:29:22 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
./configure --cc="gcc -Wl,--as-needed" --extra-ldflags="-pthread -static-libgcc" \
|
2012-11-16 17:14:01 +00:00
|
|
|
--prefix=$_inst --enable-static --enable-avfilter --disable-vdpau \
|
2012-11-15 17:31:18 +00:00
|
|
|
--disable-bzlib --disable-libgsm --disable-libspeex \
|
|
|
|
--enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
|
2012-11-13 09:29:22 +00:00
|
|
|
--disable-vaapi --disable-libfaac --disable-nonfree --enable-gpl \
|
2012-11-12 19:39:09 +00:00
|
|
|
--disable-postproc --disable-x11grab --disable-librtmp --disable-libopencore-amrnb \
|
|
|
|
--disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
|
|
|
|
--disable-outdev=alsa --disable-indev=sdl --disable-indev=alsa --disable-indev=jack \
|
|
|
|
--disable-indev=lavfi $extra
|
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
make -j$THREADS && make install
|
2012-11-12 19:39:09 +00:00
|
|
|
make clean
|
|
|
|
|
2012-11-17 11:42:37 +00:00
|
|
|
if [ -d $_inst ]; then
|
|
|
|
rm -f $INST/ffmpeg
|
|
|
|
ln -s ffmpeg-$FFMPEG_VERSION $INST/ffmpeg
|
2012-11-17 12:10:35 +00:00
|
|
|
else
|
|
|
|
ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
|
|
|
|
exit 1
|
2012-11-17 11:42:37 +00:00
|
|
|
fi
|
2012-11-15 17:31:18 +00:00
|
|
|
|
|
|
|
magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
cd $CWD
|
2012-11-15 17:31:18 +00:00
|
|
|
else
|
|
|
|
INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories."
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
deb_version() {
|
|
|
|
dpkg-query -W -f '${Version}' $1 | sed -r 's/^([0-9]\.[0-9]+).*/\1/'
|
|
|
|
}
|
|
|
|
|
|
|
|
check_package_DEB() {
|
|
|
|
r=`apt-cache policy $1 | grep -c 'Candidate:'`
|
|
|
|
|
|
|
|
if [ $r -ge 1 ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
check_package_version_match_DEB() {
|
2012-11-17 17:58:15 +00:00
|
|
|
v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)(([0-9]+\.?)+).*/\2/'`
|
2012-11-15 17:31:18 +00:00
|
|
|
|
|
|
|
if [ -z "$v" ]; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
version_match $v $2
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
check_package_version_ge_DEB() {
|
2012-11-17 17:58:15 +00:00
|
|
|
v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
|
2012-11-15 17:31:18 +00:00
|
|
|
|
|
|
|
if [ -z "$v" ]; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
version_ge $v $2
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
install_DEB() {
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Installing dependencies for DEB-based distribution"
|
|
|
|
INFO "Source code of dependencies needed to be compiled will be downloaded and extracted into $SRC"
|
|
|
|
INFO "Built libs of dependencies needed to be compiled will be installed into $INST"
|
|
|
|
INFO "Please edit \$SRC and/or \$INST variables at the begining of this script if you want to use other paths!"
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
sudo apt-get update
|
2012-11-14 21:57:47 +00:00
|
|
|
# XXX Why in hell? Let's let this stuff to the user's responsability!!!
|
|
|
|
# sudo apt-get -y upgrade
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
# These libs should always be available in debian/ubuntu official repository...
|
|
|
|
OPENJPEG_DEV="libopenjpeg-dev"
|
|
|
|
SCHRO_DEV="libschroedinger-dev"
|
|
|
|
VORBIS_DEV="libvorbis-dev"
|
|
|
|
THEORA_DEV="libtheora-dev"
|
|
|
|
|
2012-11-17 14:41:18 +00:00
|
|
|
sudo apt-get install -y gawk cmake scons gcc g++ libjpeg-dev libpng-dev libtiff-dev \
|
2012-11-12 19:39:09 +00:00
|
|
|
libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev libncurses5-dev \
|
2012-11-15 17:31:18 +00:00
|
|
|
libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV libopenexr-dev libopenal-dev \
|
|
|
|
libglew-dev yasm $SCHRO_DEV $THEORA_DEV $VORBIS_DEV libsdl1.2-dev \
|
2012-11-17 11:23:53 +00:00
|
|
|
libfftw3-dev libjack-dev python-dev patch flex bison libtbb-dev git
|
2012-11-15 17:31:18 +00:00
|
|
|
|
|
|
|
OPENJPEG_USE=true
|
|
|
|
SCHRO_USE=true
|
|
|
|
VORBIS_USE=true
|
|
|
|
THEORA_USE=true
|
|
|
|
|
|
|
|
# Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev!
|
|
|
|
XVID_DEV="libxvidcore-dev"
|
|
|
|
check_package_DEB $XVID_DEV
|
2012-11-12 19:39:09 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
sudo apt-get install -y $XVID_DEV
|
|
|
|
XVID_USE=true
|
|
|
|
else
|
|
|
|
XVID_DEV="libxvidcore4-dev"
|
|
|
|
check_package_DEB $XVID_DEV
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo apt-get install -y $XVID_DEV
|
|
|
|
XVID_USE=true
|
|
|
|
fi
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
MP3LAME_DEV="libmp3lame-dev"
|
|
|
|
check_package_DEB $MP3LAME_DEV
|
2012-11-12 19:39:09 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
sudo apt-get install -y $MP3LAME_DEV
|
|
|
|
MP3LAME_USE=true
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
X264_DEV="libx264-dev"
|
2012-11-17 17:58:15 +00:00
|
|
|
check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN
|
2012-11-12 19:39:09 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
sudo apt-get install -y $X264_DEV
|
|
|
|
X264_USE=true
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
VPX_DEV="libvpx-dev"
|
|
|
|
check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN
|
2012-11-12 19:39:09 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
sudo apt-get install -y $VPX_DEV
|
|
|
|
VPX_USE=true
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
check_package_DEB libspnav-dev
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo apt-get install -y libspnav-dev
|
|
|
|
fi
|
|
|
|
|
|
|
|
check_package_DEB python3.3-dev
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo apt-get install -y python3.3-dev
|
|
|
|
else
|
|
|
|
compile_Python
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN
|
2012-11-12 19:39:09 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo apt-get install -y libboost-dev
|
|
|
|
|
|
|
|
boost_version=`deb_version libboost-dev`
|
|
|
|
|
|
|
|
check_package_DEB libboost-locale$boost_version-dev
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo apt-get install -y libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
|
2012-11-16 12:42:01 +00:00
|
|
|
libboost-regex$boost_version-dev libboost-system$boost_version-dev \
|
|
|
|
libboost-thread$boost_version-dev
|
2012-11-12 19:39:09 +00:00
|
|
|
else
|
|
|
|
compile_Boost
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
compile_Boost
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN
|
2012-11-12 19:39:09 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo apt-get install -y libopencolorio-dev
|
|
|
|
else
|
|
|
|
compile_OCIO
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN
|
2012-11-12 19:39:09 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo apt-get install -y libopenimageio-dev
|
|
|
|
else
|
|
|
|
compile_OIIO
|
|
|
|
fi
|
|
|
|
|
2012-11-17 11:57:10 +00:00
|
|
|
if $BUILD_OSL; then
|
|
|
|
have_llvm=false
|
|
|
|
|
|
|
|
check_package_DEB llvm-$LLVM_VERSION-dev
|
2012-11-17 11:23:53 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-17 11:57:10 +00:00
|
|
|
sudo apt-get install -y llvm-$LLVM_VERSION-dev clang
|
2012-11-17 11:23:53 +00:00
|
|
|
have_llvm=true
|
2012-11-17 11:57:10 +00:00
|
|
|
else
|
|
|
|
check_package_DEB llvm-$LLVM_VERSION_MIN-dev
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo apt-get install -y llvm-$LLVM_VERSION_MIN-dev clang
|
|
|
|
have_llvm=true
|
|
|
|
fi
|
2012-11-17 11:23:53 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-17 11:57:10 +00:00
|
|
|
if $have_llvm; then
|
|
|
|
# No package currently!
|
|
|
|
compile_OSL
|
|
|
|
fi
|
2012-11-17 11:23:53 +00:00
|
|
|
fi
|
2012-11-16 12:42:01 +00:00
|
|
|
|
2012-11-13 10:49:55 +00:00
|
|
|
# XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/
|
|
|
|
# So for now, always build our own ffmpeg.
|
|
|
|
# check_package_DEB ffmpeg
|
|
|
|
# if [ $? -eq 0 ]; then
|
|
|
|
# sudo apt-get install -y ffmpeg
|
|
|
|
# ffmpeg_version=`deb_version ffmpeg`
|
|
|
|
# INFO "ffmpeg version: $ffmpeg_version"
|
|
|
|
# if [ ! -z "$ffmpeg_version" ]; then
|
|
|
|
# if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then
|
|
|
|
# sudo apt-get install -y libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
|
|
|
|
# else
|
|
|
|
# compile_FFmpeg
|
|
|
|
# fi
|
|
|
|
# fi
|
|
|
|
# fi
|
|
|
|
compile_FFmpeg
|
2012-11-12 19:39:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
check_package_RPM() {
|
2012-11-13 09:29:22 +00:00
|
|
|
r=`yum info $1 | grep -c 'Summary'`
|
2012-11-12 19:39:09 +00:00
|
|
|
|
|
|
|
if [ $r -ge 1 ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-11-14 21:57:47 +00:00
|
|
|
check_package_version_match_RPM() {
|
2012-11-13 09:29:22 +00:00
|
|
|
v=`yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'`
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ -z "$v" ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
return 1
|
|
|
|
fi
|
2012-11-16 17:14:01 +00:00
|
|
|
|
|
|
|
version_match $v $2
|
|
|
|
return $?
|
2012-11-14 21:57:47 +00:00
|
|
|
}
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-14 21:57:47 +00:00
|
|
|
check_package_version_ge_RPM() {
|
|
|
|
v=`yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'`
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ -z "$v" ]; then
|
2012-11-15 17:31:18 +00:00
|
|
|
return 1
|
|
|
|
fi
|
2012-11-16 17:14:01 +00:00
|
|
|
|
|
|
|
version_ge $v $2
|
|
|
|
return $?
|
2012-11-12 19:39:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
install_RPM() {
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Installing dependencies for RPM-based distribution"
|
|
|
|
INFO "Source code of dependencies needed to be compiled will be downloaded and extracted into $SRC"
|
|
|
|
INFO "Built libs of dependencies needed to be compiled will be installed into $INST"
|
|
|
|
INFO "Please edit \$SRC and/or \$INST variables at the begining of this script if you want to use other paths!"
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-13 09:29:22 +00:00
|
|
|
sudo yum -y update
|
2012-11-12 19:39:09 +00:00
|
|
|
|
2012-11-17 14:41:18 +00:00
|
|
|
sudo yum -y install gawk gcc gcc-c++ cmake scons libpng-devel libtiff-devel \
|
2012-11-12 19:39:09 +00:00
|
|
|
freetype-devel libX11-devel libXi-devel wget libsqlite3x-devel ncurses-devel \
|
|
|
|
readline-devel openjpeg-devel openexr-devel openal-soft-devel \
|
|
|
|
glew-devel yasm schroedinger-devel libtheora-devel libvorbis-devel SDL-devel \
|
2012-11-14 21:57:47 +00:00
|
|
|
fftw-devel lame-libs jack-audio-connection-kit-devel libspnav-devel \
|
2012-11-12 19:39:09 +00:00
|
|
|
libjpeg-devel patch python-devel
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
OPENJPEG_USE=true
|
|
|
|
SCHRO_USE=true
|
2012-11-13 09:29:22 +00:00
|
|
|
|
2012-11-14 21:57:47 +00:00
|
|
|
check_package_RPM x264-devel
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo yum install -y x264-devel
|
2012-11-15 17:31:18 +00:00
|
|
|
X264_USE=true
|
2012-11-14 21:57:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
check_package_RPM xvidcore-devel
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo yum install -y xvidcore-devel
|
2012-11-15 17:31:18 +00:00
|
|
|
XVID_USE=true
|
|
|
|
XVID_DEV="xvidcore-devel"
|
2012-11-14 21:57:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
check_package_version_ge_RPM libvpx-devel 0.9.7
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-14 21:57:47 +00:00
|
|
|
sudo yum install -y libvpx-devel
|
2012-11-15 17:31:18 +00:00
|
|
|
VPX_USE=true
|
2012-11-14 21:57:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
check_package_RPM lame-devel
|
2012-11-12 19:39:09 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-14 21:57:47 +00:00
|
|
|
sudo yum install -y lame-devel
|
2012-11-15 17:31:18 +00:00
|
|
|
MP3LAME_USE=true
|
2012-11-14 21:57:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
check_package_version_match_RPM python3-devel 3.3
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-13 09:29:22 +00:00
|
|
|
sudo yum install -y python-devel
|
2012-11-12 19:39:09 +00:00
|
|
|
else
|
|
|
|
compile_Python
|
|
|
|
fi
|
|
|
|
|
|
|
|
check_package_RPM boost-devel
|
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-13 09:29:22 +00:00
|
|
|
sudo yum install -y boost-devel
|
2012-11-12 19:39:09 +00:00
|
|
|
else
|
|
|
|
compile_Boost
|
|
|
|
fi
|
|
|
|
|
|
|
|
check_package_RPM OpenColorIO-devel
|
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-13 09:29:22 +00:00
|
|
|
sudo yum install -y OpenColorIO-devel
|
2012-11-12 19:39:09 +00:00
|
|
|
else
|
|
|
|
compile_OCIO
|
|
|
|
fi
|
|
|
|
|
|
|
|
check_package_RPM OpenImageIO-devel
|
|
|
|
if [ $? -eq 0 ]; then
|
2012-11-13 09:29:22 +00:00
|
|
|
sudo yum install -y OpenImageIO-devel
|
2012-11-12 19:39:09 +00:00
|
|
|
else
|
|
|
|
compile_OIIO
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Always for now, not sure which packages should be installed
|
|
|
|
compile_FFmpeg
|
|
|
|
}
|
|
|
|
|
2012-11-13 09:29:22 +00:00
|
|
|
check_package_SUSE() {
|
|
|
|
r=`zypper info $1 | grep -c 'Summary'`
|
|
|
|
|
|
|
|
if [ $r -ge 1 ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
check_package_version_SUSE() {
|
|
|
|
v=`zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'`
|
|
|
|
|
|
|
|
# for now major and minor versions only (as if x.y, not x.y.z)
|
|
|
|
r=`echo $v | grep -c $2`
|
|
|
|
|
|
|
|
if [ $r -ge 1 ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install_SUSE() {
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO "Installing dependencies for SuSE-based distribution"
|
|
|
|
INFO "Source code of dependencies needed to be compiled will be downloaded and extracted into $SRC"
|
|
|
|
INFO "Built libs of dependencies needed to be compiled will be installed into $INST"
|
|
|
|
INFO "Please edit \$SRC and/or \$INST variables at the begining of this script if you want to use other paths!"
|
2012-11-13 09:29:22 +00:00
|
|
|
|
|
|
|
sudo zypper --non-interactive update --auto-agree-with-licenses
|
|
|
|
|
|
|
|
sudo zypper --non-interactive install --auto-agree-with-licenses \
|
|
|
|
gcc gcc-c++ libSDL-devel openal-soft-devel libpng12-devel libjpeg62-devel \
|
|
|
|
libtiff-devel OpenEXR-devel yasm libtheora-devel libvorbis-devel cmake \
|
2012-11-13 10:12:42 +00:00
|
|
|
scons patch
|
2012-11-13 09:29:22 +00:00
|
|
|
|
|
|
|
check_package_version_SUSE python3-devel 3.3.
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
sudo zypper --non-interactive install --auto-agree-with-licenses python3-devel
|
|
|
|
else
|
|
|
|
compile_Python
|
|
|
|
fi
|
|
|
|
|
|
|
|
# can not see boost_locale in repo, so let's build own boost
|
|
|
|
compile_Boost
|
|
|
|
|
|
|
|
# this libraries are also missing in the repo
|
|
|
|
compile_OCIO
|
|
|
|
compile_OIIO
|
|
|
|
compile_FFmpeg
|
|
|
|
}
|
|
|
|
|
2012-11-13 16:42:36 +00:00
|
|
|
print_info_ffmpeglink_DEB() {
|
|
|
|
_packages="libtheora-dev"
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $XVID_USE; then
|
|
|
|
_packages="$_packages $XVID_DEV"
|
2012-11-13 16:42:36 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $VPX_USE; then
|
2012-11-13 16:42:36 +00:00
|
|
|
_packages="$_packages libvpx-dev"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $MP3LAME_USE; then
|
2012-11-13 16:42:36 +00:00
|
|
|
_packages="$_packages libmp3lame-dev"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $X264_USE; then
|
2012-11-13 16:42:36 +00:00
|
|
|
_packages="$_packages libx264-dev"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $OPENJPEG_USE; then
|
2012-11-13 16:42:36 +00:00
|
|
|
_packages="$_packages libopenjpeg-dev"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $SCHRO_USE; then
|
2012-11-13 16:42:36 +00:00
|
|
|
_packages="$_packages libschroedinger-dev"
|
|
|
|
fi
|
|
|
|
|
2012-11-13 18:04:52 +00:00
|
|
|
dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | awk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
|
2012-11-13 16:42:36 +00:00
|
|
|
}
|
|
|
|
|
2012-11-14 21:57:47 +00:00
|
|
|
print_info_ffmpeglink_RPM() {
|
2012-11-14 23:20:16 +00:00
|
|
|
_packages="libtheora-devel libvorbis-devel"
|
2012-11-14 21:57:47 +00:00
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $XVID_USE; then
|
|
|
|
_packages="$_packages $XVID_DEV"
|
2012-11-14 21:57:47 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $VPX_USE; then
|
2012-11-14 21:57:47 +00:00
|
|
|
_packages="$_packages libvpx-devel"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $MP3LAME_USE; then
|
2012-11-14 21:57:47 +00:00
|
|
|
_packages="$_packages lame-devel"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $X264_USE; then
|
2012-11-14 21:57:47 +00:00
|
|
|
_packages="$_packages x264-devel"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $OPENJPEG_USE; then
|
2012-11-14 21:57:47 +00:00
|
|
|
_packages="$_packages openjpeg-devel"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if $SCHRO_USE; then
|
2012-11-14 21:57:47 +00:00
|
|
|
_packages="$_packages schroedinger-devel"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | awk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
|
|
|
|
}
|
|
|
|
|
2012-11-13 16:42:36 +00:00
|
|
|
print_info_ffmpeglink() {
|
|
|
|
# This func must only print a ';'-separated list of libs...
|
|
|
|
if [ -z "$DISTRO" ]; then
|
|
|
|
ERROR "Failed to detect distribution type"
|
|
|
|
exit 1
|
|
|
|
elif [ "$DISTRO" = "DEB" ]; then
|
|
|
|
print_info_ffmpeglink_DEB
|
2012-11-14 21:57:47 +00:00
|
|
|
elif [ "$DISTRO" = "RPM" ]; then
|
|
|
|
print_info_ffmpeglink_RPM
|
2012-11-13 16:42:36 +00:00
|
|
|
# XXX TODO!
|
|
|
|
else INFO "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
|
|
|
|
# elif [ "$DISTRO" = "SUSE" ]; then
|
|
|
|
# print_info_ffmpeglink_SUSE
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-11-12 19:39:09 +00:00
|
|
|
print_info() {
|
|
|
|
INFO ""
|
|
|
|
INFO "If you're using CMake add this to your configuration flags:"
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ -d $INST/boost ]; then
|
|
|
|
INFO " -D BOOST_ROOT=$INST/boost"
|
2012-11-12 19:39:09 +00:00
|
|
|
INFO " -D Boost_NO_SYSTEM_PATHS=ON"
|
|
|
|
fi
|
|
|
|
|
2012-11-16 17:14:01 +00:00
|
|
|
if [ -d $INST/osl ]; then
|
|
|
|
INFO " -D CYCLES_OSL=$INST/osl"
|
|
|
|
INFO " -D WITH_CYCLES_OSL=ON"
|
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ -d $INST/ffmpeg ]; then
|
2012-11-13 16:42:36 +00:00
|
|
|
INFO " -D WITH_CODEC_FFMPEG=ON"
|
2012-11-15 17:31:18 +00:00
|
|
|
INFO " -D FFMPEG=$INST/ffmpeg"
|
2012-11-14 23:20:16 +00:00
|
|
|
INFO " -D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;rt;`print_info_ffmpeglink`'"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
INFO ""
|
|
|
|
INFO "If you're using SCons add this to your user-config:"
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ -d $INST/python-3.3 ]; then
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "BF_PYTHON = '$INST/python-3.3'"
|
|
|
|
INFO "BF_PYTHON_ABI_FLAGS = 'm'"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ -d $INST/ocio ]; then
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "BF_OCIO = '$INST/ocio'"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ -d $INST/oiio ]; then
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "BF_OIIO = '$INST/oiio'"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ -d $INST/boost ]; then
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "BF_BOOST = '$INST/boost'"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-15 17:31:18 +00:00
|
|
|
if [ -d $INST/ffmpeg ]; then
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "BF_FFMPEG = '$INST/ffmpeg'"
|
2012-11-13 16:42:36 +00:00
|
|
|
_ffmpeg_list_sep=" "
|
2012-11-18 14:27:19 +00:00
|
|
|
INFO "BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice `print_info_ffmpeglink`'"
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
2012-11-18 14:27:19 +00:00
|
|
|
|
|
|
|
INFO ""
|
|
|
|
INFO ""
|
|
|
|
INFO "WARNING: If this script had to build boost into $INST, and you are dynamically linking "
|
|
|
|
INFO " blender against it, you will have to run those commands as root user:"
|
|
|
|
INFO ""
|
|
|
|
INFO " echo \"$INST/boost/lib\" > /etc/ld.so.conf.d/boost.conf"
|
|
|
|
INFO " ldconfig"
|
|
|
|
INFO ""
|
2012-11-12 19:39:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Detect distributive type used on this machine
|
|
|
|
detect_distro
|
|
|
|
|
|
|
|
if [ -z "$DISTRO" ]; then
|
2012-11-13 16:42:36 +00:00
|
|
|
ERROR "Failed to detect distribution type"
|
2012-11-12 19:39:09 +00:00
|
|
|
exit 1
|
|
|
|
elif [ "$DISTRO" = "DEB" ]; then
|
|
|
|
install_DEB
|
|
|
|
elif [ "$DISTRO" = "RPM" ]; then
|
|
|
|
install_RPM
|
2012-11-13 09:29:22 +00:00
|
|
|
elif [ "$DISTRO" = "SUSE" ]; then
|
|
|
|
install_SUSE
|
2012-11-12 19:39:09 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
print_info
|
2012-11-13 10:49:55 +00:00
|
|
|
|
|
|
|
# Switch back to user language.
|
|
|
|
LANG=LANG_BACK
|
|
|
|
export LANG
|