changeset 5537:15ad3e21dc17

Add build rule for RapidJSON. * src/rapidjson.mk: New file. * src/rapidjson-1-prettywriter.patch: Cherry-pick patches from upstream. * dist-files.mk: Add new files to list. * index.html: Add new package to list. * src/default-octave.mk: Add dependency to rapidjson.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 17 Sep 2020 17:44:16 +0200
parents f7f10f198735
children 434de7d10cba
files dist-files.mk index.html src/default-octave.mk src/rapidjson-1-prettywriter.patch src/rapidjson.mk
diffstat 5 files changed, 92 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Wed Sep 16 11:34:15 2020 -0400
+++ b/dist-files.mk	Thu Sep 17 17:44:16 2020 +0200
@@ -626,6 +626,8 @@
   qwt.mk \
   qwtplot3d-1-fixes.patch \
   qwtplot3d.mk \
+  rapidjson-1-prettywriter.patch \
+  rapidjson.mk \
   readline-0-001.patch \
   readline-0-002.patch \
   readline-0-003.patch \
--- a/index.html	Wed Sep 16 11:34:15 2020 -0400
+++ b/index.html	Thu Sep 17 17:44:16 2020 +0200
@@ -2618,6 +2618,10 @@
         <td class="website"><a href="http://qwtplot3d.sourceforge.net/">QwtPlot3D</a></td>
     </tr>
     <tr>
+        <td class="package">rapidjson</td>
+        <td class="website"><a href="https://rapidjson.org/">RapidJSON</a></td>
+    </tr>
+    <tr>
         <td class="package">readline</td>
         <td class="website"><a href="http://tiswww.case.edu/php/chet/readline/rltop.html">Readline</a></td>
     </tr>
--- a/src/default-octave.mk	Wed Sep 16 11:34:15 2020 -0400
+++ b/src/default-octave.mk	Thu Sep 17 17:44:16 2020 +0200
@@ -21,7 +21,7 @@
 ifeq ($(USE_SYSTEM_FONTCONFIG),no)
   $(PKG)_FONTCONFIG := fontconfig
 endif
-$(PKG)_DEPS     := blas arpack curl epstool fftw fltk $($(PKG)_FONTCONFIG) ghostscript gl2ps glpk gnuplot graphicsmagick hdf5 lapack libsndfile pcre portaudio pstoedit qhull qrupdate qscintilla readline sundials-ida suitesparse texinfo zlib
+$(PKG)_DEPS     := blas arpack curl epstool fftw fltk $($(PKG)_FONTCONFIG) ghostscript gl2ps glpk gnuplot graphicsmagick hdf5 lapack libsndfile pcre portaudio pstoedit qhull qrupdate qscintilla rapidjson readline sundials-ida suitesparse texinfo zlib
 
 ifeq ($(ENABLE_QT5),yes)
     $(PKG)_DEPS += qt5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/rapidjson-1-prettywriter.patch	Thu Sep 17 17:44:16 2020 +0200
@@ -0,0 +1,56 @@
+From ac0fc79c76fc92783d2a5267082a1f8f9c28df22 Mon Sep 17 00:00:00 2001
+From: Gustav <sir.gustav.the.coder@gmail.com>
+Date: Mon, 18 May 2020 14:06:39 +0200
+Subject: [PATCH] Fixes issue #1718
+
+---
+ include/rapidjson/writer.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/rapidjson/writer.h b/include/rapidjson/writer.h
+index e7fb873a4..51dd86d58 100644
+--- a/include/rapidjson/writer.h
++++ b/include/rapidjson/writer.h
+@@ -283,6 +283,8 @@ class Writer {
+         os_->Flush();
+     }
+ 
++    static const size_t kDefaultLevelDepth = 32;
++
+ protected:
+     //! Information for each nested level
+     struct Level {
+@@ -291,8 +293,6 @@ class Writer {
+         bool inArray;       //!< true if in array, otherwise in object
+     };
+ 
+-    static const size_t kDefaultLevelDepth = 32;
+-
+     bool WriteNull()  {
+         PutReserve(*os_, 4);
+         PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'u'); PutUnsafe(*os_, 'l'); PutUnsafe(*os_, 'l'); return true;
+
+From d88be8ef1649eca4602348d1aab5c16c36f83d4f Mon Sep 17 00:00:00 2001
+From: Milo Yip <miloyip@gmail.com>
+Date: Mon, 27 Mar 2017 14:05:03 +0800
+Subject: [PATCH] Fix #905 unable to set writeFlags for PrettyWriter
+
+---
+ include/rapidjson/prettywriter.h   |  2 +-
+ test/unittest/prettywritertest.cpp | 43 ++++++++++++++++++++++++++++++
+ 2 files changed, 44 insertions(+), 1 deletion(-)
+
+diff --git a/include/rapidjson/prettywriter.h b/include/rapidjson/prettywriter.h
+index ef36a8c2a..98dfb3060 100644
+--- a/include/rapidjson/prettywriter.h
++++ b/include/rapidjson/prettywriter.h
+@@ -47,7 +47,7 @@ enum PrettyFormatOptions {
+ template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
+ class PrettyWriter : public Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags> {
+ public:
+-    typedef Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator> Base;
++    typedef Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags> Base;
+     typedef typename Base::Ch Ch;
+ 
+     //! Constructor
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/rapidjson.mk	Thu Sep 17 17:44:16 2020 +0200
@@ -0,0 +1,29 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG             := rapidjson
+$(PKG)_IGNORE   :=
+$(PKG)_VERSION  := 1.1.0
+$(PKG)_CHECKSUM := a3e0d043ad3c2d7638ffefa3beb30a77c71c869f
+$(PKG)_SUBDIR   := $(PKG)-$($(PKG)_VERSION)
+$(PKG)_FILE     := $($(PKG)_SUBDIR).tar.gz
+$(PKG)_URL      := https://github.com/Tencent/$(PKG)/archive/v$($(PKG)_VERSION).tar.gz
+$(PKG)_DEPS     :=
+
+define $(PKG)_UPDATE
+    $(WGET) -q -O- 'https://github.com/Tencent/$(PKG)/tags' | \
+    $(SED) -n 's|.*releases/tag/v\([^"]*\).*|\1|p' | $(SORT) -V | \
+    tail -1
+endef
+
+define $(PKG)_BUILD
+    mkdir '$(1).build'
+    cd '$(1).build' && \
+    cmake -DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' \
+          -DRAPIDJSON_BUILD_DOC=No \
+          -DRAPIDJSON_BUILD_EXAMPLES=No \
+          -DRAPIDJSON_BUILD_TESTS=No \
+          '$(1)'
+    $(MAKE) -C '$(1).build' -j '$(JOBS)' DESTDIR='$(3)' install
+endef
+