Blob Blame History Raw
diff -Naur OpenImageIO-0.10.0.orig/Makefile OpenImageIO-0.10.0/Makefile
--- OpenImageIO-0.10.0.orig/Makefile	2011-06-30 16:34:46.000000000 -0500
+++ OpenImageIO-0.10.0/Makefile	2011-07-11 08:44:00.005399646 -0500
@@ -27,7 +27,7 @@
 endif
 
 MY_MAKE_FLAGS ?=
-MY_CMAKE_FLAGS ?=
+MY_CMAKE_FLAGS ?= -DSELF_CONTAINED_INSTALL_TREE:BOOL=TRUE
 
 # Site-specific build instructions
 ifndef OPENIMAGEIO_SITE
diff -Naur OpenImageIO-0.10.0.orig/src/cmake/externalpackages.cmake OpenImageIO-0.10.0/src/cmake/externalpackages.cmake
--- OpenImageIO-0.10.0.orig/src/cmake/externalpackages.cmake	2011-06-30 16:34:46.000000000 -0500
+++ OpenImageIO-0.10.0/src/cmake/externalpackages.cmake	2011-07-11 08:44:00.007399556 -0500
@@ -237,3 +237,15 @@
 # end Field3d setup
 ###########################################################################
 
+###########################################################################
+# Pugixml setup.  Normally we just use the version bundled with oiio, but
+# some linux distros are quite particular about having separate packages so we
+# allow this to be overridden to use the distro-provided package if desired.
+if (USE_EXTERNAL_PUGIXML)
+    find_package (PugiXML REQUIRED)
+    # insert include path to pugixml first, to ensure that the external
+    # pugixml is found, and not the one in OIIO's include directory.
+    include_directories (BEFORE ${PUGIXML_INCLUDE_DIR})
+endif()
+
+###########################################################################
diff -Naur OpenImageIO-0.10.0.orig/src/cmake/modules/FindPugiXML.cmake OpenImageIO-0.10.0/src/cmake/modules/FindPugiXML.cmake
--- OpenImageIO-0.10.0.orig/src/cmake/modules/FindPugiXML.cmake	1969-12-31 18:00:00.000000000 -0600
+++ OpenImageIO-0.10.0/src/cmake/modules/FindPugiXML.cmake	2011-07-11 08:44:00.008399511 -0500
@@ -0,0 +1,21 @@
+# Find the pugixml XML parsing library.
+#
+# Sets the usual variables expected for find_package scripts:
+#
+# PUGIXML_INCLUDE_DIR - header location
+# PUGIXML_LIBRARIES - library to link against
+# PUGIXML_FOUND - true if pugixml was found.
+
+find_path (PUGIXML_INCLUDE_DIR pugixml.hpp)
+find_library (PUGIXML_LIBRARY NAMES pugixml)
+
+# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
+include (FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS (PugiXML DEFAULT_MSG PUGIXML_LIBRARY
+                                   PUGIXML_INCLUDE_DIR)
+
+if (PUGIXML_FOUND)
+    set (PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
+endif()
+
+mark_as_advanced (PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
diff -Naur OpenImageIO-0.10.0.orig/src/cmake/oiio_macros.cmake OpenImageIO-0.10.0/src/cmake/oiio_macros.cmake
--- OpenImageIO-0.10.0.orig/src/cmake/oiio_macros.cmake	2011-06-30 16:34:46.000000000 -0500
+++ OpenImageIO-0.10.0/src/cmake/oiio_macros.cmake	2011-07-11 08:44:00.008399511 -0500
@@ -7,9 +7,9 @@
 #
 macro (oiio_install_targets)
     install (TARGETS ${ARGN}
-             RUNTIME DESTINATION "${BINDIR}" COMPONENT user
-             LIBRARY DESTINATION "${LIBDIR}" COMPONENT user
-             ARCHIVE DESTINATION "${LIBDIR}" COMPONENT developer)
+             RUNTIME DESTINATION "${BIN_INSTALL_DIR}" COMPONENT user
+             LIBRARY DESTINATION "${LIB_INSTALL_DIR}" COMPONENT user
+             ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT developer)
 endmacro ()
 
 # Macro to add a build target for an IO plugin.
diff -Naur OpenImageIO-0.10.0.orig/src/CMakeLists.txt OpenImageIO-0.10.0/src/CMakeLists.txt
--- OpenImageIO-0.10.0.orig/src/CMakeLists.txt	2011-06-30 16:34:46.000000000 -0500
+++ OpenImageIO-0.10.0/src/CMakeLists.txt	2011-07-11 08:44:00.006399604 -0500
@@ -29,13 +29,11 @@
 set (USE_JASPER ON CACHE BOOL "Use Jasper for JPEG-2000 if found")
 set (NOTHREADS OFF CACHE BOOL "Compile with no threads or locking")
 set (PYTHON_VERSION 2.6)
+set (USE_EXTERNAL_PUGIXML OFF CACHE BOOL
+     "Use an externally built shared library version of the pugixml library")
 
-if (NOT SOVERSION)
-    set (SOVERSION ${OIIO_VERSION_MAJOR} CACHE STRING "Set the SO version in the SO name of the output library")
-endif ()
-if (NOT ${SOVERSION} STREQUAL ${OIIO_VERSION_MAJOR})
-    set (OIIO_VERSION_MAJOR ${SOVERSION})
-endif ()
+set (SOVERSION ${OIIO_VERSION_MAJOR}.${OIIO_VERSION_MINOR}
+     CACHE STRING "Set the SO version in the SO name of the output library")
 
 if (NOTHREADS)
     message (STATUS "NO THREADS!")
@@ -89,19 +87,61 @@
     add_definitions ("-DDEBUG=1")
 endif ()
 
-# Exec Install Locations
-set (BINDIR   "${CMAKE_INSTALL_PREFIX}/bin")
-set (LIBDIR   "${CMAKE_INSTALL_PREFIX}/lib")
-set (PYLIBDIR "${CMAKE_INSTALL_PREFIX}/python")
-if (EXEC_INSTALL_PREFIX)
-    set (BINDIR   "${EXEC_INSTALL_PREFIX}/bin")
-    set (LIBDIR   "${EXEC_INSTALL_PREFIX}/lib")
-    set (PYLIBDIR "${EXEC_INSTALL_PREFIX}/python")
+###########################################################################
+# Paths for install tree customization.  Note that relative paths are relative
+# to CMAKE_INSTALL_PREFIX.
+set (DEFAULT_BIN_INSTALL_DIR   "bin")
+set (DEFAULT_LIB_INSTALL_DIR   "lib")
+set (DEFAULT_INCLUDE_INSTALL_DIR "include/OpenImageIO")
+if (UNIX AND NOT SELF_CONTAINED_INSTALL_TREE)
+    # Try to be well-behaved and install into reasonable places according to
+    # the "standard" unix directory heirarchy
+    # TODO: Figure out how to get the correct python directory
+    set (DEFAULT_PYLIB_INSTALL_DIR "lib/python/site-packages")
+    set (DEFAULT_DOC_INSTALL_DIR "share/doc/openimageio")
+    set (DEFAULT_MAN_INSTALL_DIR "share/man/man1")
+else ()
+    # Here is the "self-contained install tree" case: the expectation here is
+    # that everything OIIO related will go into its own directory, not into
+    # some standard system heirarchy.
+    set (DEFAULT_PYLIB_INSTALL_DIR "python")
+    set (DEFAULT_DOC_INSTALL_DIR "doc")
+    set (DEFAULT_MAN_INSTALL_DIR "doc/man")
 endif ()
+if (EXEC_INSTALL_PREFIX)
+    # Tack on an extra prefix to support multi-arch builds.
+    set (DEFAULT_BIN_INSTALL_DIR   "${EXEC_INSTALL_PREFIX}/${DEFAULT_BIN_INSTALL_DIR}")
+    set (DEFAULT_LIB_INSTALL_DIR   "${EXEC_INSTALL_PREFIX}/${DEFAULT_LIB_INSTALL_DIR}")
+    set (DEFAULT_PYLIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${DEFAULT_PYLIB_INSTALL_DIR}")
+endif ()
+# Set up cmake cache variables corresponding to the defaults deduced above, so
+# that the user can override them as desired:
+set (BIN_INSTALL_DIR ${DEFAULT_BIN_INSTALL_DIR} CACHE STRING
+     "Install location for binaries (relative to CMAKE_INSTALL_PREFIX or absolute)")
+set (LIB_INSTALL_DIR ${DEFAULT_LIB_INSTALL_DIR} CACHE STRING
+     "Install location for libraries (relative to CMAKE_INSTALL_PREFIX or absolute)")
+set (PYLIB_INSTALL_DIR ${DEFAULT_PYLIB_INSTALL_DIR} CACHE STRING
+     "Install location for python libraries (relative to CMAKE_INSTALL_PREFIX or absolute)")
+set (INCLUDE_INSTALL_DIR ${DEFAULT_INCLUDE_INSTALL_DIR} CACHE STRING
+     "Install location of header files (relative to CMAKE_INSTALL_PREFIX or absolute)")
+set (DOC_INSTALL_DIR ${DEFAULT_DOC_INSTALL_DIR} CACHE STRING
+     "Install location for documentation (relative to CMAKE_INSTALL_PREFIX or absolute)")
+if (UNIX)
+    set (MAN_INSTALL_DIR ${DEFAULT_MAN_INSTALL_DIR} CACHE STRING
+         "Install location for manual pages (relative to CMAKE_INSTALL_PREFIX or absolute)")
+endif()
+
+set (INSTALL_DOCS ON CACHE BOOL "Install documentation")
+
 
-set (CMAKE_INSTALL_RPATH "${LIBDIR}")
+#####
+set (CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}")
+if (NOT IS_ABSOLUTE ${CMAKE_INSTALL_RPATH})
+    set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
+endif ()
 set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 
+
 ###########################################################################
 if (MSVC)
     add_definitions (-D_CRT_SECURE_NO_DEPRECATE)
diff -Naur OpenImageIO-0.10.0.orig/src/doc/CMakeLists.txt OpenImageIO-0.10.0/src/doc/CMakeLists.txt
--- OpenImageIO-0.10.0.orig/src/doc/CMakeLists.txt	2011-06-30 16:34:46.000000000 -0500
+++ OpenImageIO-0.10.0/src/doc/CMakeLists.txt	2011-07-11 08:44:00.009399468 -0500
@@ -1,11 +1,39 @@
-set (public_docs openimageio.pdf CLA-INDIVIDUAL CLA-CORPORATE)
+project(documentation)
 
-install (FILES ${public_docs} DESTINATION doc COMPONENT documentation)
+set (public_docs
+     openimageio.pdf
+     ${OpenImageIO_SOURCE_DIR}/../LICENSE
+     ${OpenImageIO_SOURCE_DIR}/../CHANGES
+)
 
-install (FILES ${PROJECT_SOURCE_DIR}/../LICENSE
-               ${PROJECT_SOURCE_DIR}/../INSTALL
-               ${PROJECT_SOURCE_DIR}/../CHANGES
-         DESTINATION .)
+if (INSTALL_DOCS)
+    install (FILES ${public_docs} DESTINATION ${DOC_INSTALL_DIR}
+             COMPONENT documentation)
+endif ()
 
-install (DIRECTORY doxygen/html DESTINATION doc
-         PATTERN .svn EXCLUDE)
+# generate man pages using txt2man and a tiny python script to munge the
+# result of "$tool --help"
+find_program(TXT2MAN txt2man)
+find_package(PythonInterp)
+if (UNIX AND TXT2MAN AND PYTHONINTERP_FOUND)
+    message (STATUS "Unix man page documentation will be generated")
+    set (cli_tools iinfo maketx idiff iv igrep iprocess iconvert)
+
+    foreach (tool ${cli_tools})
+        set (outfile "${documentation_BINARY_DIR}/${tool}.1")
+        list (APPEND manpage_files ${outfile})
+        add_custom_command (OUTPUT ${outfile}
+            COMMAND ${tool} --help |
+            ${PYTHON_EXECUTABLE} ${documentation_SOURCE_DIR}/help2man_preformat.py |
+            ${TXT2MAN} -v OpenImageIO -s 1 -t ${tool} > ${outfile}
+            DEPENDS ${tool} help2man_preformat.py)
+    endforeach()
+
+    # force man page build before install
+    add_custom_target (man_pages ALL DEPENDS ${manpage_files})
+
+    if (INSTALL_DOCS)
+        install (FILES ${manpage_files}
+                 DESTINATION ${MAN_INSTALL_DIR} COMPONENT documentation)
+    endif ()
+endif()
diff -Naur OpenImageIO-0.10.0.orig/src/doc/help2man_preformat.py OpenImageIO-0.10.0/src/doc/help2man_preformat.py
--- OpenImageIO-0.10.0.orig/src/doc/help2man_preformat.py	1969-12-31 18:00:00.000000000 -0600
+++ OpenImageIO-0.10.0/src/doc/help2man_preformat.py	2011-07-11 08:44:00.009399468 -0500
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+from __future__ import print_function
+import sys
+
+lines = [l.rstrip().replace('\t', ' '*8) for l in sys.stdin.readlines()]
+
+print('TITLE')
+print(lines[0])
+print()
+
+print('SYNOPSIS')
+for i,line in enumerate(lines[2:]):
+    if line.lstrip().startswith('-'):
+        optStart = i+2
+        break
+    print(line)
+
+print('''DESCRIPTION
+This program is part of the OpenImageIO (http://www.openimageio.org) tool suite.
+Detailed documentation is avaliable in pdf format with the OpenImageIO
+distribution.
+''')
+
+print('OPTIONS')
+for line in lines[optStart:]:
+    if not line.startswith(' '):
+        print()
+        print(line)
+    elif not line.lstrip().startswith('-'):
+        print(line.lstrip())
+    else:
+        print(line)
+print()
+
diff -Naur OpenImageIO-0.10.0.orig/src/include/CMakeLists.txt OpenImageIO-0.10.0/src/include/CMakeLists.txt
--- OpenImageIO-0.10.0.orig/src/include/CMakeLists.txt	2011-06-30 16:34:46.000000000 -0500
+++ OpenImageIO-0.10.0/src/include/CMakeLists.txt	2011-07-11 09:02:18.495191097 -0500
@@ -4,22 +4,26 @@
                     imagecache.h imageio.h osdep.h paramlist.h
                     refcnt.h strutil.h sysutil.h texture.h thread.h timer.h
                     typedesc.h ustring.h varyingref.h
-                    colortransfer.h pugixml.hpp pugiconfig.hpp
+                    colortransfer.h
     )
 
+if (NOT USE_EXTERNAL_PUGIXML)
+    list (APPEND public_headers pugixml.hpp pugiconfig.hpp)
+endif ()
+
 message(STATUS "Create version.h from version.h.in")
+# Mangle the SOVERSION so that it's a valid C++ identifier for the versioning
+# namespace defined in version.h
+string (REGEX REPLACE "\\." "_" MANGLED_SOVERSION ${SOVERSION})
+set (OIIO_VERSION_NS "v${MANGLED_SOVERSION}")
 configure_file(version.h.in ${CMAKE_BINARY_DIR}/include/version.h @ONLY)
 list(APPEND public_headers ${CMAKE_BINARY_DIR}/include/version.h)
 
-install (FILES ${public_headers} DESTINATION include/OpenImageIO
+install (FILES ${public_headers} DESTINATION ${INCLUDE_INSTALL_DIR}
          COMPONENT developer)
 
 if (USE_TBB)
-    file (GLOB tbb_headers tbb/*.h)
-    file (GLOB tbb_headers2 tbb/machine/*.h)
-    install (FILES ${tbb_headers} DESTINATION include/OpenImageIO/tbb
-             COMPONENT developer)
-    install (FILES ${tbb_headers2} DESTINATION include/OpenImageIO/tbb/machine
+    install (DIRECTORY tbb DESTINATION ${INCLUDE_INSTALL_DIR}
              COMPONENT developer)
 endif ()
 
diff -Naur OpenImageIO-0.10.0.orig/src/include/version.h.in OpenImageIO-0.10.0/src/include/version.h.in
--- OpenImageIO-0.10.0.orig/src/include/version.h.in	2011-06-30 16:34:46.000000000 -0500
+++ OpenImageIO-0.10.0/src/include/version.h.in	2011-07-11 08:44:00.010399428 -0500
@@ -39,7 +39,7 @@
 #define OIIO_VERSION_MAJOR @OIIO_VERSION_MAJOR@
 #define OIIO_VERSION_MINOR @OIIO_VERSION_MINOR@
 #define OIIO_VERSION_PATCH @OIIO_VERSION_PATCH@
-#define OIIO_VERSION_NS v@SOVERSION@
+#define OIIO_VERSION_NS @OIIO_VERSION_NS@
 
 #define OIIO_VERSION (10000 * OIIO_VERSION_MAJOR + \
                         100 * OIIO_VERSION_MINOR + \
diff -Naur OpenImageIO-0.10.0.orig/src/libOpenImageIO/CMakeLists.txt OpenImageIO-0.10.0/src/libOpenImageIO/CMakeLists.txt
--- OpenImageIO-0.10.0.orig/src/libOpenImageIO/CMakeLists.txt	2011-06-30 16:34:46.000000000 -0500
+++ OpenImageIO-0.10.0/src/libOpenImageIO/CMakeLists.txt	2011-07-11 08:44:00.011399389 -0500
@@ -12,8 +12,6 @@
                          ../include/osdep.h
                          ../include/paramlist.h
                          ../include/plugin.h
-                         ../include/pugiconfig.hpp
-                         ../include/pugixml.hpp
                          ../include/SHA1.h
                          ../include/strutil.h
                          ../include/sysutil.h
@@ -25,6 +23,13 @@
                          ../include/varyingref.h    
                          )
 
+if (NOT USE_EXTERNAL_PUGIXML)
+    list (APPEND libOpenImageIO_hdrs
+          ../include/pugiconfig.hpp
+          ../include/pugixml.hpp
+    )
+endif()
+
 set (libOpenImageIO_srcs formatspec.cpp imagebuf.cpp
                          imagebufalgo.cpp imagebufalgo_orient.cpp
                           imageinput.cpp imageio.cpp imageioplugin.cpp
@@ -37,7 +42,6 @@
                           ../libutil/paramlist.cpp 
                           ../libutil/plugin.cpp 
                           ../libutil/pystring.cpp
-                          ../libutil/pugixml.cpp
                           ../libutil/SHA1.cpp 
                           ../libutil/strutil.cpp 
                           ../libutil/sysutil.cpp 
@@ -51,6 +55,10 @@
                           ${libOpenImageIO_hdrs}
                          )
 
+if (NOT USE_EXTERNAL_PUGIXML)
+    list (APPEND libOpenImageIO_srcs ../libutil/pugixml.cpp)
+endif ()
+
 # Include our own TBB if using it
 if (USE_TBB)
     add_definitions ("-DUSE_TBB=1")
@@ -175,14 +183,16 @@
     link_openexr (OpenImageIO)
 endif ()
 
-if (SOVERSION)
+if (USE_EXTERNAL_PUGIXML)
+    target_link_libraries (OpenImageIO ${PUGIXML_LIBRARIES})
+endif ()
+
 message(STATUS "Setting SOVERSION to: ${SOVERSION}")
 set_target_properties(OpenImageIO
                          PROPERTIES
                          VERSION ${OIIO_VERSION_MAJOR}.${OIIO_VERSION_MINOR}.${OIIO_VERSION_PATCH}
                          SOVERSION ${SOVERSION}
                      )
-endif ()
 
 oiio_install_targets (OpenImageIO)
 
diff -Naur OpenImageIO-0.10.0.orig/src/python/CMakeLists.txt OpenImageIO-0.10.0/src/python/CMakeLists.txt
--- OpenImageIO-0.10.0.orig/src/python/CMakeLists.txt	2011-06-30 16:34:46.000000000 -0500
+++ OpenImageIO-0.10.0/src/python/CMakeLists.txt	2011-07-11 08:44:00.012399349 -0500
@@ -42,7 +42,7 @@
     endif()
 							 
     install (TARGETS PyOpenImageIO
-             RUNTIME DESTINATION ${PYLIBDIR} COMPONENT user
-             LIBRARY DESTINATION ${PYLIBDIR} COMPONENT user)
+             RUNTIME DESTINATION ${PYLIB_INSTALL_DIR} COMPONENT user
+             LIBRARY DESTINATION ${PYLIB_INSTALL_DIR} COMPONENT user)
 
 endif ()