[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57020] trunk/blender/build_files/ build_environment/install_deps.sh: Some cleanup/reorganisation, and:

Bastien Montagne montagne29 at wanadoo.fr
Sat May 25 16:49:30 CEST 2013


Revision: 57020
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57020
Author:   mont29
Date:     2013-05-25 14:49:29 +0000 (Sat, 25 May 2013)
Log Message:
-----------
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

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	2013-05-25 14:20:53 UTC (rev 57019)
+++ trunk/blender/build_files/build_environment/install_deps.sh	2013-05-25 14:49:29 UTC (rev 57020)
@@ -19,6 +19,8 @@
 
 # A shell script installing/building all needed dependencies to build Blender, for some Linux distributions.
 
+##### Args and Help Handling #####
+
 # Parse command line!
 ARGS=$( \
 getopt \
@@ -172,6 +174,8 @@
     --skip-ffmpeg
         Unconditionally skip FFMpeg installation/building.\""
 
+##### Main Vars #####
+
 PYTHON_VERSION="3.3.0"
 PYTHON_VERSION_MIN="3.3"
 PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2"
@@ -190,6 +194,7 @@
 BOOST_VERSION_MIN="1.49"
 BOOST_FORCE_REBUILD=false
 BOOST_SKIP=false
+_need_boost_ldconfig=false
 
 OCIO_VERSION="1.0.7"
 OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
@@ -211,6 +216,7 @@
 OIIO_VERSION_MIN="1.1"
 OIIO_FORCE_REBUILD=false
 OIIO_SKIP=false
+_need_oiio_ldconfig=false
 
 LLVM_VERSION="3.1"
 LLVM_VERSION_MIN="3.0"
@@ -262,6 +268,7 @@
 LANG=""
 export LANG
 
+##### Generic Helpers #####
 
 _echo() {
   if [ "X$1" = "X-n" ]; then
@@ -279,6 +286,8 @@
   _echo "$@"
 }
 
+##### Args Handling #####
+
 # Finish parsing the commandline args.
 eval set -- "$ARGS"
 while true; do
@@ -414,6 +423,8 @@
   WITH_OPENCOLLADA=true
 fi
 
+##### Generic Helpers #####
+
 # 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() {
@@ -498,28 +509,7 @@
   return $ret
 }
 
-detect_distro() {
-  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
-}
-
+##### Generic compile helpers #####
 prepare_opt() {
   INFO "Ensuring $INST exists and is writable by us"
   if [ ! -d  $INST ]; then
@@ -546,17 +536,41 @@
   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() {
   # To be changed each time we make edits that would modify the compiled result!
   py_magic=0
+  _init_python
 
-  _src=$SRC/Python-$PYTHON_VERSION
-  _inst=$INST/python-$PYTHON_VERSION
-
   # Clean install if needed!
   magic_compile_check python-$PYTHON_VERSION $py_magic
   if [ $? -eq 1 -o $PYTHON_FORCE_REBUILD == true ]; then
-    rm -rf $_inst
+    clean_Python
   fi
 
   if [ ! -d $_inst ]; then
@@ -582,8 +596,7 @@
     make clean
 
     if [ -d $_inst ]; then
-      rm -f $INST/python-3.3
-      ln -s python-$PYTHON_VERSION $INST/python-3.3
+      _create_inst_shortcut
     else
       ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
       exit 1
@@ -599,19 +612,29 @@
   fi
 }
 
-compile_Numpy() {
-  # To be changed each time we make edits that would modify the compiled result!
-  py_magic=0
-
+##### Build Numpy #####
+_init_numpy() {
   _src=$SRC/numpy-$NUMPY_VERSION
   _inst=$INST/numpy-$NUMPY_VERSION
   _python=$INST/python-$PYTHON_VERSION
   _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!
   magic_compile_check numpy-$NUMPY_VERSION $py_magic
   if [ $? -eq 1 -o $NUMPY_FORCE_REBUILD == true ]; then
-    rm -rf $_inst
+    clean_Numpy
   fi
 
   if [ ! -d $_inst ]; then
@@ -632,8 +655,9 @@
     $_python/bin/python3 setup.py install --prefix=$_inst
 
     if [ -d $_inst ]; then
-      rm -f $_python/$_site/numpy
-      ln -s $_inst/$_site/numpy $_python/$_site/numpy
+      # Can't use _create_inst_shortcut here...
+      rm -f $_inst_shortcut
+      ln -s $_inst/$_site/numpy $_inst_shortcut
     else
       ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting"
       exit 1
@@ -649,17 +673,28 @@
   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() {
   # To be changed each time we make edits that would modify the compiled result!
   boost_magic=7
 
-  _src=$SRC/boost-$BOOST_VERSION
-  _inst=$INST/boost-$BOOST_VERSION
+  _init_boost
 
   # Clean install if needed!
   magic_compile_check boost-$BOOST_VERSION $boost_magic
   if [ $? -eq 1 -o $BOOST_FORCE_REBUILD == true ]; then
-    rm -rf $_inst
+    clean_Boost
   fi
 
   if [ ! -d $_inst ]; then
@@ -687,8 +722,7 @@
     ./b2 --clean
 
     if [ -d $_inst ]; then
-      rm -f $INST/boost
-      ln -s boost-$BOOST_VERSION $INST/boost
+      _create_inst_shortcut
     else
       ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
       exit 1
@@ -696,6 +730,9 @@
 
     magic_compile_set boost-$BOOST_VERSION $boost_magic
 
+    # Just always run it, much simpler this way!
+    _need_boost_ldconfig=true
+
     cd $CWD
     INFO "Done compiling Boost-$BOOST_VERSION!"
   else
@@ -704,17 +741,27 @@
   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() {
   # To be changed each time we make edits that would modify the compiled result!
   ocio_magic=1
+  _init_ocio
 
-  _src=$SRC/OpenColorIO-$OCIO_VERSION
-  _inst=$INST/ocio-$OCIO_VERSION
-
   # Clean install if needed!
   magic_compile_check ocio-$OCIO_VERSION $ocio_magic
   if [ $? -eq 1 -o $OCIO_FORCE_REBUILD == true ]; then
-    rm -rf $_inst
+    clean_OCIO
   fi
 
   if [ ! -d $_inst ]; then
@@ -767,8 +814,7 @@
     make clean
 
     if [ -d $_inst ]; then
-      rm -f $INST/ocio
-      ln -s ocio-$OCIO_VERSION $INST/ocio
+      _create_inst_shortcut
     else
       ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
       exit 1
@@ -784,20 +830,29 @@
   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() {
   # To be changed each time we make edits that would modify the compiled result!
   ilmbase_magic=5
+  _init_ilmbase
 
-  _src=$SRC/ILMBase-$ILMBASE_VERSION
-  _inst=$TMP/ilmbase-$ILMBASE_VERSION
-
   # Clean install if needed!
   magic_compile_check ilmbase-$ILMBASE_VERSION $ilmbase_magic
 
   if [ $? -eq 1 -o $OPENEXR_FORCE_REBUILD == true ]; then
-    rm -rf $_src
+    clean_ILMBASE
     rm -rf $_openexr_inst
-    rm -rf $_inst
   fi
 
   if [ ! -d $_openexr_inst ]; then
@@ -862,8 +917,7 @@
     make clean
 
     if [ -d $_inst ]; then
-      rm -f $TMP/ilmbase
-      ln -s ilmbase-$ILMBASE_VERSION $TMP/ilmbase
+      _create_inst_shortcut
     else
       ERROR "ILMBase-$ILMBASE_VERSION failed to compile, exiting"
       exit 1
@@ -879,23 +933,34 @@
   INFO "Done compiling ILMBase-$ILMBASE_VERSION!"
 }
 
+#### Build OpenEXR ####
+_init_openexr() {
+  _src=$SRC/OpenEXR-$OPENEXR_VERSION
+  _inst=$_openexr_inst
+  _inst_shortcut=$INST/openexr
+}
+
+clean_OPENEXR() {
+  clean_ILMBASE
+  _init_openexr
+  _clean
+}
+
 compile_OPENEXR() {
-  _openexr_inst=$INST/openexr-$OPENEXR_VERSION
-  compile_ILMBASE
-
   # To be changed each time we make edits that would modify the compiled result!
   openexr_magic=10
 
-  _src=$SRC/OpenEXR-$OPENEXR_VERSION
-  _inst=$_openexr_inst
-
   # Clean install if needed!
   magic_compile_check openexr-$OPENEXR_VERSION $openexr_magic
   if [ $? -eq 1 -o $OPENEXR_FORCE_REBUILD == true ]; then
-    rm -rf $_src
-    rm -rf $_inst
+    clean_OPENEXR
   fi
 
+  _openexr_inst=$INST/openexr-$OPENEXR_VERSION
+  compile_ILMBASE
+  _ilmbase_inst=$_inst_shortcut
+  _init_openexr
+
   if [ ! -d $_inst ]; then
     INFO "Building OpenEXR-$OPENEXR_VERSION"
 
@@ -1039,7 +1104,7 @@
     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 ILMBASE_PACKAGE_PREFIX=$TMP/ilmbase"
+    cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst"
 
     if file /bin/cp | grep -q '32-bit'; then
       cflags="-fPIC -m32 -march=i686"
@@ -1057,10 +1122,9 @@
     make clean
 
     if [ -d $_inst ]; then
-      rm -f $INST/openexr
-      ln -s openexr-$OPENEXR_VERSION $INST/openexr
+      _create_inst_shortcut
       # 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
       ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
       exit 1
@@ -1078,18 +1142,27 @@
   _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() {
   # To be changed each time we make edits that would modify the compiled result!
   oiio_magic=11
+  _init_oiio
 
-  _src=$SRC/OpenImageIO-$OIIO_VERSION
-  _inst=$INST/oiio-$OIIO_VERSION
-
   # Clean install if needed!
   magic_compile_check oiio-$OIIO_VERSION $oiio_magic
   if [ $? -eq 1 -o $OIIO_FORCE_REBUILD == true ]; then
-    rm -rf $_src
-    rm -rf $_inst
+    clean_OIIO
   fi
 
   if [ ! -d $_inst ]; then
@@ -1311,8 +1384,7 @@
     make clean
 
     if [ -d $_inst ]; then
-      rm -f $INST/oiio
-      ln -s oiio-$OIIO_VERSION $INST/oiio
+      _create_inst_shortcut
     else
       ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
       exit 1
@@ -1320,6 +1392,9 @@
 
     magic_compile_set oiio-$OIIO_VERSION $oiio_magic
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list