You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2018/07/25 03:24:19 UTC

[03/10] mesos git commit: Added rapidjson to the mesos build.

Added rapidjson to the mesos build.

This includes a stripped bundle of the latest release. Stripping
is required for licensing (see rapidjson.md), but also helps reduce
the bloat in the mesos git repo.

Also included is a readme for how to update the dependency.

Review: https://reviews.apache.org/r/67987


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/135545f3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/135545f3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/135545f3

Branch: refs/heads/master
Commit: 135545f3a5bc492971a284edf019c5a854806de0
Parents: 5d6948e
Author: Benjamin Mahler <bm...@apache.org>
Authored: Thu Jul 19 14:32:32 2018 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Tue Jul 24 17:25:43 2018 -0700

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt         |  22 ++++++++++++++
 3rdparty/Makefile.am            |  57 +++++++++++++++++++++++++++++++++++
 3rdparty/README.md              |   1 +
 3rdparty/cmake/Versions.cmake   |   2 ++
 3rdparty/rapidjson-1.1.0.tar.gz | Bin 0 -> 114867 bytes
 3rdparty/rapidjson.md           |  37 +++++++++++++++++++++++
 3rdparty/versions.am            |   1 +
 configure.ac                    |  40 ++++++++++++++++++++++++
 src/Makefile.am                 |   5 +++
 9 files changed, 165 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/135545f3/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index b58996d..4f2d7f8 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -39,6 +39,7 @@ set(LEVELDB_URL         ${FETCH_URL}/leveldb-${LEVELDB_VERSION}.tar.gz)
 set(LIBARCHIVE_URL      ${FETCH_URL}/libarchive-${LIBARCHIVE_VERSION}.tar.gz)
 set(LIBEV_URL           ${FETCH_URL}/libev-${LIBEV_VERSION}.tar.gz)
 set(NVML_URL            ${FETCH_URL}/nvml-${NVML_VERSION}.tar.gz)
+set(RAPIDJSON_URL       ${FETCH_URL}/rapidjson-${RAPIDJSON_VERSION}.tar.gz)
 set(XZ_URL              ${FETCH_URL}/xz-${XZ_VERSION}-modified.tar.gz)
 set(ZOOKEEPER_URL       ${FETCH_URL}/zookeeper-${ZOOKEEPER_VERSION}.tar.gz)
 
@@ -432,6 +433,27 @@ ExternalProject_Add(
   URL_HASH          ${PICOJSON_HASH})
 
 
+# RapidJSON: JSON parser / serializer.
+# https://github.com/Tencent/rapidjson
+#####################################
+EXTERNAL(rapidjson ${RAPIDJSON_VERSION} ${CMAKE_CURRENT_BINARY_DIR})
+add_library(rapidjson INTERFACE)
+add_dependencies(rapidjson ${RAPIDJSON_TARGET})
+
+target_include_directories(
+    rapidjson INTERFACE
+    ${RAPIDJSON_ROOT}/rapidjson-${RAPIDJSON_VERSION}/include)
+
+ExternalProject_Add(
+  ${RAPIDJSON_TARGET}
+  PREFIX            ${RAPIDJSON_CMAKE_ROOT}
+  CONFIGURE_COMMAND ${CMAKE_NOOP}
+  BUILD_COMMAND     ${CMAKE_NOOP}
+  INSTALL_COMMAND   ${CMAKE_NOOP}
+  URL               ${RAPIDJSON_URL}
+  URL_HASH          ${RAPIDJSON_HASH})
+
+
 # NVML: NVIDIA Management Library.
 # https://developer.nvidia.com/nvidia-management-library-nvml
 #############################################################

http://git-wip-us.apache.org/repos/asf/mesos/blob/135545f3/3rdparty/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/Makefile.am b/3rdparty/Makefile.am
index 0c75453..b2cbf58 100644
--- a/3rdparty/Makefile.am
+++ b/3rdparty/Makefile.am
@@ -67,6 +67,7 @@ NVML = nvml-$(NVML_VERSION)
 PIP = pip-$(PIP_VERSION)
 PICOJSON = picojson-$(PICOJSON_VERSION)
 PROTOBUF = protobuf-$(PROTOBUF_VERSION)
+RAPIDJSON = rapidjson-$(RAPIDJSON_VERSION)
 SETUPTOOLS = setuptools-$(SETUPTOOLS_VERSION)
 WHEEL = wheel-$(WHEEL_VERSION)
 ZOOKEEPER = zookeeper-$(ZOOKEEPER_VERSION)
@@ -89,6 +90,7 @@ EXTRA_DIST =			\
   $(PIP).tar.gz			\
   $(PROTOBUF).tar.gz		\
   $(PICOJSON).tar.gz		\
+  $(RAPIDJSON).tar.gz		\
   $(SETUPTOOLS).tar.gz		\
   $(WHEEL).tar.gz		\
   $(ZOOKEEPER).tar.gz
@@ -129,6 +131,7 @@ CLEAN_EXTRACTED =		\
   $(PIP)			\
   $(PICOJSON)			\
   $(PROTOBUF)			\
+  $(RAPIDJSON)			\
   $(SETUPTOOLS)			\
   $(WHEEL)			\
   $(ZOOKEEPER)
@@ -318,6 +321,53 @@ $(PICOJSON)/picojson.h: $(PICOJSON)-stamp
 ALL_LOCAL += $(PICOJSON)-stamp
 endif
 
+if WITH_BUNDLED_RAPIDJSON
+# Stout depends on rapidjson. Install rapidjson into $PREFIX/include
+# but don't add it to the source tarball.
+rapidjsondir = $(includedir)/rapidjson
+
+nodist_rapidjson_HEADERS =				\
+  $(RAPIDJSON)/include/rapidjson/error/en.h		\
+  $(RAPIDJSON)/include/rapidjson/error/error.h		\
+  $(RAPIDJSON)/include/rapidjson/internal/biginteger.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/diyfp.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/dtoa.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/ieee754.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/itoa.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/meta.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/pow10.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/regex.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/stack.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/strfunc.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/strtod.h	\
+  $(RAPIDJSON)/include/rapidjson/internal/swap.h	\
+  $(RAPIDJSON)/include/rapidjson/msinttypes/inttypes.h	\
+  $(RAPIDJSON)/include/rapidjson/msinttypes/stdint.h	\
+  $(RAPIDJSON)/include/rapidjson/allocators.h		\
+  $(RAPIDJSON)/include/rapidjson/cursorstreamwrapper.h	\
+  $(RAPIDJSON)/include/rapidjson/document.h		\
+  $(RAPIDJSON)/include/rapidjson/encodedstream.h	\
+  $(RAPIDJSON)/include/rapidjson/encodings.h		\
+  $(RAPIDJSON)/include/rapidjson/filereadstream.h	\
+  $(RAPIDJSON)/include/rapidjson/filewritestream.h	\
+  $(RAPIDJSON)/include/rapidjson/fwd.h			\
+  $(RAPIDJSON)/include/rapidjson/istreamwrapper.h	\
+  $(RAPIDJSON)/include/rapidjson/memorybuffer.h		\
+  $(RAPIDJSON)/include/rapidjson/memorystream.h		\
+  $(RAPIDJSON)/include/rapidjson/ostreamwrapper.h	\
+  $(RAPIDJSON)/include/rapidjson/pointer.h		\
+  $(RAPIDJSON)/include/rapidjson/prettywriter.h		\
+  $(RAPIDJSON)/include/rapidjson/rapidjson.h		\
+  $(RAPIDJSON)/include/rapidjson/reader.h		\
+  $(RAPIDJSON)/include/rapidjson/schema.h		\
+  $(RAPIDJSON)/include/rapidjson/stream.h		\
+  $(RAPIDJSON)/include/rapidjson/stringbuffer.h		\
+  $(RAPIDJSON)/include/rapidjson/writer.h
+
+$(nodist_rapidjson_HEADERS): $(RAPIDJSON)-stamp
+
+ALL_LOCAL += $(RAPIDJSON)-stamp
+endif
 
 if WITH_BUNDLED_PROTOBUF
 $(PROTOBUF)/src/protoc $(PROTOBUF)/src/libprotobuf.la: $(PROTOBUF)-build-stamp
@@ -501,6 +551,13 @@ if WITH_BUNDLED_PROTOBUF
 	cd $(PROTOBUF) && \
 	  $(MAKE) $(AM_MAKEFLAGS) DESTDIR=$(INSTALLDIR) install
 endif
+if WITH_BUNDLED_RAPIDJSON
+# TODO(bmahler): Rapidjson has a cmake build, can we just cmake install
+# instead of copying?
+	@test -d $(INSTALLDIR)/include/rapidjson || \
+	  rm -rf $(INSTALLDIR)/include/rapidjson
+	cp -fpR $(RAPIDJSON)/include/rapidjson $(INSTALLDIR)/include/
+endif
 if WITH_BUNDLED_ZOOKEEPER
 	cd $(ZOOKEEPER)/src/c && \
 	  $(MAKE) $(AM_MAKEFLAGS) DESTDIR=$(INSTALLDIR) install

http://git-wip-us.apache.org/repos/asf/mesos/blob/135545f3/3rdparty/README.md
----------------------------------------------------------------------
diff --git a/3rdparty/README.md b/3rdparty/README.md
index fa9a648..a6741c3 100644
--- a/3rdparty/README.md
+++ b/3rdparty/README.md
@@ -19,6 +19,7 @@ This directory contains bundled packages within the Mesos repository.
   - picojson
   - pip
   - [protobuf](protobuf.md)
+  - [rapidjson](rapidjson.md)
   - setuptools
   - wheel
   - zookeeper

http://git-wip-us.apache.org/repos/asf/mesos/blob/135545f3/3rdparty/cmake/Versions.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
index 0a897d8..849b72d 100644
--- a/3rdparty/cmake/Versions.cmake
+++ b/3rdparty/cmake/Versions.cmake
@@ -31,6 +31,8 @@ set(PICOJSON_VERSION        "1.3.0")
 set(PICOJSON_HASH           "SHA256=056805CA2691798F5545935A14BB477F2E1D827C9FB862E6E449DBEA22801C7D")
 set(PROTOBUF_VERSION        "3.5.0")
 set(PROTOBUF_HASH           "SHA256=F046682F05C39605E1687DC37E2E0EEBCEB8298CA1B046D64EE00AE124924EBC")
+set(RAPIDJSON_VERSION       "1.1.0")
+set(RAPIDJSON_HASH          "SHA256=CF60F30E3D760142D8D3F876714FC9712B17038270678878CFA222E6B62C0BF5")
 set(LIBARCHIVE_VERSION      "3.3.2")
 set(LIBARCHIVE_HASH         "SHA256=ed2dbd6954792b2c054ccf8ec4b330a54b85904a80cef477a1c74643ddafa0ce")
 set(BZIP2_VERSION           "1.0.6")

http://git-wip-us.apache.org/repos/asf/mesos/blob/135545f3/3rdparty/rapidjson-1.1.0.tar.gz
----------------------------------------------------------------------
diff --git a/3rdparty/rapidjson-1.1.0.tar.gz b/3rdparty/rapidjson-1.1.0.tar.gz
new file mode 100644
index 0000000..73d85d2
Binary files /dev/null and b/3rdparty/rapidjson-1.1.0.tar.gz differ

http://git-wip-us.apache.org/repos/asf/mesos/blob/135545f3/3rdparty/rapidjson.md
----------------------------------------------------------------------
diff --git a/3rdparty/rapidjson.md b/3rdparty/rapidjson.md
new file mode 100644
index 0000000..ddf306c
--- /dev/null
+++ b/3rdparty/rapidjson.md
@@ -0,0 +1,37 @@
+# rapidjson
+
+Found here:
+https://github.com/Tencent/rapidjson
+
+## License Notes
+rapidjson has an MIT license but includes a binary that has the JSON license which cannot be included in Apache products:
+
+https://www.apache.org/legal/resolved.html#json
+
+Therefore we must strip content from the release.
+
+## How to upgrade
+
+Be sure to strip the release in order to comply with the licensing
+requirements noted above, as well as to lower the size impact on
+the mesos git repository:
+
+```
+# Download the latest release, e.g.:
+$ curl --location https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz -o rapidjson-1.1.0.tar.gz
+
+# Extract, strip everything but the license and include
+# folder, and re-bundle.
+$ tar -zxvf rapidjson-1.1.0.tar.gz
+$ mkdir -p stripped-rapidjson/rapidjson-1.1.0
+$ mv rapidjson-1.1.0/license.txt stripped-rapidjson/rapidjson-1.1.0
+$ mv rapidjson-1.1.0/include stripped-rapidjson/rapidjson-1.1.0
+$ tar -zcvf rapidjson-1.1.0.tar.gz stripped-rapidjson/rapidjson-1.1.0
+
+# Place it into 3rdparty.
+# Update 3rdparty/versions.am with the new version.
+# Update 3rdparty/cmake/Versions.cmake with the new version and
+# its SHA-256 hash. You can obtain the hash as follows, make sure
+# to do this on the stripped release:
+$ openssl sha -sha256 3rdparty/rapidjson-1.1.0.tar.gz
+```

http://git-wip-us.apache.org/repos/asf/mesos/blob/135545f3/3rdparty/versions.am
----------------------------------------------------------------------
diff --git a/3rdparty/versions.am b/3rdparty/versions.am
index 5779280..8fd8bd4 100644
--- a/3rdparty/versions.am
+++ b/3rdparty/versions.am
@@ -36,6 +36,7 @@ NVML_VERSION = 352.79
 PICOJSON_VERSION = 1.3.0
 PIP_VERSION = 7.1.2
 PROTOBUF_VERSION = 3.5.0
+RAPIDJSON_VERSION = 1.1.0
 SETUPTOOLS_VERSION = 20.9.0
 WHEEL_VERSION = 0.24.0
 ZOOKEEPER_VERSION = 3.4.8

http://git-wip-us.apache.org/repos/asf/mesos/blob/135545f3/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index e86c496..58003b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -498,6 +498,13 @@ AC_ARG_WITH([picojson],
                            location prefixed by the given path]),
             [without_bundled_picojson=yes], [])
 
+AC_ARG_WITH([rapidjson],
+            AS_HELP_STRING([--with-rapidjson@<:@=DIR@:>@],
+                           [excludes building and using the bundled rapidjson
+                           package in lieu of an installed version at a
+                           location prefixed by the given path]),
+            [without_bundled_rapidjson=yes], [])
+
 AC_ARG_WITH([protobuf],
             AS_HELP_STRING([--with-protobuf@<:@=DIR@:>@],
                            [excludes building and using the bundled protobuf
@@ -1834,6 +1841,39 @@ fi
 AM_CONDITIONAL([WITH_BUNDLED_PICOJSON], [test "x$with_bundled_picojson" = "xyes"])
 
 
+if test -n "`echo $with_rapidjson`"; then
+  CPPFLAGS="$CPPFLAGS -I${with_rapidjson}/include"
+fi
+
+# Check if user has asked us to use a preinstalled rapidjson, or if
+# they asked us to ignore all bundled libraries while compiling and
+# linking.
+if test "x$without_bundled_rapidjson" = "xyes" || \
+   test "x$enable_bundled" != "xyes"; then
+  # Check if headers and library were located.
+  AC_CHECK_HEADERS([rapidjson/rapidjson.h], [found_rapidjson=yes])
+
+  if test "x$found_rapidjson" = "xyes"; then
+    with_bundled_rapidjson=no
+  else
+    AC_MSG_ERROR([cannot find rapidjson
+-------------------------------------------------------------------
+You have requested the use of a non-bundled rapidjson but no suitable
+rapidjson could be found.
+
+You may want specify the location of rapidjson by providing a prefix
+path via --with-rapidjson=DIR, or check that the path you provided is
+correct if you're already doing this.
+-------------------------------------------------------------------
+])
+  fi
+else
+  with_bundled_rapidjson=yes
+fi
+
+AM_CONDITIONAL([WITH_BUNDLED_RAPIDJSON], [test "x$with_bundled_rapidjson" = "xyes"])
+
+
 # Check if Sasl2 prefix path was provided, and if so, add it to
 # the CPPFLAGS and LDFLAGS with respective /include and /lib path
 # suffixes.

http://git-wip-us.apache.org/repos/asf/mesos/blob/135545f3/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index ecb95ef..71f9052 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,6 +41,7 @@ NVML = 3rdparty/nvml-$(NVML_VERSION)
 PICOJSON = 3rdparty/picojson-$(PICOJSON_VERSION)
 PIP = 3rdparty/pip-$(PIP_VERSION)
 PROTOBUF = 3rdparty/protobuf-$(PROTOBUF_VERSION)
+RAPIDJSON = 3rdparty/rapidjson-$(RAPIDJSON_VERSION)
 SETUPTOOLS = 3rdparty/setuptools-$(SETUPTOOLS_VERSION)
 STOUT = 3rdparty/stout
 WHEEL = 3rdparty/wheel-$(WHEEL_VERSION)
@@ -244,6 +245,10 @@ LDADD += -lprotobuf
 PROTOC = @PROTOCOMPILER@
 endif
 
+if WITH_BUNDLED_RAPIDJSON
+MESOS_CPPFLAGS += -I../$(RAPIDJSON)/include
+endif
+
 if WITH_BUNDLED_STOUT
 MESOS_CPPFLAGS += -I$(top_srcdir)/$(STOUT)/include
 endif