From 92b1c8198d6ec37eb23acc215e88e826abe810b8 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Wed, 11 Aug 2021 16:53:35 +0200 Subject: [PATCH] WIP. Reorganize src build directories --- miniupnpc/Makefile | 204 +++++++++------------ miniupnpc/setup.py | 4 +- miniupnpc/{ => src}/addr_is_reserved.c | 0 miniupnpc/{ => src}/addr_is_reserved.h | 0 miniupnpc/{ => src}/codelength.h | 0 miniupnpc/{ => src}/connecthostport.c | 0 miniupnpc/{ => src}/connecthostport.h | 0 miniupnpc/{ => src}/igd_desc_parse.c | 0 miniupnpc/{ => src}/listdevices.c | 0 miniupnpc/{ => src}/minihttptestserver.c | 0 miniupnpc/{ => src}/minisoap.c | 0 miniupnpc/{ => src}/minisoap.h | 0 miniupnpc/{ => src}/minissdpc.c | 0 miniupnpc/{ => src}/minissdpc.h | 0 miniupnpc/{ => src}/miniupnpc.c | 0 miniupnpc/{ => src}/miniupnpc_socketdef.h | 0 miniupnpc/{ => src}/miniupnpcmodule.c | 0 miniupnpc/{ => src}/miniwget.c | 0 miniupnpc/{ => src}/miniwget_private.h | 0 miniupnpc/{ => src}/minixml.c | 0 miniupnpc/{ => src}/minixml.h | 0 miniupnpc/{ => src}/minixmlvalid.c | 0 miniupnpc/{ => src}/portlistingparse.c | 0 miniupnpc/{ => src}/receivedata.c | 0 miniupnpc/{ => src}/receivedata.h | 0 miniupnpc/{ => src}/testaddr_is_reserved.c | 0 miniupnpc/{ => src}/testigddescparse.c | 0 miniupnpc/{ => src}/testminiwget.c | 0 miniupnpc/{ => src}/testminixml.c | 0 miniupnpc/{ => src}/testportlistingparse.c | 0 miniupnpc/{ => src}/testupnpreplyparse.c | 0 miniupnpc/{ => src}/upnpc.c | 0 miniupnpc/{ => src}/upnpcommands.c | 0 miniupnpc/{ => src}/upnpdev.c | 0 miniupnpc/{ => src}/upnperrors.c | 0 miniupnpc/{ => src}/upnpreplyparse.c | 0 miniupnpc/{ => src}/win32_snprintf.h | 0 miniupnpc/testminiwget.sh | 20 +- miniupnpc/testupnpreplyparse.sh | 4 +- miniupnpc/updateminiupnpcstrings.sh | 13 +- 40 files changed, 114 insertions(+), 131 deletions(-) rename miniupnpc/{ => src}/addr_is_reserved.c (100%) rename miniupnpc/{ => src}/addr_is_reserved.h (100%) rename miniupnpc/{ => src}/codelength.h (100%) rename miniupnpc/{ => src}/connecthostport.c (100%) rename miniupnpc/{ => src}/connecthostport.h (100%) rename miniupnpc/{ => src}/igd_desc_parse.c (100%) rename miniupnpc/{ => src}/listdevices.c (100%) rename miniupnpc/{ => src}/minihttptestserver.c (100%) rename miniupnpc/{ => src}/minisoap.c (100%) rename miniupnpc/{ => src}/minisoap.h (100%) rename miniupnpc/{ => src}/minissdpc.c (100%) rename miniupnpc/{ => src}/minissdpc.h (100%) rename miniupnpc/{ => src}/miniupnpc.c (100%) rename miniupnpc/{ => src}/miniupnpc_socketdef.h (100%) rename miniupnpc/{ => src}/miniupnpcmodule.c (100%) rename miniupnpc/{ => src}/miniwget.c (100%) rename miniupnpc/{ => src}/miniwget_private.h (100%) rename miniupnpc/{ => src}/minixml.c (100%) rename miniupnpc/{ => src}/minixml.h (100%) rename miniupnpc/{ => src}/minixmlvalid.c (100%) rename miniupnpc/{ => src}/portlistingparse.c (100%) rename miniupnpc/{ => src}/receivedata.c (100%) rename miniupnpc/{ => src}/receivedata.h (100%) rename miniupnpc/{ => src}/testaddr_is_reserved.c (100%) rename miniupnpc/{ => src}/testigddescparse.c (100%) rename miniupnpc/{ => src}/testminiwget.c (100%) rename miniupnpc/{ => src}/testminixml.c (100%) rename miniupnpc/{ => src}/testportlistingparse.c (100%) rename miniupnpc/{ => src}/testupnpreplyparse.c (100%) rename miniupnpc/{ => src}/upnpc.c (100%) rename miniupnpc/{ => src}/upnpcommands.c (100%) rename miniupnpc/{ => src}/upnpdev.c (100%) rename miniupnpc/{ => src}/upnperrors.c (100%) rename miniupnpc/{ => src}/upnpreplyparse.c (100%) rename miniupnpc/{ => src}/win32_snprintf.h (100%) diff --git a/miniupnpc/Makefile b/miniupnpc/Makefile index fc6d125..654bf59 100644 --- a/miniupnpc/Makefile +++ b/miniupnpc/Makefile @@ -27,6 +27,11 @@ endif HAVE_IPV6 ?= yes export HAVE_IPV6 +# directories +INCDIR = include +SRCDIR = src +BUILD = build + CC ?= gcc #AR = gar #CFLAGS = -O -g @@ -39,6 +44,7 @@ CFLAGS ?= -O CFLAGS += -Wall CFLAGS += -W -Wstrict-prototypes CFLAGS += -fno-common +CPPFLAGS += -I$(BUILD) CPPFLAGS += -DMINIUPNPC_SET_SOCKET_TIMEOUT CPPFLAGS += -DMINIUPNPC_GET_SRC_ADDR CPPFLAGS += -D_BSD_SOURCE @@ -53,6 +59,9 @@ endif #CFLAGS += -ansi #CPPFLAGS += -DNO_GETADDRINFO +DEPFLAGS = -MM -MG + +MKDIR = mkdir -p INSTALL = install SH = /bin/sh JAVA = java @@ -77,72 +86,65 @@ endif # APIVERSION is used to build SONAME APIVERSION = 17 -SRCS = igd_desc_parse.c miniupnpc.c minixml.c minisoap.c miniwget.c \ - upnpc.c upnpcommands.c upnpreplyparse.c testminixml.c \ - minixmlvalid.c testupnpreplyparse.c minissdpc.c \ - upnperrors.c testigddescparse.c testminiwget.c \ - connecthostport.c portlistingparse.c receivedata.c \ - upnpdev.c testportlistingparse.c miniupnpcmodule.c \ - minihttptestserver.c addr_is_reserved.c testaddr_is_reserved.c \ - listdevices.c +SRCS = $(wildcard $(SRCDIR)/*.c) -LIBOBJS = miniwget.o minixml.o igd_desc_parse.o minisoap.o \ +LIBOBJS = $(addprefix $(BUILD)/,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 + addr_is_reserved.o) -ifeq (, $(findstring amiga, $(OS))) -ifeq (, $(findstring mingw, $(OS))$(findstring cygwin, $(OS))$(findstring msys, $(OS))) -CFLAGS := -fPIC $(CFLAGS) -endif -LIBOBJS := $(LIBOBJS) minissdpc.o -endif +BUILDINCLUDES = $(addprefix $(BUILD)/, miniupnpcstrings.h) -OBJS = $(patsubst %.c,%.o,$(SRCS)) +OBJS = $(patsubst $(SRCDIR)/%.c,$(BUILD)/%.o,$(SRCS)) +DEPS = $(patsubst $(SRCDIR)/%.c,$(BUILD)/%.d,$(SRCS)) # HEADERS to install -CPPFLAGS += -Iinclude/ -HEADERS = $(wildcard include/*.h) +CPPFLAGS += -I$(INCDIR) +HEADERS = $(wildcard $(INCDIR)/*.h) # library names -LIBRARY = libminiupnpc.a +LIBRARY = $(BUILD)/libminiupnpc.a ifneq (, $(findstring darwin, $(OS))) - SHAREDLIBRARY = libminiupnpc.dylib - SONAME = $(basename $(SHAREDLIBRARY)).$(APIVERSION).dylib + SHAREDLIBRARY = $(BUILD)/libminiupnpc.dylib + SONAME = $(notdir $(basename $(SHAREDLIBRARY))).$(APIVERSION).dylib CPPFLAGS += -D_DARWIN_C_SOURCE else ifeq ($(JARSUFFIX), win32) - SHAREDLIBRARY = miniupnpc.dll + SHAREDLIBRARY = $(BUILD)/miniupnpc.dll else # Linux/BSD/etc. - SHAREDLIBRARY = libminiupnpc.so - SONAME = $(SHAREDLIBRARY).$(APIVERSION) + SHAREDLIBRARY = $(BUILD)/libminiupnpc.so + SONAME = $(notdir $(SHAREDLIBRARY)).$(APIVERSION) endif endif -EXECUTABLES = upnpc-static listdevices -EXECUTABLES_ADDTESTS = testminixml minixmlvalid testupnpreplyparse \ - testigddescparse testminiwget testportlistingparse +EXECUTABLES = $(addprefix $(BUILD)/, upnpc-static listdevices) +EXECUTABLES_ADDTESTS = $(addprefix $(BUILD)/, testminixml minixmlvalid \ + testupnpreplyparse testigddescparse testminiwget testportlistingparse) -TESTMINIXMLOBJS = minixml.o igd_desc_parse.o testminixml.o +TESTMINIXMLOBJS = $(addprefix $(BUILD)/, minixml.o igd_desc_parse.o testminixml.o) -TESTMINIWGETOBJS = miniwget.o testminiwget.o connecthostport.o receivedata.o +TESTMINIWGETOBJS = $(addprefix $(BUILD)/, miniwget.o testminiwget.o connecthostport.o receivedata.o) -TESTUPNPREPLYPARSE = testupnpreplyparse.o minixml.o upnpreplyparse.o +TESTUPNPREPLYPARSE = $(addprefix $(BUILD)/, testupnpreplyparse.o minixml.o upnpreplyparse.o) -TESTPORTLISTINGPARSE = testportlistingparse.o minixml.o portlistingparse.o +TESTPORTLISTINGPARSE = $(addprefix $(BUILD)/, testportlistingparse.o minixml.o portlistingparse.o) -TESTADDR_IS_RESERVED = testaddr_is_reserved.o addr_is_reserved.o +TESTADDR_IS_RESERVED = $(addprefix $(BUILD)/, testaddr_is_reserved.o addr_is_reserved.o) -TESTIGDDESCPARSE = testigddescparse.o igd_desc_parse.o minixml.o \ +TESTIGDDESCPARSE = $(addprefix $(BUILD)/, testigddescparse.o igd_desc_parse.o minixml.o \ miniupnpc.o miniwget.o upnpcommands.o upnpreplyparse.o \ minisoap.o connecthostport.o receivedata.o \ - portlistingparse.o addr_is_reserved.o + portlistingparse.o addr_is_reserved.o) ifeq (, $(findstring amiga, $(OS))) -EXECUTABLES := $(EXECUTABLES) upnpc-shared -TESTMINIWGETOBJS := $(TESTMINIWGETOBJS) minissdpc.o -TESTIGDDESCPARSE := $(TESTIGDDESCPARSE) minissdpc.o +ifeq (, $(findstring mingw, $(OS))$(findstring cygwin, $(OS))$(findstring msys, $(OS))) +CFLAGS += -fPIC +endif +EXECUTABLES += $(BUILD)/upnpc-shared +TESTMINIWGETOBJS += $(BUILD)/minissdpc.o +TESTIGDDESCPARSE += $(BUILD)/minissdpc.o +LIBOBJS += $(BUILD)/minissdpc.o endif LIBDIR ?= lib @@ -160,13 +162,12 @@ PKGCONFIGDIR = $(INSTALLDIRLIB)/pkgconfig FILESTOINSTALL = $(LIBRARY) $(EXECUTABLES) ifeq (, $(findstring amiga, $(OS))) -FILESTOINSTALL := $(FILESTOINSTALL) $(SHAREDLIBRARY) miniupnpc.pc +FILESTOINSTALL += $(SHAREDLIBRARY) miniupnpc.pc endif .PHONY: install clean depend all check test everything \ installpythonmodule updateversion -# validateminixml validateminiwget all: $(LIBRARY) $(EXECUTABLES) @@ -177,53 +178,53 @@ check: validateminixml validateminiwget validateupnpreplyparse \ everything: all $(EXECUTABLES_ADDTESTS) -pythonmodule: $(LIBRARY) miniupnpcmodule.c setup.py +pythonmodule: $(LIBRARY) $(SRCDIR)/miniupnpcmodule.c setup.py MAKE=$(MAKE) python setup.py build touch $@ installpythonmodule: pythonmodule MAKE=$(MAKE) python setup.py install -pythonmodule3: $(LIBRARY) miniupnpcmodule.c setup.py +pythonmodule3: $(LIBRARY) $(SRCDIR)/miniupnpcmodule.c setup.py MAKE=$(MAKE) python3 setup.py build touch $@ installpythonmodule3: pythonmodule3 MAKE=$(MAKE) python3 setup.py install -validateminixml: minixmlvalid +validateminixml: $(BUILD)/minixmlvalid @echo "minixml validation test" - ./minixmlvalid + ./$< touch $@ -validateminiwget: testminiwget minihttptestserver testminiwget.sh +validateminiwget: testminiwget.sh $(BUILD)/testminiwget $(BUILD)/minihttptestserver @echo "miniwget validation test" - ./testminiwget.sh + ./$< touch $@ -validateupnpreplyparse: testupnpreplyparse testupnpreplyparse.sh +validateupnpreplyparse: testupnpreplyparse.sh $(BUILD)/testupnpreplyparse @echo "upnpreplyparse validation test" - ./testupnpreplyparse.sh + ./$< touch $@ -validateportlistingparse: testportlistingparse +validateportlistingparse: $(BUILD)/testportlistingparse @echo "portlistingparse validation test" - ./testportlistingparse + ./$< touch $@ -validateigddescparse: testigddescparse +validateigddescparse: $(BUILD)/testigddescparse @echo "igd desc parse validation test" - ./testigddescparse testdesc/new_LiveBox_desc.xml testdesc/new_LiveBox_desc.values - ./testigddescparse testdesc/linksys_WAG200G_desc.xml testdesc/linksys_WAG200G_desc.values + ./$< testdesc/new_LiveBox_desc.xml testdesc/new_LiveBox_desc.values + ./$< testdesc/linksys_WAG200G_desc.xml testdesc/linksys_WAG200G_desc.values touch $@ -validateaddr_is_reserved: testaddr_is_reserved +validateaddr_is_reserved: $(BUILD)/testaddr_is_reserved @echo "addr_is_reserved() validation test" - ./testaddr_is_reserved + ./$< touch $@ clean: - $(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS) miniupnpcstrings.h + $(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS) $(BUILDINCLUDES) $(RM) $(EXECUTABLES_ADDTESTS) # clean python stuff $(RM) pythonmodule pythonmodule3 @@ -281,7 +282,8 @@ cleaninstall: $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(LIBRARY) $(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(SHAREDLIBRARY) -miniupnpc.pc: VERSION +$(BUILD)/miniupnpc.pc: VERSION + @$(MKDIR) $(BUILD) $(RM) $@ echo "prefix=$(INSTALLPREFIX)" >> $@ echo "exec_prefix=\$${prefix}" >> $@ @@ -294,8 +296,7 @@ miniupnpc.pc: VERSION echo "Libs: -L\$${libdir} -lminiupnpc" >> $@ echo "Cflags: -I\$${includedir}" >> $@ -depend: - makedepend -Y -- $(CFLAGS) $(CPPFLAGS) -- $(SRCS) 2>/dev/null +depend: $(DEPS) $(LIBRARY): $(LIBOBJS) ifneq (, $(findstring darwin, $(OS))) @@ -312,30 +313,39 @@ else $(CC) -shared $(LDFLAGS) -Wl,-soname,$(SONAME) -o $@ $^ endif -upnpc-static: upnpc.o $(LIBRARY) +$(BUILD)/%.o: $(SRCDIR)/%.c $(BUILD)/%.d + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + +$(DEPS): $(BUILDINCLUDES) + +$(BUILD)/%.d: $(SRCDIR)/%.c + @$(MKDIR) $(@D) + $(CC) $(CPPFLAGS) $(DEPFLAGS) -MT $@ -o $@ $< + +$(BUILD)/upnpc-static: $(BUILD)/upnpc.o $(LIBRARY) $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS) -upnpc-shared: upnpc.o $(SHAREDLIBRARY) +$(BUILD)/upnpc-shared: $(BUILD)/upnpc.o $(SHAREDLIBRARY) $(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS) -listdevices: listdevices.o $(LIBRARY) +$(BUILD)/listdevices: $(BUILD)/listdevices.o $(LIBRARY) -testminixml: $(TESTMINIXMLOBJS) +$(BUILD)/testminixml: $(TESTMINIXMLOBJS) -testminiwget: $(TESTMINIWGETOBJS) +$(BUILD)/testminiwget: $(TESTMINIWGETOBJS) -minixmlvalid: minixml.o minixmlvalid.o +$(BUILD)/minixmlvalid: $(addprefix $(BUILD)/, minixml.o minixmlvalid.o) -testupnpreplyparse: $(TESTUPNPREPLYPARSE) +$(BUILD)/testupnpreplyparse: $(TESTUPNPREPLYPARSE) -testigddescparse: $(TESTIGDDESCPARSE) +$(BUILD)/testigddescparse: $(TESTIGDDESCPARSE) -testportlistingparse: $(TESTPORTLISTINGPARSE) +$(BUILD)/testportlistingparse: $(TESTPORTLISTINGPARSE) -testaddr_is_reserved: $(TESTADDR_IS_RESERVED) +$(BUILD)/testaddr_is_reserved: $(TESTADDR_IS_RESERVED) -miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION - $(SH) updateminiupnpcstrings.sh +$(BUILD)/miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION + $(SH) updateminiupnpcstrings.sh $@ $< # ftp tool supplied with OpenBSD can download files from http. jnaerator-%.jar: @@ -375,51 +385,9 @@ ideb: minihttptestserver: minihttptestserver.o -# DO NOT DELETE THIS LINE -- make depend depends on it. +print-%: + @echo "$* = $($*)" -igd_desc_parse.o: include/igd_desc_parse.h -miniupnpc.o: include/miniupnpc.h include/miniupnpc_declspec.h -miniupnpc.o: include/igd_desc_parse.h include/upnpdev.h minissdpc.h -miniupnpc.o: include/miniwget.h miniwget_private.h miniupnpc_socketdef.h -miniupnpc.o: minisoap.h minixml.h include/upnpcommands.h -miniupnpc.o: include/miniupnpctypes.h connecthostport.h addr_is_reserved.h -minixml.o: minixml.h -minisoap.o: minisoap.h miniupnpc_socketdef.h miniupnpcstrings.h -miniwget.o: miniupnpcstrings.h include/miniwget.h -miniwget.o: include/miniupnpc_declspec.h connecthostport.h -miniwget.o: miniupnpc_socketdef.h receivedata.h -upnpc.o: include/miniwget.h include/miniupnpc_declspec.h include/miniupnpc.h -upnpc.o: include/igd_desc_parse.h include/upnpdev.h include/upnpcommands.h -upnpc.o: include/miniupnpctypes.h include/portlistingparse.h -upnpc.o: include/upnperrors.h miniupnpcstrings.h -upnpcommands.o: include/upnpcommands.h include/miniupnpc_declspec.h -upnpcommands.o: include/miniupnpctypes.h include/miniupnpc.h -upnpcommands.o: include/igd_desc_parse.h include/upnpdev.h -upnpcommands.o: include/portlistingparse.h include/upnpreplyparse.h -upnpreplyparse.o: include/upnpreplyparse.h minixml.h -testminixml.o: minixml.h include/igd_desc_parse.h -minixmlvalid.o: minixml.h -testupnpreplyparse.o: include/upnpreplyparse.h -minissdpc.o: miniupnpc_socketdef.h minissdpc.h include/miniupnpc_declspec.h -minissdpc.o: include/upnpdev.h include/miniupnpc.h include/igd_desc_parse.h -minissdpc.o: receivedata.h codelength.h -upnperrors.o: include/upnperrors.h include/miniupnpc_declspec.h -upnperrors.o: include/upnpcommands.h include/miniupnpctypes.h -upnperrors.o: include/miniupnpc.h include/igd_desc_parse.h include/upnpdev.h -testigddescparse.o: include/igd_desc_parse.h minixml.h include/miniupnpc.h -testigddescparse.o: include/miniupnpc_declspec.h include/upnpdev.h -testminiwget.o: include/miniwget.h include/miniupnpc_declspec.h -connecthostport.o: connecthostport.h miniupnpc_socketdef.h -portlistingparse.o: include/portlistingparse.h include/miniupnpc_declspec.h -portlistingparse.o: include/miniupnpctypes.h minixml.h -receivedata.o: receivedata.h miniupnpc_socketdef.h -upnpdev.o: include/upnpdev.h include/miniupnpc_declspec.h -testportlistingparse.o: include/portlistingparse.h -testportlistingparse.o: include/miniupnpc_declspec.h include/miniupnpctypes.h -miniupnpcmodule.o: include/miniupnpc.h include/miniupnpc_declspec.h -miniupnpcmodule.o: include/igd_desc_parse.h include/upnpdev.h -miniupnpcmodule.o: include/upnpcommands.h include/miniupnpctypes.h -miniupnpcmodule.o: include/upnperrors.h -testaddr_is_reserved.o: addr_is_reserved.h -listdevices.o: include/miniupnpc.h include/miniupnpc_declspec.h -listdevices.o: include/igd_desc_parse.h include/upnpdev.h +ifneq ($(MAKECMDGOALS),clean) +-include $(DEPS) +endif diff --git a/miniupnpc/setup.py b/miniupnpc/setup.py index 9e622bc..bbb102e 100755 --- a/miniupnpc/setup.py +++ b/miniupnpc/setup.py @@ -13,7 +13,7 @@ from setuptools.command import build_ext import subprocess import os -EXT = ['libminiupnpc.a'] +EXT = ['build/libminiupnpc.a'] class make_then_build_ext(build_ext.build_ext): def run(self): @@ -29,7 +29,7 @@ setup(name="miniupnpc", description='miniUPnP client', cmdclass={'build_ext': make_then_build_ext}, ext_modules=[ - Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], + Extension(name="miniupnpc", sources=["src/miniupnpcmodule.c"], include_dirs=['include'], extra_objects=EXT) ]) diff --git a/miniupnpc/addr_is_reserved.c b/miniupnpc/src/addr_is_reserved.c similarity index 100% rename from miniupnpc/addr_is_reserved.c rename to miniupnpc/src/addr_is_reserved.c diff --git a/miniupnpc/addr_is_reserved.h b/miniupnpc/src/addr_is_reserved.h similarity index 100% rename from miniupnpc/addr_is_reserved.h rename to miniupnpc/src/addr_is_reserved.h diff --git a/miniupnpc/codelength.h b/miniupnpc/src/codelength.h similarity index 100% rename from miniupnpc/codelength.h rename to miniupnpc/src/codelength.h diff --git a/miniupnpc/connecthostport.c b/miniupnpc/src/connecthostport.c similarity index 100% rename from miniupnpc/connecthostport.c rename to miniupnpc/src/connecthostport.c diff --git a/miniupnpc/connecthostport.h b/miniupnpc/src/connecthostport.h similarity index 100% rename from miniupnpc/connecthostport.h rename to miniupnpc/src/connecthostport.h diff --git a/miniupnpc/igd_desc_parse.c b/miniupnpc/src/igd_desc_parse.c similarity index 100% rename from miniupnpc/igd_desc_parse.c rename to miniupnpc/src/igd_desc_parse.c diff --git a/miniupnpc/listdevices.c b/miniupnpc/src/listdevices.c similarity index 100% rename from miniupnpc/listdevices.c rename to miniupnpc/src/listdevices.c diff --git a/miniupnpc/minihttptestserver.c b/miniupnpc/src/minihttptestserver.c similarity index 100% rename from miniupnpc/minihttptestserver.c rename to miniupnpc/src/minihttptestserver.c diff --git a/miniupnpc/minisoap.c b/miniupnpc/src/minisoap.c similarity index 100% rename from miniupnpc/minisoap.c rename to miniupnpc/src/minisoap.c diff --git a/miniupnpc/minisoap.h b/miniupnpc/src/minisoap.h similarity index 100% rename from miniupnpc/minisoap.h rename to miniupnpc/src/minisoap.h diff --git a/miniupnpc/minissdpc.c b/miniupnpc/src/minissdpc.c similarity index 100% rename from miniupnpc/minissdpc.c rename to miniupnpc/src/minissdpc.c diff --git a/miniupnpc/minissdpc.h b/miniupnpc/src/minissdpc.h similarity index 100% rename from miniupnpc/minissdpc.h rename to miniupnpc/src/minissdpc.h diff --git a/miniupnpc/miniupnpc.c b/miniupnpc/src/miniupnpc.c similarity index 100% rename from miniupnpc/miniupnpc.c rename to miniupnpc/src/miniupnpc.c diff --git a/miniupnpc/miniupnpc_socketdef.h b/miniupnpc/src/miniupnpc_socketdef.h similarity index 100% rename from miniupnpc/miniupnpc_socketdef.h rename to miniupnpc/src/miniupnpc_socketdef.h diff --git a/miniupnpc/miniupnpcmodule.c b/miniupnpc/src/miniupnpcmodule.c similarity index 100% rename from miniupnpc/miniupnpcmodule.c rename to miniupnpc/src/miniupnpcmodule.c diff --git a/miniupnpc/miniwget.c b/miniupnpc/src/miniwget.c similarity index 100% rename from miniupnpc/miniwget.c rename to miniupnpc/src/miniwget.c diff --git a/miniupnpc/miniwget_private.h b/miniupnpc/src/miniwget_private.h similarity index 100% rename from miniupnpc/miniwget_private.h rename to miniupnpc/src/miniwget_private.h diff --git a/miniupnpc/minixml.c b/miniupnpc/src/minixml.c similarity index 100% rename from miniupnpc/minixml.c rename to miniupnpc/src/minixml.c diff --git a/miniupnpc/minixml.h b/miniupnpc/src/minixml.h similarity index 100% rename from miniupnpc/minixml.h rename to miniupnpc/src/minixml.h diff --git a/miniupnpc/minixmlvalid.c b/miniupnpc/src/minixmlvalid.c similarity index 100% rename from miniupnpc/minixmlvalid.c rename to miniupnpc/src/minixmlvalid.c diff --git a/miniupnpc/portlistingparse.c b/miniupnpc/src/portlistingparse.c similarity index 100% rename from miniupnpc/portlistingparse.c rename to miniupnpc/src/portlistingparse.c diff --git a/miniupnpc/receivedata.c b/miniupnpc/src/receivedata.c similarity index 100% rename from miniupnpc/receivedata.c rename to miniupnpc/src/receivedata.c diff --git a/miniupnpc/receivedata.h b/miniupnpc/src/receivedata.h similarity index 100% rename from miniupnpc/receivedata.h rename to miniupnpc/src/receivedata.h diff --git a/miniupnpc/testaddr_is_reserved.c b/miniupnpc/src/testaddr_is_reserved.c similarity index 100% rename from miniupnpc/testaddr_is_reserved.c rename to miniupnpc/src/testaddr_is_reserved.c diff --git a/miniupnpc/testigddescparse.c b/miniupnpc/src/testigddescparse.c similarity index 100% rename from miniupnpc/testigddescparse.c rename to miniupnpc/src/testigddescparse.c diff --git a/miniupnpc/testminiwget.c b/miniupnpc/src/testminiwget.c similarity index 100% rename from miniupnpc/testminiwget.c rename to miniupnpc/src/testminiwget.c diff --git a/miniupnpc/testminixml.c b/miniupnpc/src/testminixml.c similarity index 100% rename from miniupnpc/testminixml.c rename to miniupnpc/src/testminixml.c diff --git a/miniupnpc/testportlistingparse.c b/miniupnpc/src/testportlistingparse.c similarity index 100% rename from miniupnpc/testportlistingparse.c rename to miniupnpc/src/testportlistingparse.c diff --git a/miniupnpc/testupnpreplyparse.c b/miniupnpc/src/testupnpreplyparse.c similarity index 100% rename from miniupnpc/testupnpreplyparse.c rename to miniupnpc/src/testupnpreplyparse.c diff --git a/miniupnpc/upnpc.c b/miniupnpc/src/upnpc.c similarity index 100% rename from miniupnpc/upnpc.c rename to miniupnpc/src/upnpc.c diff --git a/miniupnpc/upnpcommands.c b/miniupnpc/src/upnpcommands.c similarity index 100% rename from miniupnpc/upnpcommands.c rename to miniupnpc/src/upnpcommands.c diff --git a/miniupnpc/upnpdev.c b/miniupnpc/src/upnpdev.c similarity index 100% rename from miniupnpc/upnpdev.c rename to miniupnpc/src/upnpdev.c diff --git a/miniupnpc/upnperrors.c b/miniupnpc/src/upnperrors.c similarity index 100% rename from miniupnpc/upnperrors.c rename to miniupnpc/src/upnperrors.c diff --git a/miniupnpc/upnpreplyparse.c b/miniupnpc/src/upnpreplyparse.c similarity index 100% rename from miniupnpc/upnpreplyparse.c rename to miniupnpc/src/upnpreplyparse.c diff --git a/miniupnpc/win32_snprintf.h b/miniupnpc/src/win32_snprintf.h similarity index 100% rename from miniupnpc/win32_snprintf.h rename to miniupnpc/src/win32_snprintf.h diff --git a/miniupnpc/testminiwget.sh b/miniupnpc/testminiwget.sh index 08a6085..a4a665e 100755 --- a/miniupnpc/testminiwget.sh +++ b/miniupnpc/testminiwget.sh @@ -17,6 +17,8 @@ # it should now also run with dash TMPD=`mktemp -d -t miniwgetXXXXXXXXXX` +TESTSERVER=./build/minihttptestserver +TESTMINIWGET=./build/testminiwget HTTPSERVEROUT="${TMPD}/httpserverout" EXPECTEDFILE="${TMPD}/expectedfile" DOWNLOADEDFILE="${TMPD}/downloadedfile" @@ -50,11 +52,15 @@ case "$HAVE_IPV6" in esac -#make minihttptestserver -#make testminiwget +if [ ! -x "$TESTSERVER" ] || [ ! -x "$TESTMINIWGET" ] ; then + echo "Please build $TESTSERVER and $TESTMINIWGET" + #make minihttptestserver + #make testminiwget + exit 1 +fi # launching the test HTTP server -./minihttptestserver $SERVERARGS -e $EXPECTEDFILE > $HTTPSERVEROUT & +$TESTSERVER $SERVERARGS -e $EXPECTEDFILE > $HTTPSERVEROUT & SERVERPID=$! while [ -z "$PORT" ]; do sleep 1 @@ -74,7 +80,7 @@ URL3="http://$ADDR:$PORT/addcrap" URL4="http://$ADDR:$PORT/malformed" echo "standard test ..." -./testminiwget $URL1 "${DOWNLOADEDFILE}.1" +$TESTMINIWGET $URL1 "${DOWNLOADEDFILE}.1" if cmp $EXPECTEDFILE "${DOWNLOADEDFILE}.1" ; then echo "ok" else @@ -83,7 +89,7 @@ else fi echo "chunked transfert encoding test ..." -./testminiwget $URL2 "${DOWNLOADEDFILE}.2" +$TESTMINIWGET $URL2 "${DOWNLOADEDFILE}.2" if cmp $EXPECTEDFILE "${DOWNLOADEDFILE}.2" ; then echo "ok" else @@ -92,7 +98,7 @@ else fi echo "response too long test ..." -./testminiwget $URL3 "${DOWNLOADEDFILE}.3" +$TESTMINIWGET $URL3 "${DOWNLOADEDFILE}.3" if cmp $EXPECTEDFILE "${DOWNLOADEDFILE}.3" ; then echo "ok" else @@ -101,7 +107,7 @@ else fi echo "malformed response test ..." -./testminiwget $URL4 "${DOWNLOADEDFILE}.4" +$TESTMINIWGET $URL4 "${DOWNLOADEDFILE}.4" # kill the test HTTP server kill $SERVERPID diff --git a/miniupnpc/testupnpreplyparse.sh b/miniupnpc/testupnpreplyparse.sh index 992930b..3780401 100755 --- a/miniupnpc/testupnpreplyparse.sh +++ b/miniupnpc/testupnpreplyparse.sh @@ -1,8 +1,10 @@ #!/bin/sh +TESTUPNPREPLYPARSE=./build/testupnpreplyparse + for f in testreplyparse/*.xml ; do bf="`dirname $f`/`basename $f .xml`" - if ./testupnpreplyparse $f $bf.namevalue ; then + if $TESTUPNPREPLYPARSE $f $bf.namevalue ; then echo "$f : passed" else echo "$f : FAILED" diff --git a/miniupnpc/updateminiupnpcstrings.sh b/miniupnpc/updateminiupnpcstrings.sh index dde4354..d24a027 100755 --- a/miniupnpc/updateminiupnpcstrings.sh +++ b/miniupnpc/updateminiupnpcstrings.sh @@ -1,12 +1,19 @@ #! /bin/sh # $Id: updateminiupnpcstrings.sh,v 1.7 2011/01/04 11:41:53 nanard Exp $ # project miniupnp : http://miniupnp.free.fr/ -# (c) 2009 Thomas Bernard +# (c) 2009-2021 Thomas Bernard FILE=miniupnpcstrings.h -TMPFILE=miniupnpcstrings.h.tmp TEMPLATE_FILE=${FILE}.in +if [ -n "$1" ] ; then + FILE="$1" +fi +if [ -n "$2" ] ; then + TEMPLATE_FILE="$2" +fi +TMPFILE=`mktemp -t miniupnpcstrings` + # detecting the OS name and version OS_NAME=`uname -s` OS_VERSION=`uname -r` @@ -49,5 +56,5 @@ sed -e "$EXPR" < $TEMPLATE_FILE > $TMPFILE EXPR="s|MINIUPNPC_VERSION_STRING \".*\"|MINIUPNPC_VERSION_STRING \"${MINIUPNPC_VERSION}\"|" echo "setting MINIUPNPC_VERSION_STRING macro value to ${MINIUPNPC_VERSION} in $FILE." sed -e "$EXPR" < $TMPFILE > $FILE -rm $TMPFILE +rm -v $TMPFILE