summaryrefslogtreecommitdiff
path: root/src/plugins/ruby
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2014-02-05 17:27:36 +0100
committerSebastien Helleu <flashcode@flashtux.org>2014-02-05 17:27:36 +0100
commitd8b9e0a6bfd7947be88d064f76b1edfb6169d014 (patch)
treef5d058a74eb7f1ded18d53f2485e3c722009d554 /src/plugins/ruby
parent15394897e3ab6737b9eb205bd126422a5d5143e3 (diff)
downloadweechat-d8b9e0a6bfd7947be88d064f76b1edfb6169d014.zip
ruby: add detection and fix compilation with Ruby 2.0 (patch #8209)
Now the search for Ruby is first performed with pkg-config and includes detection of Ruby 2.0. If not found, the old code for detection is used (for old distros or old Ruby versions). The specific test on Ruby 1.9.0 (to disable this version) has been removed (1.9.0 was a dev/unstable version from 2007, quite old now).
Diffstat (limited to 'src/plugins/ruby')
-rw-r--r--src/plugins/ruby/CMakeLists.txt6
-rw-r--r--src/plugins/ruby/weechat-ruby.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/ruby/CMakeLists.txt b/src/plugins/ruby/CMakeLists.txt
index ef0d5e7bd..3058f97e3 100644
--- a/src/plugins/ruby/CMakeLists.txt
+++ b/src/plugins/ruby/CMakeLists.txt
@@ -23,8 +23,10 @@ weechat-ruby-api.h)
SET_TARGET_PROPERTIES(ruby PROPERTIES PREFIX "")
IF(RUBY_FOUND)
- INCLUDE_DIRECTORIES(${RUBY_INCLUDE_PATH} ${RUBY_ARCH})
- TARGET_LINK_LIBRARIES(ruby ${RUBY_LIBRARY} weechat_plugins_scripts)
+ INCLUDE_DIRECTORIES(${RUBY_INCLUDE_DIRS})
+ SET(LINK_LIBS)
+ LIST(APPEND LINK_LIBS ${RUBY_LDFLAGS})
+ TARGET_LINK_LIBRARIES(ruby ${LINK_LIBS} ${RUBY_LIB} weechat_plugins_scripts)
ENDIF(RUBY_FOUND)
INSTALL(TARGETS ruby LIBRARY DESTINATION ${LIBDIR}/plugins)
diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c
index 5a791ad43..38fa7f52c 100644
--- a/src/plugins/ruby/weechat-ruby.c
+++ b/src/plugins/ruby/weechat-ruby.c
@@ -23,7 +23,7 @@
#undef _
#include <ruby.h>
-#if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+#if (defined(RUBY_API_VERSION_MAJOR) && defined(RUBY_API_VERSION_MINOR)) && (RUBY_API_VERSION_MAJOR >= 2 || (RUBY_API_VERSION_MAJOR == 1 && RUBY_API_VERSION_MINOR >= 9))
#include <ruby/encoding.h>
#endif
#ifdef HAVE_RUBY_VERSION_H
@@ -1149,7 +1149,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* init stdout/stderr buffer */
ruby_buffer_output[0] = '\0';
-#if defined(RUBY_VERSION) && RUBY_VERSION >= 19
+#if (defined(RUBY_API_VERSION_MAJOR) && defined(RUBY_API_VERSION_MINOR)) && (RUBY_API_VERSION_MAJOR >= 2 || (RUBY_API_VERSION_MAJOR == 1 && RUBY_API_VERSION_MINOR >= 9))
RUBY_INIT_STACK;
#endif