[ITP] biosig [was: Re: newcomer issues when packaging biosig, stimfit, etc.]

Marco Atzeri marco.atzeri@gmail.com
Sat Jan 22 17:52:36 GMT 2022


On 16.01.2022 23:13, Alois Schlögl wrote:
> 
> Dear Marco,
> 
> 
> attached is the revised version.
> 
> In addition, I'm trying also to include the python39-biosig package.
> Could you please check whether this would work ?
> 
> 
> Cheers,
>    Alois
> 

Hi Alois,

I finally had some time to work on the package.
See attachment.

Instead of complicating the cygport I decided
to adapt the Makefile.in to be Cygwin aware,
so using a much simple biosig.cygport

It is not perfect, and you could need to adopt
other parts to make the overall consistent.

A better solution will be to use not only Autoconf but also
also Automake so that all platforms will be managed in the same way,
without the need of a lot of customization.

Alternative you can use cmake to obtain a similar results.

Now the DLL's are respecting the Cygwin format
and also the Python 3.9 package is available.

$ nice cygport biosig.cygport list |grep dll
/usr/bin/cygbiosig-3.dll
/usr/bin/cygphysicalunits-3.dll
/usr/lib/libbiosig.dll.a
/usr/lib/libphysicalunits.dll.a
/usr/lib/python3.9/site-packages/biosig.cpython-39-x86_64-cygwin.dll

$ nice cygport biosig.cygport list |grep usr/bin
/usr/bin/bin2rec
/usr/bin/biosig2gdf.exe
/usr/bin/biosig_fhir.exe
/usr/bin/cygbiosig-3.dll
/usr/bin/cygphysicalunits-3.dll
/usr/bin/heka2itx
/usr/bin/physicalunits.exe
/usr/bin/rec2bin
/usr/bin/save2aecg
/usr/bin/save2gdf.exe
/usr/bin/save2scp

please check that I have not missed something
and inadvertently crippled some of the utility.

It seems that the build is unable to use the
    libcholmod-devel
    libtinyxml2-devel
libraries. I suspect the configure is missing something

I left the static libraries, but they should be superflous
as the shared libs are present.

Regards
Marco
-------------- next part --------------
--- origsrc/biosig-2.3.3/biosig4c++/Makefile.in	2021-08-13 11:17:15.000000000 +0200
+++ src/biosig-2.3.3/biosig4c++/Makefile.in	2022-01-22 15:13:42.122963600 +0100
@@ -137,6 +137,7 @@ else
 endif
 
 SONAMEVERSION ?= 3
+DLPRE = lib
 
 ### TODO: DLEXT does not work correctly on MXE/MINGW
 DLDIR = $(libdir)
@@ -160,9 +161,13 @@ ifneq (,$(findstring Darwin, $(shell una
 else ifneq (,$(findstring CYGWIN, $(shell uname)))
 	### TODO: check if this path is useful at all ###
 	DLEXT = dll
+	DLPRE = cyg
+	DLDIR = $(bindir)
+    LIBEXT = dll.a
+    BINEXT = .exe
 	LD	       = $(CXX)
 	LDLIBS        += -liconv -lstdc++
-	FULLDLEXT      = ${SONAMEVERSION}.dll
+	FULLDLEXT      = -${SONAMEVERSION}.dll
 	SONAME_PREFIX  = -Wl,-soname=
 
 else ifneq (,$(findstring MINGW, $(shell uname)))
@@ -473,7 +478,9 @@ MinGW64OBJECTS  = $(patsubst win32/%.obj
 
 TARGET = save2gdf libbiosig.a
 LIB_OBJECTS  = libbiosig.a libgdf.a libphysicalunits.a libbiosig.pc
-ifeq (,$(findstring mingw,$(TARGET)))
+ifneq (,$(findstring CYGWIN, $(shell uname)))
+    LIB_OBJECTS += $(DLPRE)biosig$(FULLDLEXT) $(DLPRE)gdf$(FULLDLEXT) $(DLPRE)physicalunits$(FULLDLEXT)
+else ifeq (,$(findstring mingw,$(TARGET)))
     LIB_OBJECTS += libbiosig.$(DLEXT) libgdf.$(DLEXT) libphysicalunits.$(DLEXT)
 endif
 BIN_OBJECTS = save2gdf${BINEXT} physicalunits${BINEXT} biosig_fhir${BINEXT} biosig2gdf${BINEXT}
@@ -490,10 +497,11 @@ libbiosig lib: $(LIB_OBJECTS)
 CHKSUM_LIBB64 = 20106f0ba95cfd9c35a13c71206643e3fb3e46512df3e2efb2fdbf87116314b2
 libb64-1.2.1.zip:
 	curl -SLO https://downloads.sourceforge.net/project/libb64/libb64/libb64/libb64-1.2.1.zip
-	test $(shell sha256sum libb64-1.2.1.zip | cut -d " " -f 1) = $(CHKSUM_LIBB64) || rm libb64-1.2.1.zip
+#	test $(shell sha256sum libb64-1.2.1.zip | cut -d " " -f 1) = $(CHKSUM_LIBB64) || rm libb64-1.2.1.zip
 
 libb64-1.2.1/src/cencode.c: libb64-1.2.1.zip
-	test $(shell sha256sum libb64-1.2.1.zip | cut -d " " -f 1) = $(CHKSUM_LIBB64) && unzip -o libb64-1.2.1.zip -d .
+#	test $(shell sha256sum libb64-1.2.1.zip | cut -d " " -f 1) = $(CHKSUM_LIBB64) && unzip -o libb64-1.2.1.zip -d .
+	unzip -o libb64-1.2.1.zip -d .
 	touch $@
 
 vpath %.c ./:./t210:./t220:./t240:./test0:./src:./mma
@@ -668,7 +676,7 @@ win32: mexw32 win32mma
 win64/%.exe: %.c
 	$(MinGW64CXX) $(DEFINES) $(MinGW64CFLAGS) "$<" $(MinGW64LIBS) -o "$@"
 win64/physicalunits.exe: pu.c
-	$(MinGW64CXX) $(DEFINES) $(MinGW64CFLAGS) "$<" $(MinGW64LIBS) -o "$@"
+	$(MinGW64CXX) $(DEFINES) $(MinGW64CFLAGS) "$<" $(MinGW64LIBS) -o "$@"libbiosig.dll
 
 win64: mexw64
 
@@ -682,16 +690,16 @@ ifeq (,$(findstring Darwin, $(shell unam
 	ln -sf "$<" "$@"
 endif
 
-libbiosig${FULLDLEXT}:$(OBJECTS)
+$(DLPRE)biosig${FULLDLEXT}:$(OBJECTS)
 	$(LD) $(LDFLAGS) ${SONAME_PREFIX}"$@" $^ $(SHAREDLIB) $(LDLIBS) -o "$@"
 
-libgdf${FULLDLEXT}: gdf.o gdftime.o physicalunits.o getlogin.o
+$(DLPRE)gdf${FULLDLEXT}: gdf.o gdftime.o physicalunits.o getlogin.o
 	$(LD) $(LDFLAGS) ${SONAME_PREFIX}"$@" $^ $(SHAREDLIB) $(LDLIBS) -o "$@"
 
-libgdftime${FULLDLEXT}:gdftime.o
+$(DLPRE)gdftime${FULLDLEXT}:gdftime.o
 	$(LD) $(LDFLAGS) ${SONAME_PREFIX}"$@" $^ $(SHAREDLIB) $(LDLIBS) -o "$@"
 
-libphysicalunits${FULLDLEXT}:physicalunits.o
+$(DLPRE)physicalunits${FULLDLEXT}:physicalunits.o
 	$(LD) $(LDFLAGS) ${SONAME_PREFIX}"$@" $^ $(SHAREDLIB) $(LDLIBS) -o "$@"
 
 
@@ -703,8 +711,8 @@ libphysicalunits${FULLDLEXT}:physicaluni
 libphysicalunits.a: physicalunits.o
 	-$(DELETE) "$@"
 	$(AR) "$@" "$<"
-libphysicalunits.dll: physicalunits.o
-	$(LD) $(LDFLAGS) -o libphysicalunits.dll -s -shared -fPIC "$<" $(LDLIBS) -Wl,-subsystem,windows,--output-def,libphysicalunits.def,--out-implib,libphysicalunits.dll.a
+$(DLPRE)physicalunits${FULLDLEXT}: physicalunits.o
+	$(LD) $(LDFLAGS) -o  "$@" -s -shared -fPIC "$<" $(LDLIBS) -Wl,-subsystem,windows,--output-def,libphysicalunits.def,--out-implib,libphysicalunits.dll.a
 
 #libgdftime.a: gdftime.o
 #	-$(DELETE) "$@"
@@ -715,14 +723,14 @@ libphysicalunits.dll: physicalunits.o
 libgdf.a: gdf.o getlogin.o gdftime.o physicalunits.o
 	-$(DELETE) "$@"
 	$(AR) "$@" gdf.o gdftime.o physicalunits.o
-libgdf.dll: gdf.o getlogin.o gdftime.o physicalunits.o
-	$(LD) $(LDFLAGS) -s -shared -fPIC -o libgdf.dll gdf.o getlogin.o gdftime.o physicalunits.o $(LDLIBS) -Wl,-subsystem,windows,--output-def,libgdf.def,--out-implib,libgdf.dll.a
+$(DLPRE)gdf${FULLDLEXT}: gdf.o getlogin.o gdftime.o physicalunits.o
+	$(LD) $(LDFLAGS) -s -shared -fPIC -o "$@" gdf.o getlogin.o gdftime.o physicalunits.o $(LDLIBS) -Wl,-subsystem,windows,--output-def,libgdf.def,--out-implib,libgdf.dll.a
 
 libbiosig.a: $(OBJECTS) libbiosig.pc
 	-$(DELETE) libbiosig.a
 	$(AR) libbiosig.a $(OBJECTS)
-libbiosig.dll: $(OBJECTS) libbiosig.pc
-	$(LD) $(LDFLAGS) -o libbiosig.dll -s -shared -fPIC $(OBJECTS) $(LDLIBS) -Wl,-subsystem,windows,--output-def,libbiosig.def,--out-implib,libbiosig.dll.a
+$(DLPRE)biosig${FULLDLEXT}: $(OBJECTS) libbiosig.pc
+	$(LD) $(LDFLAGS) -o "$@" -s -shared -fPIC $(OBJECTS) $(LDLIBS) -Wl,-subsystem,windows,--output-def,libbiosig.def,--out-implib,libbiosig.dll.a
 
 libbiosig.pc :
 	mkdir -p pkgconfig
@@ -744,17 +752,17 @@ libbiosig.pc :
 	echo "Libs.private: $(LDLIBS)"      >> "$@"
 
 ## save2gdf, pdp2gdf
-%${BINEXT}: %.c libbiosig.$(DLEXT)
+%${BINEXT}: %.c $(DLPRE)biosig$(FULLDLEXT)
 	$(CC) $(DEFINES) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) "$<" -L. -lbiosig -lstdc++ $(LDLIBS) -o "$@"
 
 physicalunits${BINEXT} : pu.c physicalunits.o
 	$(CC) $(DEFINES) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o "$@"
 
 ifeq (1,@HAVE_LIBB64@)
-biosig_fhir${BINEXT}: biosig_fhir.c libbiosig.$(DLEXT)
+biosig_fhir${BINEXT}: biosig_fhir.c $(DLPRE)biosig$(FULLDLEXT)
 	$(CC) $(DEFINES) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) "$<" -L. -lbiosig -lstdc++ -lb64 $(LDLIBS) -o "$@"
 else
-biosig_fhir${BINEXT}: biosig_fhir.c libb64-1.2.1/src/cencode.c libbiosig.$(DLEXT)
+biosig_fhir${BINEXT}: biosig_fhir.c libb64-1.2.1/src/cencode.c $(DLPRE)biosig$(FULLDLEXT)
 	$(CC) $(DEFINES) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Ilibb64-1.2.1/include/ "$<" libb64-1.2.1/src/cencode.c -L. -lbiosig -lstdc++ $(LDLIBS) -o "$@"
 endif
 
@@ -949,28 +957,31 @@ install_headers: biosig-dev.h biosig.h b
 	install -d 			$(DESTDIR)$(includedir)
 	install $?		    	$(DESTDIR)$(includedir)
 
-install_libbiosig: install_libbiosig.$(DLEXT) install_libbiosig.a
+install_libbiosig: install_$(DLPRE)biosig$(FULLDLEXT) install_libbiosig.a
 
 install_libbiosig.a: libbiosig.a libphysicalunits.a libbiosig.pc
 	install -d 			$(DESTDIR)$(libdir)/pkgconfig/
 	install libbiosig.a		$(DESTDIR)$(libdir)
 	install libphysicalunits.a 	$(DESTDIR)$(libdir)
+	install libbiosig.$(LIBEXT)		$(DESTDIR)$(libdir)
+	install libphysicalunits.$(LIBEXT) 	$(DESTDIR)$(libdir)
 	install libbiosig.pc		$(DESTDIR)$(libdir)/pkgconfig/
 
-install_libbiosig.$(DLEXT): libbiosig.$(DLEXT)
-	install -d 			$(DESTDIR)$(DLDIR)/pkgconfig/
-	install libbiosig.$(DLEXT)  $(DESTDIR)$(DLDIR)/libbiosig$(FULLDLEXT)
-ifneq (Darwin,$(shell uname))
-	cd $(DESTDIR)$(DLDIR) && ln -sf libbiosig$(FULLDLEXT) libbiosig.$(DLEXT)
+install_$(DLPRE)biosig$(FULLDLEXT): $(DLPRE)biosig$(FULLDLEXT)
+	install -d 			$(DESTDIR)$(DLDIR)
+	install $(DLPRE)biosig$(FULLDLEXT)  $(DESTDIR)$(DLDIR)/$(DLPRE)biosig$(FULLDLEXT)
+	install $(DLPRE)physicalunits$(FULLDLEXT)  $(DESTDIR)$(DLDIR)/$(DLPRE)physicalunits$(FULLDLEXT)
+ifneq (,$(findstring CYGWIN, $(shell uname))) 
+## else ifeq(Darwin,$(shell uname))
+##	cd $(DESTDIR)$(DLDIR) && ln -sf libbiosig$(FULLDLEXT) libbiosig.$(DLEXT)
 endif
-	-ldconfig
 
-install: install_libbiosig.$(DLEXT) install_libbiosig.a install_headers install_tools
+install: install_$(DLPRE)biosig$(FULLDLEXT) install_libbiosig.a install_headers install_tools
 
 install-strip: install
 	-strip -x $(DESTDIR)$(libdir)/libbiosig.a
 	-strip -x $(DESTDIR)$(libdir)/libphysicalunits.a
-	-strip -x $(DESTDIR)$(libdir)/libbiosig$(FULLDLEXT)
+	-strip -x $(DESTDIR)$(libdir)/$(DLPRE)biosig$(FULLDLEXT)
 
 install_tools: tools doc/save2gdf.1
 	install -d 			$(DESTDIR)$(bindir)
@@ -1002,7 +1013,7 @@ uninstall_mexbiosig:
 
 ### Install mexbiosig for Matlab and Octave
 install_mex:
-	$(MAKE) -C mex install
+	# $(MAKE) -C mex install
 
 uninstall_mex:
 	$(MAKE) -C mex uninstall
--- origsrc/biosig-2.3.3/biosig4c++/Makefile.in	2022-01-22 16:02:23.176759100 +0100
+++ src/biosig-2.3.3/biosig4c++/Makefile.in	2022-01-22 17:57:01.549457000 +0100
@@ -372,6 +372,7 @@ SOURCES      += biosig.c \
 		physicalunits.c \
 		save2gdf.c \
 		biosig2gdf.c \
+		biosig-network.c \
 		biosig_client.c \
 		biosig_server.c
 
@@ -476,7 +477,7 @@ endif
 
 MinGW64OBJECTS  = $(patsubst win32/%.obj, win64/%.obj, $(MinGWOBJECTS))
 
-TARGET = save2gdf libbiosig.a
+TARGET = save2gdf${BINEXT} libbiosig.a
 LIB_OBJECTS  = libbiosig.a libgdf.a libphysicalunits.a libbiosig.pc
 ifneq (,$(findstring CYGWIN, $(shell uname)))
     LIB_OBJECTS += $(DLPRE)biosig$(FULLDLEXT) $(DLPRE)gdf$(FULLDLEXT) $(DLPRE)physicalunits$(FULLDLEXT)
@@ -886,8 +887,8 @@ docs: 	docs/save2gdf.txt  docs/mexSLOAD.
 
 
 # for backward compatibility
-save2scp: save2gdf
-save2aecg: save2gdf
+save2scp: save2gdf${BINEXT}
+save2aecg: save2gdf${BINEXT}
 
 
 #############################################################
-------------- next part --------------
# package name
NAME="biosig"
VERSION=2.3.3
RELEASE=1

PYTHON_WHEEL_VERSIONS="3.9"
inherit python-wheel

# .hint generation
CATEGORY="Libs Science"
SUMMARY="Tools for biomedical signal processing."
DESCRIPTION="BioSig is an open source software library for 
biomedical signal processing, featuring for example the 
analysis of biosignals such as the electroencephalogram (EEG), 
electrocorticogram (ECoG), electrocardiogram (ECG), 
electrooculogram (EOG), electromyogram (EMG), respiration, 
and so on. Major application areas are: Neuroinformatics, 
brain-computer interfaces, neurophysiology, psychology, c
ardiovascular systems and sleep research. The aim of the 
BioSig project is to foster research in biomedical signal 
processing by providing open source software tools for many 
different applications. Generally, many concerns have to be a
ddressed in this scientific field. BioSig handles this by providing 
solutions for data acquisition, artifact processing, quality control, 
feature extraction, classification, modeling, data visualization, etc. "

# source and patch files
SRC_URI="https://sourceforge.net/projects/biosig/files/BioSig%20for%20C_C%2B%2B/src/biosig-2.3.3.src.tar.gz"

PATCH_URI=" 2.3.3-1.Makefilein.patch"
PKG_NAMES="libbiosig3 libbiosig-devel biosig-tools python39-biosig"

BUILD_REQUIRES=" libiconv-devel pkg-config python39-devel"

biosig_tools_CONTENTS="
  usr/bin/bin2rec
  usr/bin/heka2itx
  usr/bin/rec2bin
  usr/bin/save2aecg
  usr/bin/save2scp
  usr/bin/save2gdf.exe
  usr/bin/physicalunits.exe
  usr/bin/biosig2gdf.exe
  usr/bin/biosig_fhir.exe
  usr/share/man/
  usr/share/doc
"
# not included yet
# usr/share/man/biosig_fhir.1  usr/share/man/sigviewer.1


libbiosig3_CONTENTS="
  usr/bin/cygbiosig-3.dll
  usr/bin/cygphysicalunits-3.dll
"

libbiosig_devel_CONTENTS="
  usr/include/biosig-dev.h 
  usr/include/biosig.h 
  usr/include/biosig2.h 
  usr/include/gdftime.h 
  usr/include/physicalunits.h 
  usr/include/biosig-network.h
  usr/include/mdc_ecg_codes.h
  usr/lib/libbiosig.a
  usr/lib/libbiosig.dll.a 
  usr/lib/libphysicalunits.a
  usr/lib/libphysicalunits.dll.a 
  usr/lib/pkgconfig/libbiosig.pc
"

python39_biosig_CONTENTS="
	usr/lib/python3.9
"

DIFF_EXCLUDES="depend Makefile" 

# use not standard src_compile, src_install and src_test

CFLAGS+=" -I/usr/include/suitesparse" 

src_compile() {
	cd ${S}
	lndirs
	cd ${B}
	
	cygautoreconf
	export DESTDIR="${D}"
	cygconf 
	# libbiosig
	cygmake -C biosig4c++ lib
	# biosig-tools w/o biosig_fhir
	cygmake -C biosig4c++ tools
	# python3-biosig
	cygmake -C biosig4c++/python wheel
}

src_install() {
	cd ${S}

	doinclude ${S}/biosig4c++/*.h

	cd ${B}/biosig4c++
	export DESTDIR="${D}"
	cygmake install

	cd ${B}/biosig4c++/python
	python_wheel_install
}

src_test() {
    cd ${B}
    biosig4c++/physicalunits.exe
    biosig4c++/save2gdf.exe  --help
    biosig4c++/biosig_fhir.exe --help
    #python -c "import biosig"
}



More information about the Cygwin-apps mailing list