From 6866b571ab96f03ca0775424e45458c5731f230f Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 2 Feb 2023 14:29:07 +0000 Subject: [PATCH] depends: miniupnpc 2.2.7 Includes a temporary patch to fix the Windows Autotools build. See https://miniupnp.tuxfamily.org/files/changelog.php?file=miniupnpc-2.2.7.tar.gz. --- depends/packages/miniupnpc.mk | 20 ++- .../patches/miniupnpc/dont_leak_info.patch | 26 ++-- .../patches/miniupnpc/fix_windows_build.patch | 143 ++++++++++++++++++ .../miniupnpc/respect_mingw_cflags.patch | 23 --- doc/dependencies.md | 2 +- 5 files changed, 166 insertions(+), 48 deletions(-) create mode 100644 depends/patches/miniupnpc/fix_windows_build.patch delete mode 100644 depends/patches/miniupnpc/respect_mingw_cflags.patch diff --git a/depends/packages/miniupnpc.mk b/depends/packages/miniupnpc.mk index 5698a7cbb1a..39c640f1e7e 100644 --- a/depends/packages/miniupnpc.mk +++ b/depends/packages/miniupnpc.mk @@ -1,30 +1,28 @@ package=miniupnpc -$(package)_version=2.2.2 +$(package)_version=2.2.7 $(package)_download_path=https://miniupnp.tuxfamily.org/files/ $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=888fb0976ba61518276fe1eda988589c700a3f2a69d71089260d75562afd3687 -$(package)_patches=dont_leak_info.patch respect_mingw_cflags.patch no_libtool.patch +$(package)_sha256_hash=b0c3a27056840fd0ec9328a5a9bac3dc5e0ec6d2e8733349cf577b0aa1e70ac1 +$(package)_patches=dont_leak_info.patch no_libtool.patch fix_windows_build.patch -# Next time this package is updated, ensure that _WIN32_WINNT is still properly set. -# See discussion in https://github.com/bitcoin/bitcoin/pull/25964. define $(package)_set_vars $(package)_build_opts=CC="$($(package)_cc)" -$(package)_build_opts_mingw32=-f Makefile.mingw CFLAGS="$($(package)_cflags) -D_WIN32_WINNT=0x0601" +$(package)_build_opts_mingw32=-f Makefile.mingw CFLAGS="$($(package)_cflags)" $(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)" endef define $(package)_preprocess_cmds patch -p1 < $($(package)_patch_dir)/dont_leak_info.patch && \ - patch -p1 < $($(package)_patch_dir)/respect_mingw_cflags.patch && \ - patch -p1 < $($(package)_patch_dir)/no_libtool.patch + patch -p1 < $($(package)_patch_dir)/no_libtool.patch && \ + patch -p1 < $($(package)_patch_dir)/fix_windows_build.patch endef define $(package)_build_cmds - $(MAKE) libminiupnpc.a $($(package)_build_opts) + $(MAKE) build/libminiupnpc.a $($(package)_build_opts) endef define $(package)_stage_cmds mkdir -p $($(package)_staging_prefix_dir)/include/miniupnpc $($(package)_staging_prefix_dir)/lib &&\ - install *.h $($(package)_staging_prefix_dir)/include/miniupnpc &&\ - install libminiupnpc.a $($(package)_staging_prefix_dir)/lib + install include/*.h $($(package)_staging_prefix_dir)/include/miniupnpc &&\ + install build/libminiupnpc.a $($(package)_staging_prefix_dir)/lib endef diff --git a/depends/patches/miniupnpc/dont_leak_info.patch b/depends/patches/miniupnpc/dont_leak_info.patch index 512f9c50ea8..95a09a26dce 100644 --- a/depends/patches/miniupnpc/dont_leak_info.patch +++ b/depends/patches/miniupnpc/dont_leak_info.patch @@ -1,31 +1,31 @@ -commit 8815452257437ba36607d0e2381c01142d1c7bb0 +commit 51f6dd991c29af66fb4f64c6feb2787cce23a1a7 Author: fanquake -Date: Thu Nov 19 10:51:19 2020 +0800 +Date: Mon Jan 8 11:21:40 2024 +0000 Don't leak OS and miniupnpc version info in User-Agent -diff --git a//minisoap.c b/minisoap.c -index 7860667..775580b 100644 ---- a/minisoap.c -+++ b/minisoap.c +diff --git a/src/minisoap.c b/src/minisoap.c +index 903ac5f..046e0ea 100644 +--- a/src/minisoap.c ++++ b/src/minisoap.c @@ -90,7 +90,7 @@ int soapPostSubmit(SOCKET fd, headerssize = snprintf(headerbuf, sizeof(headerbuf), "POST %s HTTP/%s\r\n" "Host: %s%s\r\n" -- "User-Agent: " OS_STRING ", " UPNP_VERSION_STRING ", MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n" +- "User-Agent: " OS_STRING " " UPNP_VERSION_STRING " MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n" + "User-Agent: " UPNP_VERSION_STRING "\r\n" "Content-Length: %d\r\n" + #if (UPNP_VERSION_MAJOR == 1) && (UPNP_VERSION_MINOR == 0) "Content-Type: text/xml\r\n" - "SOAPAction: \"%s\"\r\n" -diff --git a/miniwget.c b/miniwget.c -index d5b7970..05aeb9c 100644 ---- a/miniwget.c -+++ b/miniwget.c +diff --git a/src/miniwget.c b/src/miniwget.c +index e76a5e5..0cc36fe 100644 +--- a/src/miniwget.c ++++ b/src/miniwget.c @@ -444,7 +444,7 @@ miniwget3(const char * host, "GET %s HTTP/%s\r\n" "Host: %s:%d\r\n" "Connection: Close\r\n" -- "User-Agent: " OS_STRING ", " UPNP_VERSION_STRING ", MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n" +- "User-Agent: " OS_STRING " " UPNP_VERSION_STRING " MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n" + "User-Agent: " UPNP_VERSION_STRING "\r\n" "\r\n", diff --git a/depends/patches/miniupnpc/fix_windows_build.patch b/depends/patches/miniupnpc/fix_windows_build.patch new file mode 100644 index 00000000000..6a4467b7e3c --- /dev/null +++ b/depends/patches/miniupnpc/fix_windows_build.patch @@ -0,0 +1,143 @@ +build: Temporary patch to make Windows compile + +--- a/Makefile.mingw ++++ b/Makefile.mingw +@@ -9,10 +9,12 @@ + # + SRCDIR = src + INCDIR = include ++BUILD = build + + CC ?= gcc + SETUP_COMPILER_FLAG?= + DLLWRAP = dllwrap ++MKDIR = mkdir -p + WINDRES = windres + SH = /bin/sh + ZIP = zip +@@ -26,24 +28,25 @@ CFLAGS ?= -Os + CFLAGS += -Wall + CFLAGS += -W -Wstrict-prototypes + +-CPPFLAGS += -DNDEBUG -D_WIN32_WINNT=0x501 ++CPPFLAGS += -DNDEBUG -D_WIN32_WINNT=0x601 + CPPFLAGS += -Iinclude + CPPFLAGS += -I. ++CPPFLAGS += -I$(BUILD) + + # -liphlpapi is needed for GetBestRoute() and GetIpAddrTable() + LDLIBS = -lws2_32 -liphlpapi + + PYTHON=\utils\python25\python +-OBJS=miniwget.o minixml.o igd_desc_parse.o minisoap.o \ ++OBJS=$(addprefix $(BUILD)/,miniwget.o minixml.o igd_desc_parse.o minisoap.o \ + minissdpc.o \ + miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \ + connecthostport.o portlistingparse.o receivedata.o \ +- upnpdev.o addr_is_reserved.o ++ upnpdev.o addr_is_reserved.o) + OBJSDLL=$(addprefix dll-, $(OBJS)) winres.o +-BINARIES=upnpc-static.exe upnpc-shared.exe \ ++BINARIES=$(addprefix $(BUILD)/,upnpc-static.exe upnpc-shared.exe \ + upnp-listdevices-static.exe upnp-listdevices-shared.exe \ + miniupnpc.dll libminiupnpc.a \ +- testminixml.exe ++ testminixml.exe) + ifneq ($(GITHUB_SHA),) + COMMITREF=$(GITHUB_SHA) + else +@@ -76,11 +79,12 @@ clean: + $(RM) miniupnpc.dll miniupnpc.lib miniupnpc.dll.def + $(RM) libminiupnpc.a + $(RM) $(DISTFILE) ++ $(RM) -r build/ + + $(DISTFILE): $(BINARIES) + $(ZIP) $@ *.exe *.dll *.lib *.def *.a LICENSE README Changelog.txt + +-libminiupnpc.a: $(OBJS) ++$(BUILD)/libminiupnpc.a: $(OBJS) + $(AR) cr $@ $? + + pythonmodule: libminiupnpc.a +@@ -97,13 +101,13 @@ miniupnpc.dll: miniupnpc.def $(OBJSDLL) + + miniupnpc.lib: miniupnpc.dll + +-%.o: $(SRCDIR)/%.c ++$(BUILD)/%.o: $(SRCDIR)/%.c + $(CC) $(CFLAGS) $(CPPFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $< + +-dll-%.o: $(SRCDIR)/%.c ++$(BUILD)/dll-%.o: $(SRCDIR)/%.c + $(CC) $(CFLAGS) $(CPPFLAGS) -DMINIUPNP_EXPORTS -c -o $@ $< + +-%-shared.o: $(SRCDIR)/%.c ++$(BUILD)/%-shared.o: $(SRCDIR)/%.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + + # --enable-stdcall-fixup +@@ -131,7 +135,8 @@ miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings.exe VERSION + + rc_version.h: miniupnpcstrings.h + else +-miniupnpcstrings.h: miniupnpcstrings.h.in VERSION ++$(BUILD)/miniupnpcstrings.h: miniupnpcstrings.h.in VERSION ++ @$(MKDIR) $(@D) + sed 's|OS_STRING ".*"|OS_STRING "Windows/Mingw32"|' $< | \ + sed 's|MINIUPNPC_VERSION_STRING ".*"|MINIUPNPC_VERSION_STRING "$(shell cat VERSION)"|' > $@ + +@@ -143,7 +148,7 @@ rc_version.h: VERSION + mv $@.tmp $@ + endif + +-miniupnpc.pc: VERSION ++$(BUILD)/miniupnpc.pc: VERSION + $(RM) $@ + echo "prefix=$(INSTALLPREFIX)" >> $@ + echo "exec_prefix=\$${prefix}" >> $@ +@@ -156,32 +161,32 @@ miniupnpc.pc: VERSION + echo "Libs: -L\$${libdir} -lminiupnpc" >> $@ + echo "Cflags: -I\$${includedir}" >> $@ + +-winres.o: miniupnpc.rc rc_version.h ++$(BUILD)/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 $@ $^ + +-minixml.o: $(SRCDIR)/minixml.c $(SRCDIR)/minixml.h ++$(BUILD)/minixml.o: $(SRCDIR)/minixml.c $(SRCDIR)/minixml.h + +-upnpc.o: include/miniwget.h $(SRCDIR)/minisoap.h include/miniupnpc.h include/igd_desc_parse.h +-upnpc.o: include/upnpreplyparse.h include/upnpcommands.h include/upnperrors.h miniupnpcstrings.h ++$(BUILD)/upnpc.o: include/miniwget.h $(SRCDIR)/minisoap.h include/miniupnpc.h include/igd_desc_parse.h ++$(BUILD)/upnpc.o: include/upnpreplyparse.h include/upnpcommands.h include/upnperrors.h miniupnpcstrings.h + +-miniwget.o: $(SRCDIR)/miniwget.c include/miniwget.h miniupnpcstrings.h $(SRCDIR)/connecthostport.h ++$(BUILD)/miniwget.o: $(SRCDIR)/miniwget.c include/miniwget.h $(BUILD)/miniupnpcstrings.h $(SRCDIR)/connecthostport.h + +-minisoap.o: $(SRCDIR)/minisoap.c $(SRCDIR)/minisoap.h miniupnpcstrings.h ++$(BUILD)/minisoap.o: $(SRCDIR)/minisoap.c $(SRCDIR)/minisoap.h $(BUILD)/miniupnpcstrings.h + +-miniupnpc.o: $(SRCDIR)/miniupnpc.c include/miniupnpc.h $(SRCDIR)/minisoap.h \ ++$(BUILD)/miniupnpc.o: $(SRCDIR)/miniupnpc.c include/miniupnpc.h $(SRCDIR)/minisoap.h \ + include/miniwget.h $(SRCDIR)/minixml.h $(SRCDIR)/addr_is_reserved.h + +-igd_desc_parse.o: $(SRCDIR)/igd_desc_parse.c include/igd_desc_parse.h ++$(BUILD)/igd_desc_parse.o: $(SRCDIR)/igd_desc_parse.c include/igd_desc_parse.h + +-upnpreplyparse.o: $(SRCDIR)/upnpreplyparse.c include/upnpreplyparse.h $(SRCDIR)/minixml.h ++$(BUILD)/upnpreplyparse.o: $(SRCDIR)/upnpreplyparse.c include/upnpreplyparse.h $(SRCDIR)/minixml.h + +-upnpcommands.o: $(SRCDIR)/upnpcommands.c include/upnpcommands.h include/upnpreplyparse.h \ ++$(BUILD)/upnpcommands.o: $(SRCDIR)/upnpcommands.c include/upnpcommands.h include/upnpreplyparse.h \ + include/miniupnpc.h include/portlistingparse.h + +-minissdpc.o: $(SRCDIR)/minissdpc.c $(SRCDIR)/minissdpc.h $(SRCDIR)/receivedata.h ++$(BUILD)/minissdpc.o: $(SRCDIR)/minissdpc.c $(SRCDIR)/minissdpc.h $(SRCDIR)/receivedata.h + +-upnpdev.o: $(SRCDIR)/upnpdev.c include/upnpdev.h ++$(BUILD)/upnpdev.o: $(SRCDIR)/upnpdev.c include/upnpdev.h + diff --git a/depends/patches/miniupnpc/respect_mingw_cflags.patch b/depends/patches/miniupnpc/respect_mingw_cflags.patch deleted file mode 100644 index a44580ddab6..00000000000 --- a/depends/patches/miniupnpc/respect_mingw_cflags.patch +++ /dev/null @@ -1,23 +0,0 @@ -commit fec515a7ac9991a0ee91068fda046b54b191155e -Author: fanquake -Date: Wed Jul 27 15:52:37 2022 +0100 - - build: respect CFLAGS in makefile.mingw - - Similar to the other Makefile. - - Cherry-pick of https://github.com/miniupnp/miniupnp/pull/619. - -diff --git a/Makefile.mingw b/Makefile.mingw -index 2bff7bd..88430d2 100644 ---- a/Makefile.mingw -+++ b/Makefile.mingw -@@ -19,7 +19,7 @@ else - RM = rm -f - endif - #CFLAGS = -Wall -g -DDEBUG -D_WIN32_WINNT=0X501 --CFLAGS = -Wall -W -Wstrict-prototypes -Os -DNDEBUG -D_WIN32_WINNT=0X501 -+CFLAGS ?= -Wall -W -Wstrict-prototypes -Os -DNDEBUG -D_WIN32_WINNT=0X501 - LDLIBS = -lws2_32 -liphlpapi - # -lwsock32 - # -liphlpapi is needed for GetBestRoute() and GetIpAddrTable() diff --git a/doc/dependencies.md b/doc/dependencies.md index 43973d0c15b..2b9d9128d3a 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -36,7 +36,7 @@ You can find installation instructions in the `build-*.md` file for your platfor | Dependency | Releases | Version used | Minimum required | Runtime | | --- | --- | --- | --- | --- | | [libnatpmp](../depends/packages/libnatpmp.mk) | [link](https://github.com/miniupnp/libnatpmp/) | commit [f2433be...](https://github.com/bitcoin/bitcoin/pull/29708) | | No | -| [MiniUPnPc](../depends/packages/miniupnpc.mk) | [link](https://miniupnp.tuxfamily.org/) | [2.2.2](https://github.com/bitcoin/bitcoin/pull/20421) | 2.1 | No | +| [MiniUPnPc](../depends/packages/miniupnpc.mk) | [link](https://miniupnp.tuxfamily.org/) | [2.2.7](https://github.com/bitcoin/bitcoin/pull/29707) | 2.1 | No | ### Notifications | Dependency | Releases | Version used | Minimum required | Runtime |