From 04cb58f895ed1968c5d383f747d24ccd5b3a7e1c Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Tue, 8 Mar 2022 18:59:31 +0100 Subject: [PATCH 1/8] cross-compile/macosx: install IRMP dylib in library directory (DMG creation) --- cross-compile/macosx/create_dmg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cross-compile/macosx/create_dmg b/cross-compile/macosx/create_dmg index effe378..be97673 100755 --- a/cross-compile/macosx/create_dmg +++ b/cross-compile/macosx/create_dmg @@ -116,7 +116,7 @@ install_name_tool -change \ install_name_tool -change \ /usr/local/opt/python/Frameworks/Python.framework/Versions/$PYVER/Python \ @executable_path/../Frameworks/Python.framework/Versions/$PYVER/Python \ - $FRAMEWORKSDIR/libirmp.*.dylib + $PREFIX/lib/libirmp.*.dylib # Add wrapper (sets PYTHONHOME/SIGROK_FIRMWARE_DIR/SIGROKDECODE_DIR). mv $MACOSDIR/$APPNAME_BINARY $MACOSDIR/$APPNAME_BINARY.real -- 2.30.2 From 8a9979e1f48dcdb1f1b1023be8e1ec2ac0f73a6e Mon Sep 17 00:00:00 2001 From: Brian 'Redbeard' Harrington Date: Sat, 10 Sep 2022 14:44:07 -0700 Subject: [PATCH 2/8] cross-compile/macosx: Set DYLD_LIBRARY_PATH After a prior change to the dynamic library path location users have reported issues of nightly builds crashing on MacOS: - #1633 - #1627 - #1651 - #1744 This change, mentioned by Andrea Leofreddi in #1633, hints PulseView and sigrok-cli as to the correct location of dynamic libraries through the addition of an environment variable to the startup script. --- cross-compile/macosx/contrib/pulseview | 1 + cross-compile/macosx/contrib/sigrok-cli | 1 + 2 files changed, 2 insertions(+) diff --git a/cross-compile/macosx/contrib/pulseview b/cross-compile/macosx/contrib/pulseview index e41b4ad..a77ae3e 100755 --- a/cross-compile/macosx/contrib/pulseview +++ b/cross-compile/macosx/contrib/pulseview @@ -20,6 +20,7 @@ DIR="$(dirname "$0")" cd "$DIR" +export DYLD_LIBRARY_PATH="../Frameworks" export PYTHONHOME="../Frameworks/Python.framework/Versions/3.7" export SIGROK_FIRMWARE_DIR="../share/sigrok-firmware" export SIGROKDECODE_DIR="../share/libsigrokdecode/decoders" diff --git a/cross-compile/macosx/contrib/sigrok-cli b/cross-compile/macosx/contrib/sigrok-cli index f3adbb0..3eb8ee2 100755 --- a/cross-compile/macosx/contrib/sigrok-cli +++ b/cross-compile/macosx/contrib/sigrok-cli @@ -20,6 +20,7 @@ DIR="$(dirname "$0")" cd "$DIR" +export DYLD_LIBRARY_PATH="../Frameworks" export PYTHONHOME="../Frameworks/Python.framework/Versions/3.7" export SIGROK_FIRMWARE_DIR="../share/sigrok-firmware" export SIGROKDECODE_DIR="../share/libsigrokdecode/decoders" -- 2.30.2 From 730388d5b12511a27d93f72b4ec3b648588cf708 Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Sun, 2 Oct 2022 14:38:58 +0200 Subject: [PATCH 3/8] sigrok-cross-mingw: pass PREFIX to sigrok-dumps install command Catch up with recent sigrok-dumps Makefile adjustment. The DESTDIR variable traditionally serves a different purpose. Prefer PREFIX to specify the in-filesystem base path where share/... is located. --- cross-compile/mingw/sigrok-cross-mingw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cross-compile/mingw/sigrok-cross-mingw b/cross-compile/mingw/sigrok-cross-mingw index 12c68ec..7a2fa04 100755 --- a/cross-compile/mingw/sigrok-cross-mingw +++ b/cross-compile/mingw/sigrok-cross-mingw @@ -228,7 +228,7 @@ cd .. $ECHO "component sigrok-dumps ..." $GIT_CLONE $REPO_BASE/sigrok-dumps cd sigrok-dumps -make install DESTDIR=$PREFIX/share/sigrok-dumps $V +make install PREFIX=$PREFIX $V cd .. # sigrok-cli -- 2.30.2 From 177ed39a41dc16e470e08170e4255b37213aa9bf Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Wed, 23 Nov 2022 16:12:47 +0100 Subject: [PATCH 4/8] cross-compile/mingw: update sigrok specific libusb patch Catch up with recent mainline MXE as of 2022-11-23. Unbreak the autoreconf(1) invocation before the configure call. Don't force a specific libusb version any longer (MXE ships 1.0.26 by now). --- cross-compile/mingw/libusb1_upgrade.patch | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/cross-compile/mingw/libusb1_upgrade.patch b/cross-compile/mingw/libusb1_upgrade.patch index dd2d4af..8dc8646 100644 --- a/cross-compile/mingw/libusb1_upgrade.patch +++ b/cross-compile/mingw/libusb1_upgrade.patch @@ -24,27 +24,9 @@ index ab01bf69..53aed36e 100644 define $(PKG)_BUILD - cd '$(1)' && ./configure \ + cd '$(1)' && autoreconf -i && ./configure \ - $(MXE_CONFIGURE_OPTS) \ - CFLAGS=-D_WIN32_WINNT=0x0500 + $(MXE_CONFIGURE_OPTS) $(MAKE) -C '$(1)' -j '$(JOBS)' install - - -diff --git a/src/libusb1.mk b/src/libusb1.mk -index ab01bf69..53aed36e 100644 ---- a/src/libusb1.mk -+++ b/src/libusb1.mk -@@ -4,8 +4,8 @@ PKG := libusb1 - $(PKG)_WEBSITE := https://libusb.info/ - $(PKG)_DESCR := LibUsb-1.0 - $(PKG)_IGNORE := --$(PKG)_VERSION := 1.0.24 --$(PKG)_CHECKSUM := 7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a -+$(PKG)_VERSION := 1.0.25 -+$(PKG)_CHECKSUM := 8a28ef197a797ebac2702f095e81975e2b02b2eeff2774fa909c78a74ef50849 - $(PKG)_SUBDIR := libusb-$($(PKG)_VERSION) - $(PKG)_FILE := libusb-$($(PKG)_VERSION).tar.bz2 - $(PKG)_URL := https://$(SOURCEFORGE_MIRROR)/project/libusb/libusb-1.0/libusb-$($(PKG)_VERSION)/$($(PKG)_FILE) - + diff --git a/src/libusb1-1-fixes.patch b/src/libusb1-1-fixes.patch new file mode 100644 -- 2.30.2 From 7ba871493bbb6173a245850cffdba550654ad6cc Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Wed, 23 Nov 2022 16:15:37 +0100 Subject: [PATCH 5/8] cross-compile/mingw: comment on sigrok specific "MXE fixes" patch No change in behaviour, just comments and grouping and whitespace fixup. Separate the binutils downgrade from the glib downgrade. Provide empty lines for faster editor navigation. Provide comments for human readers. Keep MXE's style of glib.mk indentation when disabling warnings. This patch no longer applies to recent MXE versions, but might as well have become obsolete. A build without these "MXE fixes" patches is attempted, the result is yet to get determined. Needs more consideration. --- cross-compile/mingw/mxe_fixes.patch | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/cross-compile/mingw/mxe_fixes.patch b/cross-compile/mingw/mxe_fixes.patch index 72a4dd0..b62d513 100644 --- a/cross-compile/mingw/mxe_fixes.patch +++ b/cross-compile/mingw/mxe_fixes.patch @@ -1,3 +1,12 @@ +Implementor's note: These patches currently (2022-11) don't apply to +recent MXE, their context has changed. The patches' motivation might +have become obsolete, too. This needs reconsideration. When in doubt, +attempt to build with an MXE toolchain which omits these "MXE fixes" +(which actually are downgrades of tools and libraries, while mainline +MXE has upgraded and could have fixed previous issues). Older notes +from a previous implementation follow below. + + These patches are currently required to get a properly working MXE setup for sigrok usage. @@ -15,6 +24,9 @@ MXE setup for sigrok usage. See the other file for a libusb discussion. + +Change from binutils 2.28 to 2.35. + diff --git a/src/binutils-1-fixes.patch b/src/binutils-1-fixes.patch deleted file mode 100644 index 357428fe..00000000 @@ -168,6 +180,7 @@ index 357428fe..00000000 - - if (pe_def_file->version_major != -1) - { + diff --git a/src/binutils.mk b/src/binutils.mk index 9721b581..8eab8bf3 100644 --- a/src/binutils.mk @@ -183,6 +196,10 @@ index 9721b581..8eab8bf3 100644 $(PKG)_SUBDIR := binutils-$($(PKG)_VERSION) $(PKG)_FILE := binutils-$($(PKG)_VERSION).tar.bz2 $(PKG)_URL := https://ftp.gnu.org/gnu/binutils/$($(PKG)_FILE) + + +Provide glib fixing patches. As well as downgrade to 2.44.1. + diff --git a/src/glib-1-fixes.patch b/src/glib-1-fixes.patch index 764ece9e..428cc6a9 100644 --- a/src/glib-1-fixes.patch @@ -494,6 +511,7 @@ index 764ece9e..428cc6a9 100644 - { - g_set_error (error, - G_IO_ERROR, + diff --git a/src/glib-2-format.patch b/src/glib-2-format.patch new file mode 100644 index 00000000..3d594af0 @@ -577,6 +595,7 @@ index 00000000..3d594af0 + glib_gpi_cast='(gint64)' + glib_gpui_cast='(guint64)' + ;; + diff --git a/src/glib.mk b/src/glib.mk index 825b86bb..499a45b8 100644 --- a/src/glib.mk @@ -598,7 +617,7 @@ index 825b86bb..499a45b8 100644 cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \ $(MXE_CONFIGURE_OPTS) \ --enable-regex \ -+ --disable-compile-warnings \ ++ --disable-compile-warnings \ --disable-threads \ --disable-selinux \ --disable-inotify \ @@ -606,7 +625,7 @@ index 825b86bb..499a45b8 100644 cd '$(SOURCE_DIR)' && NOCONFIGURE=true ./autogen.sh cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \ $(MXE_CONFIGURE_OPTS) \ -+ --disable-compile-warnings \ ++ --disable-compile-warnings \ --enable-regex \ --disable-threads \ --disable-selinux \ @@ -614,7 +633,7 @@ index 825b86bb..499a45b8 100644 cd '$(SOURCE_DIR)' && NOCONFIGURE=true ./autogen.sh cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \ $(MXE_CONFIGURE_OPTS) \ -+ --disable-compile-warnings \ ++ --disable-compile-warnings \ --with-threads=win32 \ --with-pcre=system \ --with-libiconv=gnu \ -- 2.30.2 From ce4722e3215c0e94497312a30f792226eefd7571 Mon Sep 17 00:00:00 2001 From: fenugrec Date: Wed, 30 Nov 2022 15:58:01 -0500 Subject: [PATCH 6/8] new-driver: split assignment and conditional Arguably, code is slightly easier to analyze this way, with less risk of mistaking a typo for "==" and an assignment. --- source/drv-protocol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/drv-protocol.c b/source/drv-protocol.c index 1b300bb..b331b6b 100644 --- a/source/drv-protocol.c +++ b/source/drv-protocol.c @@ -27,10 +27,12 @@ SR_PRIV int {lib}_receive_data(int fd, int revents, void *cb_data) (void)fd; - if (!(sdi = cb_data)) + sdi = cb_data; + if (!sdi) return TRUE; - if (!(devc = sdi->priv)) + devc = sdi->priv; + if (!devc) return TRUE; if (revents == G_IO_IN) {{ -- 2.30.2 From 64859badb1221edccb103b6eadfbda9e760ed9a9 Mon Sep 17 00:00:00 2001 From: Dave Platt Date: Sat, 28 Jan 2023 20:38:39 -0800 Subject: [PATCH 7/8] sigrok-fwextract-kingst-la2016: handle compressed Qt resources Qt resources in executable images support optional compression. Recent vendor software uses this feature. Uncompress firmware images during extraction of their blobs. This handles the Qt resource compression part of bug #1825. --- firmware/kingst-la/sigrok-fwextract-kingst-la2016 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/firmware/kingst-la/sigrok-fwextract-kingst-la2016 b/firmware/kingst-la/sigrok-fwextract-kingst-la2016 index 3575b04..0bcf9bf 100755 --- a/firmware/kingst-la/sigrok-fwextract-kingst-la2016 +++ b/firmware/kingst-la/sigrok-fwextract-kingst-la2016 @@ -99,24 +99,31 @@ class qt_resources(object): child_count, first_child = which[2:] for i in range(child_count): child = table[first_child + i] - if child[1] & RCCFileInfo_Directory: + flags = child[1] + if flags & RCCFileInfo_Directory: read_dir_entries(table, child, parents + [child[0]]) else: country, language, data_offset = child[2:] full_name = "/".join(parents + [child[0]]) self._resources[full_name] = data_offset + self._resource_flags[full_name] = flags self._res_datas = self._get_elf_sym_value("_ZL16qt_resource_data") self._res_names = self._get_elf_sym_value("_ZL16qt_resource_name") self._res_struct = self._get_elf_sym_value("_ZL18qt_resource_struct") self._resources = {} # res_fn -> res_offset + self._resource_flags = {} # res_fn -> RCC_flags table = read_table() read_dir_entries(table, table[0]) def get_resource(self, res_fn): + RCCFileInfo_Compressed = 1 offset = self._resources[res_fn] + flags = self._resource_flags[res_fn] data = self._get_resource_data(offset) + if flags & RCCFileInfo_Compressed: + data = zlib.decompress(data[4:]) return data def find_resource_names(self, res_fn_re): -- 2.30.2 From 249b79d0a94e9ac4ec96533bf3108e2a50e6b38d Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Sun, 29 Jan 2023 08:38:04 +0100 Subject: [PATCH 8/8] sigrok-fwextract-kingst-la2016: concentrate RCC flags in one spot Move the symbolic identifiers for RCC flag bits to one common location in the Qt resource handling support code. Previous versions kept them local to individual methods which referenced them. --- firmware/kingst-la/sigrok-fwextract-kingst-la2016 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/firmware/kingst-la/sigrok-fwextract-kingst-la2016 b/firmware/kingst-la/sigrok-fwextract-kingst-la2016 index 0bcf9bf..d690719 100755 --- a/firmware/kingst-la/sigrok-fwextract-kingst-la2016 +++ b/firmware/kingst-la/sigrok-fwextract-kingst-la2016 @@ -39,6 +39,9 @@ parseelf = importlib.util.module_from_spec(spec) spec.loader.exec_module(parseelf) class qt_resources(object): + RCCFileInfo_Compressed = 0x01 + RCCFileInfo_Directory = 0x02 + def __init__(self, program): self._elf = parseelf.elf(program) self._elf_sections = {} # idx -> data @@ -75,7 +78,6 @@ class qt_resources(object): return self._res_datas[offset:offset + length] def _read_resources(self): - RCCFileInfo_Directory = 0x02 def read_table(): table = [] offset = 0 @@ -83,7 +85,7 @@ class qt_resources(object): name_offset, flags = struct.unpack(">IH", self._res_struct[offset:offset+4+2]) offset += 6 name = self._get_resource_name(name_offset) - if flags & RCCFileInfo_Directory: + if flags & self.RCCFileInfo_Directory: child_count, first_child_offset = struct.unpack(">II", self._res_struct[offset:offset + 4 + 4]) offset += 4 + 4 table.append((name, flags, child_count, first_child_offset)) @@ -94,13 +96,13 @@ class qt_resources(object): return table def read_dir_entries(table, which, parents=[]): name, flags = which[:2] - if not flags & RCCFileInfo_Directory: + if not flags & self.RCCFileInfo_Directory: raise Exception("not a directory!") child_count, first_child = which[2:] for i in range(child_count): child = table[first_child + i] flags = child[1] - if flags & RCCFileInfo_Directory: + if flags & self.RCCFileInfo_Directory: read_dir_entries(table, child, parents + [child[0]]) else: country, language, data_offset = child[2:] @@ -118,11 +120,10 @@ class qt_resources(object): read_dir_entries(table, table[0]) def get_resource(self, res_fn): - RCCFileInfo_Compressed = 1 offset = self._resources[res_fn] flags = self._resource_flags[res_fn] data = self._get_resource_data(offset) - if flags & RCCFileInfo_Compressed: + if flags & self.RCCFileInfo_Compressed: data = zlib.decompress(data[4:]) return data -- 2.30.2