[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52240] trunk/blender: Another nuch of fixes/improvements to install_deps script, among which:

Bastien Montagne montagne29 at wanadoo.fr
Thu Nov 15 18:31:18 CET 2012


Revision: 52240
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52240
Author:   mont29
Date:     2012-11-15 17:31:18 +0000 (Thu, 15 Nov 2012)
Log Message:
-----------
Another nuch of fixes/improvements to install_deps script, among which:
*New $INST variable to easily change the installation root dir of compiled libs.
*Better handling of versions for debian (DEB) too (and fix a bug for fedora (RPM) ones).
*Enhancements/fixes to compile_FOO funcs:
**Most notable, we now can force a recompile when we change something into these funcs, so user will always have latest-instructions compiled libs (else, he would have have to manually remove lib dirs under $INST...)
*General naming cleanup inside script (still wip).

Also adding boost date_time lib to linux in cmake file (why wasn't it there???).

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/build_files/build_environment/install_deps.sh

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2012-11-15 17:16:27 UTC (rev 52239)
+++ trunk/blender/CMakeLists.txt	2012-11-15 17:31:18 UTC (rev 52240)
@@ -661,7 +661,7 @@
 			else()
 				set(Boost_USE_MULTITHREADED ON)
 			endif()
-			set(__boost_packages filesystem regex system thread)
+			set(__boost_packages filesystem regex system thread date_time)
 			if (WITH_INTERNATIONAL)
 				list(APPEND __boost_packages locale)
 			endif()

Modified: trunk/blender/build_files/build_environment/install_deps.sh
===================================================================
--- trunk/blender/build_files/build_environment/install_deps.sh	2012-11-15 17:16:27 UTC (rev 52239)
+++ trunk/blender/build_files/build_environment/install_deps.sh	2012-11-15 17:31:18 UTC (rev 52240)
@@ -2,25 +2,58 @@
 
 DISTRO=""
 SRC="$HOME/src/blender-deps"
+INST="/opt/lib"
 CWD=$PWD
 
 THREADS=`cat /proc/cpuinfo | grep cores | uniq | sed -e "s/.*: *\(.*\)/\\1/"`
 
 PYTHON_VERSION="3.3.0"
-BOOST_VERSION="1_51_0"
+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"
+
+OCIO_VERSION="1.0.7"
+OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION"
+OCIO_VERSION_MIN="1.0"
+
 OIIO_VERSION="1.1.0"
-OCIO_VERSION="1.0.7"
+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"
+OSL_SOURCE="https://github.com/DingTo/OpenShadingLanguage/archive/blender-fixes.zip"
+
 FFMPEG_VERSION="1.0"
+FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
+FFMPEG_VERSION_MIN="0.7.6"
 _ffmpeg_list_sep=";"
 
-# XXX Looks like ubuntu has libxvidcore4-dev, while debian has libxvidcore-dev...
-HASXVID=false
-XVIDDEV=""
-HASVPX=false
-HASMP3LAME=false
-HASX264=false
-HASOPENJPEG=false
-HASSCHRO=false
+# 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=""
+VPX_USE=false
+VPX_VERSION_MIN=0.9.7
+VPX_DEV=""
+MP3LAME_USE=false
+MP3LAME_DEV=""
+OPENJPEG_USE=false
+OPENJPEG_DEV=""
 
 # Switch to english language, else some things (like check_package_DEB()) won't work!
 LANG_BACK=$LANG
@@ -35,17 +68,17 @@
   echo "${@}"
 }
 
-# Return 1 if $1 >= $2, else 0.
+# Return 0 if $1 >= $2, else 1.
 # $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
+  else
     return 0
-  else
-    return 1
   fi
 }
 
-# Return 1 if $1 is into $2 (e.g. 3.3.2 is into 3.3, but not 3.3.0 or 3.3.5)
+# 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.
 # $1 and $2 should be version numbers made of numbers only.
 # $1 should be at least as long as $2!
 version_match() {
@@ -56,16 +89,16 @@
   arr1=( $1 )
   arr2=( $2 )
 
-  ret=0
+  ret=1
 
   count1=${#arr1[@]}
   count2=${#arr2[@]}
   if [ $count1 -ge $count2 ]; then
-    ret=1
+    ret=0
     for (( i=0; $i < $count2; i++ ))
     do
       if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
-        ret=0
+        ret=1
         break
       fi
     done
@@ -86,21 +119,44 @@
 }
 
 prepare_opt() {
-  INFO "Ensuring /opt/lib exists and writable by us"
-  sudo mkdir -p /opt/lib
-  sudo chown $USER /opt/lib
-  sudo chmod 775 /opt/lib
+  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
+}
+
 compile_Python() {
-  if [ ! -d /opt/lib/python-$PYTHON_VERSION ]; then
+  # To be changed each time we make edits that would modify the compiled result!
+  py_magic=0
+
+  # Clean install if needed!
+  magic_compile_check python-$PYTHON_VERSION $py_magic
+  if [ $? -eq 1 ]; then
+    rm -rf $INST/python-$PYTHON_VERSION
+  fi
+
+  if [ ! -d $INST/python-$PYTHON_VERSION ]; then
     INFO "Building Python-$PYTHON_VERSION"
 
     prepare_opt
 
     if [ ! -d $SRC/Python-$PYTHON_VERSION ]; then
       mkdir -p $SRC
-      wget -c http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2 -P $SRC
+      wget -c $PYTHON_SOURCE -P $SRC
 
       INFO "Unpacking Python-$PYTHON_VERSION"
       tar -C $SRC -xf $SRC/Python-$PYTHON_VERSION.tar.bz2
@@ -108,7 +164,7 @@
 
     cd $SRC/Python-$PYTHON_VERSION
 
-    ./configure --prefix=/opt/lib/python-$PYTHON_VERSION --enable-ipv6 \
+    ./configure --prefix=$INST/python-$PYTHON_VERSION --enable-ipv6 \
         --enable-loadable-sqlite-extensions --with-dbmliborder=bdb \
         --with-computed-gotos --with-pymalloc
 
@@ -116,61 +172,88 @@
     make install
     make clean
 
-    rm -f /opt/lib/python-3.3
-    ln -s python-$PYTHON_VERSION /opt/lib/python-3.3
+    rm -f $INST/python-3.3
+    ln -s python-$PYTHON_VERSION $INST/python-3.3
 
+    magic_compile_set python-$PYTHON_VERSION $py_magic
+
     cd $CWD
+  else
+    INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!"
   fi
 }
 
 compile_Boost() {
-  INFO "Building boost"
+  # To be changed each time we make edits that would modify the compiled result!
+  boost_magic=7
 
-  version_dots=`echo "$BOOST_VERSION" | sed -r 's/_/./g'`
+  # Clean install if needed!
+  magic_compile_check boost-$BOOST_VERSION $boost_magic
+  if [ $? -eq 1 ]; then
+    rm -rf $INST/boost-$BOOST_VERSION
+  fi
 
-  if [ ! -d /opt/lib/boost-$version_dots ]; then
-    INFO "Building Boost-$version_dots"
+  if [ ! -d $INST/boost-$BOOST_VERSION ]; then
+    INFO "Building Boost-$BOOST_VERSION"
 
     prepare_opt
 
-    if [ ! -d $SRC/boost_$BOOST_VERSION ]; then
-      INFO "Downloading Boost-$version_dots"
+    if [ ! -d $SRC/boost-$BOOST_VERSION ]; then
+      INFO "Downloading Boost-$BOOST_VERSION"
       mkdir -p $SRC
-      wget -c http://sourceforge.net/projects/boost/files/boost/$version_dots/boost_$BOOST_VERSION.tar.bz2/download \
-        -O $SRC/boost_$BOOST_VERSION.tar.bz2
-      tar -C $SRC -xf $SRC/boost_$BOOST_VERSION.tar.bz2
+      wget -c $BOOST_SOURCE -O $SRC/boost-$BOOST_VERSION.tar.bz2
+      tar -C $SRC --transform "s,(.*/?)boost_1_[^/]+(.*),\1boost-$BOOST_VERSION\2,x" -xf $SRC/boost-$BOOST_VERSION.tar.bz2
     fi
 
-    cd $SRC/boost_$BOOST_VERSION
-    ./bootstrap.sh --with-libraries=system,filesystem,thread,regex,locale,date-time --prefix=/opt/lib/boost-$version_dots
-    ./b2 install
+    cd $SRC/boost-$BOOST_VERSION
+    if [ ! -f $SRC/boost-$BOOST_VERSION/b2 ]; then
+      ./bootstrap.sh
+    fi
+    ./b2 -j$THREADS -a --with-system --with_filesystem --with-thread --with-regex --with-locale --with-date_time \
+         --prefix=$INST/boost-$BOOST_VERSION --disable-icu boost.locale.icu=off install
     ./b2 --clean
 
-    rm -f /opt/lib/boost
-    ln -s boost-$version_dots /opt/lib/boost
+    rm -f $INST/boost
+    ln -s boost-$BOOST_VERSION $INST/boost
 
+    magic_compile_set boost-$BOOST_VERSION $boost_magic
+
     cd $CWD
+  else
+    INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!"
   fi
 }
 
 compile_OCIO() {
-  if [ ! -d /opt/lib/ocio-$OCIO_VERSION ]; then
+  # To be changed each time we make edits that would modify the compiled result!
+  ocio_magic=1
+
+  # Clean install if needed!
+  magic_compile_check ocio-$OCIO_VERSION $ocio_magic
+  if [ $? -eq 1 ]; then
+    rm -rf $INST/ocio-$OCIO_VERSION
+  fi
+
+  if [ ! -d $INST/ocio-$OCIO_VERSION ]; then
     INFO "Building OpenColorIO-$OCIO_VERSION"
 
     prepare_opt
 
     if [ ! -d $SRC/OpenColorIO-$OCIO_VERSION ]; then
-        INFO "Downloading OpenColorIO-$OCIO_VERSION"
-        mkdir -p $SRC
-        wget -c http://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION \
-          -O $SRC/OpenColorIO-$OCIO_VERSION.tar.gz
+      INFO "Downloading OpenColorIO-$OCIO_VERSION"
+      mkdir -p $SRC
+      wget -c $OCIO_SOURCE -O $SRC/OpenColorIO-$OCIO_VERSION.tar.gz
 
-        INFO "Unpacking OpenColorIO-$OCIO_VERSION"
-        tar -C "$SRC" -xf $SRC/OpenColorIO-$OCIO_VERSION.tar.gz
-        mv $SRC/imageworks-OpenColorIO* $SRC/OpenColorIO-$OCIO_VERSION
+      INFO "Unpacking OpenColorIO-$OCIO_VERSION"
+      tar -C $SRC --transform "s,(.*/?)imageworks-OpenColorIO[^/]*(.*),\1OpenColorIO-$OCIO_VERSION\2,x" \
+          -xf $SRC/OpenColorIO-$OCIO_VERSION.tar.gz
     fi
 
     cd $SRC/OpenColorIO-$OCIO_VERSION
+    # Always refresh the whole build!
+    if [ -d build ]; then
+      rm -rf build
+    fi    
     mkdir build
     cd build
 
@@ -181,8 +264,8 @@
     fi
 
     cmake -D CMAKE_BUILD_TYPE=Release \
-        -D CMAKE_PREFIX_PATH=/opt/lib/ocio-$OCIO_VERSION \
-        -D CMAKE_INSTALL_PREFIX=/opt/lib/ocio-$OCIO_VERSION \
+        -D CMAKE_PREFIX_PATH=$INST/ocio-$OCIO_VERSION \
+        -D CMAKE_INSTALL_PREFIX=$INST/ocio-$OCIO_VERSION \
         -D CMAKE_CXX_FLAGS="$cflags" \
         -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" \
         ..
@@ -190,43 +273,59 @@
     make -j$THREADS
     make install
 
-    # Force linking against sttaic libs
-    rm -f /opt/lib/ocio-$OCIO_VERSION/lib/*.so*
+    # Force linking against static libs
+    rm -f $INST/ocio-$OCIO_VERSION/lib/*.so*
 
     # Additional depencencies
-    cp ext/dist/lib/libtinyxml.a /opt/lib/ocio-$OCIO_VERSION/lib
-    cp ext/dist/lib/libyaml-cpp.a /opt/lib/ocio-$OCIO_VERSION/lib
+    cp ext/dist/lib/libtinyxml.a $INST/ocio-$OCIO_VERSION/lib
+    cp ext/dist/lib/libyaml-cpp.a $INST/ocio-$OCIO_VERSION/lib
 
     make clean
 
-    rm -f /opt/lib/ocio
-    ln -s ocio-$OCIO_VERSION /opt/lib/ocio
+    rm -f $INST/ocio
+    ln -s ocio-$OCIO_VERSION $INST/ocio
 
+    magic_compile_set ocio-$OCIO_VERSION $ocio_magic
+
     cd $CWD
+  else
+    INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!"
   fi
 }
 
 compile_OIIO() {
-  if [ ! -d /opt/lib/oiio-$OIIO_VERSION ]; then

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list