From 1756c9259a5252384c00bee543ca4bc05ead82fd Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Thu, 5 Nov 2020 13:24:59 +0100 Subject: [PATCH] github workflows: try to upload win32 binaries --- .github/workflows/mingw.yml | 8 +++++++- miniupnpc/Makefile.mingw | 28 +++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 7b7d811..9ebf29f 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -26,4 +26,10 @@ jobs: run: sudo apt-get install gcc-mingw-w64-i686 mingw-w64-tools - name: build miniupnpc for win32 - run: make -C miniupnpc -f Makefile.mingw DLLWRAP=i686-w64-mingw32-dllwrap CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar + run: make -C miniupnpc -f Makefile.mingw DLLWRAP=i686-w64-mingw32-dllwrap CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar all dist + + - name: upload binaries + uses: actions/upload-artifact@v2 + with: + name: win32-binaries + path: miniupnpc/*.zip diff --git a/miniupnpc/Makefile.mingw b/miniupnpc/Makefile.mingw index 9cd457e..3f18795 100644 --- a/miniupnpc/Makefile.mingw +++ b/miniupnpc/Makefile.mingw @@ -1,7 +1,7 @@ # $Id: Makefile.mingw,v 1.21 2015/09/18 12:45:16 nanard Exp $ # Miniupnp project. # http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ -# (c) 2005-2018 Thomas Bernard +# (c) 2005-2020 Thomas Bernard # This Makefile is made for MinGW # # To cross compile on a *nix machine : @@ -11,6 +11,7 @@ CC ?= gcc SETUP_COMPILER_FLAG?= DLLWRAP = dllwrap SH = /bin/sh +ZIP = zip ifeq ($(OS),Windows_NT) RM = del else @@ -28,9 +29,22 @@ OBJS=miniwget.o minixml.o igd_desc_parse.o minisoap.o \ connecthostport.o portlistingparse.o receivedata.o \ upnpdev.o addr_is_reserved.o OBJSDLL=$(addprefix dll-, $(OBJS)) +BINARIES=upnpc-static.exe upnpc-shared.exe \ + listdevices-static.exe listdevices-shared.exe \ + miniupnpc.dll libminiupnpc.a \ + testminixml.exe +ifneq ($(GITHUB_SHA),) +COMMITREF=$(GITHUB_SHA) +else +COMMITREF=$(shell git rev-parse --short HEAD) +endif +DISTFILE:=$(shell echo "miniupnpc-bin-win32-`cat VERSION`-$(COMMITREF).zip") -all: upnpc-static.exe upnpc-shared.exe testminixml.exe libminiupnpc.a \ - miniupnpc.dll listdevices-static.exe listdevices-shared.exe +.PHONY: all dist clean + +all: $(BINARIES) + +dist: $(DISTFILE) clean: $(RM) miniupnpcstrings.h @@ -39,6 +53,9 @@ clean: $(RM) miniupnpc.dll miniupnpc.lib miniupnpc.dll.def $(RM) libminiupnpc.a +$(DISTFILE): $(BINARIES) + $(ZIP) $@ *.exe *.dll *.lib *.def *.a LICENSE README Changelog.txt + libminiupnpc.a: $(OBJS) $(AR) cr $@ $? @@ -86,6 +103,9 @@ miniupnpcstrings.h: miniupnpcstrings.h.in VERSION sed 's|MINIUPNPC_VERSION_STRING ".*"|MINIUPNPC_VERSION_STRING "$(shell cat VERSION)"|' > $@ endif +testminixml.exe: testminixml.o minixml.o igd_desc_parse.o + $(CC) -static -o $@ $^ + minixml.o: minixml.c minixml.h upnpc.o: miniwget.h minisoap.h miniupnpc.h igd_desc_parse.h @@ -100,8 +120,6 @@ miniupnpc.o: miniupnpc.c miniupnpc.h minisoap.h miniwget.h minixml.h \ igd_desc_parse.o: igd_desc_parse.c igd_desc_parse.h -testminixml.exe: minixml.o igd_desc_parse.o testminixml.c - upnpreplyparse.o: upnpreplyparse.c upnpreplyparse.h minixml.h upnpcommands.o: upnpcommands.c upnpcommands.h upnpreplyparse.h miniupnpc.h portlistingparse.h