mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-24 18:58:08 -07:00
sci-libs/libsigrok: re-add ruby support
Signed-off-by: Sven Wegener <swegener@gentoo.org>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
From bae9308ec157378bd22ce4f4a0226f1e7ef23594 Mon Sep 17 00:00:00 2001
|
||||
From: Anatol Pomozov <anatol.pomozov@gmail.com>
|
||||
Date: Mon, 8 Jun 2020 20:46:44 -0700
|
||||
Subject: [PATCH] Fix ruby SWIG bindings generation
|
||||
|
||||
bindings/swig/doc.py generates a swig interface file for ruby bindings
|
||||
that includes docstrings with comments braces ( /* and */ ) like this:
|
||||
|
||||
%feature("docstring") sigrok::Channel::type "/* Type of this channel. */\n";
|
||||
%feature("docstring") sigrok::Channel::enabled "/* Enabled status of this channel. */\n";
|
||||
|
||||
SWIG generates *.cxx and adds its own braces to the docstring:
|
||||
|
||||
/*/* Document-class: Sigrok::Error
|
||||
Exception thrown when an error code is returned by any libsigrok call. */
|
||||
*/
|
||||
|
||||
this causes compilation error for Ruby bindings.
|
||||
|
||||
To fix the error we should not add extra braces to the docstring.
|
||||
With this patch libsigrok compiles fine with with ruby 2.7 and swig 4.0.2.
|
||||
|
||||
Fixes bug #1526
|
||||
|
||||
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
|
||||
---
|
||||
bindings/swig/doc.py | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/bindings/swig/doc.py b/bindings/swig/doc.py
|
||||
index e8767af8..182f5477 100644
|
||||
--- a/bindings/swig/doc.py
|
||||
+++ b/bindings/swig/doc.py
|
||||
@@ -46,7 +46,7 @@ for compound in index.findall('compound'):
|
||||
if language == 'python':
|
||||
print('%%feature("docstring") %s "%s";' % (class_name, brief))
|
||||
elif language == 'ruby':
|
||||
- print('%%feature("docstring") %s "/* Document-class: %s\\n%s */\\n";' % (class_name, class_name.replace("sigrok", "Sigrok", 1), brief))
|
||||
+ print('%%feature("docstring") %s "Document-class: %s\\n%s\\n";' % (class_name, class_name.replace("sigrok", "Sigrok", 1), brief))
|
||||
elif language == 'java':
|
||||
print('%%typemap(javaclassmodifiers) %s "/** %s */\npublic class"' % (
|
||||
class_name, brief))
|
||||
@@ -77,10 +77,10 @@ for compound in index.findall('compound'):
|
||||
for name, desc in parameters.items()]) + '";')
|
||||
if language == 'ruby' and kind == 'public-func':
|
||||
print(str.join('\n', [
|
||||
- '%%feature("docstring") %s::%s "/* %s' % (
|
||||
+ '%%feature("docstring") %s::%s "%s' % (
|
||||
class_name, member_name, brief)] + [
|
||||
'@param %s %s' % (name, desc)
|
||||
- for name, desc in parameters.items()]) + ' */\\n";')
|
||||
+ for name, desc in parameters.items()]) + '\\n";')
|
||||
elif language == 'java' and kind == 'public-func':
|
||||
print(str.join('\n', [
|
||||
'%%javamethodmodifiers %s::%s "/** %s' % (
|
||||
@@ -111,4 +111,4 @@ for compound in index.findall('compound'):
|
||||
print('%}')
|
||||
elif language == 'ruby' and constants:
|
||||
for member_name, brief in constants:
|
||||
- print('%%feature("docstring") %s::%s "/* %s */\\n";' % (class_name, member_name, brief))
|
||||
+ print('%%feature("docstring") %s::%s "%s\\n";' % (class_name, member_name, brief))
|
||||
--
|
||||
2.27.0
|
||||
@@ -5,7 +5,10 @@ EAPI="8"
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..13} )
|
||||
|
||||
inherit autotools python-r1 java-pkg-opt-2 udev xdg-utils
|
||||
USE_RUBY="ruby31 ruby32"
|
||||
RUBY_OPTIONAL="yes"
|
||||
|
||||
inherit autotools python-r1 java-pkg-opt-2 ruby-ng udev xdg-utils
|
||||
|
||||
if [[ ${PV} == *9999* ]]; then
|
||||
EGIT_REPO_URI="https://github.com/sigrokproject/${PN}.git"
|
||||
@@ -20,9 +23,10 @@ HOMEPAGE="https://sigrok.org/wiki/Libsigrok"
|
||||
|
||||
LICENSE="GPL-3"
|
||||
SLOT="0/4"
|
||||
IUSE="bluetooth +cxx ftdi hidapi java parport python serial static-libs test +udev usb"
|
||||
IUSE="bluetooth +cxx ftdi hidapi java parport python ruby serial static-libs test +udev usb"
|
||||
REQUIRED_USE="java? ( cxx )
|
||||
python? ( cxx ${PYTHON_REQUIRED_USE} )"
|
||||
python? ( cxx ${PYTHON_REQUIRED_USE} )
|
||||
ruby? ( cxx || ( $(ruby_get_use_targets) ) )"
|
||||
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
@@ -39,6 +43,7 @@ LIB_DEPEND="
|
||||
${PYTHON_DEPS}
|
||||
>=dev-python/pygobject-3.0.0[${PYTHON_USEDEP}]
|
||||
)
|
||||
ruby? ( $(ruby_implementations_depend) )
|
||||
serial? ( >=dev-libs/libserialport-0.1.1[static-libs(+)] )
|
||||
usb? ( virtual/libusb:1[static-libs(+)] )
|
||||
"
|
||||
@@ -58,6 +63,7 @@ DEPEND="${LIB_DEPEND//\[static-libs(+)]}
|
||||
dev-python/numpy[${PYTHON_USEDEP}]
|
||||
dev-python/setuptools[${PYTHON_USEDEP}]
|
||||
)
|
||||
ruby? ( >=dev-lang/swig-3.0.8 )
|
||||
test? ( >=dev-libs/check-0.9.4 )
|
||||
virtual/pkgconfig
|
||||
"
|
||||
@@ -68,6 +74,7 @@ PATCHES=(
|
||||
# https://sigrok.org/bugzilla/show_bug.cgi?id=1527
|
||||
"${FILESDIR}/${P}-swig-4.patch"
|
||||
# https://sigrok.org/bugzilla/show_bug.cgi?id=1526
|
||||
"${FILESDIR}/${P}-ruby-swig-docs.patch"
|
||||
"${FILESDIR}/${P}-check-0.15.patch"
|
||||
# https://bugs.gentoo.org/878395
|
||||
"${FILESDIR}/${PN}-0.5.2-swig-4.1.patch"
|
||||
@@ -77,6 +84,7 @@ PATCHES=(
|
||||
|
||||
pkg_setup() {
|
||||
use python && python_setup
|
||||
use ruby && ruby-ng_pkg_setup
|
||||
java-pkg-opt-2_pkg_setup
|
||||
}
|
||||
|
||||
@@ -88,7 +96,17 @@ sigrok_src_prepare() {
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
each_ruby_prepare() {
|
||||
sigrok_src_prepare
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
if use ruby; then
|
||||
# copy source to where ruby-ng_src_unpack puts it
|
||||
cp -rl "${S}" "${WORKDIR}"/all || die
|
||||
# ruby-ng_src_prepare calls default by itself
|
||||
ruby-ng_src_prepare
|
||||
fi
|
||||
default
|
||||
sigrok_src_prepare
|
||||
use python && python_copy_sources
|
||||
@@ -115,9 +133,14 @@ each_python_configure() {
|
||||
sigrok_src_configure --enable-python
|
||||
}
|
||||
|
||||
each_ruby_configure() {
|
||||
RUBY="${RUBY}" sigrok_src_configure --enable-ruby
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
sigrok_src_configure
|
||||
use python && python_foreach_impl each_python_configure
|
||||
use ruby && ruby-ng_src_configure
|
||||
}
|
||||
|
||||
each_python_compile() {
|
||||
@@ -125,9 +148,14 @@ each_python_compile() {
|
||||
emake python-build
|
||||
}
|
||||
|
||||
each_ruby_compile() {
|
||||
emake ruby-build
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
default
|
||||
use python && python_foreach_impl each_python_compile
|
||||
use ruby && ruby-ng_src_compile
|
||||
}
|
||||
|
||||
src_test() {
|
||||
@@ -140,9 +168,14 @@ each_python_install() {
|
||||
python_optimize
|
||||
}
|
||||
|
||||
each_ruby_install() {
|
||||
emake ruby-install DESTDIR="${D}"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
use python && python_foreach_impl each_python_install
|
||||
use ruby && ruby-ng_src_install
|
||||
use udev && udev_dorules contrib/*.rules
|
||||
find "${D}" -name '*.la' -type f -delete || die
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ EAPI="8"
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..13} )
|
||||
|
||||
inherit python-r1 java-pkg-opt-2 udev xdg-utils
|
||||
USE_RUBY="ruby31 ruby32"
|
||||
RUBY_OPTIONAL="yes"
|
||||
|
||||
inherit python-r1 java-pkg-opt-2 ruby-ng udev xdg-utils
|
||||
|
||||
if [[ ${PV} == *9999* ]]; then
|
||||
EGIT_REPO_URI="https://github.com/sigrokproject/${PN}.git"
|
||||
@@ -20,9 +23,10 @@ HOMEPAGE="https://sigrok.org/wiki/Libsigrok"
|
||||
|
||||
LICENSE="GPL-3"
|
||||
SLOT="0/9999"
|
||||
IUSE="bluetooth +cxx ftdi hidapi java nettle parport python serial static-libs test +udev usb"
|
||||
IUSE="bluetooth +cxx ftdi hidapi java nettle parport python ruby serial static-libs test +udev usb"
|
||||
REQUIRED_USE="java? ( cxx )
|
||||
python? ( cxx ${PYTHON_REQUIRED_USE} )"
|
||||
python? ( cxx ${PYTHON_REQUIRED_USE} )
|
||||
ruby? ( cxx || ( $(ruby_get_use_targets) ) )"
|
||||
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
@@ -40,6 +44,7 @@ LIB_DEPEND="
|
||||
${PYTHON_DEPS}
|
||||
>=dev-python/pygobject-3.0.0[${PYTHON_USEDEP}]
|
||||
)
|
||||
ruby? ( $(ruby_implementations_depend) )
|
||||
serial? ( >=dev-libs/libserialport-0.1.1[static-libs(+)] )
|
||||
usb? ( virtual/libusb:1[static-libs(+)] )
|
||||
"
|
||||
@@ -59,6 +64,7 @@ DEPEND="${LIB_DEPEND//\[static-libs(+)]}
|
||||
dev-python/numpy[${PYTHON_USEDEP}]
|
||||
dev-python/setuptools[${PYTHON_USEDEP}]
|
||||
)
|
||||
ruby? ( >=dev-lang/swig-3.0.8 )
|
||||
test? ( >=dev-libs/check-0.9.4 )
|
||||
virtual/pkgconfig
|
||||
"
|
||||
@@ -67,6 +73,7 @@ S="${WORKDIR}"/${P}
|
||||
|
||||
pkg_setup() {
|
||||
use python && python_setup
|
||||
use ruby && ruby-ng_pkg_setup
|
||||
java-pkg-opt-2_pkg_setup
|
||||
}
|
||||
|
||||
@@ -78,7 +85,17 @@ sigrok_src_prepare() {
|
||||
[[ ${PV} == *9999* ]] && eautoreconf
|
||||
}
|
||||
|
||||
each_ruby_prepare() {
|
||||
sigrok_src_prepare
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
if use ruby; then
|
||||
# copy source to where ruby-ng_src_unpack puts it
|
||||
cp -rl "${S}" "${WORKDIR}"/all || die
|
||||
# ruby-ng_src_prepare calls default by itself
|
||||
ruby-ng_src_prepare
|
||||
fi
|
||||
default
|
||||
sigrok_src_prepare
|
||||
use python && python_copy_sources
|
||||
@@ -106,9 +123,14 @@ each_python_configure() {
|
||||
sigrok_src_configure --enable-python
|
||||
}
|
||||
|
||||
each_ruby_configure() {
|
||||
RUBY="${RUBY}" sigrok_src_configure --enable-ruby
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
sigrok_src_configure
|
||||
use python && python_foreach_impl each_python_configure
|
||||
use ruby && ruby-ng_src_configure
|
||||
}
|
||||
|
||||
each_python_compile() {
|
||||
@@ -116,9 +138,14 @@ each_python_compile() {
|
||||
emake python-build
|
||||
}
|
||||
|
||||
each_ruby_compile() {
|
||||
emake ruby-build
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
default
|
||||
use python && python_foreach_impl each_python_compile
|
||||
use ruby && ruby-ng_src_compile
|
||||
}
|
||||
|
||||
src_test() {
|
||||
@@ -131,9 +158,14 @@ each_python_install() {
|
||||
python_optimize
|
||||
}
|
||||
|
||||
each_ruby_install() {
|
||||
emake ruby-install DESTDIR="${D}"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
use python && python_foreach_impl each_python_install
|
||||
use ruby && ruby-ng_src_install
|
||||
use udev && udev_dorules contrib/*.rules
|
||||
find "${D}" -name '*.la' -type f -delete || die
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user