Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
build/
**/build_release_64/
*/build_release_32/
*/build_debug_64/
*/build_debug_32/
firmware/kingst-la/*.bitstream
firmware/kingst-la/*.fw
20 changes: 13 additions & 7 deletions cross-compile/mingw/README
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ README
This is a small script for cross-compiling sigrok and its dependencies
for MinGW-w64/Windows systems.

If you have a local fork (or copy) of a sigrok repository in $HOME/sigrok, the script will use it instead of cloning from the remote repository.


Status
------
Expand Down Expand Up @@ -37,24 +39,28 @@ First, get the MXE cross-compile environment for MinGW-w64/Windows:
$ cd $HOME
$ git clone https://github.com/mxe/mxe.git mxe-git
$ cd mxe-git
$ git reset --hard b48b3cc7085548e896fe967dc6371ff9951390a4

Apply some fixes that are currently required for a proper build:

$ cd $HOME/sigrok-util/cross-compile/mingw
$ cp mxe_fixes.patch $HOME/mxe-git
$ cp hidapi_fixes.patch $HOME/mxe-git
$ cd $HOME/mxe-git
$ patch -p1 < mxe_fixes.patch
$ patch -p1 < libusb1_upgrade.patch
$ patch -p1 < hidapi_fixes.patch

Build all required packages:
Build all required packages ( for both i686 and x86_64 ):

$ make MXE_TARGETS=i686-w64-mingw32.static.posix \
$ make -j$(nproc) MXE_TARGETS="i686-w64-mingw32.static.posix x86_64-w64-mingw32.static.posix" \
MXE_PLUGIN_DIRS=plugins/examples/qt5-freeze \
gcc glib libzip libusb1 libftdi1 hidapi glibmm qtbase qtimageformats \
qtsvg qttranslations boost check gendef libieee1284 \
qtbase_CONFIGURE_OPTS='-no-sql-mysql'
qtsvg qttools qttranslations boost check gendef libieee1284 \
nettle qwt qtbase_CONFIGURE_OPTS='-no-sql-mysql'

This will take a while.

You can also use "MXE_TARGETS=x86_64-w64-mingw32.static.posix" to build
64-bit installers instead.
You can use "MXE_TARGETS=x86_64-w64-mingw32.static.posix" to specifically build 64-bit installer or "MXE_TARGETS=i686-w64-mingw32.static.posix" for 32-bit installer.

See http://mxe.cc for details on MXE.

Expand Down
41 changes: 41 additions & 0 deletions cross-compile/mingw/hidapi_fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From a69d26c8a1291ecd4febbec7ccc0b0d43410b09d Mon Sep 17 00:00:00 2001
From: Thomas Hebb <tommyhebb@gmail.com>
Date: Fri, 16 Jul 2021 22:31:49 -0700
Subject: [PATCH] hidapi: Switch source to new GitHub repo and update

The README at https://github.com/libusb/hidapi says "HIDAPI library was
originally developed by Alan Ott (signal11). It was moved to
libusb/hidapi on June 4th, 2019, in order to merge important bugfixes
and continue development of the library." As such, the libusb version is
now the official repository and we should use it.

Also update to the latest master. Among other things, this fixes a
[bug][autoconf-fix] that broke the build on new versions of autoconf
(2.70 and later).

[autoconf-fix]: https://github.com/libusb/hidapi/pull/226
---
src/hidapi.mk | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/hidapi.mk b/src/hidapi.mk
index c92e359f7c..5814db2e01 100644
--- a/src/hidapi.mk
+++ b/src/hidapi.mk
@@ -1,12 +1,12 @@
# This file is part of MXE. See LICENSE.md for licensing information.

PKG := hidapi
-$(PKG)_WEBSITE := https://github.com/signal11/hidapi/
+$(PKG)_WEBSITE := https://github.com/libusb/hidapi/
$(PKG)_DESCR := HIDAPI
$(PKG)_IGNORE :=
-$(PKG)_VERSION := a6a622f
-$(PKG)_CHECKSUM := 32ea444bdd6c6a8a940bfa3287a2dc8c291a141fdc78cd638b37b546b44d95be
-$(PKG)_GH_CONF := signal11/hidapi/branches/master
+$(PKG)_VERSION := 2a24bf9
+$(PKG)_CHECKSUM := fcf650c10ccd39c47cc86ffd676befc71dd74bd8367f6716418974830f218d1f
+$(PKG)_GH_CONF := libusb/hidapi/branches/master
$(PKG)_DEPS := cc

define $(PKG)_BUILD
67 changes: 0 additions & 67 deletions cross-compile/mingw/libusb1_upgrade.patch

This file was deleted.

99 changes: 75 additions & 24 deletions cross-compile/mingw/mxe_fixes.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
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.

- libsigrok currently requires a special libusb branch.

- Add an additional libusb RAW_IO patch in MXE directly, which obsoletes
the need to build a custom libusb in sigrok-cross-mingw.

- We're reverting to glib 2.44.1 for now since more recent
versions (e.g. 2.50.2) seem to have a bug. Details:
https://sigrok.org/bugzilla/show_bug.cgi?id=1232
Expand All @@ -22,11 +18,6 @@ MXE setup for sigrok usage.
- Bump MXE's binutils to version 2.35, which added -mbig-obj support
for 32bit Windows (64bit was supported already). Required for PulseView.

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
Expand Down Expand Up @@ -180,7 +171,6 @@ 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
Expand All @@ -196,10 +186,73 @@ 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/libusb1.mk b/src/libusb1.mk
index ab01bf69..53aed36e 100644
--- a/src/libusb1.mk
+++ b/src/libusb1.mk
@@ -4,11 +4,11 @@ PKG := libusb1
$(PKG)_WEBSITE := https://libusb.info/
$(PKG)_DESCR := LibUsb-1.0
$(PKG)_IGNORE :=
-$(PKG)_VERSION := 1.0.24
-$(PKG)_CHECKSUM := 7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a
-$(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)
+$(PKG)_VERSION := 1.0.20-rc3-event-abstraction-v4
+$(PKG)_CHECKSUM := 58fee7f3f05fda209d14c55763df36ab86028bd9ab82c9bb74f1d5ab3208bcfd
+$(PKG)_SUBDIR := libusb-event-abstraction-v4
+$(PKG)_FILE := libusb-event-abstraction-v4.zip
+$(PKG)_URL := https://github.com/uwehermann/libusb/archive/event-abstraction-v4.zip
$(PKG)_DEPS := cc

define $(PKG)_UPDATE
@@ -19,7 +19,7 @@ define $(PKG)_UPDATE
endef

define $(PKG)_BUILD
- cd '$(1)' && ./configure \
+ cd '$(1)' && autoreconf -i && ./configure \
$(MXE_CONFIGURE_OPTS) \
CFLAGS=-D_WIN32_WINNT=0x0500
$(MAKE) -C '$(1)' -j '$(JOBS)' install
diff --git a/src/libusb1-1-fixes.patch b/src/libusb1-1-fixes.patch
new file mode 100644
index 00000000..6cdeb0c4
--- /dev/null
+++ b/src/libusb1-1-fixes.patch
@@ -0,0 +1,31 @@
+From d4f7a49d77bd8f4ac871a999fc9ec898cb22b8c3 Mon Sep 17 00:00:00 2001
+From: Vlad Ivanov <vlad-mbx@ya.ru>
+Date: Tue, 9 Feb 2016 10:35:23 +0300
+Subject: [PATCH] windows_usb: enable RAW_IO policy by default
+
+libusb should set RAW_IO policy unconditionally because it
+implements the buffer management itself.
+
+Signed-off-by: Vlad Ivanov <vlad-mbx@ya.ru>
+---
+ libusb/os/windows_usb.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
+index 6640ad5..12fdab0 100644
+--- a/libusb/os/windows_usb.c
++++ b/libusb/os/windows_usb.c
+@@ -2890,6 +2890,10 @@ static int winusbx_configure_endpoints(int sub_api, struct libusb_device_handle
+ AUTO_CLEAR_STALL, sizeof(UCHAR), &policy)) {
+ usbi_dbg("failed to enable AUTO_CLEAR_STALL for endpoint %02X", endpoint_address);
+ }
++ if (!WinUSBX[sub_api].SetPipePolicy(winusb_handle, endpoint_address,
++ RAW_IO, sizeof(UCHAR), &policy)) {
++ usbi_dbg("failed to enable RAW_IO for endpoint %02X", endpoint_address);
++ }
+ }
+
+ return LIBUSB_SUCCESS;
+--
+2.5.0
+
diff --git a/src/glib-1-fixes.patch b/src/glib-1-fixes.patch
index 764ece9e..428cc6a9 100644
--- a/src/glib-1-fixes.patch
Expand Down Expand Up @@ -511,7 +564,6 @@ 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
Expand Down Expand Up @@ -595,7 +647,6 @@ 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
Expand All @@ -617,23 +668,23 @@ 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 \
@@ -55,6 +56,7 @@ define $(PKG)_BUILD_NATIVE
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 \
@@ -97,6 +99,7 @@ define $(PKG)_BUILD
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 \
Loading