forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app-i18n/tomoe: fix build with >=dev-lang/ruby-1.9
Package-Manager: Portage-2.3.6, Repoman-2.3.1
- Loading branch information
Showing
2 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- a/bindings/ruby/tomoe-rb-char.c | ||
+++ b/bindings/ruby/tomoe-rb-char.c | ||
@@ -2,6 +2,10 @@ | ||
|
||
#define _SELF(obj) RVAL2TCHR(obj) | ||
|
||
+#ifndef RSTRING_LEN | ||
+# define RSTRING_LEN(s) (RSTRING(s)->len) | ||
+#endif | ||
+ | ||
static VALUE | ||
tc_initialize(int argc, VALUE *argv, VALUE self) | ||
{ | ||
@@ -13,7 +17,7 @@ | ||
if (NIL_P(xml)) { | ||
chr = tomoe_char_new(); | ||
} else { | ||
- chr = tomoe_char_new_from_xml_data(RVAL2CSTR(xml), RSTRING(xml)->len); | ||
+ chr = tomoe_char_new_from_xml_data(RVAL2CSTR(xml), RSTRING_LEN(xml)); | ||
} | ||
|
||
G_INITIALIZE(self, chr); | ||
--- a/macros/ruby.m4 | ||
+++ b/macros/ruby.m4 | ||
@@ -28,13 +28,18 @@ | ||
|
||
changequote(<<, >>) | ||
for var_name in archdir sitearchdir CFLAGS LIBRUBYARG libdir \ | ||
- sitelibdir sitearchdir; do | ||
- rbconfig_tmp=`$rbconfig "print Config::CONFIG['$var_name']"` | ||
+ sitelibdir rubyhdrdir rubyarchhdrdir; do | ||
+ rbconfig_tmp=`$rbconfig "print RbConfig::CONFIG['$var_name']"` | ||
eval "rbconfig_$var_name=\"$rbconfig_tmp\"" | ||
done | ||
changequote([, ]) | ||
|
||
- RUBY_CFLAGS="$RUBY_CFLAGS -I$rbconfig_archdir " | ||
+ if test "x$rbconfig_rubyhdrdir" = "x"; then | ||
+ RUBY_CFLAGS="$RUBY_CFLAGS -I$rbconfig_archdir " | ||
+ else | ||
+ RUBY_CFLAGS="$RUBY_CFLAGS -I$rbconfig_rubyhdrdir " | ||
+ RUBY_CFLAGS="$RUBY_CFLAGS -I$rbconfig_rubyarchhdrdir " | ||
+ fi | ||
RUBY_CFLAGS="$RUBY_CFLAGS -I$rbconfig_sitearchdir " | ||
RUBY_CFLAGS="$RUBY_CFLAGS $rbconfig_CFLAGS " | ||
RUBY_LIBS="$rbconfig_LIBRUBYARG" | ||
--- a/module/dict/tomoe-dict-ruby.c | ||
+++ b/module/dict/tomoe-dict-ruby.c | ||
@@ -52,6 +52,13 @@ | ||
#define TOMOE_IS_DICT_RUBY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOMOE_TYPE_DICT_RUBY)) | ||
#define TOMOE_DICT_RUBY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TOMOE_TYPE_DICT_RUBY, TomoeDictRubyClass)) | ||
|
||
+#ifndef RARRAY_LEN | ||
+# define RARRAY_LEN(a) (RARRAY(a)->len) | ||
+#endif | ||
+#ifndef RARRAY_PTR | ||
+# define RARRAY_PTR(a) (RARRAY(a)->ptr) | ||
+#endif | ||
+ | ||
enum { | ||
PROP_0, | ||
PROP_FILENAME, | ||
@@ -209,7 +216,7 @@ | ||
ruby_script (PACKAGE); | ||
ruby_set_argv (1, argv); | ||
|
||
- if (RARRAY(rb_load_path)->len == 0) { | ||
+ if (RARRAY_LEN(rb_load_path) == 0) { | ||
ruby_init_loadpath (); | ||
} | ||
} | ||
@@ -405,10 +412,10 @@ | ||
|
||
rb_results = rb_funcall (dict->rb_dict, rb_intern ("search"), | ||
1, GOBJ2RVAL (query)); | ||
- len = RARRAY (rb_results)->len; | ||
+ len = RARRAY_LEN(rb_results); | ||
for (i = len; i; i--) { | ||
results = g_list_prepend (results, | ||
- RVAL2TCND (RARRAY (rb_results)->ptr[i])); | ||
+ RVAL2TCND (RARRAY_PTR(rb_results)[i])); | ||
} | ||
return results; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Copyright 1999-2017 Gentoo Foundation | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
EAPI="6" | ||
PYTHON_COMPAT=( python2_7 ) | ||
USE_RUBY="ruby22 ruby23" | ||
|
||
inherit autotools ltprune python-single-r1 ruby-single | ||
|
||
DESCRIPTION="Japanese handwriting recognition engine" | ||
HOMEPAGE="http://tomoe.osdn.jp/" | ||
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" | ||
|
||
LICENSE="LGPL-2.1" | ||
SLOT="0" | ||
KEYWORDS="~amd64 ~x86" | ||
IUSE="hyperestraier mysql python ruby ${USE_RUBY//ruby/ruby_targets_ruby} static-libs subversion" | ||
RESTRICT="test" | ||
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} ) | ||
ruby? ( || ( ${USE_RUBY//ruby/ruby_targets_ruby} ) )" | ||
|
||
_ruby_set_globals() { | ||
local ruby | ||
for ruby in ${USE_RUBY}; do | ||
RUBY_USEDEP="${RUBY_USEDEP}ruby_targets_${ruby}?," | ||
done | ||
RUBY_USEDEP="${RUBY_USEDEP%,}" | ||
} | ||
_ruby_set_globals | ||
unset -f _ruby_set_globals | ||
|
||
RDEPEND="dev-libs/glib:2 | ||
hyperestraier? ( app-text/hyperestraier ) | ||
mysql? ( virtual/libmysqlclient ) | ||
python? ( | ||
${PYTHON_DEPS} | ||
dev-python/pygobject:2[${PYTHON_USEDEP}] | ||
dev-python/pygtk:2[${PYTHON_USEDEP}] | ||
) | ||
ruby? ( | ||
${RUBY_DEPS} | ||
dev-ruby/ruby-glib2[${RUBY_USEDEP}] | ||
) | ||
subversion? ( dev-vcs/subversion )" | ||
DEPEND="${RDEPEND} | ||
dev-util/gtk-doc-am | ||
dev-util/intltool | ||
virtual/pkgconfig" | ||
|
||
PATCHES=( | ||
"${FILESDIR}"/${PN}-gentoo.patch | ||
"${FILESDIR}"/${PN}-export-symbols.patch | ||
"${FILESDIR}"/${PN}-glib-2.32.patch | ||
"${FILESDIR}"/${PN}-ruby19.patch | ||
) | ||
|
||
pkg_setup() { | ||
use python && python-single-r1_pkg_setup | ||
} | ||
|
||
src_prepare() { | ||
sed -i \ | ||
-e "s/use_est=yes/use_est=$(usex hyperestraier)/" \ | ||
-e "s/use_mysql=yes/use_mysql=$(usex mysql)/" \ | ||
configure.ac | ||
|
||
sed -i "s/use_svn=yes/use_svn=$(usex subversion)/" macros/svn.m4 | ||
|
||
default | ||
eautoreconf | ||
} | ||
|
||
src_configure() { | ||
local ruby | ||
for ruby in ${RUBY_TARGETS_PREFERENCE}; do | ||
if use ruby_targets_${ruby}; then | ||
break | ||
fi | ||
done | ||
|
||
econf \ | ||
$(use_enable ruby dict-ruby) \ | ||
$(use_enable static-libs static) \ | ||
$(use_with python python "") \ | ||
$(use_with ruby ruby "$(type -p ${ruby})") \ | ||
--with-svn-include="${EPREFIX}"/usr/include \ | ||
--with-svn-lib="${EPREFIX}"/usr/$(get_libdir) | ||
} | ||
|
||
src_install() { | ||
default | ||
prune_libtool_files --modules | ||
} |