You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by as...@apache.org on 2020/08/28 12:47:10 UTC
[mesos] 02/05: Added RE2 to the automake build.
This is an automated email from the ASF dual-hosted git repository.
asekretenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit afe493e73a2b954d1b2dba3d4c5f6b08b9cb0b1b
Author: Andrei Sekretenko <as...@apache.org>
AuthorDate: Mon Aug 17 15:54:43 2020 +0200
Added RE2 to the automake build.
This is a prerequisite to implementing regex-based offer constaints.
Review: https://reviews.apache.org/r/72783
---
3rdparty/Makefile.am | 20 ++++++++++++
3rdparty/versions.am | 1 +
configure.ac | 50 ++++++++++++++++++++++++++++++
src/Makefile.am | 11 +++++++
src/python/native_common/ext_modules.py.in | 9 ++++++
5 files changed, 91 insertions(+)
diff --git a/3rdparty/Makefile.am b/3rdparty/Makefile.am
index c277627..23f49ec 100644
--- a/3rdparty/Makefile.am
+++ b/3rdparty/Makefile.am
@@ -71,6 +71,7 @@ PIP = pip-$(PIP_VERSION)
PICOJSON = picojson-$(PICOJSON_VERSION)
PROTOBUF = protobuf-$(PROTOBUF_VERSION)
RAPIDJSON = rapidjson-$(RAPIDJSON_VERSION)
+RE2 = re2-$(RE2_VERSION)
SETUPTOOLS = setuptools-$(SETUPTOOLS_VERSION)
WHEEL = wheel-$(WHEEL_VERSION)
ZOOKEEPER = zookeeper-$(ZOOKEEPER_VERSION)
@@ -97,6 +98,7 @@ EXTRA_DIST = \
$(PROTOBUF).tar.gz \
$(PICOJSON).tar.gz \
$(RAPIDJSON).tar.gz \
+ $(RE2).tar.gz \
$(SETUPTOOLS).tar.gz \
$(WHEEL).tar.gz \
$(ZOOKEEPER).tar.gz
@@ -167,6 +169,7 @@ CLEAN_EXTRACTED = \
$(PICOJSON) \
$(PROTOBUF) \
$(RAPIDJSON) \
+ $(RE2) \
$(SETUPTOOLS) \
$(WHEEL) \
$(ZOOKEEPER)
@@ -619,6 +622,19 @@ $(LEVELDB)/out-static/libleveldb.a: $(LEVELDB)-stamp
ALL_LOCAL += $(LEVELDB)/out-static/libleveldb.a
endif
+if WITH_BUNDLED_RE2
+LIB_RE2 = $(RE2)/obj/libre2.a
+
+$(LIB_RE2): $(RE2)-build-stamp
+
+$(RE2)-build-stamp: $(RE2)-stamp
+ cd $(RE2) && $(MAKE) $(AM_MAKEFLAGS) CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS) -fPIC"
+ touch $@
+
+ALL_LOCAL += $(LIB_RE2)
+endif
+
+
if WITH_BUNDLED_ZOOKEEPER
$(ZOOKEEPER)/src/c/libzookeeper_mt.la: $(ZOOKEEPER)-stamp
cd $(ZOOKEEPER)/src/c && ./configure $(CONFIGURE_ARGS) && \
@@ -697,6 +713,10 @@ if WITH_BUNDLED_RAPIDJSON
rm -rf $(INSTALLDIR)/include/rapidjson
cp -fpR $(RAPIDJSON)/include/rapidjson $(INSTALLDIR)/include/
endif
+if WITH_BUNDLED_RE2
+ cd $(RE2) && \
+ $(MAKE) $(AM_MAKEFLAGS) DESTDIR=$(INSTALLDIR) install
+endif
if WITH_BUNDLED_ZOOKEEPER
cd $(ZOOKEEPER)/src/c && \
$(MAKE) $(AM_MAKEFLAGS) DESTDIR=$(INSTALLDIR) install
diff --git a/3rdparty/versions.am b/3rdparty/versions.am
index 6f6195d..5b90be8 100644
--- a/3rdparty/versions.am
+++ b/3rdparty/versions.am
@@ -40,6 +40,7 @@ PICOJSON_VERSION = 1.3.0
PIP_VERSION = 7.1.2
PROTOBUF_VERSION = 3.5.0
RAPIDJSON_VERSION = 1.1.0
+RE2_VERSION = 2020-07-06
SETUPTOOLS_VERSION = 20.9.0
WHEEL_VERSION = 0.24.0
ZOOKEEPER_VERSION = 3.4.8
diff --git a/configure.ac b/configure.ac
index a049945..b19440a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -528,6 +528,13 @@ AC_ARG_WITH([rapidjson],
location prefixed by the given path]),
[without_bundled_rapidjson=yes], [])
+AC_ARG_WITH([re2],
+ AS_HELP_STRING([--with-re2@<:@=DIR@:>@],
+ [excludes building and using the bundled re2
+ package in lieu of an installed version at a
+ location prefixed by the given path]),
+ [without_bundled_re2=yes], [])
+
AC_ARG_WITH([protobuf],
AS_HELP_STRING([--with-protobuf@<:@=DIR@:>@],
[excludes building and using the bundled protobuf
@@ -2019,6 +2026,49 @@ fi
AM_CONDITIONAL([WITH_BUNDLED_RAPIDJSON], [test "x$with_bundled_rapidjson" = "xyes"])
+# Check if re2 prefix path was supplied and if so, add it to CPPFLAGS
+# while extending it by /include and to LDFLAGS while extending it by
+# /lib.
+if test -n "`echo $with_re2`"; then
+ CPPFLAGS="$CPPFLAGS -I${with_re2}/include"
+ LDFLAGS="$LDFLAGS -L${with_re2}/lib"
+fi
+
+# Check if user has asked us to use a preinstalled re2, or if they
+# asked us to ignore all bundled libraries while compiling and
+# linking.
+if test "x$without_bundled_re2" = "xyes" || \
+ test "x$enable_bundled" != "xyes"; then
+ # Check if headers and library were located.
+ AC_CHECK_HEADERS([re2/re2.h],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([#include <re2/re2.h>], [])],
+ [TEST_LIBS="$TEST_LIBS -lre2"] [found_re2=yes],
+ [AC_MSG_WARN([re2 is not installed.])])])
+
+ if test "x$found_re2" = "xyes"; then
+ with_bundled_re2=no
+ else
+ AC_MSG_ERROR([cannot find re2
+-------------------------------------------------------------------
+You have requested the use of a non-bundled re2 but no suitable
+re2 could be found.
+
+You may want specify the location of re2 by providing a prefix
+path via --with-re2=DIR, or check that the path you provided is
+correct if you're already doing this.
+-------------------------------------------------------------------
+])
+ fi
+else
+ with_bundled_re2=yes
+fi
+
+AM_CONDITIONAL([WITH_BUNDLED_RE2],
+ [test "x$with_bundled_re2" = "xyes"])
+
+
+
# Check if Sasl2 prefix path was provided, and if so, add it to
# the CPPFLAGS and LDFLAGS with respective /include and /lib path
diff --git a/src/Makefile.am b/src/Makefile.am
index 8b95611..1043c7b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -44,6 +44,7 @@ PICOJSON = 3rdparty/picojson-$(PICOJSON_VERSION)
PIP = 3rdparty/pip-$(PIP_VERSION)
PROTOBUF = 3rdparty/protobuf-$(PROTOBUF_VERSION)
RAPIDJSON = 3rdparty/rapidjson-$(RAPIDJSON_VERSION)
+RE2 = 3rdparty/re2-$(RE2_VERSION)
SETUPTOOLS = 3rdparty/setuptools-$(SETUPTOOLS_VERSION)
STOUT = 3rdparty/stout
WHEEL = 3rdparty/wheel-$(WHEEL_VERSION)
@@ -265,6 +266,15 @@ if WITH_BUNDLED_RAPIDJSON
MESOS_CPPFLAGS += -I../$(RAPIDJSON)/include
endif
+if WITH_BUNDLED_RE2
+MESOS_CPPFLAGS += -I../$(RE2)
+LIB_RE2 = ../$(RE2)/obj/libre2.a
+else
+LIB_RE2 = -lre2
+LDADD += -lre2
+endif
+
+
if WITH_BUNDLED_STOUT
MESOS_CPPFLAGS += -I$(top_srcdir)/$(STOUT)/include
endif
@@ -1745,6 +1755,7 @@ libmesos_la_LIBADD = \
$(LIB_PROCESS) \
$(LIB_PROTOBUF) \
$(LIB_LIBSECCOMP) \
+ $(LIB_RE2) \
$(LIB_ZOOKEEPER) \
-lsvn_subr-1 \
-lsvn_delta-1 \
diff --git a/src/python/native_common/ext_modules.py.in b/src/python/native_common/ext_modules.py.in
index 38e6717..62e32a6 100644
--- a/src/python/native_common/ext_modules.py.in
+++ b/src/python/native_common/ext_modules.py.in
@@ -115,6 +115,8 @@ def _create_module(module_name):
gperftools = os.path.join('3rdparty', 'gperftools-2.5')
protobuf = os.path.join('3rdparty', 'protobuf-3.5.0')
+ re2 = os.path.join('3rdparty', 're2-2020-07-06')
+
# Build the list of source files. Note that each source must be
# relative to our current directory (where this script lives).
SOURCES = [
@@ -169,6 +171,13 @@ def _create_module(module_name):
'-lprotobuf'
)
+ EXTRA_OBJECTS += _cond_extra_object(
+ "@WITH_BUNDLED_RE2_TRUE@",
+ "@WITH_BUNDLED_RE2_FALSE@",
+ os.path.join(abs_top_builddir, re2, 'obj', 'libre2.a'),
+ '-lre2'
+ )
+
if '@ENABLE_SECCOMP_ISOLATOR_TRUE@' == '':
libseccomp = os.path.join('3rdparty', 'libseccomp-2.3.3')
libseccomp = os.path.join(