[PATCH 5/6] 2nd step: Implement the logic

Michael Jansen kde at michael-jansen.biz
Mon Mar 14 20:23:55 CET 2011


Not there yet. I have no clue how i reliably find out if the cmake installation prefix is the same as the ruby
installation prefix. Are things like --libdir and --exec_prefix (ruby is autoconf) relevant here.

Doc is missing too.
---
 cmake/FindRuby.cmake |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/cmake/FindRuby.cmake b/cmake/FindRuby.cmake
index b8b75f3..848eb69 100644
--- a/cmake/FindRuby.cmake
+++ b/cmake/FindRuby.cmake
@@ -186,6 +186,42 @@ MARK_AS_ADVANCED(
    RUBY_CUSTOMARCH_DIR
    RUBY_CUSTOMLIB_DIR
    )
+
+#
+### DETERMINE THE INSTALLATION AREA TO USE
+#
+# A option that can be used to switch between the installation areas.
+set(RUBY_INSTALLATION_AREA "auto" CACHE STRING "The installation area to use for installation of ruby modules (custom|site|vendor).")
+
+if(RUBY_INSTALLATION_AREA STREQUAL "site")
+    message(STATUS "Ruby will use the site installation area.")
+    set(RUBY_INSTALL_LIBDIR  ${RUBY_SITELIB_DIR}  CACHE PATH "The ruby modules lib installation directory.")
+    set(RUBY_INSTALL_ARCHDIR ${RUBY_SITEARCH_DIR} CACHE PATH "The ruby modules arch installation directory.")
+elseif(RUBY_INSTALLATION_AREA STREQUAL "vendor")
+    message(STATUS "Ruby will use the vendor installation area.")
+    set(RUBY_INSTALL_LIBDIR  ${RUBY_VENDORLIB_DIR}  CACHE PATH "The ruby modules lib installation directory.")
+    set(RUBY_INSTALL_ARCHDIR ${RUBY_VENDORARCH_DIR} CACHE PATH "The ruby modules arch installation directory.")
+elseif(RUBY_INSTALLATION_AREA STREQUAL "custom")
+    message(STATUS "Ruby will use the custom installation area.")
+    set(RUBY_INSTALL_LIBDIR  ${RUBY_CUSTOMLIB_DIR}  CACHE PATH "The ruby modules lib installation directory.")
+    set(RUBY_INSTALL_ARCHDIR ${RUBY_CUSTOMARCH_DIR} CACHE PATH "The ruby modules arch installation directory.")
+elseif(RUBY_INSTALLATION_AREA STREQUAL "auto")
+    message(STATUS "WHAT SHOULD I DO HERE. WHICH PATH OF rbconfig.rb SHOULD I COMPARE AGAINST WHICH CMAKE PATH")
+    IF( "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" EQUAL "${RUBY_POSSIBLE_LIB_DIR}" )
+       message(STATUS "Same installation prefix")
+       set(RUBY_INSTALL_LIBDIR  ${RUBY_SITELIB_DIR}  CACHE PATH "The ruby modules lib installation directory.")
+       set(RUBY_INSTALL_ARCHDIR ${RUBY_SITEARCH_DIR} CACHE PATH "The ruby modules arch installation directory.")
+    ELSE( "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" EQUAL "${RUBY_POSSIBLE_LIB_DIR}" )
+        message(STATUS "Different installation prefix")
+        set(RUBY_INSTALL_LIBDIR  ${RUBY_CUSTOMLIB_DIR}  CACHE PATH "The ruby modules lib installation directory.")
+        set(RUBY_INSTALL_ARCHDIR ${RUBY_CUSTOMARCH_DIR} CACHE PATH "The ruby modules arch installation directory.")
+    ENDIF( "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" EQUAL "${RUBY_POSSIBLE_LIB_DIR}" )
+else(RUBY_INSTALLATION_AREA STREQUAL "site")
+    message(FATAL_ERROR "Unknown ruby installation area '${RUBY_INSTALLATION_AREA}'.")
+endif(RUBY_INSTALLATION_AREA STREQUAL "site")
+
+
+#
 ### FIND THE RUBY INCLUDE DIRECTORY
 #
 # We need this because rubyhdrdir is not always set (ruby 1.8)
-- 
1.7.1


--nextPart3101659.7u16iE8AI0--



More information about the Kde-buildsystem mailing list