]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD/MEDIUM: da Adding pcre2 support.
authorDavid Carlier <dcarlier@deviceatlas.com>
Tue, 16 Feb 2021 11:37:45 +0000 (11:37 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 18 Feb 2021 13:58:43 +0000 (14:58 +0100)
The DeviceAtlas Detection API now supports also the pcre2 library,
 and some users wish to have exclusively this version in their
environment.
Also, there is no longer new development happening in the legacy
 pcre(1) counterpart.
Simple check in the build process as the mutual exclusivity check between the
 two are already taking care of early on. Moving the check to the part
only when we build haproxy + the API from source as the other case the API is
 already built with the chosen regex library separately.

Makefile
doc/DeviceAtlas-device-detection.txt

index a21f738e86faa342739465521e2fc7678cf6faca..d5c3f4c4e6ce0236292c0e2a887e20c1be0a423e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -616,9 +616,6 @@ OPTIONS_OBJS    += src/hlua.o src/hlua_fcn.o
 endif
 
 ifneq ($(USE_DEVICEATLAS),)
-ifeq ($(USE_PCRE),)
-$(error the DeviceAtlas module needs the PCRE library in order to compile)
-endif
 # Use DEVICEATLAS_SRC and possibly DEVICEATLAS_INC and DEVICEATLAS_LIB to force path
 # to DeviceAtlas headers and libraries if needed.
 DEVICEATLAS_SRC =
@@ -627,6 +624,14 @@ DEVICEATLAS_LIB = $(DEVICEATLAS_SRC)
 ifeq ($(DEVICEATLAS_SRC),)
 OPTIONS_LDFLAGS += -lda
 else
+ifeq ($(USE_PCRE),)
+ifeq ($(USE_PCRE2),)
+$(error the DeviceAtlas module needs the PCRE or the PCRE2 library in order to compile)
+endif
+endif
+ifneq ($(USE_PCRE2),)
+OPTIONS_CFLAGS  += -DDA_REGEX_HDR=\"dac_pcre2.c\" -DDA_REGEX_TAG=2
+endif
 OPTIONS_OBJS   += $(DEVICEATLAS_LIB)/json.o
 OPTIONS_OBJS   += $(DEVICEATLAS_LIB)/dac.o
 endif
index 2358c5cc6e251419236c000689da5c42ae32dc8c..ccafaa0b1dd30b0ed6eb858ebd6b6c3386b88072 100644 (file)
@@ -2,10 +2,10 @@ DeviceAtlas Device Detection
 ----------------------------
 
 In order to add DeviceAtlas Device Detection support, you would need to download
-the API source code from https://deviceatlas.com/deviceatlas-haproxy-module and
-once extracted :
+the API source code from https://deviceatlas.com/deviceatlas-haproxy-module.
+The build supports the USE_PCRE and USE_PCRE2 options. Once extracted :
 
-    $ make TARGET=<target> USE_PCRE=1 USE_DEVICEATLAS=1 DEVICEATLAS_SRC=<path to the API root folder>
+    $ make TARGET=<target> USE_PCRE (or USE_PCRE2=1) USE_DEVICEATLAS=1 DEVICEATLAS_SRC=<path to the API root folder>
 
 Optionally DEVICEATLAS_INC and DEVICEATLAS_LIB may be set to override the path
 to the include files and libraries respectively if they're not in the source