following on cygwin-apps

On 08.01.2022 18:41, Marco Atzeri wrote:
On 08.01.2022 18:34, Alois Schlögl wrote:
Dear Cygwin community,


Hi Alois,

I intend to package Stimfit [1] and Biosig [2] (and perhaps libb64,libbiosig,sigviewer) for cygwin. The packages are already available in Debian, but when trying to package them for cygwin, I run into some difficulties. I read the documentation [3-5], but I got stuck, and I'd appreciate your help on this. Attached are my current versions of  *.cygports and *.hint files

please subscribe to cygwin-apps.
The discussion about maintainership and packaging are handled there


I looked on libb64, as it is not using autoconf/automake
you can not use the default src_* but you need to define them.

As the Makefile is building only static lib and has no install
procedure I modified to build only shared and I used
cygport for the installation.
I also separated the test.

See attached update cygport and patch.




# package name
NAME="libb64"
VERSION=1.2.1
RELEASE=1

# .hint generation
CATEGORY="Libs"
SUMMARY="libary for base64-encoding"
DESCRIPTION="A library of ANSI C routines for fast 
encoding/decoding data into and from a base64-encoded format"

SRC_URI="https://sourceforge.net/projects/libb64/files/libb64/libb64/libb64-${PV}.zip";

PKG_NAMES="libb64 libb64-devel libb64-util"

libb64_util_CONTENTS="usr/bin/base64.exe"

libb64_CONTENTS="usr/bin/cygb64.dll"

libb64_devel_CONTENTS="
  usr/share/doc/
  usr/include
  usr/lib
"

DIFF_EXCLUDES="depend"

# use not standard src_compile, src_install and src_test

src_compile() {
        cd ${S}
        lndirs
        cd ${B}
        make 
}

src_install() {
        cd ${D}

        dodir usr/include/b64
        insinto /usr/include/b64
        doins ${S}/include/b64/*
        
        dobin ${B}/base64/base64.exe 
        dobin ${B}/src/cygb64.dll 
        dolib ${B}/src/libb64.dll.a 

        dodir usr/share/b64/examples
        insinto usr/share/b64/examples
        dodoc ${S}/examples/*.c ${S}/examples/*.txt ${S}/examples/README.md
}       

src_test() {
    cd ${B}
    make -C examples test
}

--- origsrc/libb64-1.2.1/base64/Makefile        2013-06-18 14:49:36.000000000 
+0200
+++ src/libb64-1.2.1/base64/Makefile    2022-01-08 19:42:26.156240800 +0100
@@ -34,10 +34,8 @@ vpath %.a ../src
 
 all: $(TARGETS) #strip
 
-base64: libb64.a
-
-strip:
-       strip $(BINARIES) *.exe
+base64: ../src/cygb64.dll
+       g++ $(CXXFLAGS) $(SOURCES) -L../src -lb64 -o $@
 
 clean: clean_VisualStudioProject
        rm -f *.exe* *.o $(TARGETS) *.bak *~
--- origsrc/libb64-1.2.1/examples/Makefile      2013-06-18 14:49:36.000000000 
+0200
+++ src/libb64-1.2.1/examples/Makefile  2022-01-08 20:12:21.021189700 +0100
@@ -19,9 +19,13 @@ vpath %.a ../src
 
 .PHONY : clean
 
-all: $(TARGETS) test
+all: $(TARGETS) 
 
-c-example1 c-example2: libb64.a
+c-example1: ../src/cygb64.dll
+       gcc $(CXXFLAGS) c-example1.c -L../src -lb64 -o $@
+
+c-example2: ../src/cygb64.dll
+       gcc $(CXXFLAGS) c-example2.c -L../src -lb64 -o $@
 
 clean: 
        rm -f *.exe* *.o $(TARGETS) $(DEBRIS) *.bak *~
@@ -33,10 +37,10 @@ depend: $(SOURCES)
        makedepend -f- $(CFLAGS) $(SOURCES) 2> /dev/null 1> depend
 
 test-c-example1: c-example1
-       ./c-example1
+       PATH=$(PWD)/src:$(PATH) ./c-example1
 
 test-c-example2: c-example2
-       ./c-example2 loremgibson.txt encoded.txt decoded.txt
+       PATH=$(PWD)/src:$(PATH) ./c-example2 loremgibson.txt encoded.txt 
decoded.txt
        diff -q loremgibson.txt decoded.txt
 
 test: test-c-example1 test-c-example2
--- origsrc/libb64-1.2.1/src/Makefile   2013-06-18 14:49:36.000000000 +0200
+++ src/libb64-1.2.1/src/Makefile       2022-01-08 19:39:12.010457300 +0100
@@ -1,4 +1,4 @@
-LIBRARIES = libb64.a
+LIBRARIES = cygb64.dll
 
 # Build flags (uncomment one)
 #############################
@@ -24,11 +24,9 @@ vpath %.h ../include/b64
 
 all: $(TARGETS) #strip
 
-libb64.a: cencode.o cdecode.o
-       $(AR) $(ARFLAGS) $@ $^
-
-strip:
-       strip $(BINARIES) *.exe
+cygb64.dll: cencode.o cdecode.o
+       gcc -shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base  \
+       -o $@  -Wl,--out-implib=libb64.dll.a  $^ 
 
 clean:
        rm -f *.exe* *.o $(TARGETS) *.bak *~

Reply via email to