InstallDeps: Fix broken OSL (would not generate valid default names for its .oso...
authorBastien Montagne <montagne29@wanadoo.fr>
Sat, 3 Oct 2015 14:20:03 +0000 (16:20 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Sat, 3 Oct 2015 14:28:09 +0000 (16:28 +0200)
Also, externalize temp/hacky patches in own dir, much much cleaner than integrating them in bash script!

build_files/build_environment/install_deps.sh
build_files/build_environment/install_deps_patches/llvm.patch [new file with mode: 0644]
build_files/build_environment/install_deps_patches/osl.patch [new file with mode: 0644]

index 2d839858b80dffe115eb3e224a6e1ef1a9eb2322..d4728014db5f11b2fa4e48bf52308e0543f243ca 100755 (executable)
@@ -44,6 +44,7 @@ INST="/opt/lib"
 TMP="/tmp"
 CWD=$PWD
 INFO_PATH=$CWD
+SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 
 # Do not install some optional, potentially conflicting libs by default...
 WITH_ALL=false
@@ -1378,19 +1379,7 @@ compile_LLVM() {
       cd $_src
 
       # XXX Ugly patching hack!
-      cat << EOF | patch -p1
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -13,7 +13,7 @@
- set(LLVM_VERSION_MAJOR 3)
- set(LLVM_VERSION_MINOR 1)
--set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
-+set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
- set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-EOF
+      patch -p1 -i "$SCRIPT_DIR/install_deps_patches/llvm.patch"
 
       cd $CWD
 
@@ -1460,10 +1449,10 @@ compile_OSL() {
 
   # Clean install if needed!
   magic_compile_check osl-$OSL_VERSION $osl_magic
-  #~ if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
+  if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
     #~ rm -Rf $_src  # XXX Radical, but not easy to change remote repo fully automatically
-    #~ clean_OSL
-  #~ fi
+    clean_OSL
+  fi
 
   if [ ! -d $_inst ]; then
     INFO "Building OpenShadingLanguage-$OSL_VERSION"
@@ -1492,6 +1481,9 @@ compile_OSL() {
       # Stick to same rev as windows' libs...
       git checkout $OSL_SOURCE_REPO_UID
       git reset --hard
+
+      # XXX Ugly patching hack!
+      patch -p1 -i "$SCRIPT_DIR/install_deps_patches/osl.patch"
     fi
 
     # Always refresh the whole build!
@@ -1533,6 +1525,9 @@ compile_OSL() {
       fi
     fi
 
+    #~ cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
+    #~ cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
+
     cmake $cmake_d ..
 
     make -j$THREADS && make install
diff --git a/build_files/build_environment/install_deps_patches/llvm.patch b/build_files/build_environment/install_deps_patches/llvm.patch
new file mode 100644 (file)
index 0000000..2e05c33
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -13,7 +13,7 @@
+ set(LLVM_VERSION_MAJOR 3)
+ set(LLVM_VERSION_MINOR 1)
+-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
++set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
diff --git a/build_files/build_environment/install_deps_patches/osl.patch b/build_files/build_environment/install_deps_patches/osl.patch
new file mode 100644 (file)
index 0000000..3b52403
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/src/shaders/CMakeLists.txt
++++ b/src/shaders/CMakeLists.txt
+@@ -27,7 +27,7 @@ macro (osl_compile oslsrc objlist headers)
+         message (STATUS "cmd: ${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc ${oslsrc}")
+     endif ()
+     add_custom_command (OUTPUT ${osofile}
+-        COMMAND "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc" ${oslsrc}
++        COMMAND "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc" "-o" ${osofile} ${oslsrc}
+         MAIN_DEPENDENCY ${oslsrc}
+         DEPENDS ${${headers}} ${oslsrc} "${CMAKE_CURRENT_BINARY_DIR}/stdosl.h" "${CMAKE_CURRENT_BINARY_DIR}/../oslc/oslc"
+         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+