Install_deps.sh: More attempt to fix building OSL on newer distro.
authorBastien Montagne <montagne29@wanadoo.fr>
Tue, 17 Nov 2015 19:38:01 +0000 (20:38 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 17 Nov 2015 19:38:01 +0000 (20:38 +0100)
Now it looks like our version of OSL is not compatible with OIIO 1.5... sigh...

build_files/build_environment/install_deps.sh

index 30360a63c06e00e666e8126a0067137e993b4172..a7ebe5d0443ccbe6978f7ddd7c3aa04de3cd78f0 100755 (executable)
@@ -228,6 +228,7 @@ _with_built_openexr=false
 
 OIIO_VERSION="1.4.16"
 OIIO_VERSION_MIN="1.4.0"
+OIIO_VERSION_MAX="1.5.0"  # Not supported by current OSL...
 OIIO_FORCE_REBUILD=false
 OIIO_SKIP=false
 
@@ -627,6 +628,18 @@ version_ge() {
   fi
 }
 
+# Return 0 if $3 > $1 >= $2, else 1.
+# $1 and $2 should be version numbers made of numbers only.
+version_ge_lt() {
+  version_ge $1 $3
+  if [ $? -eq 1 ]; then
+    return 1
+  else
+    version_ge $1 $2
+    return $?
+  fi
+}
+
 # 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!
@@ -1877,6 +1890,17 @@ check_package_version_ge_DEB() {
   return $?
 }
 
+check_package_version_ge_lt_DEB() {
+  v=`apt-cache policy $1 | grep 'Candidate:' | sed -r 's/.*:\s*([0-9]+:)?(([0-9]+\.?)+).*/\2/'`
+
+  if [ -z "$v" ]; then
+    return 1
+  fi
+
+  version_ge_lt $v $2 $3
+  return $?
+}
+
 install_packages_DEB() {
   if [ ! $SUDO ]; then
     WARNING "--no-sudo enabled, impossible to run apt-get install for $@, you'll have to do it yourself..."
@@ -2159,7 +2183,7 @@ install_DEB() {
   if $OIIO_SKIP; then
     WARNING "Skipping OpenImageIO installation, as requested..."
   else
-    check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN
+    check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
     if [ $? -eq 0 -a $_with_built_openexr == false ]; then
       install_packages_DEB libopenimageio-dev
       clean_OIIO
@@ -2325,6 +2349,17 @@ check_package_version_ge_RPM() {
   return $?
 }
 
+check_package_version_ge_lt_RPM() {
+  v=`get_package_version_RPM $1`
+
+  if [ -z "$v" ]; then
+    return 1
+  fi
+
+  version_ge_lt $v $2 $3
+  return $?
+}
+
 install_packages_RPM() {
   rpm_flavour
   if [ $RPM = "FEDORA" -o $RPM = "RHEL" ]; then
@@ -2608,7 +2643,7 @@ install_RPM() {
   if $OIIO_SKIP; then
     WARNING "Skipping OpenImageIO installation, as requested..."
   else
-    check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN
+    check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
     if [ $? -eq 0 -a $_with_built_openexr == false ]; then
       install_packages_RPM OpenImageIO-devel
       clean_OIIO
@@ -2748,6 +2783,17 @@ check_package_version_ge_ARCH() {
   return $?
 }
 
+check_package_version_ge_lt_ARCH() {
+  v=`get_package_version_ARCH $1`
+
+  if [ -z "$v" ]; then
+    return 1
+  fi
+
+  version_ge_lt $v $2 $3
+  return $?
+}
+
 install_packages_ARCH() {
   if [ ! $SUDO ]; then
     WARNING "--no-sudo enabled, impossible to run pacman for $@, you'll have to do it yourself..."
@@ -2937,7 +2983,7 @@ install_ARCH() {
   if $OIIO_SKIP; then
     WARNING "Skipping OpenImageIO installation, as requested..."
   else
-    check_package_version_ge_ARCH openimageio $OIIO_VERSION_MIN
+    check_package_version_ge_lt_ARCH openimageio $OIIO_VERSION_MIN $OIIO_VERSION_MAX
     if [ $? -eq 0 ]; then
       install_packages_ARCH openimageio
       clean_OIIO