From 3c2fe6ef5c5abc40c364eb11bdbeeb1acde020d2 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Thu, 31 Jan 2013 16:46:11 +0400 Subject: jansson 2.4.99 --- jansson/Makefile | 29 ++ jansson/libjansson.p5m | 16 ++ jansson/libjansson4.p5m | 12 + jansson/patches/0000-2.5-dev-git-update.patch | 295 +++++++++++++++++++++ jansson/patches/0001-Do-not-play-with-GCC.patch | 61 +++++ jansson/patches/0002-Just-use-C99.patch | 53 ++++ .../patches/0003-Remove-check-exports-test.patch | 99 +++++++ 7 files changed, 565 insertions(+) create mode 100644 jansson/Makefile create mode 100644 jansson/libjansson.p5m create mode 100644 jansson/libjansson4.p5m create mode 100644 jansson/patches/0000-2.5-dev-git-update.patch create mode 100644 jansson/patches/0001-Do-not-play-with-GCC.patch create mode 100644 jansson/patches/0002-Just-use-C99.patch create mode 100644 jansson/patches/0003-Remove-check-exports-test.patch diff --git a/jansson/Makefile b/jansson/Makefile new file mode 100644 index 0000000..2d02e47 --- /dev/null +++ b/jansson/Makefile @@ -0,0 +1,29 @@ +package ?= ips + +include /usr/share/cibs/rules/$(package).mk +include /usr/share/cibs/rules/archive.mk +include /usr/share/cibs/rules/autotools.mk +include /usr/share/cibs/rules/autoreconf.mk +include /usr/share/cibs/rules/patch.mk +include /usr/share/cibs/rules/32.mk +include /usr/share/cibs/rules/64.mk + +summary := C library for encoding, decoding and manipulating JSON data +license := MIT +license-file := LICENSE + +home := http://www.digip.org/jansson/ +name := jansson +version := 2.4 +archive := $(name)-$(version).tar.gz +download := $(home)/releases/$(archive) + +# We use updates from git: +ips-version := $(version).99 + +checksum-jansson-2.4.tar.gz := \ + md5:c4629b89bf0432f3158c461e88fe0113 \ + sha1:994b84fd0b5d9050d01d250c7f90f038a3eeeed0 \ + sha256:1fcbd1ac3d8b610644acf86a5731d760bb228c9acbace20a2ad0f23baec79b41 \ + size:401597 + diff --git a/jansson/libjansson.p5m b/jansson/libjansson.p5m new file mode 100644 index 0000000..63ad1c6 --- /dev/null +++ b/jansson/libjansson.p5m @@ -0,0 +1,16 @@ +set name=pkg.fmri value=pkg:/library/libjansson@$(ips-version) +set name=pkg.summary value="$(summary)" +set name=info.upstream-url value="$(home)" +set name=info.source-url value="$(download)" + +license $(license-file) license="$(license)" + +depend fmri=pkg:/library/libjansson4@$(ips-version) type=require +depend fmri=pkg:/library/libjansson4@$(ips-version) type=incorporate + +file path=usr/lib/$(mach64)/pkgconfig/jansson.pc +file path=usr/lib/$(mach64)/libjansson.a +file path=usr/include/jansson.h +file path=usr/include/jansson_config.h +link path=usr/lib/$(mach64)/libjansson.so target=libjansson.so.4 +link path=usr/lib/libjansson.so target=libjansson.so.4 diff --git a/jansson/libjansson4.p5m b/jansson/libjansson4.p5m new file mode 100644 index 0000000..a7a0022 --- /dev/null +++ b/jansson/libjansson4.p5m @@ -0,0 +1,12 @@ +set name=pkg.fmri value=pkg:/library/libjansson4@$(ips-version) +set name=pkg.summary value="$(summary), shared library" +set name=info.upstream-url value="$(home)" +set name=info.source-url value="$(download)" + +license $(license-file) license="$(license)" + +$(build64)file path=usr/lib/$(mach64)/libjansson.so.4.4.0 +$(build64)link path=usr/lib/$(mach64)/libjansson.so.4 target=libjansson.so.4.4.0 + +$(build32)file path=usr/lib/libjansson.so.4.4.0 +$(build32)link path=usr/lib/libjansson.so.4 target=libjansson.so.4.4.0 diff --git a/jansson/patches/0000-2.5-dev-git-update.patch b/jansson/patches/0000-2.5-dev-git-update.patch new file mode 100644 index 0000000..5ded82a --- /dev/null +++ b/jansson/patches/0000-2.5-dev-git-update.patch @@ -0,0 +1,295 @@ +diff --git a/.travis.yml b/.travis.yml +new file mode 100644 +index 0000000..bd4b160 +--- /dev/null ++++ b/.travis.yml +@@ -0,0 +1,5 @@ ++language: c ++compiler: ++ - gcc ++ - clang ++script: autoreconf -f -i && ./configure && make check +diff --git a/README.rst b/README.rst +index 4607125..a01cbc0 100644 +--- a/README.rst ++++ b/README.rst +@@ -1,6 +1,10 @@ + Jansson README + ============== + ++.. image:: https://travis-ci.org/akheron/jansson.png ++ :alt: Build status ++ :target: https://travis-ci.org/akheron/jansson ++ + Jansson_ is a C library for encoding, decoding and manipulating JSON + data. Its main features and design principles are: + +diff --git a/configure.ac b/configure.ac +index 3b595a4..91d783f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1,5 +1,5 @@ + AC_PREREQ([2.60]) +-AC_INIT([jansson], [2.4], [petri@digip.org]) ++AC_INIT([jansson], [2.5-dev], [petri@digip.org]) + + AM_INIT_AUTOMAKE([1.10 foreign]) + +diff --git a/doc/conf.py b/doc/conf.py +index 6010904..1f667ed 100644 +--- a/doc/conf.py ++++ b/doc/conf.py +@@ -48,7 +48,7 @@ copyright = u'2009-2012, Petri Lehtinen' + # built documents. + # + # The short X.Y version. +-version = '2.4' ++version = '2.5-dev' + # The full version, including alpha/beta/rc tags. + release = version + +diff --git a/release.sh b/release.sh +new file mode 100755 +index 0000000..c2551f8 +--- /dev/null ++++ b/release.sh +@@ -0,0 +1,70 @@ ++#!/bin/sh ++# ++# Use this script to easily make releases of Jansson. It configures ++# the source tree, and builds and signs all tarballs. ++ ++die() { ++ echo $1 >&2 ++ exit 1 ++} ++ ++confirm() { ++ local answer ++ read -p "$1 [yN]: " answer ++ [ "$answer" = "Y" -o "$answer" = "y" ] || exit 0 ++} ++ ++set -e ++[ -f configure.ac ] || die "Must be run at project root directory" ++ ++# Determine version ++v=$(grep AC_INIT configure.ac | sed -r 's/.*, \[(.+?)\],.*/\1/') ++[ -n "$v" ] || die "Unable to determine version" ++confirm "Version is $v, proceed?" ++ ++# Sanity checks ++vi=$(grep version-info src/Makefile.am | sed 's/^[ \t]*//g' | cut -d" " -f2) ++confirm "Libtool version-info is $vi, proceed?" ++ ++r=$(grep 'Released ' CHANGES | head -n 1) ++confirm "Last CHANGES entry says \"$r\", proceed??" ++ ++dv=$(grep ^version doc/conf.py | sed -r "s/.*'(.*)'.*/\1/") ++if [ "$dv" != "$v" ]; then ++ die "Documentation version ($dv) doesn't match library version" ++fi ++ ++[ -f Makefile ] && make distclean || true ++rm -f jansson-$v.tar.* ++rm -rf jansson-$v-doc ++rm -f jansson-$v-doc.tar.* ++ ++autoreconf -fi ++./configure ++ ++# Run tests and make gz source tarball ++: ${VALGRIND:=1} ++export VALGRIND ++make distcheck ++ ++# Make bzip2 source tarball ++make dist-bzip2 ++ ++# Sign source tarballs ++for s in gz bz2; do ++ gpg --detach-sign --armor jansson-$v.tar.$s ++done ++ ++# Build documentation ++make html ++mv doc/_build/html jansson-$v-doc ++ ++# Make and sign documentation tarballs ++for s in gz bz2; do ++ [ $s = gz ] && compress=gzip ++ [ $s = bz2 ] && compress=bzip2 ++ tar cf - jansson-$v-doc | $compress -9 -c > jansson-$v-doc.tar.$s ++ gpg --detach-sign --armor jansson-$v-doc.tar.$s ++done ++ ++echo "All done" +diff --git a/src/dump.c b/src/dump.c +index 2c7dee9..bbf87d0 100644 +--- a/src/dump.c ++++ b/src/dump.c +@@ -38,7 +38,7 @@ static int dump_to_file(const char *buffer, size_t size, void *data) + } + + /* 32 spaces (the maximum indentation size) */ +-static char whitespace[] = " "; ++static const char whitespace[] = " "; + + static int dump_indent(size_t flags, int depth, int space, json_dump_callback_t dump, void *data) + { +diff --git a/src/hashtable.c b/src/hashtable.c +index 76cf69b..bcbaa8c 100644 +--- a/src/hashtable.c ++++ b/src/hashtable.c +@@ -74,7 +74,7 @@ static void insert_to_bucket(hashtable_t *hashtable, bucket_t *bucket, + } + } + +-static size_t primes[] = { ++static const size_t primes[] = { + 5, 13, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, + 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, + 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, +diff --git a/src/jansson.h b/src/jansson.h +index 352c6ce..ec384d8 100644 +--- a/src/jansson.h ++++ b/src/jansson.h +@@ -22,10 +22,10 @@ extern "C" { + + #define JANSSON_MAJOR_VERSION 2 + #define JANSSON_MINOR_VERSION 4 +-#define JANSSON_MICRO_VERSION 0 ++#define JANSSON_MICRO_VERSION 99 + + /* Micro version is omitted if it's 0 */ +-#define JANSSON_VERSION "2.4" ++#define JANSSON_VERSION "2.5-dev" + + /* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this + for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */ +@@ -47,7 +47,7 @@ typedef enum { + JSON_NULL + } json_type; + +-typedef struct { ++typedef struct json_t { + json_type type; + size_t refcount; + } json_t; +diff --git a/src/load.c b/src/load.c +index d88a704..16ff53d 100644 +--- a/src/load.c ++++ b/src/load.c +@@ -37,7 +37,7 @@ + #define l_isalpha(c) (l_isupper(c) || l_islower(c)) + #define l_isdigit(c) ('0' <= (c) && (c) <= '9') + #define l_isxdigit(c) \ +- (l_isdigit(c) || 'A' <= (c) || (c) <= 'F' || 'a' <= (c) || (c) <= 'f') ++ (l_isdigit(c) || ('A' <= (c) && (c) <= 'F') || ('a' <= (c) && (c) <= 'f')) + + /* Read one byte from stream, convert to unsigned char, then int, and + return. return EOF on end of file. This corresponds to the +@@ -447,7 +447,7 @@ out: + } + + #if JSON_INTEGER_IS_LONG_LONG +-#ifdef _MSC_VER // Microsoft Visual Studio ++#ifdef _MSC_VER /* Microsoft Visual Studio */ + #define json_strtoint _strtoi64 + #else + #define json_strtoint strtoll +diff --git a/src/pack_unpack.c b/src/pack_unpack.c +index 39db9b8..18f9ccb 100644 +--- a/src/pack_unpack.c ++++ b/src/pack_unpack.c +@@ -21,7 +21,7 @@ typedef struct { + int column; + } scanner_t; + +-static const char *type_names[] = { ++static const char * const type_names[] = { + "object", + "array", + "string", +@@ -34,7 +34,7 @@ static const char *type_names[] = { + + #define type_name(x) type_names[json_typeof(x)] + +-static const char *unpack_value_starters = "{[siIbfFOon"; ++static const char unpack_value_starters[] = "{[siIbfFOon"; + + + static void scanner_init(scanner_t *s, json_error_t *error, +diff --git a/src/value.c b/src/value.c +index ba9908e..003b5f3 100644 +--- a/src/value.c ++++ b/src/value.c +@@ -509,7 +509,10 @@ int json_array_remove(json_t *json, size_t index) + + json_decref(array->table[index]); + +- array_move(array, index, index + 1, array->entries - index); ++ /* If we're removing the last element, nothing has to be moved */ ++ if(index < array->entries - 1) ++ array_move(array, index, index + 1, array->entries - index - 1); ++ + array->entries--; + + return 0; +diff --git a/test/bin/Makefile.am b/test/bin/Makefile.am +index 346db5d..478f62b 100644 +--- a/test/bin/Makefile.am ++++ b/test/bin/Makefile.am +@@ -1,6 +1,6 @@ + check_PROGRAMS = json_process + +-AM_CPPFLAGS = -I$(top_srcdir)/src ++AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src + AM_CFLAGS = -Wall -Werror + LDFLAGS = -static # for speed and Valgrind + LDADD = $(top_builddir)/src/libjansson.la +diff --git a/test/suites/api/Makefile.am b/test/suites/api/Makefile.am +index 9e60f48..2b1746d 100644 +--- a/test/suites/api/Makefile.am ++++ b/test/suites/api/Makefile.am +@@ -29,7 +29,7 @@ test_pack_SOURCES = test_pack.c util.h + test_simple_SOURCES = test_simple.c util.h + test_unpack_SOURCES = test_unpack.c util.h + +-AM_CPPFLAGS = -I$(top_srcdir)/src ++AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src + AM_CFLAGS = -Wall -Werror + LDFLAGS = -static # for speed and Valgrind + LDADD = $(top_builddir)/src/libjansson.la +diff --git a/test/suites/api/test_array.c b/test/suites/api/test_array.c +index 4585db9..b20637f 100644 +--- a/test/suites/api/test_array.c ++++ b/test/suites/api/test_array.c +@@ -206,6 +206,7 @@ static void test_insert(void) + static void test_remove(void) + { + json_t *array, *five, *seven; ++ int i; + + array = json_array(); + five = json_integer(5); +@@ -253,6 +254,19 @@ static void test_remove(void) + json_array_get(array, 2) != seven) + fail("remove works incorrectly"); + ++ json_decref(array); ++ ++ array = json_array(); ++ for(i = 0; i < 4; i++) { ++ json_array_append(array, five); ++ json_array_append(array, seven); ++ } ++ if(json_array_size(array) != 8) ++ fail("unable to append 8 items to array"); ++ ++ /* Remove an element from a "full" array. */ ++ json_array_remove(array, 5); ++ + json_decref(five); + json_decref(seven); + json_decref(array); diff --git a/jansson/patches/0001-Do-not-play-with-GCC.patch b/jansson/patches/0001-Do-not-play-with-GCC.patch new file mode 100644 index 0000000..522cb8b --- /dev/null +++ b/jansson/patches/0001-Do-not-play-with-GCC.patch @@ -0,0 +1,61 @@ +From b86f02ac1cd825bb81bff506b841065fdd589940 Mon Sep 17 00:00:00 2001 +From: Igor Pashev +Date: Thu, 31 Jan 2013 09:59:16 +0400 +Subject: [PATCH 1/3] Do not play with GCC + +--- + configure.ac | 1 - + src/Makefile.am | 4 ---- + test/bin/Makefile.am | 1 - + test/suites/api/Makefile.am | 1 - + 4 files changed, 0 insertions(+), 7 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 91d783f..a2042b3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -9,7 +9,6 @@ AC_CONFIG_HEADERS([config.h]) + # Checks for programs. + AC_PROG_CC + AC_PROG_LIBTOOL +-AM_CONDITIONAL([GCC], [test x$GCC = xyes]) + + # Checks for libraries. + +diff --git a/src/Makefile.am b/src/Makefile.am +index 9d040f6..08685ac 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -23,7 +23,3 @@ libjansson_la_LDFLAGS = \ + -export-symbols-regex '^json_' \ + -version-info 8:0:4 + +-if GCC +-# These flags are gcc specific +-AM_CFLAGS = -Wall -Wextra -Wdeclaration-after-statement -Werror +-endif +diff --git a/test/bin/Makefile.am b/test/bin/Makefile.am +index 478f62b..63b6dce 100644 +--- a/test/bin/Makefile.am ++++ b/test/bin/Makefile.am +@@ -1,6 +1,5 @@ + check_PROGRAMS = json_process + + AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src +-AM_CFLAGS = -Wall -Werror + LDFLAGS = -static # for speed and Valgrind + LDADD = $(top_builddir)/src/libjansson.la +diff --git a/test/suites/api/Makefile.am b/test/suites/api/Makefile.am +index 2b1746d..1dbdd2b 100644 +--- a/test/suites/api/Makefile.am ++++ b/test/suites/api/Makefile.am +@@ -30,6 +30,5 @@ test_simple_SOURCES = test_simple.c util.h + test_unpack_SOURCES = test_unpack.c util.h + + AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src +-AM_CFLAGS = -Wall -Werror + LDFLAGS = -static # for speed and Valgrind + LDADD = $(top_builddir)/src/libjansson.la +-- +1.7.3.2 + diff --git a/jansson/patches/0002-Just-use-C99.patch b/jansson/patches/0002-Just-use-C99.patch new file mode 100644 index 0000000..2e298f5 --- /dev/null +++ b/jansson/patches/0002-Just-use-C99.patch @@ -0,0 +1,53 @@ +From 179d9026aa4d6d2b9a0def85424c0e8eff240fb5 Mon Sep 17 00:00:00 2001 +From: Igor Pashev +Date: Thu, 31 Jan 2013 10:15:31 +0400 +Subject: [PATCH 2/3] Just use C99 + +--- + configure.ac | 2 +- + src/value.c | 9 --------- + 2 files changed, 1 insertions(+), 10 deletions(-) + +diff --git a/configure.ac b/configure.ac +index a2042b3..6455d7f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -7,7 +7,7 @@ AC_CONFIG_SRCDIR([src/value.c]) + AC_CONFIG_HEADERS([config.h]) + + # Checks for programs. +-AC_PROG_CC ++AC_PROG_CC_C99 + AC_PROG_LIBTOOL + + # Checks for libraries. +diff --git a/src/value.c b/src/value.c +index 003b5f3..e671377 100644 +--- a/src/value.c ++++ b/src/value.c +@@ -5,7 +5,6 @@ + * it under the terms of the MIT license. See LICENSE for details. + */ + +-#define _GNU_SOURCE + + #include + #include +@@ -17,14 +16,6 @@ + #include "jansson_private.h" + #include "utf.h" + +-/* Work around nonstandard isnan() and isinf() implementations */ +-#ifndef isnan +-static JSON_INLINE int isnan(double x) { return x != x; } +-#endif +-#ifndef isinf +-static JSON_INLINE int isinf(double x) { return !isnan(x) && isnan(x - x); } +-#endif +- + static JSON_INLINE void json_init(json_t *json, json_type type) + { + json->type = type; +-- +1.7.3.2 + diff --git a/jansson/patches/0003-Remove-check-exports-test.patch b/jansson/patches/0003-Remove-check-exports-test.patch new file mode 100644 index 0000000..44ef89b --- /dev/null +++ b/jansson/patches/0003-Remove-check-exports-test.patch @@ -0,0 +1,99 @@ +From f25f30260896b31338876bf57cda416c0c08ee82 Mon Sep 17 00:00:00 2001 +From: Igor Pashev +Date: Thu, 31 Jan 2013 11:05:12 +0400 +Subject: [PATCH 3/3] Remove check-exports test. + +This test is inadequate in many ways: + +1. Solaris linker adds some extra global symbols like _fini or _init. +2. libtool can pass wrong option to GNU ld + (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13201), + thus many other symbols are exported. + +The right way to control global symbols is a version script +(in terms of GNU ld) or a map file (Solaris ld). + +libtool actually generates map file for Solaris ld. +--- + test/suites/api/Makefile.am | 2 +- + test/suites/api/check-exports | 23 ----------------------- + test/suites/api/run | 16 ++++++---------- + 3 files changed, 7 insertions(+), 34 deletions(-) + delete mode 100755 test/suites/api/check-exports + +diff --git a/test/suites/api/Makefile.am b/test/suites/api/Makefile.am +index 1dbdd2b..775264f 100644 +--- a/test/suites/api/Makefile.am ++++ b/test/suites/api/Makefile.am +@@ -1,4 +1,4 @@ +-EXTRA_DIST = run check-exports ++EXTRA_DIST = run + + check_PROGRAMS = \ + test_array \ +diff --git a/test/suites/api/check-exports b/test/suites/api/check-exports +deleted file mode 100755 +index 1c2ba9a..0000000 +--- a/test/suites/api/check-exports ++++ /dev/null +@@ -1,23 +0,0 @@ +-#!/bin/sh +-# +-# This test checks that libjansson.so exports the correct symbols. +-# +- +-SOFILE="../src/.libs/libjansson.so" +- +-# The list of symbols, which the shared object should export, is read +-# from the def file, which is used in Windows builds +-grep 'json_' $top_srcdir/src/jansson.def \ +- | sed -e 's/ //g' \ +- | sort \ +- >$test_log/exports +- +-nm -D $SOFILE >/dev/null >$test_log/symbols 2>/dev/null \ +- || exit 77 # Skip if "nm -D" doesn't seem to work +- +-grep ' [DT] ' $test_log/symbols | cut -d' ' -f3 | sort >$test_log/output +- +-if ! cmp -s $test_log/exports $test_log/output; then +- diff -u $test_log/exports $test_log/output >&2 +- exit 1 +-fi +diff --git a/test/suites/api/run b/test/suites/api/run +index 3327e15..cdbab87 100755 +--- a/test/suites/api/run ++++ b/test/suites/api/run +@@ -7,7 +7,7 @@ + + is_test() { + case "$test_name" in +- *.c|check-exports) ++ *.c) + return 0 + ;; + *) +@@ -17,15 +17,11 @@ is_test() { + } + + run_test() { +- if [ "$test_name" = "check-exports" ]; then +- test_log=$test_log $test_path >$test_log/stdout 2>$test_log/stderr +- else +- $test_runner $suite_builddir/${test_name%.c} \ +- >$test_log/stdout \ +- 2>$test_log/stderr \ +- || return 1 +- valgrind_check $test_log/stderr || return 1 +- fi ++ $test_runner $suite_builddir/${test_name%.c} \ ++ >$test_log/stdout \ ++ 2>$test_log/stderr \ ++ || return 1 ++ valgrind_check $test_log/stderr || return 1 + } + + show_error() { +-- +1.7.3.2 + -- cgit v1.2.3