]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD/MEDIUM: deviceatlas: addon build rework.
authorDavid Carlier <dcarlier@deviceatlas.com>
Thu, 25 Jan 2024 09:00:14 +0000 (09:00 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 26 Jan 2024 17:54:27 +0000 (18:54 +0100)
- 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.

addons/deviceatlas/Makefile.inc [new file with mode: 0644]

diff --git a/addons/deviceatlas/Makefile.inc b/addons/deviceatlas/Makefile.inc
new file mode 100644 (file)
index 0000000..63719bf
--- /dev/null
@@ -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 $@ $<