[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53534] trunk/blender/build_files: Patch from Ejner Fergo: enhancements to install_deps.sh.

Bastien Montagne montagne29 at wanadoo.fr
Thu Jan 3 16:35:50 CET 2013


Revision: 53534
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53534
Author:   mont29
Date:     2013-01-03 15:35:46 +0000 (Thu, 03 Jan 2013)
Log Message:
-----------
Patch from Ejner Fergo: enhancements to install_deps.sh.
Mostly, it:
* Adds numpy and opencollada
* Merges both Suse and Fedora/Redhat into a single func (not sure this is a good idea, but would have been to painful to undo this).

Notes:
* I changed a bit how numpy is handled, so that the script does not try to build it when py3.3 was installed from package!
* Bumped oiio 'magic number', as now trying to use libtiff5 means we have to rebuild everything using tiff!
* Only made a quick test on my own system, but Ejner made quite some extensive ones, so it should be safe.
* I?\226?\128?\153m not sure keeping on extending that horrible bash thing is a good idea. Shell scripts are nice for small, limited stuff, but I personnaly find that one (over 53ko!) unreadable and a pita to maintain. Further more, doing the same for windows would mean to rewrite everything in another language... I have started work to port this as a py3 script, so that we have a nice structure (classes...) easy to extend/tweak/implement in various OSs/etc.!

Modified Paths:
--------------
    trunk/blender/build_files/build_environment/install_deps.sh
    trunk/blender/build_files/cmake/Modules/FindOpenCOLLADA.cmake

Modified: trunk/blender/build_files/build_environment/install_deps.sh
===================================================================
--- trunk/blender/build_files/build_environment/install_deps.sh	2013-01-03 15:15:51 UTC (rev 53533)
+++ trunk/blender/build_files/build_environment/install_deps.sh	2013-01-03 15:35:46 UTC (rev 53534)
@@ -1,16 +1,37 @@
-#!/bin/bash
+#!/usr/bin/env bash
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
 
+# A shell script installing/building all needed dependencies to build Blender, for some Linux distributions.
+
 # Parse command line!
 ARGS=$( \
 getopt \
 -o s:i:t:h \
---long source:,install:,threads:,help,with-all,with-osl,all-static,force-all,force-python,\
-force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-ffmpeg,\
-skip-python,skip-boost,skip-ocio,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg \
+--long source:,install:,threads:,help,with-all,with-osl,with-opencollada,all-static,force-all,\
+force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-opencollada,\
+force-ffmpeg,skip-python,skip-numpy,skip-boost,skip-ocio,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg,\
+skip-opencollada \
 -- "$@" \
 )
 
 DISTRO=""
+RPM=""
 SRC="$HOME/src/blender-deps"
 INST="/opt/lib"
 CWD=$PWD
@@ -21,6 +42,9 @@
 # Do not yet enable osl, use --with-osl (or --with-all) option to try it.
 WITH_OSL=false
 
+# Do not yet enable opencollada, use --with-opencollada (or --with-all) option to try it.
+WITH_OPENCOLLADA=false
+
 # Try to link everything statically. Use this to produce portable versions of blender.
 ALL_STATIC=false
 
@@ -37,8 +61,12 @@
 Number of threads for building: \$THREADS (automatically detected, use --threads=<nbr> to override it).
 Full install: \$WITH_ALL (use --with-all option to enable it).
 Building OSL: \$WITH_OSL (use --with-osl option to enable it).
+Building OpenCOLLADA: \$WITH_OPENCOLLADA (use --with-opencollada option to enable it).
 All static linking: \$ALL_STATIC (use --all-static option to enable it).
 
+Example:
+Full install without OpenCOLLADA: --with-all --skip-opencollada
+
 Use --help to show all available options!\""
 
 ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
@@ -64,6 +92,9 @@
         Try to install or build the OpenShadingLanguage libraries (and their dependencies).
         Still experimental!
 
+    --with-opencollada
+        Build and install the OpenCOLLADA libraries.
+
     --all-static
         Build libraries as statically as possible, to create static builds of Blender.
 
@@ -73,6 +104,9 @@
     --force-python
         Force the rebuild of Python.
 
+    --force-numpy
+        Force the rebuild of NumPy.
+
     --force-boost
         Force the rebuild of Boost.
 
@@ -88,6 +122,9 @@
     --force-osl
         Force the rebuild of OpenShadingLanguage.
 
+    --force-opencollada
+        Force the rebuild of OpenCOLLADA.
+
     --force-ffmpeg
         Force the rebuild of FFMpeg.
 
@@ -101,6 +138,9 @@
     --skip-python
         Unconditionally skip Python installation/building.
 
+    --skip-numpy
+        Unconditionally skip NumPy installation/building.
+
     --skip-boost
         Unconditionally skip Boost installation/building.
 
@@ -116,6 +156,9 @@
     --skip-osl
         Unconditionally skip OpenShadingLanguage installation/building.
 
+    --skip-opencollada
+        Unconditionally skip OpenCOLLADA installation/building.
+
     --skip-ffmpeg
         Unconditionally skip FFMpeg installation/building.\""
 
@@ -125,6 +168,13 @@
 PYTHON_FORCE_REBUILD=false
 PYTHON_SKIP=false
 
+#Could not get numpy-1.6.2 to compile with python-3.3
+NUMPY_VERSION="1.7.0rc1"
+NUMPY_VERSION_MIN="1.7"
+NUMPY_SOURCE="http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz"
+NUMPY_FORCE_REBUILD=false
+NUMPY_SKIP=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"
@@ -158,6 +208,12 @@
 OSL_FORCE_REBUILD=false
 OSL_SKIP=false
 
+# Version??
+OPENCOLLADA_VERSION="1.3"
+OPENCOLLADA_SOURCE="https://github.com/KhronosGroup/OpenCOLLADA.git"
+OPENCOLLADA_FORCE_REBUILD=false
+OPENCOLLADA_SKIP=false
+
 FFMPEG_VERSION="1.0"
 FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
 FFMPEG_VERSION_MIN="0.7.6"
@@ -236,22 +292,30 @@
     --with-osl)
       WITH_OSL=true; shift; continue
     ;;
+    --with-opencollada)
+      WITH_OPENCOLLADA=true; shift; continue
+    ;;
     --all-static)
       ALL_STATIC=true; shift; continue
     ;;
     --force-all)
       PYTHON_FORCE_REBUILD=true
+      NUMPY_FORCE_REBUILD=true
       BOOST_FORCE_REBUILD=true
       OCIO_FORCE_REBUILD=true
       OIIO_FORCE_REBUILD=true
       LLVM_FORCE_REBUILD=true
       OSL_FORCE_REBUILD=true
+      OPENCOLLADA_FORCE_REBUILD=true
       FFMPEG_FORCE_REBUILD=true
       shift; continue
     ;;
     --force-python)
       PYTHON_FORCE_REBUILD=true; shift; continue
     ;;
+    --force-numpy)
+      NUMPY_FORCE_REBUILD=true; shift; continue
+    ;;
     --force-boost)
       BOOST_FORCE_REBUILD=true; shift; continue
     ;;
@@ -267,12 +331,18 @@
     --force-osl)
       OSL_FORCE_REBUILD=true; shift; continue
     ;;
+    --force-opencollada)
+      OPENCOLLADA_FORCE_REBUILD=true; shift; continue
+    ;;
     --force-ffmpeg)
       FFMPEG_FORCE_REBUILD=true; shift; continue
     ;;
     --skip-python)
       PYTHON_SKIP=true; shift; continue
     ;;
+    --skip-numpy)
+      NUMPY_SKIP=true; shift; continue
+    ;;
     --skip-boost)
       BOOST_SKIP=true; shift; continue
     ;;
@@ -288,6 +358,9 @@
     --skip-osl)
       OSL_SKIP=true; shift; continue
     ;;
+    --skip-opencollada)
+      OPENCOLLADA_SKIP=true; shift; continue
+    ;;
     --skip-ffmpeg)
       FFMPEG_SKIP=true; shift; continue
     ;;
@@ -308,6 +381,7 @@
 
 if $WITH_ALL; then
   WITH_OSL=true
+  WITH_OPENCOLLADA=true
 fi
 
 # Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
@@ -397,10 +471,22 @@
 detect_distro() {
   if [ -f /etc/debian_version ]; then
     DISTRO="DEB"
-  elif [ -f /etc/redhat-release ]; then
+  elif [ -f /etc/redhat-release -o /etc/SuSE-release ]; then
     DISTRO="RPM"
+  elif [ -f /etc/arch-release ]; then
+    DISTRO="ARCH"
+  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
-    DISTRO="SUSE"
+    RPM="SUSE"
   fi
 }
 
@@ -483,6 +569,56 @@
   fi
 }
 
+compile_Numpy() {
+  # To be changed each time we make edits that would modify the compiled result!
+  py_magic=0
+
+  _src=$SRC/numpy-$NUMPY_VERSION
+  _inst=$INST/numpy-$NUMPY_VERSION
+  _python=$INST/python-$PYTHON_VERSION
+  _site=lib/python3.3/site-packages
+
+  # Clean install if needed!
+  magic_compile_check numpy-$NUMPY_VERSION $py_magic
+  if [ $? -eq 1 -o $NUMPY_FORCE_REBUILD == true ]; then
+    rm -rf $_inst
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building Numpy-$NUMPY_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      mkdir -p $SRC
+      wget -c $NUMPY_SOURCE -O $_src.tar.gz
+
+      INFO "Unpacking Numpy-$NUMPY_VERSION"
+      tar -C $SRC -xf $_src.tar.gz
+    fi
+
+    cd $_src
+
+    $_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
+    else
+      ERROR "Numpy-$NUMPY_VERSION failed to compile, exiting"
+      exit 1
+    fi
+
+    magic_compile_set numpy-$NUMPY_VERSION $py_magic
+
+    cd $CWD
+    INFO "Done compiling Numpy-$NUMPY_VERSION!"
+  else
+    INFO "Own Numpy-$NUMPY_VERSION is up to date, nothing to do!"
+    INFO "If you want to force rebuild of this lib, use the --force-numpy option."
+  fi
+}
+
 compile_Boost() {
   # To be changed each time we make edits that would modify the compiled result!
   boost_magic=7
@@ -620,7 +756,7 @@
 
 compile_OIIO() {
   # To be changed each time we make edits that would modify the compiled result!
-  oiio_magic=6
+  oiio_magic=7
 
   _src=$SRC/OpenImageIO-$OIIO_VERSION
   _inst=$INST/oiio-$OIIO_VERSION
@@ -797,6 +933,7 @@
     cmake_d="-D CMAKE_BUILD_TYPE=Release"
     cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
     cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
+    cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
 
     if [ -d $_FFI_INCLUDE_DIR ]; then
       cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
@@ -920,6 +1057,70 @@
   fi
 }
 
+compile_OpenCOLLADA() {
+  # To be changed each time we make edits that would modify the compiled results!
+  opencollada_magic=5
+
+  _src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
+  _inst=$INST/opencollada-$OPENCOLLADA_VERSION
+
+  # Clean install if needed!
+  magic_compile_check opencollada-$OPENCOLLADA_VERSION $opencollada_magic
+  if [ $? -eq 1 -o $OPENCOLLADA_FORCE_REBUILD == true ]; then
+    rm -rf $_inst
+  fi
+
+  if [ ! -d $_inst ]; then
+    INFO "Building OpenCOLLADA-$OPENCOLLADA_VERSION"
+
+    prepare_opt
+
+    if [ ! -d $_src ]; then
+      mkdir -p $SRC
+      git clone $OPENCOLLADA_SOURCE $_src
+    fi
+
+    cd $_src
+
+    # XXX For now, always update from latest repo...
+    git pull origin
+
+    # Always refresh the whole build!
+    if [ -d build ]; then
+      rm -rf build
+    fi
+    mkdir build
+    cd build
+
+    cmake_d="-D CMAKE_BUILD_TYPE=Release"
+    cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
+    cmake_d="$cmake_d -D USE_EXPAT=OFF"
+    cmake_d="$cmake_d -D USE_LIBXML=ON"
+    cmake_d="$cmake_d -D USE_STATIC=ON"
+
+    cmake $cmake_d ../
+
+    make -j$THREADS && make install
+    make clean
+
+    if [ -d $_inst ]; then
+      rm -f $INST/opencollada

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list