From b89190535a3df772798d8a452681be78196001ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Wed, 13 Dec 2017 16:52:21 +0100 Subject: [PATCH] Add upstream patch for adding size_t json_c_object_sizeof() Enable partial multi-threaded support --- ...-c-0.13_Makefile_add_aclocal_amflags.patch | 20 ++++++++ ...ct_add_size_t_json_c_object_sizeof_1.patch | 42 +++++++++++++++ ...ct_add_size_t_json_c_object_sizeof_2.patch | 51 +++++++++++++++++++ json-c.spec | 30 +++++++---- 4 files changed, 132 insertions(+), 11 deletions(-) create mode 100644 json-c-0.13_Makefile_add_aclocal_amflags.patch create mode 100644 json-c-0.13_json_object_add_size_t_json_c_object_sizeof_1.patch create mode 100644 json-c-0.13_json_object_add_size_t_json_c_object_sizeof_2.patch diff --git a/json-c-0.13_Makefile_add_aclocal_amflags.patch b/json-c-0.13_Makefile_add_aclocal_amflags.patch new file mode 100644 index 0000000..41d78e5 --- /dev/null +++ b/json-c-0.13_Makefile_add_aclocal_amflags.patch @@ -0,0 +1,20 @@ +From 87556afe2a062c28bccd910ec5bc22b9988726e7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Sun, 10 Dec 2017 16:29:41 +0100 +Subject: [PATCH] Makefile: Add ACLOCAL_AMFLAGS + +This is recommended by the libtool manual. +--- + Makefile.am | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index 5ad354a4a3..a0a43fc8bc 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,3 +1,5 @@ ++ACLOCAL_AMFLAGS = -I autoconf-archive/m4 ++ + EXTRA_DIST = README.md README.html + EXTRA_DIST += config.h.win32 + EXTRA_DIST += Doxyfile diff --git a/json-c-0.13_json_object_add_size_t_json_c_object_sizeof_1.patch b/json-c-0.13_json_object_add_size_t_json_c_object_sizeof_1.patch new file mode 100644 index 0000000..157abe3 --- /dev/null +++ b/json-c-0.13_json_object_add_size_t_json_c_object_sizeof_1.patch @@ -0,0 +1,42 @@ +From c123a1c21b944b3391fe022263ebfcdc15e5c5d1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Mon, 11 Dec 2017 12:55:40 +0100 +Subject: [PATCH] json_object: Add size_t json_object_sizeof() + +--- + json_object.c | 5 +++++ + json_object.h | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/json_object.c b/json_object.c +index 9daa6fdb0a..f12d8f08d8 100644 +--- a/json_object.c ++++ b/json_object.c +@@ -509,6 +509,11 @@ int json_object_object_length(const struct json_object *jso) + return lh_table_length(jso->o.c_object); + } + ++size_t json_object_sizeof(void) ++{ ++ return sizeof(struct json_object); ++} ++ + struct json_object* json_object_object_get(const struct json_object* jso, + const char *key) + { +diff --git a/json_object.h b/json_object.h +index 283eb95300..6a2751d228 100644 +--- a/json_object.h ++++ b/json_object.h +@@ -392,6 +392,11 @@ JSON_EXPORT struct lh_table* json_object_get_object(const struct json_object *ob + */ + JSON_EXPORT int json_object_object_length(const struct json_object* obj); + ++/** Get the sizeof (struct json_object). ++ * @returns a size_t with the sizeof (struct json_object) ++ */ ++JSON_EXPORT size_t json_object_sizeof(void); ++ + /** Add an object field to a json_object of type json_type_object + * + * The reference count will *not* be incremented. This is to make adding diff --git a/json-c-0.13_json_object_add_size_t_json_c_object_sizeof_2.patch b/json-c-0.13_json_object_add_size_t_json_c_object_sizeof_2.patch new file mode 100644 index 0000000..66c9f91 --- /dev/null +++ b/json-c-0.13_json_object_add_size_t_json_c_object_sizeof_2.patch @@ -0,0 +1,51 @@ +From 5b6d62259afbc1709d4437b8c488de429079cae0 Mon Sep 17 00:00:00 2001 +From: Eric Haszlakiewicz +Date: Tue, 12 Dec 2017 18:26:51 -0500 +Subject: [PATCH] Apply gcc's "const" attribute to the json_c_object_sizeof() + function as an optimizer hint. Also, rename that function from + json_object_sizeof(). + +--- + json_object.c | 2 +- + json_object.h | 8 +++++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/json_object.c b/json_object.c +index f12d8f08d8..042477a71b 100644 +--- a/json_object.c ++++ b/json_object.c +@@ -509,7 +509,7 @@ int json_object_object_length(const struct json_object *jso) + return lh_table_length(jso->o.c_object); + } + +-size_t json_object_sizeof(void) ++size_t json_c_object_sizeof(void) + { + return sizeof(struct json_object); + } +diff --git a/json_object.h b/json_object.h +index 6a2751d228..758efa6f1d 100644 +--- a/json_object.h ++++ b/json_object.h +@@ -27,6 +27,12 @@ + #define THIS_FUNCTION_IS_DEPRECATED(func) func + #endif + ++#ifdef __GNUC__ ++#define JSON_C_CONST_FUNCTION(func) func __attribute__((const)) ++#else ++#define CONST_FUNCTION(func) func ++#endif ++ + #if defined(_MSC_VER) + #define JSON_EXPORT __declspec(dllexport) + #else +@@ -395,7 +401,7 @@ JSON_EXPORT int json_object_object_length(const struct json_object* obj); + /** Get the sizeof (struct json_object). + * @returns a size_t with the sizeof (struct json_object) + */ +-JSON_EXPORT size_t json_object_sizeof(void); ++JSON_C_CONST_FUNCTION(JSON_EXPORT size_t json_c_object_sizeof(void)); + + /** Add an object field to a json_object of type json_type_object + * diff --git a/json-c.spec b/json-c.spec index 8f89505..8f8411e 100644 --- a/json-c.spec +++ b/json-c.spec @@ -1,4 +1,7 @@ +%{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} + %global so_ver 3 +%global reldate 20171207 # Uncomment when building a bootstrap for a bumped so-name. # You also need to adjust the parameters below. @@ -10,24 +13,24 @@ %global so_ver_old 2 %endif -%global reldate 20171207 -%{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} - Name: json-c Version: 0.13 -Release: 2%{?dist} +Release: 3%{?dist} Summary: JSON implementation in C License: MIT URL: https://github.com/%{name}/%{name} Source0: %{url}/archive/%{name}-%{version}-%{reldate}.tar.gz %if 0%{?bootstrap} -Source1: %{url}/archive/%{name}-%{version_old}-%{reldate_old}.tar.gz +Source1: %{url}/archive/%{name}-%{version_old}-%{reldate_old}.tar.gz %endif -BuildRequires: autoconf -BuildRequires: automake +# Upstreamed. +Patch0: %{url}/pull/386.patch#/%{name}-0.13_Makefile_add_aclocal_amflags.patch +Patch1: %{url}/commit/94fd101601c24627ae44498a7a73e9f2d9fb6e91.patch#/%{name}-0.13_json_object_add_size_t_json_c_object_sizeof_1.patch +Patch2: %{url}/commit/5b6d62259afbc1709d4437b8c488de429079cae0.patch#/%{name}-0.13_json_object_add_size_t_json_c_object_sizeof_2.patch + BuildRequires: libtool %description @@ -68,7 +71,6 @@ for doc in ChangeLog; do %{__mv} -f ${doc}.new ${doc} done -%{_bindir}/echo -e '\nACLOCAL_AMFLAGS = -I autoconf-archive/m4' >> Makefile.am %{_bindir}/autoreconf -fiv %if 0%{?bootstrap} @@ -85,8 +87,10 @@ popd %configure \ --disable-silent-rules \ --disable-static \ + --enable-rdrand \ --enable-shared \ - --enable-rdrand + --enable-threading + %make_build %{_bindir}/doxygen Doxyfile @@ -97,8 +101,8 @@ pushd bootstrap_ver --disable-rpath \ --disable-silent-rules \ --disable-static \ - --enable-shared \ - --enable-rdrand + --enable-rdrand \ + --enable-shared %make_build popd %endif @@ -171,6 +175,10 @@ end %changelog +* Wed Dec 13 2017 Björn Esser - 0.13-3 +- Add upstream patch for adding size_t json_c_object_sizeof() +- Enable partial multi-threaded support + * Mon Dec 11 2017 Björn Esser - 0.13-2 - Drop json_object_private.h