qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcpie...@apache.org
Subject svn commit: r1547579 - in /qpid/proton/trunk/proton-c/bindings: CMakeLists.txt ruby/CMakeLists.txt
Date Tue, 03 Dec 2013 20:40:20 GMT
Author: mcpierce
Date: Tue Dec  3 20:40:20 2013
New Revision: 1547579

URL: http://svn.apache.org/r1547579
Log:
PROTON-464: Install Ruby bindings to install prefix if specified.

If the user provides a CMAKE_INSTALL_PREFIX on the command line, then
that directory is used to install the Ruby language bindings. If no
install prefix is specified then the Ruby bindings honor the directory
specified by the Ruby VM itself.

Modified:
    qpid/proton/trunk/proton-c/bindings/CMakeLists.txt
    qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt

Modified: qpid/proton/trunk/proton-c/bindings/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/CMakeLists.txt?rev=1547579&r1=1547578&r2=1547579&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/bindings/CMakeLists.txt Tue Dec  3 20:40:20 2013
@@ -37,6 +37,13 @@ endif (PYTHONLIBS_FOUND)
 
 # Prerequisites for Ruby:
 find_package(Ruby)
+
+if (NOT RUBY_FOUND)
+  if (RUBY_EXECUTABLE)
+    set (RUBY_FOUND 1)
+  endif (RUBY_EXECUTABLE)
+endif (NOT RUBY_FOUND)
+
 if (RUBY_FOUND)
   set (DEFAULT_RUBY ON)
 endif (RUBY_FOUND)

Modified: qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt?rev=1547579&r1=1547578&r2=1547579&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/bindings/ruby/CMakeLists.txt Tue Dec  3 20:40:20 2013
@@ -26,10 +26,6 @@ set_target_properties(cproton-ruby
     OUTPUT_NAME "cproton"
     LINK_FLAGS "${CATCH_UNDEFINED}" )
 
-install(TARGETS cproton-ruby
-        DESTINATION ${RUBY_ARCH_DIR}
-        COMPONENT Ruby)
-
 # Install the Ruby libraries
 set(RUBY_LIBRARIES
     lib/qpid_proton/array.rb
@@ -47,30 +43,89 @@ set(RUBY_LIBRARIES
     lib/qpid_proton/tracker_status.rb
 )
 
+if (NOT RUBY_INSTALL_PREFIX)
+  set(RUBY_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
+endif (NOT RUBY_INSTALL_PREFIX)
+
+# if the CMAKE_INSTALL_PREFIX isn't defined, then set it
+# using the prefix from Ruby
+execute_process(COMMAND ${RUBY_EXECUTABLE}
+  -r rbconfig -e "print RbConfig::CONFIG['prefix']"
+  OUTPUT_VARIABLE RUBY_PREFIX)
+
 set(RUBY_ARCHLIB_DIR "${RUBY_VENDORLIB_DIR}")
 
-if (NOT RUBY_ARCHLIB_DIR)
+# Get the Ruby arch directory for where platform-specific code
+execute_process(COMMAND ${RUBY_EXECUTABLE}
+  -r rbconfig -e "install_prefix = '${RUBY_INSTALL_PREFIX}';
+                                  path = RbConfig::CONFIG['vendorarchdir'];
+                                  unless path.nil?
+                                    path.gsub!('${RUBY_PREFIX}',
+                                               install_prefix);
+                                  else
+                                    path = '';
+                                  end;
+                                  print path;"
+  RESULT_VARIABLE RESULT_RUBY_ARCHLIB_DIR
+  OUTPUT_VARIABLE OUTPUT_RUBY_ARCHLIB_DIR)
+
+# fallback for older versions of Ruby
+if(OUTPUT_RUBY_ARCHLIB_DIR STREQUAL "")
   execute_process(COMMAND ${RUBY_EXECUTABLE}
-                  -r rbconfig -e "print RbConfig::CONFIG['vendorlibdir']"
+    -r rbconfig -e "install_prefix = '${RUBY_INSTALL_PREFIX}';
+                                    path = RbConfig::CONFIG['archdir'];
+                                    path.gsub!('${RUBY_PREFIX}',
+                                               install_prefix);
+                                    print path;"
     RESULT_VARIABLE RESULT_RUBY_ARCHLIB_DIR
     OUTPUT_VARIABLE OUTPUT_RUBY_ARCHLIB_DIR)
+endif (OUTPUT_RUBY_ARCHLIB_DIR STREQUAL "")
+
+
+set(RUBY_ARCHLIB_DIR "${OUTPUT_RUBY_ARCHLIB_DIR}")
+
+MESSAGE(STATUS "RUBY_ARCHLIB_DIR=${RUBY_ARCHLIB_DIR}")
 
-  if(NOT RESULT_RUBY_ARCHLIB_DIR AND OUTPUT_RUBY_ARCHLIB_DIR )
-    execute_process(COMMAND ${RUBY_EXECUTABLE}
-                    -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']"
-      RESULT_VARIABLE RESULT_RUBY_ARCHLIB_DIR
-      OUTPUT_VARIABLE OUTPUT_RUBY_ARCHLIB_DIR)
+# Get the Ruby library directory for platform independent code
+execute_process(COMMAND ${RUBY_EXECUTABLE}
+  -r rbconfig -e "install_prefix = '${RUBY_INSTALL_PREFIX}';
+                                  path = RbConfig::CONFIG['vendorlibdir'];
+                                  unless path.nil?
+                                    path.gsub!('${RUBY_PREFIX}',
+                                               install_prefix);
+                                  else
+                                    path = '';
+                                  end;
+                                  print path;"
+  RESULT_VARIABLE RESULT_RUBY_SITELIB_DIR
+  OUTPUT_VARIABLE OUTPUT_RUBY_SITELIB_DIR)
 
-  endif()
+# fallback for older versions of Ruby
+if(OUTPUT_RUBY_SITELIB_DIR STREQUAL "")
+  execute_process(COMMAND ${RUBY_EXECUTABLE}
+    -r rbconfig -e "install_prefix = '${RUBY_INSTALL_PREFIX}';
+                                    path = RbConfig::CONFIG['libdir'];
+                                    path.gsub!('${RUBY_PREFIX}',
+                                               install_prefix);
+                                    print path;"
+    RESULT_VARIABLE RESULT_RUBY_SITELIB_DIR
+    OUTPUT_VARIABLE OUTPUT_RUBY_SITELIB_DIR)
+
+endif(OUTPUT_RUBY_SITELIB_DIR STREQUAL "")
 
-  set(RUBY_ARCHLIB_DIR "${OUTPUT_RUBY_ARCHLIB_DIR}")
+set(RUBY_SITELIB_DIR "${OUTPUT_RUBY_SITELIB_DIR}")
 
-endif ()
+MESSAGE(STATUS "RUBY_SITELIB_DIR=${RUBY_SITELIB_DIR}")
 
 install(FILES lib/qpid_proton.rb
-        DESTINATION ${RUBY_ARCHLIB_DIR}
+        DESTINATION ${RUBY_SITELIB_DIR}
         COMPONENT Ruby)
 
 install(FILES ${RUBY_LIBRARIES}
-        DESTINATION ${RUBY_ARCHLIB_DIR}/qpid_proton
+        DESTINATION ${RUBY_SITELIB_DIR}/qpid_proton
+        COMPONENT Ruby)
+
+install(TARGETS cproton-ruby
+        DESTINATION ${RUBY_ARCHLIB_DIR}
         COMPONENT Ruby)
+



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message