Hi here the first patch of the series related to the da's addon build
change.
From 6ee26e72c1d38a9e83c6c64e40c3ca50aa3f9ff9 Mon Sep 17 00:00:00 2001
From: David Carlier <dcarl...@deviceatlas.com>
Date: Thu, 25 Jan 2024 09:00:14 +0000
Subject: [PATCH 1/3] 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.
---
 addons/deviceatlas/Makefile.inc | 43 +++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 addons/deviceatlas/Makefile.inc

diff --git a/addons/deviceatlas/Makefile.inc b/addons/deviceatlas/Makefile.inc
new file mode 100644
index 000000000..6ca2be6b3
--- /dev/null
+++ b/addons/deviceatlas/Makefile.inc
@@ -0,0 +1,43 @@
+# DEVICEATLAS_SRC     : DeviceAtlas API source root path
+
+
+OS              := $(shell uname -s)
+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.cpp
+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
+
+ifeq ($(OS), Linux)
+LDFLAGS         += -lrt
+endif
+ifeq ($(OS), SunOS)
+LDFLAGS         += -lrt
+endif
-- 
2.40.1

Reply via email to