aboutsummaryrefslogtreecommitdiff
path: root/depends/patches/miniupnpc/fix_windows_build.patch
diff options
context:
space:
mode:
Diffstat (limited to 'depends/patches/miniupnpc/fix_windows_build.patch')
-rw-r--r--depends/patches/miniupnpc/fix_windows_build.patch143
1 files changed, 143 insertions, 0 deletions
diff --git a/depends/patches/miniupnpc/fix_windows_build.patch b/depends/patches/miniupnpc/fix_windows_build.patch
new file mode 100644
index 0000000000..6a4467b7e3
--- /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
+