# HG changeset patch
# User Markus Mützel <markus.muetzel@gmx.de>
# Date 1618737257 -7200
#      Sun Apr 18 11:14:17 2021 +0200
# Node ID 643aeb6a7362d744b740c533e65da568832f203d
# Parent  56df28fdf14fc2da2347dd15b57a456481ceea6c
Add Octave package biosig.

* Makefile.in: Add new target and variables for bundled Octave packages that
  aren't listed on Octave Forge.
* binary-dist-rules.mk: Include new build target.
* src/opkg-biosig.mk: Add new file for Octave package biosig.
* dist-files.mk, index.html: Add new file to build system.

diff -r 56df28fdf14f -r 643aeb6a7362 Makefile.in
--- a/Makefile.in	Mon Apr 12 18:43:03 2021 +0200
+++ b/Makefile.in	Sun Apr 18 11:14:17 2021 +0200
@@ -533,8 +533,10 @@
 ## Packages removed from list because build is broken:
 ## None.
 OCTAVE_FORGE_PACKAGES := $(addprefix of-,audio communications control database dataframe data-smoothing dicom financial fits fuzzy-logic-toolkit ga general generate_html geometry gsl image instrument-control interval io linear-algebra lssa ltfat mapping matgeom miscellaneous nan netcdf nurbs ocs octproj optim optiminterp quaternion queueing signal sockets sparsersb splines statistics stk strings struct symbolic tisean tsa video windows zeromq)
+OCTAVE_OTHER_PACKAGES := $(addprefix opkg-,biosig)
 # get ALL deps for all of- packages, regardless of whether building the actual forge package in the installer
 OCTAVE_FORGE_DEPS:= $(sort $(foreach p,$(addprefix $(TOP_DIR)/src/,$(addsuffix .mk,$(OCTAVE_FORGE_PACKAGES))),$(shell $(SED) -n 's/.*_DEPS.*:=\(.*\)/\1/p' $p)))
+OCTAVE_OTHER_PKG_DEPS:= $(sort $(foreach p,$(addprefix $(TOP_DIR)/src/,$(addsuffix .mk,$(OCTAVE_OTHER_PACKAGES))),$(shell $(SED) -n 's/.*_DEPS.*:=\(.*\)/\1/p' $p)))
 
 BLAS_PACKAGES := blas
 ifeq ($(ENABLE_OPENBLAS),yes)
@@ -703,6 +705,9 @@
 .PHONY: octave-forge-packages
 octave-forge-packages: $(OCTAVE_FORGE_DEPS) $(OCTAVE_FORGE_PACKAGES)
 
+.PHONY: octave-other-packages
+octave-other-packages: $(OCTAVE_OTHER_PKG_DEPS) $(OCTAVE_OTHER_PACKAGES)
+
 .PHONY: blas-packages
 blas-packages: $(BLAS_PACKAGES)
 
@@ -837,18 +842,20 @@
       && $(INSTALL) -m644 '$($(PKG)_FILE)' '$(3)$(HOST_PREFIX)/src'
 endef
 
+# FIXME: The OCTAVE_FORGE_PKG_BUILD build rule probably works for *any* valid
+# Octave package (not only Octave Forge packages).  Consider renaming it.
 ifeq ($(MXE_SYSTEM),msvc)
-define OCTAVE_FORGE_PKG_BUILD
+  define OCTAVE_FORGE_PKG_BUILD
     $(INSTALL) -d '$(3)$(HOST_PREFIX)/local/octave-$(octave_VERSION)/share/octave'
     $(INSTALL) -d '$(3)$(HOST_PREFIX)/local/octave-$(octave_VERSION)/lib/octave'
     cd '$(1)/..' && tar cvfz $($(PKG)_FILE) $($(PKG)_SUBDIR)
     cd '$(1)/..' && $(HOST_PREFIX)/local/octave-$(octave_VERSION)/bin/octave-cli.exe -H -f -q \
-        --eval "more off;" \
-        --eval "pkg('prefix', '`cd "$(3)" && pwd -W`$(HOST_PREFIX)/local/octave-$(octave_VERSION)/share/octave/packages', '`cd "$(3)" && pwd -W`$(HOST_PREFIX)/local/octave-$(octave_VERSION)/lib/octave/packages');" \
-	--eval "pkg('install', '-verbose', '$($(PKG)_FILE)');"
+      --eval "more off;" \
+      --eval "pkg('prefix', '`cd "$(3)" && pwd -W`$(HOST_PREFIX)/local/octave-$(octave_VERSION)/share/octave/packages', '`cd "$(3)" && pwd -W`$(HOST_PREFIX)/local/octave-$(octave_VERSION)/lib/octave/packages');" \
+      --eval "pkg('install', '-verbose', '$($(PKG)_FILE)');"
 endef
 else
-define OCTAVE_FORGE_PKG_BUILD
+  define OCTAVE_FORGE_PKG_BUILD
     if [ $(ENABLE_BINARY_PACKAGES) = no ]; then \
       mkdir -p '$(3)$(HOST_PREFIX)/src'; \
       cd '$(1)/..' \
@@ -863,7 +870,7 @@
         CONFIGURE_OPTIONS="$(HOST_AND_BUILD_CONFIGURE_OPTIONS)" $(4) \
         $(PYTHON3) $(TOP_DIR)/tools/pkg-install.py install -verbose "$($(PKG)_FILE)"; \
      fi
-endef
+  endef
 endif
 
 define OCTAVE_FORGE_PKG_UPDATE
diff -r 56df28fdf14f -r 643aeb6a7362 binary-dist-rules.mk
--- a/binary-dist-rules.mk	Mon Apr 12 18:43:03 2021 +0200
+++ b/binary-dist-rules.mk	Sun Apr 18 11:14:17 2021 +0200
@@ -49,16 +49,13 @@
       native-gcc \
       npp
   endif
-
-  # other packages we want to include
-  WINDOWS_BINARY_DIST_DEPS += \
-    biosig
 endif
 
 BINARY_DIST_DEPS := \
   $(OCTAVE_TARGET) \
   blas-packages \
   octave-forge-packages \
+  octave-other-packages \
   devel-packages \
   units \
   transfig \
diff -r 56df28fdf14f -r 643aeb6a7362 dist-files.mk
--- a/dist-files.mk	Mon Apr 12 18:43:03 2021 +0200
+++ b/dist-files.mk	Sun Apr 18 11:14:17 2021 +0200
@@ -559,6 +559,7 @@
   openscenegraph.mk \
   openssl-1-fixes.patch \
   openssl.mk \
+  opkg-biosig.mk \
   opus.mk \
   pango-1-fixes.patch \
   pango.mk \
diff -r 56df28fdf14f -r 643aeb6a7362 index.html
--- a/index.html	Mon Apr 12 18:43:03 2021 +0200
+++ b/index.html	Sun Apr 18 11:14:17 2021 +0200
@@ -2466,6 +2466,10 @@
         <td class="website"><a href="http://www.openssl.org/">openssl</a></td>
     </tr>
     <tr>
+        <td class="package">opkg-biosig</td>
+        <td class="website"><a href="https://biosig.sourceforge.io/">Biosig Octave Package</a></td>
+    </tr>
+    <tr>
         <td class="package">opus</td>
         <td class="website"><a href="https://opus-codec.org/">opus</a></td>
     </tr>
diff -r 56df28fdf14f -r 643aeb6a7362 src/opkg-biosig.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/opkg-biosig.mk	Sun Apr 18 11:14:17 2021 +0200
@@ -0,0 +1,24 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG             := opkg-biosig
+$(PKG)_IGNORE   :=
+$(PKG)_VERSION  := 2.2.1
+$(PKG)_CHECKSUM := 1d74631995b0c945badc654d703aa35483afec33
+$(PKG)_SUBDIR   := mexbiosig-$($(PKG)_VERSION)
+$(PKG)_FILE     := $($(PKG)_SUBDIR).src.tar.gz
+$(PKG)_URL      := https://pub.ist.ac.at/~schloegl/biosig/prereleases/$($(PKG)_FILE)
+$(PKG)_DEPS     := biosig
+
+ifeq ($(ENABLE_BINARY_PACKAGES),yes)
+  $(PKG)_DEPS += $(OCTAVE_TARGET)
+endif
+
+define $(PKG)_UPDATE
+  echo 'Warning: Updates are temporarily disabled for package $(PKG).' >&2;
+  echo $($(PKG)_VERSION)
+endef
+
+define $(PKG)_BUILD
+  $(OCTAVE_FORGE_PKG_BUILD)
+endef
