[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52700] trunk/blender/build_files/ build_environment/install_deps.sh: Various "user-friendly" edits, mostly adding command-line args parsing...
Bastien Montagne
montagne29 at wanadoo.fr
Sat Dec 1 19:07:46 CET 2012
Revision: 52700
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52700
Author: mont29
Date: 2012-12-01 18:07:45 +0000 (Sat, 01 Dec 2012)
Log Message:
-----------
Various "user-friendly" edits, mostly adding command-line args parsing... So now you can try to build OSL with just install_deps.sh --with-osl
Modified Paths:
--------------
trunk/blender/build_files/build_environment/install_deps.sh
Modified: trunk/blender/build_files/build_environment/install_deps.sh
===================================================================
--- trunk/blender/build_files/build_environment/install_deps.sh 2012-12-01 14:23:44 UTC (rev 52699)
+++ trunk/blender/build_files/build_environment/install_deps.sh 2012-12-01 18:07:45 UTC (rev 52700)
@@ -1,13 +1,20 @@
#!/bin/bash
+# Parse command line!
+ARGS=$( \
+getopt \
+-o s:i:t:h \
+--long source:,install:,threads:,help,with-osl,all-static,force-python,force-boost,\
+force-ocio,force-oiio,force-llvm,force-osl,force-ffmpeg \
+-- "$@" \
+)
+
DISTRO=""
SRC="$HOME/src/blender-deps"
INST="/opt/lib"
CWD=$PWD
-# OSL is horror for manual building even
-# i would want it to be setteled for manual build first,
-# and only then do it automatically
+# Do not yet enable osl, use --build-osl option to try it.
BUILD_OSL=false
# Try to link everything statically. Use this to produce protable versions of blender.
@@ -18,45 +25,52 @@
THREADS=1
fi
-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 begining of this script if you want to use other paths!
+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 begining of this script,
+or use --source/--install options, if you want to use other paths!
-Number of threads for building: $THREADS.
-Building OSL: $BUILD_OSL (edit \$BUILD_OSL var to change this).
-All static linking: $ALL_STATIC (edit \$ALL_STATIC var to change this)."
+Number of threads for building: \$THREADS (automatically detected, use --threads=<nbr> to override it).
+Building OSL: \$BUILD_OSL (use --with-osl option to enable it).
+All static linking: \$ALL_STATIC (use --all-static option to enable it).\""
-
PYTHON_VERSION="3.3.0"
PYTHON_VERSION_MIN="3.3"
PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2"
+PYTHON_FORCE_REBUILD=false
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"
+BOOST_FORCE_REBUILD=false
OCIO_VERSION="1.0.7"
OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
OCIO_VERSION_MIN="1.0"
+OCIO_FORCE_REBUILD=false
OIIO_VERSION="1.1.1"
OIIO_SOURCE="https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_VERSION"
OIIO_VERSION_MIN="1.1"
+OIIO_FORCE_REBUILD=false
LLVM_VERSION="3.1"
LLVM_VERSION_MIN="3.0"
LLVM_VERSION_FOUND=""
LLVM_SOURCE="http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz"
LLVM_CLANG_SOURCE="http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz"
+LLVM_FORCE_REBUILD=false
# OSL needs to be compiled for now!
OSL_VERSION="1.2.0"
OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage/archive/blender-fixes.tar.gz"
+OSL_FORCE_REBUILD=false
FFMPEG_VERSION="1.0"
FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
FFMPEG_VERSION_MIN="0.7.6"
+FFMPEG_FORCE_REBUILD=false
_ffmpeg_list_sep=";"
# FFMPEG optional libs.
@@ -84,14 +98,86 @@
LANG=""
export LANG
+
+_echo() {
+ if [ "X$1" = "X-n" ]; then
+ shift; printf "%s" "$@"
+ else
+ printf "%s\n" "$@"
+ fi
+}
+
ERROR() {
- echo "${@}"
+ _echo "$@"
}
INFO() {
- echo "${@}"
+ _echo "$@"
}
+# 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
+ ;;
+ -t|--threads)
+ THREADS="$2"; shift; shift; continue
+ ;;
+ -h|--help)
+ INFO ""
+ INFO "USAGE:"
+ INFO ""
+ INFO "`eval _echo "$COMMON_INFO"`"
+ INFO ""
+ exit 0
+ ;;
+ --with-osl)
+ BUILD_OSL=true; shift; continue
+ ;;
+ --all-static)
+ ALL_STATIC=true; shift; continue
+ ;;
+ --force-python)
+ PYTHON_FORCE_REBUILD=true; shift; continue
+ ;;
+ --force-boost)
+ BOOST_FORCE_REBUILD=true; shift; continue
+ ;;
+ --force-ocio)
+ OCIO_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-ffmpeg)
+ FFMPEG_FORCE_REBUILD=true; shift; continue
+ ;;
+ --)
+ # no more arguments to parse
+ break
+ ;;
+ *)
+ INFO ""
+ INFO "Wrong parameter! Usage:"
+ INFO ""
+ INFO "`eval _echo "$COMMON_INFO"`"
+ INFO ""
+ exit 1
+ ;;
+ esac
+done
+
# 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() {
@@ -139,7 +225,7 @@
# $1 and $2 should be version numbers made of numbers only.
version_ge() {
version_eq $1 $2
- if [ $? -eq 1 -a $(echo -e "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then
+ if [ $? -eq 1 -a $(_echo "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then
return 1
else
return 0
@@ -221,7 +307,7 @@
# Clean install if needed!
magic_compile_check python-$PYTHON_VERSION $py_magic
- if [ $? -eq 1 ]; then
+ if [ $? -eq 1 -o $PYTHON_FORCE_REBUILD == true ]; then
rm -rf $_inst
fi
@@ -258,9 +344,10 @@
magic_compile_set python-$PYTHON_VERSION $py_magic
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, delete the '$_src' and '$_inst' directories."
+ INFO "If you want to force rebuild of this lib, use the --force-python option."
fi
}
@@ -273,7 +360,7 @@
# Clean install if needed!
magic_compile_check boost-$BOOST_VERSION $boost_magic
- if [ $? -eq 1 ]; then
+ if [ $? -eq 1 -o $BOOST_FORCE_REBUILD == true ]; then
rm -rf $_inst
fi
@@ -307,10 +394,15 @@
magic_compile_set boost-$BOOST_VERSION $boost_magic
+ # Rebuild dependecies as well!
+ OIIO_FORCE_REBUILD=true
+ OSL_FORCE_REBUILD=true
+
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, delete the '$_src' and '$_inst' directories."
+ INFO "If you want to force rebuild of this lib, use the --force-boost option."
fi
}
@@ -323,7 +415,7 @@
# Clean install if needed!
magic_compile_check ocio-$OCIO_VERSION $ocio_magic
- if [ $? -eq 1 ]; then
+ if [ $? -eq 1 -o $OCIO_FORCE_REBUILD == true ]; then
rm -rf $_inst
fi
@@ -387,9 +479,10 @@
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, delete the '$_src' and '$_inst' directories."
+ INFO "If you want to force rebuild of this lib, use the --force-ocio option."
fi
}
@@ -402,7 +495,7 @@
# Clean install if needed!
magic_compile_check oiio-$OIIO_VERSION $oiio_magic
- if [ $? -eq 1 ]; then
+ if [ $? -eq 1 -o $OIIO_FORCE_REBUILD == true ]; then
rm -rf $_inst
fi
@@ -495,10 +588,14 @@
magic_compile_set oiio-$OIIO_VERSION $oiio_magic
+ # Rebuild dependecies as well!
+ OSL_FORCE_REBUILD=true
+
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, delete the '$_src' and '$_inst' directories."
+ INFO "If you want to force rebuild of this lib, use the --force-oiio option."
fi
}
@@ -512,7 +609,7 @@
# Clean install if needed!
magic_compile_check llvm-$LLVM_VERSION $llvm_magic
- if [ $? -eq 1 ]; then
+ if [ $? -eq 1 -o $LLVM_FORCE_REBUILD == true ]; then
rm -rf $_inst
rm -rf $_inst_clang
fi
@@ -588,10 +685,14 @@
magic_compile_set llvm-$LLVM_VERSION $llvm_magic
+ # Rebuild dependecies as well!
+ OSL_FORCE_REBUILD=true
+
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, delete the '$_src' and '$_inst' directories."
+ INFO "If you want to force rebuild of this lib, use the --force-llvm option."
fi
}
@@ -604,7 +705,7 @@
# Clean install if needed!
magic_compile_check osl-$OSL_VERSION $osl_magic
- if [ $? -eq 1 ]; then
+ if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
rm -rf $_inst
fi
@@ -679,9 +780,10 @@
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, delete the '$_src' and '$_inst' directories."
+ INFO "If you want to force rebuild of this lib, use the --force-osl option."
fi
}
@@ -694,7 +796,7 @@
# Clean install if needed!
magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic
- if [ $? -eq 1 ]; then
+ if [ $? -eq 1 -o $FFMPEG_FORCE_REBUILD == true ]; then
rm -rf $_inst
fi
@@ -777,9 +879,10 @@
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, delete the '$_src' and '$_inst' directories."
+ INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
fi
}
@@ -822,8 +925,9 @@
install_DEB() {
INFO ""
INFO "Installing dependencies for DEB-based distribution"
- INFO "$COMMON_INFO"
INFO ""
+ INFO "`eval _echo "$COMMON_INFO"`"
+ INFO ""
if [ ! -z "`cat /etc/debian_version | grep ^6`" ]; then
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list