From: David Carlier Date: Thu, 25 Jan 2024 09:00:14 +0000 (+0000) Subject: BUILD/MEDIUM: deviceatlas: addon build rework. X-Git-Tag: v3.0-dev2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9cfd6c8f8e473645f390bb2b507bcf3111ec66fd;p=thirdparty%2Fhaproxy.git BUILD/MEDIUM: deviceatlas: addon build rework. - Removing the legacy v2 support, which in turn suppress the need to set a regex engine. - Moving the options and addon into its distrinct build unit, cleaning up the main one in the process. - Adding a new option to disable the cache if desired or if having a C++ toolchain is not a possibility. --- diff --git a/addons/deviceatlas/Makefile.inc b/addons/deviceatlas/Makefile.inc new file mode 100644 index 0000000000..63719bf506 --- /dev/null +++ b/addons/deviceatlas/Makefile.inc @@ -0,0 +1,38 @@ +# DEVICEATLAS_SRC : DeviceAtlas API source root path + + +CXX := c++ +CXXLIB := -lstdc++ + +CURL_CONFIG := curl-config +CURLDIR := $(shell $(CURL_CONFIG) --prefix 2>/dev/null || echo /usr/local) +CURL_INC := $(CURLDIR)/include +CURL_LIB := $(CURLDIR)/lib +CURL_LDFLAGS := $(shell $(CURL_CONFIG) --libs 2>/dev/null || echo -L /usr/local/lib -lcurl) + +ifeq ($(DEVICEATLAS_SRC),) +OPTIONS_LDFLAGS += -lda +else +DEVICEATLAS_INC = $(DEVICEATLAS_SRC) +DEVICEATLAS_LIB = $(DEVICEATLAS_SRC) +OPTIONS_LDFLAGS += $(CURL_LDFLAGS) -lz -lzip -lpthread +OPTIONS_CFLAGS += -DDATLAS_CURL -DDATLAS_CURLSSET -DDATLAS_GZ -DDATLAS_ZIP +OPTIONS_CFLAGS += -I$(DEVICEATLAS_INC) -I$(CURL_INC) +ifeq ($(DEVICEATLAS_NOCACHE),) +CXXFLAGS := $(OPTIONS_CFLAGS) -std=gnu++11 +OPTIONS_OBJS += $(DEVICEATLAS_SRC)/dacache.o +OPTIONS_LDFLAGS += $(CXXLIB) +else +OPTIONS_CFLAGS += -DAPINOCACHE +endif +OPTIONS_OBJS += $(DEVICEATLAS_SRC)/dac.o +OPTIONS_OBJS += $(DEVICEATLAS_SRC)/json.o +OPTIONS_OBJS += $(DEVICEATLAS_SRC)/dasch.o +OPTIONS_OBJS += $(DEVICEATLAS_SRC)/dadwarc.o +OPTIONS_OBJS += $(DEVICEATLAS_SRC)/dadwcom.o +OPTIONS_OBJS += $(DEVICEATLAS_SRC)/dadwcurl.o +OPTIONS_OBJS += $(DEVICEATLAS_SRC)/Os/daunix.o +endif + +addons/deviceatlas/dummy/%.o: addons/deviceatlas/dummy/%.cpp + $(cmd_CXX) $(CXXFLAGS) -c -o $@ $<