[MEDIUM] build: switch ebtree users to use new ebtree version
All files referencing the previous ebtree code were changed to point
to the new one in the ebtree directory. A makefile variable (EBTREE_DIR)
is also available to use files from another directory.
The ability to build the libebtree library temporarily remains disabled
because it can have an impact on some existing toolchains and does not
appear worth it in the medium term if we add support for multi-criteria
stickiness for instance.
diff --git a/Makefile b/Makefile
index 46b762c..824e8e1 100644
--- a/Makefile
+++ b/Makefile
@@ -410,10 +410,12 @@
BUILD_OPTIONS += $(call ignore_implicit,USE_STATIC_PCRE)
endif
+# This one can be changed to look for ebtree files in an external directory
+EBTREE_DIR := ebtree
#### Global compile options
VERBOSE_CFLAGS = $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE)
-COPTS = -Iinclude -Wall
+COPTS = -Iinclude -I$(EBTREE_DIR) -Wall
COPTS += $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) $(SILENT_DEFINE)
COPTS += $(DEBUG) $(OPTIONS_CFLAGS) $(ADDINC)
@@ -462,12 +464,22 @@
src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o \
src/stream_interface.o src/dumpstats.o src/proto_tcp.o \
src/session.o src/hdr_idx.o src/ev_select.o src/signal.o \
- src/acl.o src/memory.o src/freq_ctr.o \
- src/ebtree.o src/eb32tree.o
+ src/acl.o src/memory.o src/freq_ctr.o
-haproxy: $(OBJS) $(OPTIONS_OBJS)
+EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o \
+ $(EBTREE_DIR)/eb32tree.o $(EBTREE_DIR)/eb64tree.o \
+ $(EBTREE_DIR)/ebmbtree.o $(EBTREE_DIR)/ebsttree.o \
+ $(EBTREE_DIR)/ebimtree.o $(EBTREE_DIR)/ebistree.o
+
+# Not used right now
+LIB_EBTREE = $(EBTREE_DIR)/libebtree.a
+
+haproxy: $(OBJS) $(OPTIONS_OBJS) $(EBTREE_OBJS)
$(LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
+$(LIB_EBTREE): $(EBTREE_OBJS)
+ $(AR) rv $@ $^
+
objsize: haproxy
@objdump -t $^|grep ' g '|grep -F '.text'|awk '{print $$5 FS $$6}'|sort
@@ -504,8 +516,8 @@
install: install-bin install-man install-doc
clean:
- rm -f *.[oas] src/*.[oas] core haproxy test
- for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
+ rm -f *.[oas] src/*.[oas] ebtree/*.[oas] haproxy test
+ for dir in . src include/* doc ebtree; do rm -f $$dir/*~ $$dir/*.rej $$dir/core; done
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION)$(SUBVERS).tar.gz
rm -f haproxy-$(VERSION) nohup.out gmon.out
diff --git a/Makefile.bsd b/Makefile.bsd
index 7957f94..015a365 100644
--- a/Makefile.bsd
+++ b/Makefile.bsd
@@ -92,8 +92,11 @@
VER_OPTS := -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\" \
-DCONFIG_HAPROXY_DATE=\"$(VERDATE)\"
-COPTS = -Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) \
- $(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
+# This one can be changed to look for ebtree files in an external directory
+EBTREE_DIR := ebtree
+
+COPTS = -Iinclude -I$(EBTREE_DIR) $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) \
+ $(REGEX_OPTS) $(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
LIBS = $(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
CFLAGS = -Wall $(COPTS) $(DEBUG)
LDFLAGS = -g
@@ -107,12 +110,16 @@
src/session.o src/hdr_idx.o src/ev_select.o src/signal.o \
src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o \
src/ev_poll.o src/ev_kqueue.o \
- src/acl.o src/memory.o src/freq_ctr.o \
- src/ebtree.o src/eb32tree.o
+ src/acl.o src/memory.o src/freq_ctr.o
+
+EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o \
+ $(EBTREE_DIR)/eb32tree.o $(EBTREE_DIR)/eb64tree.o \
+ $(EBTREE_DIR)/ebmbtree.o $(EBTREE_DIR)/ebsttree.o \
+ $(EBTREE_DIR)/ebimtree.o $(EBTREE_DIR)/ebistree.o
all: haproxy
-haproxy: $(OBJS) $(OPT_OBJS)
+haproxy: $(OBJS) $(OPT_OBJS) $(EBTREE_OBJS)
$(LD) $(LDFLAGS) -o $@ $> $(LIBS)
.SUFFIXES: .c.o
@@ -129,8 +136,8 @@
$(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $>
clean:
- rm -f *.[oas] src/*.[oas] core haproxy test
- for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
+ rm -f *.[oas] src/*.[oas] ebtree/*.[oas] haproxy test
+ for dir in . src include/* doc ebtree; do rm -f $$dir/*~ $$dir/*.rej $$dir/core; done
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out
version:
diff --git a/Makefile.osx b/Makefile.osx
index 19fb720..5fa0da0 100644
--- a/Makefile.osx
+++ b/Makefile.osx
@@ -31,6 +31,9 @@
PCREDIR!= pcre-config --prefix 2>/dev/null || :
#PCREDIR=/usr/local
+# This one can be changed to look for ebtree files in an external directory
+EBTREE_DIR = ebtree
+
# This is for darwin 3.0 and above
COPTS.darwin = -DENABLE_POLL -DENABLE_KQUEUE
LIBS.darwin =
@@ -89,8 +92,8 @@
VER_OPTS := -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\" \
-DCONFIG_HAPROXY_DATE=\"$(VERDATE)\"
-COPTS = -Iinclude $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) $(REGEX_OPTS) \
- $(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
+COPTS = -Iinclude -I$(EBTREE_DIR) $(ADDINC) $(CPU_OPTS) $(TARGET_OPTS) \
+ $(REGEX_OPTS) $(SMALL_OPTS) $(VER_OPTS) $(DEFINE)
LIBS = $(LIBS.$(TARGET)) $(LIBS.$(REGEX)) $(ADDLIB)
CFLAGS = -Wall $(COPTS) $(DEBUG) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -mmacosx-version-min=10.4
LDFLAGS = -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -mmacosx-version-min=10.4
@@ -104,13 +107,17 @@
src/session.o src/hdr_idx.o src/ev_select.o src/signal.o \
src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o \
src/ev_poll.o \
- src/acl.o src/memory.o src/freq_ctr.o \
- src/ebtree.o src/eb32tree.o
+ src/acl.o src/memory.o src/freq_ctr.o
+
+EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o \
+ $(EBTREE_DIR)/eb32tree.o $(EBTREE_DIR)/eb64tree.o \
+ $(EBTREE_DIR)/ebmbtree.o $(EBTREE_DIR)/ebsttree.o \
+ $(EBTREE_DIR)/ebimtree.o $(EBTREE_DIR)/ebistree.o
all: haproxy
-haproxy: $(OBJS)
- $(LD) $(LDFLAGS) $(OBJS) -o $@
+haproxy: $(OBJS) $(EBTREE_OBJS)
+ $(LD) $(LDFLAGS) $(OBJS) $(EBTREE_OBJS) -o $@
.SUFFIXES: .c.o
@@ -126,8 +133,8 @@
$(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
clean:
- rm -f *.[oas] src/*.[oas] core haproxy test
- for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done
+ rm -f *.[oas] src/*.[oas] ebtree/*.[oas] haproxy test
+ for dir in . src include/* doc ebtree; do rm -f $$dir/*~ $$dir/*.rej $$dir/core; done
rm -f haproxy-$(VERSION).tar.gz haproxy-$(VERSION) nohup.out gmon.out
version:
diff --git a/contrib/halog/Makefile b/contrib/halog/Makefile
index 2215e03..f85acc7 100644
--- a/contrib/halog/Makefile
+++ b/contrib/halog/Makefile
@@ -1,13 +1,14 @@
-INCLUDE = -I../../include
-OPTIMIZE = -O3 -mtune=pentium-m
+EBTREE_DIR = ../../ebtree
+INCLUDE = -I$(EBTREE_DIR)
+OPTIMIZE = -O3 #-mtune=pentium-m
OBJS = halog halog64
halog: halog.c fgets2.c
- $(CC) $(OPTIMIZE) -o $@ $(INCLUDE) ../../src/ebtree.c ../../src/eb32tree.c $^
+ $(CC) $(OPTIMIZE) -o $@ $(INCLUDE) $(EBTREE_DIR)/ebtree.c $(EBTREE_DIR)/eb32tree.c $^
halog64: halog.c fgets2-64.c
- $(CC) $(OPTIMIZE) -o $@ $(INCLUDE) ../../src/ebtree.c ../../src/eb32tree.c $^
+ $(CC) $(OPTIMIZE) -o $@ $(INCLUDE) $(EBTREE_DIR)/ebtree.c $(EBTREE_DIR)/eb32tree.c $^
clean:
rm -vf $(OBJS)
diff --git a/contrib/halog/halog.c b/contrib/halog/halog.c
index 27e0961..fcf99c4 100644
--- a/contrib/halog/halog.c
+++ b/contrib/halog/halog.c
@@ -27,7 +27,7 @@
#include <unistd.h>
#include <ctype.h>
-#include <common/eb32tree.h>
+#include <eb32tree.h>
#define ACCEPT_FIELD 6
#define TIME_FIELD 9
diff --git a/include/common/standard.h b/include/common/standard.h
index ce70f2e..0a6b68b 100644
--- a/include/common/standard.h
+++ b/include/common/standard.h
@@ -27,7 +27,7 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <common/config.h>
-#include <common/eb32tree.h>
+#include <eb32tree.h>
#include <proto/fd.h>
/****** string-specific macros and functions ******/
diff --git a/include/proto/task.h b/include/proto/task.h
index 62f83e3..0cfe28f 100644
--- a/include/proto/task.h
+++ b/include/proto/task.h
@@ -26,11 +26,11 @@
#include <sys/time.h>
#include <common/config.h>
-#include <common/eb32tree.h>
#include <common/memory.h>
#include <common/mini-clist.h>
#include <common/standard.h>
#include <common/ticks.h>
+#include <eb32tree.h>
#include <types/task.h>
diff --git a/include/types/lb_chash.h b/include/types/lb_chash.h
index 3eee12c..5991ce9 100644
--- a/include/types/lb_chash.h
+++ b/include/types/lb_chash.h
@@ -23,8 +23,8 @@
#define _TYPES_LB_CHASH_H
#include <common/config.h>
-#include <common/ebtree.h>
-#include <common/eb32tree.h>
+#include <ebtree.h>
+#include <eb32tree.h>
struct lb_chash {
struct eb_root act; /* weighted chash entries of active servers */
diff --git a/include/types/lb_fwlc.h b/include/types/lb_fwlc.h
index cad4d13..170eb24 100644
--- a/include/types/lb_fwlc.h
+++ b/include/types/lb_fwlc.h
@@ -23,7 +23,7 @@
#define _TYPES_LB_FWLC_H
#include <common/config.h>
-#include <common/ebtree.h>
+#include <ebtree.h>
struct lb_fwlc {
struct eb_root act; /* weighted least conns on the active servers */
diff --git a/include/types/lb_fwrr.h b/include/types/lb_fwrr.h
index 600a511..731f055 100644
--- a/include/types/lb_fwrr.h
+++ b/include/types/lb_fwrr.h
@@ -23,7 +23,7 @@
#define _TYPES_LB_FWRR_H
#include <common/config.h>
-#include <common/ebtree.h>
+#include <ebtree.h>
/* This structure is used to apply fast weighted round robin on a server group */
struct fwrr_group {
diff --git a/include/types/protocols.h b/include/types/protocols.h
index 66c742b..c13c73d 100644
--- a/include/types/protocols.h
+++ b/include/types/protocols.h
@@ -28,8 +28,8 @@
#include <sys/un.h>
#include <common/config.h>
-#include <common/eb32tree.h>
#include <common/mini-clist.h>
+#include <eb32tree.h>
#include <types/counters.h>
#include <types/task.h>
diff --git a/include/types/proxy.h b/include/types/proxy.h
index ec00d74..8348f92 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -29,11 +29,11 @@
#include <common/appsession.h>
#include <common/config.h>
-#include <common/eb32tree.h>
#include <common/mini-clist.h>
#include <common/regex.h>
#include <common/sessionhash.h>
#include <common/tools.h>
+#include <eb32tree.h>
#include <types/acl.h>
#include <types/backend.h>
diff --git a/include/types/server.h b/include/types/server.h
index b3fe83d..935992d 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -26,8 +26,8 @@
#include <arpa/inet.h>
#include <common/config.h>
-#include <common/eb32tree.h>
#include <common/mini-clist.h>
+#include <eb32tree.h>
#include <types/buffers.h>
#include <types/counters.h>
diff --git a/include/types/task.h b/include/types/task.h
index 641cb17..41f889c 100644
--- a/include/types/task.h
+++ b/include/types/task.h
@@ -25,8 +25,8 @@
#include <sys/time.h>
#include <common/config.h>
-#include <common/eb32tree.h>
#include <common/mini-clist.h>
+#include <eb32tree.h>
/* values for task->state */
#define TASK_SLEEPING 0x00 /* task sleeping */
diff --git a/src/lb_chash.c b/src/lb_chash.c
index bfd4cd0..58c029a 100644
--- a/src/lb_chash.c
+++ b/src/lb_chash.c
@@ -19,7 +19,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/debug.h>
-#include <common/eb32tree.h>
+#include <eb32tree.h>
#include <types/global.h>
#include <types/server.h>
diff --git a/src/lb_fwlc.c b/src/lb_fwlc.c
index 5d1a31b..c2fcb4e 100644
--- a/src/lb_fwlc.c
+++ b/src/lb_fwlc.c
@@ -13,7 +13,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/debug.h>
-#include <common/eb32tree.h>
+#include <eb32tree.h>
#include <types/global.h>
#include <types/server.h>
diff --git a/src/lb_fwrr.c b/src/lb_fwrr.c
index 84d179d..d92b6eb 100644
--- a/src/lb_fwrr.c
+++ b/src/lb_fwrr.c
@@ -13,7 +13,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/debug.h>
-#include <common/eb32tree.h>
+#include <eb32tree.h>
#include <types/global.h>
#include <types/server.h>
diff --git a/src/lb_map.c b/src/lb_map.c
index 2918c26..d3264bb 100644
--- a/src/lb_map.c
+++ b/src/lb_map.c
@@ -13,7 +13,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/debug.h>
-#include <common/eb32tree.h>
+#include <eb32tree.h>
#include <types/global.h>
#include <types/server.h>
diff --git a/src/standard.c b/src/standard.c
index 6b0be2d..6a8724a 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -20,8 +20,8 @@
#include <arpa/inet.h>
#include <common/config.h>
-#include <common/eb32tree.h>
#include <common/standard.h>
+#include <eb32tree.h>
#include <proto/log.h>
/* enough to store 10 integers of :
diff --git a/src/task.c b/src/task.c
index cc455f5..9b21fd9 100644
--- a/src/task.c
+++ b/src/task.c
@@ -13,11 +13,11 @@
#include <string.h>
#include <common/config.h>
-#include <common/eb32tree.h>
#include <common/memory.h>
#include <common/mini-clist.h>
#include <common/standard.h>
#include <common/time.h>
+#include <eb32tree.h>
#include <proto/proxy.h>
#include <proto/session.h>