mingw32: build resources for .dll

This commit is contained in:
Thomas Bernard 2020-11-30 01:21:26 +01:00
parent 44dd54051c
commit f04dbafe09
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
7 changed files with 25 additions and 16 deletions

View File

@ -26,7 +26,7 @@ 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 all dist
run: make -C miniupnpc -f Makefile.mingw DLLWRAP=i686-w64-mingw32-dllwrap CC=i686-w64-mingw32-gcc WINDRES=i686-w64-mingw32-windres AR=i686-w64-mingw32-ar all dist
- name: upload binaries
uses: actions/upload-artifact@v2

View File

@ -1,5 +1,6 @@
deb_dist/
build/
.*.swp
*.o
*.a
*.so
@ -10,6 +11,7 @@ build/
*.dylib
Makefile.bak
miniupnpcstrings.h
rc_version.h
pythonmodule
pythonmodule3
upnpc-shared

View File

@ -10,6 +10,7 @@
CC ?= gcc
SETUP_COMPILER_FLAG?=
DLLWRAP = dllwrap
WINDRES = windres
SH = /bin/sh
ZIP = zip
ifeq ($(OS),Windows_NT)
@ -28,7 +29,7 @@ OBJS=miniwget.o minixml.o igd_desc_parse.o minisoap.o \
miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \
connecthostport.o portlistingparse.o receivedata.o \
upnpdev.o addr_is_reserved.o
OBJSDLL=$(addprefix dll-, $(OBJS))
OBJSDLL=$(addprefix dll-, $(OBJS)) winres.o
BINARIES=upnpc-static.exe upnpc-shared.exe \
listdevices-static.exe listdevices-shared.exe \
miniupnpc.dll libminiupnpc.a \
@ -101,8 +102,18 @@ else
miniupnpcstrings.h: miniupnpcstrings.h.in VERSION
sed 's|OS_STRING ".*"|OS_STRING "Windows/Mingw32"|' $< | \
sed 's|MINIUPNPC_VERSION_STRING ".*"|MINIUPNPC_VERSION_STRING "$(shell cat VERSION)"|' > $@
rc_version.h: VERSION
echo "#define LIBMINIUPNPC_DOTTED_VERSION \"$(shell cat VERSION)\"" > $@.tmp
echo "#define LIBMINIUPNPC_MAJOR_VERSION $(shell cat VERSION|cut -d. -f1)" >> $@.tmp
echo "#define LIBMINIUPNPC_MINOR_VERSION $(shell cat VERSION|cut -d. -f2)" >> $@.tmp
echo "#define LIBMINIUPNPC_MICRO_VERSION $(shell cat VERSION|cut -d. -f3)" >> $@.tmp
mv $@.tmp $@
endif
winres.o: miniupnpc.rc rc_version.h
$(WINDRES) -D INTERNAL_NAME=\\\"miniupnpc.dll\\0\\\" -i $< -o $@
testminixml.exe: testminixml.o minixml.o igd_desc_parse.o
$(CC) -static -o $@ $^

View File

@ -1,5 +1,5 @@
#include <winver.h>
#include "rcVersion.h"
#include "rc_version.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION LIBMINIUPNPC_MAJOR_VERSION,LIBMINIUPNPC_MINOR_VERSION,LIBMINIUPNPC_MICRO_VERSION,0
@ -18,15 +18,15 @@ BEGIN
BEGIN
BLOCK "04090000" /* Lang = US English, Charset = ASCII */
BEGIN
VALUE "FileDescription", "MiniUPnP library\0"
VALUE "FileDescription", "MiniUPnPc library\0"
VALUE "FileVersion", LIBMINIUPNPC_DOTTED_VERSION "\0"
VALUE "InternalName", INTERNAL_NAME
VALUE "LegalCopyright", "Copyright (C) Thomas Bernard\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", INTERNAL_NAME
VALUE "ProductName", "MiniUPnP\0"
VALUE "ProductName", "MiniUPnPc\0"
VALUE "ProductVersion", LIBMINIUPNPC_DOTTED_VERSION "\0"
VALUE "Comments", "For more information visit http://xmlsoft.org/\0"
VALUE "Comments", "For more information visit https://miniupnp.tuxfamil.org/\0"
END
END
BLOCK "VarFileInfo"

View File

@ -184,15 +184,15 @@
<ClInclude Include="..\upnperrors.h" />
<ClInclude Include="..\upnpreplyparse.h" />
<ClInclude Include="..\win32_snprintf.h" />
<ClInclude Include="rcVersion.h" />
<ClInclude Include="..\rc_version.h" />
</ItemGroup>
<ItemGroup>
<None Include="genminiupnpcstrings.vbs" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="miniupnpc.rc" />
<ResourceCompile Include="../miniupnpc.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -180,15 +180,15 @@
<ClInclude Include="..\upnperrors.h" />
<ClInclude Include="..\upnpreplyparse.h" />
<ClInclude Include="..\win32_snprintf.h" />
<ClInclude Include="rcVersion.h" />
<ClInclude Include="..\rc_version.h" />
</ItemGroup>
<ItemGroup>
<None Include="genminiupnpcstrings.vbs" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="miniupnpc.rc" />
<ResourceCompile Include="../miniupnpc.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -1,4 +0,0 @@
#define LIBMINIUPNPC_MAJOR_VERSION 2
#define LIBMINIUPNPC_MINOR_VERSION 2
#define LIBMINIUPNPC_MICRO_VERSION 0
#define LIBMINIUPNPC_DOTTED_VERSION "2.2.0"