From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 986A4158083 for ; Sat, 31 Aug 2024 19:27:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D7245E2AB2; Sat, 31 Aug 2024 19:27:23 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B8D46E2AB2 for ; Sat, 31 Aug 2024 19:27:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E7A4C343104 for ; Sat, 31 Aug 2024 19:27:22 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8307B14D6 for ; Sat, 31 Aug 2024 19:27:21 +0000 (UTC) From: "Sven Wegener" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Wegener" Message-ID: <1725132436.a294ac7a6ae93b338b4a5a9a2feeb6bdc335dc3b.swegener@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/libsigrok/, sci-libs/libsigrok/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: sci-libs/libsigrok/files/libsigrok-0.5.2-ruby-swig-docs.patch sci-libs/libsigrok/libsigrok-0.5.2-r5.ebuild sci-libs/libsigrok/libsigrok-9999.ebuild X-VCS-Directories: sci-libs/libsigrok/files/ sci-libs/libsigrok/ X-VCS-Committer: swegener X-VCS-Committer-Name: Sven Wegener X-VCS-Revision: a294ac7a6ae93b338b4a5a9a2feeb6bdc335dc3b X-VCS-Branch: master Date: Sat, 31 Aug 2024 19:27:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 2ce0e7a9-b0b5-42ef-b9bc-7bd5bae5046e X-Archives-Hash: 34e6f1efaefe142e857a54a2a1cadc6e commit: a294ac7a6ae93b338b4a5a9a2feeb6bdc335dc3b Author: Sven Wegener gentoo org> AuthorDate: Sat Aug 31 16:01:52 2024 +0000 Commit: Sven Wegener gentoo org> CommitDate: Sat Aug 31 19:27:16 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a294ac7a sci-libs/libsigrok: re-add ruby support Signed-off-by: Sven Wegener gentoo.org> .../files/libsigrok-0.5.2-ruby-swig-docs.patch | 63 ++++++++++++++++++++++ sci-libs/libsigrok/libsigrok-0.5.2-r5.ebuild | 39 ++++++++++++-- sci-libs/libsigrok/libsigrok-9999.ebuild | 38 +++++++++++-- 3 files changed, 134 insertions(+), 6 deletions(-) diff --git a/sci-libs/libsigrok/files/libsigrok-0.5.2-ruby-swig-docs.patch b/sci-libs/libsigrok/files/libsigrok-0.5.2-ruby-swig-docs.patch new file mode 100644 index 000000000000..808227a2fffb --- /dev/null +++ b/sci-libs/libsigrok/files/libsigrok-0.5.2-ruby-swig-docs.patch @@ -0,0 +1,63 @@ +From bae9308ec157378bd22ce4f4a0226f1e7ef23594 Mon Sep 17 00:00:00 2001 +From: Anatol Pomozov +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 +--- + 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 diff --git a/sci-libs/libsigrok/libsigrok-0.5.2-r5.ebuild b/sci-libs/libsigrok/libsigrok-0.5.2-r5.ebuild index b5b8f1dea964..29150532d1a4 100644 --- a/sci-libs/libsigrok/libsigrok-0.5.2-r5.ebuild +++ b/sci-libs/libsigrok/libsigrok-0.5.2-r5.ebuild @@ -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 } diff --git a/sci-libs/libsigrok/libsigrok-9999.ebuild b/sci-libs/libsigrok/libsigrok-9999.ebuild index 191f1750e535..908f3fbda84e 100644 --- a/sci-libs/libsigrok/libsigrok-9999.ebuild +++ b/sci-libs/libsigrok/libsigrok-9999.ebuild @@ -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 }