Dear Willy,

Le dim. 30 sept. 2018 à 14:38, Willy Tarreau <[email protected]> a écrit :

> Hello Fabrice,
>
> On Sun, Sep 30, 2018 at 12:20:55PM +0200, Fabrice Fontaine wrote:
> > Dear all,
> >
> > I added haproxy to buildroot and to do so, I added a way of configuring
> the
> > path of pcre-config and pcre-config2.
>
> This looks OK however I think from a users' perspective that it would be
> better to let the user specify the path to the pcre-config command instead
> of only the directory containing it. This gives more flexibility, for
> example allowing to have a different name than "pcre-config". Maybe you
> could simply call that variable "PCRE_CONFIG" in this case.
>
OK, thanks for your quick review, see attached patch, I made two variables
PCRE_CONFIG and PCRE2_CONFIG.

>
> > So, please find attached a patch. As
> > this my first contribution to haproxy, please excuse me if I made any
> > mistakes.
>
> It's mostly OK. Please prefix the subject line with "BUILD:" so that we
> know it affects the build system (just run "git log Makefile" to see
> what we do), but that's just a cosmetic detail.
>
OK done.

>
> Thanks,
> Willy
>
Best Regards,

Fabrice
From 658cd370c3fa90484bfee1c493b7dd9c0248ac57 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <[email protected]>
Date: Fri, 28 Sep 2018 19:21:26 +0200
Subject: [PATCH] BUILD: Allow configuration of pcre-config path

Add PCRE_CONFIG and PCRE2_CONFIG variables to allow the user to
configure path of pcre-config or pcre2-config instead of using the one
in his path.
This is particulary useful when cross-compiling.

Signed-off-by: Fabrice Fontaine <[email protected]>
---
 Makefile | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 382f944f..074e0169 100644
--- a/Makefile
+++ b/Makefile
@@ -78,9 +78,13 @@
 # Other variables :
 #   DLMALLOC_SRC   : build with dlmalloc, indicate the location of dlmalloc.c.
 #   DLMALLOC_THRES : should match PAGE_SIZE on every platform (default: 4096).
+#   PCRE_CONFIG    : force the binary path to get pcre config (by default
+#                                                              pcre-config)
 #   PCREDIR        : force the path to libpcre.
 #   PCRE_LIB       : force the lib path to libpcre (defaults to $PCREDIR/lib).
 #   PCRE_INC       : force the include path to libpcre ($PCREDIR/inc)
+#   PCRE2_CONFIG   : force the binary path to get pcre2 config (by default
+#                                                               pcre2-config)
 #   SSL_LIB        : force the lib path to libssl/libcrypto
 #   SSL_INC        : force the include path to libssl/libcrypto
 #   LUA_LIB        : force the lib path to lua
@@ -734,7 +738,8 @@ endif
 # Forcing PCREDIR to an empty string will let the compiler use the default
 # locations.
 
-PCREDIR	        := $(shell pcre-config --prefix 2>/dev/null || echo /usr/local)
+PCRE_CONFIG    	:= pcre-config
+PCREDIR	        := $(shell $(PCRE_CONFIG) --prefix 2>/dev/null || echo /usr/local)
 ifneq ($(PCREDIR),)
 PCRE_INC        := $(PCREDIR)/include
 PCRE_LIB        := $(PCREDIR)/lib
@@ -759,7 +764,8 @@ endif
 endif
 
 ifneq ($(USE_PCRE2)$(USE_STATIC_PCRE2)$(USE_PCRE2_JIT),)
-PCRE2DIR	:= $(shell pcre2-config --prefix 2>/dev/null || echo /usr/local)
+PCRE2_CONFIG 	:= pcre2-config
+PCRE2DIR	:= $(shell $(PCRE2_CONFIG) --prefix 2>/dev/null || echo /usr/local)
 ifneq ($(PCRE2DIR),)
 PCRE2_INC       := $(PCRE2DIR)/include
 PCRE2_LIB       := $(PCRE2DIR)/lib
@@ -777,7 +783,7 @@ endif
 endif
 
 
-PCRE2_LDFLAGS	:= $(shell pcre2-config --libs$(PCRE2_WIDTH) 2>/dev/null || echo -L/usr/local/lib -lpcre2-$(PCRE2_WIDTH))
+PCRE2_LDFLAGS	:= $(shell $(PCRE2_CONFIG) --libs$(PCRE2_WIDTH) 2>/dev/null || echo -L/usr/local/lib -lpcre2-$(PCRE2_WIDTH))
 
 ifeq ($(PCRE2_LDFLAGS),)
 $(error libpcre2-$(PCRE2_WIDTH) not found)
-- 
2.17.1

Reply via email to