diff --git a/sci-libs/libsigrok/Manifest b/sci-libs/libsigrok/Manifest new file mode 100644 index 0000000..af07436 --- /dev/null +++ b/sci-libs/libsigrok/Manifest @@ -0,0 +1,6 @@ +AUX libsigrok-0.6.0_pre20241020-nullptr.patch 548 BLAKE2B 990e3bc4e48bf150863d3544e503172e1afa43254a105cffc51d756f442b24018e50316bccd3e333214d16c4bbc2db5ef54de7e54c114641fd9aaa43e2e2f68a SHA512 4bfc441e8e2862bd16822629c8c70e0015c3a8772d32539cd59a059302a057e97dd662094965caf27c0d6c3d752f4c010b6f8ff6a1098366237f1d30dc1f0754 +AUX libsigrok-0.6.0_pre20241020-serial.patch 828 BLAKE2B f145eaa8953298db4d5cd19ca143db480f9612a96744070dc65a9d0d359a76210ece4d0d3d5961450e58c3115b88d9934e2ac63a6c3c287ca50ef1e0e7a36bf2 SHA512 54ae9fced3a899708b5d8af34f31cd57c95d9bcdadd881e3f8789d7067d5db1b5d2d9ebdf0d939b24184414017d9944d3b899f0cc8552965a9bb06911d0b7636 +AUX libsigrok-0.6.0_pre20241020-swig.patch 1246 BLAKE2B be6160f2aef9ea7b6be78264fa0ccfa4dc5fd6091f423e3e10a9704f84ddd319a583bb0efb2700eba4ee9aa31b93b898b7b27fe76ebef6517df80f5994fa74ed SHA512 dd1905d14a6d692eb4064e9d6caadc2e8a0db2417ba7919565a2d55b999c9d15ba719f0fe417045d1b5930b97d1a635163a63a05858c313b16348c69f0841fb6 +DIST libsigrok-f06f788.zip 1881766 BLAKE2B 9477312c9365c4b35ef5fb5d0908946be6f1a7f681c0b42fe4a02595069b87697bf50ad5c11130abc15229b977c2432ed8407207b954f52078c471695c911908 SHA512 bfc3390cb1f6c54f137f8f75a3eb841451ceb0376c3ba9b020cfd106a815d59179d326bd6c00a59f44a9dd5b559cf422e012761ef16c6e7ec164f1eaef5a374e +EBUILD libsigrok-0.6.0_pre20241020.ebuild 4737 BLAKE2B e6955f0e9c1ea91ca75fa2110e61d6f267b21a75ac46863769e58ef0bd97b7928bb382f68f5a3d06c6c3e7dd04bf9336a1f7ac2a0071082bdd2604448dc89c63 SHA512 5553a25f9f252a883169e07a7474ed79f520f1ec253f9bc44613793dc8e4c4941743f1e50a437a859d1fabf2532e8c4bce899067c979fe83a10da173725f0571 +MISC metadata.xml 1067 BLAKE2B f706629a4d4bfca63bc61a95e4289bf7cb246f069142a362b7db6727ee52232e2b173ac1375f30e046fde6d5eabadb986bff656e9e0dcc1d8a7a1b66ff93f3f8 SHA512 060559c6ea4b9ed1e187552654f01009e461f96b76dc9046d9ee8203cb8675279a06a73a40c9735ff5a2211e54444bf525d1eb6cb0ed88a238b8805863c736d9 diff --git a/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-nullptr.patch b/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-nullptr.patch new file mode 100644 index 0000000..c15e0f8 --- /dev/null +++ b/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-nullptr.patch @@ -0,0 +1,12 @@ +diff '--color=auto' -ur libsigrok-f06f788/bindings/python/sigrok/core/classes.i ../libsigrok-f06f788/bindings/python/sigrok/core/classes.i +--- libsigrok-f06f788/bindings/python/sigrok/core/classes.i 2024-10-20 13:10:56.000000000 -0700 ++++ ../libsigrok-f06f788/bindings/python/sigrok/core/classes.i 2026-06-09 18:27:00.993413702 -0700 +@@ -85,7 +85,7 @@ + if (!GLib) { + fprintf(stderr, "Import of gi.repository.GLib failed.\n"); + #if PY_VERSION_HEX >= 0x03000000 +- return nullptr; ++ return 0; + #else + return; + #endif diff --git a/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-serial.patch b/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-serial.patch new file mode 100644 index 0000000..3fb2597 --- /dev/null +++ b/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-serial.patch @@ -0,0 +1,18 @@ +https://bugs.gentoo.org/957126 +https://github.com/sigrokproject/libsigrok/commit/467c80149e1ce0cd9bc77517466cc6b8f4753d49 + +From: Daniel Trnka +Date: Sun, 24 Nov 2024 14:11:46 +0100 +Subject: [PATCH] gwinstek-psp: Only build if serial_comm is enabled + +--- a/configure.ac ++++ b/configure.ac +@@ -336,7 +336,7 @@ SR_DRIVER([GMC MH 1x/2x], [gmc-mh-1x-2x], [serial_comm]) + SR_DRIVER([Great Scott Gadgets GreatFET One], [greatfet], [libusb]) + SR_DRIVER([GW Instek GDS-800], [gwinstek-gds-800], [serial_comm]) + SR_DRIVER([GW Instek GPD], [gwinstek-gpd], [serial_comm]) +-SR_DRIVER([GW Instek PSP], [gwinstek-psp]) ++SR_DRIVER([GW Instek PSP], [gwinstek-psp], [serial_comm]) + SR_DRIVER([Hameg HMO], [hameg-hmo]) + SR_DRIVER([Hantek 4032L], [hantek-4032l], [libusb]) + SR_DRIVER([Hantek 6xxx], [hantek-6xxx], [libusb]) diff --git a/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-swig.patch b/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-swig.patch new file mode 100644 index 0000000..8f96a1e --- /dev/null +++ b/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-swig.patch @@ -0,0 +1,38 @@ +https://bugs.gentoo.org/878395 +https://bugs.gentoo.org/959264 + +From cdd8b55975e447840ce76f3a241be88fec7585b3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= +Date: Sun, 3 Nov 2024 17:07:29 +0100 +Subject: [PATCH] support SWIG 4.2 and later +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +otherwise building sigrok fails with +bindings/swig/enums.i:1: Error: Unknown directive '%attribute'. + +Also indicate that bindings/swig/enums.i is a generated file. + +Signed-off-by: Klaus Kämpf +--- + bindings/cxx/enums.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/bindings/cxx/enums.py b/bindings/cxx/enums.py +index 3711334e7..388faf225 100644 +--- a/bindings/cxx/enums.py ++++ b/bindings/cxx/enums.py +@@ -73,9 +73,11 @@ + code = open(os.path.join(outdirname, 'cxx/enums.cpp'), 'w') + swig = open(os.path.join(outdirname, 'swig/enums.i'), 'w') + +-for file in (header, code): ++for file in (header, code, swig): + print("/* Generated file - edit enums.py instead! */", file=file) + ++print('%include "attribute.i"', file=swig) ++ + print("namespace sigrok {", file=header) + + # Template for beginning of class declaration and public members. diff --git a/sci-libs/libsigrok/libsigrok-0.6.0_pre20241020.ebuild b/sci-libs/libsigrok/libsigrok-0.6.0_pre20241020.ebuild new file mode 100644 index 0000000..cdb9b2f --- /dev/null +++ b/sci-libs/libsigrok/libsigrok-0.6.0_pre20241020.ebuild @@ -0,0 +1,216 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +USE_RUBY="ruby31 ruby32 ruby33" +RUBY_OPTIONAL="yes" +inherit flag-o-matic toolchain-funcs +inherit python-r1 java-pkg-opt-2 ruby-ng udev xdg-utils + +case ${PV} in +*9999*) + EGIT_REPO_URI="https://github.com/sigrokproject/${PN}.git" + inherit git-r3 autotools + S="${WORKDIR}"/${P} + ;; +*_p*) + inherit autotools unpacker + COMMIT="f06f788118191d19fdbbb37046d3bd5cec91adb1" + SRC_URI="https://sigrok.org/gitweb/?p=${PN}.git;a=snapshot;h=${COMMIT};sf=zip -> ${PN}-${COMMIT:0:7}.zip" + S="${WORKDIR}"/${PN}-${COMMIT:0:7} + ;; +*) + SRC_URI="https://sigrok.org/download/source/${PN}/${P}.tar.gz" + S="${WORKDIR}"/${P} + ;; +esac + +DESCRIPTION="Basic hardware drivers for logic analyzers and input/output file format support" +HOMEPAGE="https://sigrok.org/wiki/Libsigrok" + +LICENSE="GPL-3" +if [[ ${PV} == *9999* ]]; then + SLOT="0/9999" +else + SLOT="0/4" + KEYWORDS="~amd64 ~arm ~arm64 ~x86" +fi +IUSE="bluetooth +cxx ftdi gpib hidapi java nettle parport python ruby serial test +udev usb" +REQUIRED_USE="java? ( cxx ) + python? ( cxx ${PYTHON_REQUIRED_USE} ) + ruby? ( cxx || ( $(ruby_get_use_targets) ) )" + +RESTRICT="!test? ( test )" + +# We also support librevisa, but that isn't in the tree ... +COMMON_DEPEND=" + >=dev-libs/glib-2.32.0 + >=dev-libs/libzip-0.8:= + virtual/zlib:= + bluetooth? ( >=net-wireless/bluez-4.0:= ) + cxx? ( dev-cpp/glibmm:2 ) + ftdi? ( dev-embedded/libftdi:1 ) + gpib? ( sci-libs/linux-gpib ) + hidapi? ( >=dev-libs/hidapi-0.8.0 ) + nettle? ( dev-libs/nettle:= ) + parport? ( sys-libs/libieee1284 ) + python? ( + ${PYTHON_DEPS} + >=dev-python/pygobject-3.0.0[${PYTHON_USEDEP}] + ) + ruby? ( $(ruby_implementations_depend) ) + serial? ( >=dev-libs/libserialport-0.1.1 ) + usb? ( virtual/libusb:1 ) +" +RDEPEND="${COMMON_DEPEND} + java? ( >=virtual/jre-1.8:* ) +" +DEPEND="${COMMON_DEPEND} + java? ( + >=dev-lang/swig-3.0.6 + >=virtual/jdk-1.8:* + ) + python? ( + >=dev-lang/swig-3.0.6 + dev-python/numpy[${PYTHON_USEDEP}] + dev-python/setuptools[${PYTHON_USEDEP}] + ) + ruby? ( >=dev-lang/swig-3.0.8 ) + test? ( >=dev-libs/check-0.9.4 ) +" +BDEPEND=" + virtual/pkgconfig + cxx? ( app-text/doxygen ) +" +[[ ${PV} == *_p* ]] && BDEPEND+=" app-arch/unzip" + +PATCHES=( + "${FILESDIR}"/${PN}-0.6.0_pre20241020-swig.patch + "${FILESDIR}"/${PN}-0.6.0_pre20241020-serial.patch + "${FILESDIR}"/${PN}-0.6.0_pre20241020-nullptr.patch +) + +pkg_setup() { + use python && python_setup + use ruby && ruby-ng_pkg_setup + java-pkg-opt-2_pkg_setup +} + +src_unpack() { + case ${PV} in + *9999*) + git-r3_src_unpack ;; + *_p*) + unpack_zip ${A} ;; + esac + default +} + +sigrok_src_prepare() { + [[ ${PV} == *9999* || ${PV} == *_p* ]] && 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 +} + +sigrok_src_configure() { + # bug #981675 + [[ ${CHOST} == *-darwin* ]] && append-cflags $(test-flags-CC -fpermissive) + + local myeconfargs=( + --disable-python + --disable-ruby + $(use_with bluetooth libbluez) + $(use_enable cxx) + $(use_with ftdi libftdi) + $(use_with hidapi libhidapi) + $(use_enable java) + $(use_with nettle libnettle) + $(use_with parport libieee1284) + $(use_with serial libserialport) + $(use_with usb libusb) + ) + econf "${myeconfargs[@]}" "${@}" +} + +each_python_configure() { + pushd "${BUILD_DIR}" > /dev/null || die + sigrok_src_configure --enable-python + popd >/dev/null || die +} + +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() { + pushd "${BUILD_DIR}" > /dev/null || die + emake python-build + popd >/dev/null || die +} + +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() { + emake check +} + +each_python_install() { + pushd "${BUILD_DIR}" > /dev/null || die + emake python-install DESTDIR="${D}" + python_optimize + popd >/dev/null || die +} + +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 +} + +pkg_postinst() { + xdg_icon_cache_update + xdg_mimeinfo_database_update + udev_reload +} + +pkg_postrm() { + xdg_icon_cache_update + xdg_mimeinfo_database_update + udev_reload +} diff --git a/sci-libs/libsigrok/metadata.xml b/sci-libs/libsigrok/metadata.xml new file mode 100644 index 0000000..25f0558 --- /dev/null +++ b/sci-libs/libsigrok/metadata.xml @@ -0,0 +1,24 @@ + + + + + embedded@gentoo.org + Embedded Gentoo + + + libsigrok is a shared library written in C, which provides the basic + hardware access drivers for logic analyzers and other supported devices, + as well as input/output file format support. + + + Enable drivers that need dev-embedded/libftdi + Enable drivers that need sci-libs/linux-gpib + Enable drivers that need dev-libs/hidapi + Enable drivers that need dev-libs/nettle + Enable drivers that are parallel (IEEE1284) based + Enable drivers that are serial (RS232) based + + + sigrokproject/libsigrok + +