On Wed, Jul 6, 2011 at 11:32 PM, Richard Shaw <[email protected]> wrote:
> I followed the link but didn't see an easy way to get a unified patch.
> There's probably a way but I'm not as familiar with git/github as I am
> with svn. I know git is supposed to be much easier for developers but
> svn is a lot easier for packagers. :)

Ah, sorry about that, I don't see a nice way to do it in the web interface
either.  The appropriate branch is cjf-packaging-fix inside
the git://github.com/c42f/oiio.git repo, so in principle you would clone that
repo & check out the branch...

But in practise I'll just send you the patch since it's fairly trivial :)

If this works for you, then we'll need some input from whoever is
responsible for adding the SOVERSION feature before it can be merged,
since it changes the behaviour just a little.  I imagine Larry might
backport it to the 0.10 branch so you can work from there if everyone
is happy.

~Chris
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f322e83..ec410dc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -30,12 +30,8 @@ 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)
 
-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!")
diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt
index 74a6cbc..70e4899 100644
--- a/src/include/CMakeLists.txt
+++ b/src/include/CMakeLists.txt
@@ -8,6 +8,10 @@ set (public_headers argparse.h dassert.h errorhandler.h export.h
     )
 
 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)
 
diff --git a/src/include/version.h.in b/src/include/version.h.in
index 9362846..cf6eda4 100644
--- a/src/include/version.h.in
+++ b/src/include/version.h.in
@@ -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 --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt
index fbc1df3..f141cdc 100644
--- a/src/libOpenImageIO/CMakeLists.txt
+++ b/src/libOpenImageIO/CMakeLists.txt
@@ -189,14 +189,12 @@ if (EMBEDPLUGINS)
     link_openexr (OpenImageIO)
 endif ()
 
-if (SOVERSION)
 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)
 
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to