Skip to content

Commit

Permalink
Squashed 'src/univalue/' changes from 98fadc0909..c390ac375f
Browse files Browse the repository at this point in the history
c390ac375f Merge bitcoin-core/univalue-subtree#19: Split sources for easier buildsystem integration
4a5b0a1c65 build: Move source entries out to sources.mk
6c7d94b33c build: cleanup wonky gen usage
a222637c6d Merge bitcoin#23: Merge changes from jgarzik/univalue@1ae6a23
f77d0f718d Merge commit '1ae6a231a0169938eb3972c1d48dd17cba5947e1' into HEAD
1ae6a231a0 Merge pull request bitcoin#57 from MarcoFalke/test_fix
92bdd11f0b univalue_write: remove unneeded sstream.h include
ffb621c130 Merge pull request bitcoin#56 from drodil/remove_sstream_header
f33acf9fe8 Merge commit '7890db9~' into HEAD
66e0adec4d Remove unnecessary sstream header from univalue.h
88967f6586 Version 1.0.4
1dc113dbef Merge pull request bitcoin#50 from luke-jr/pushKV_bool
72392fb227 [tests] test pushKV for boolean values
c23132bcf4 Pushing boolean value to univalue correctly
81faab26a1 Merge pull request bitcoin#48 from fwolfst/47-UPDATE_MIT_LINK_TO_HTTPS
b17634ef24 Update URLs to MIT license.
88ab64f6b5 Merge pull request bitcoin#46 from jasonbcox/master
35ed96da31 Merge pull request bitcoin#44 from MarcoFalke/Mf1709-univalue-cherrypick-explicit
420c226290 Merge pull request bitcoin#45 from MarcoFalke/Mf1710-univalue-revert-test

git-subtree-dir: src/univalue
git-subtree-split: c390ac375f2fad0433c8fb1b4b5e30749e112a89
  • Loading branch information
fanquake committed Oct 4, 2021
1 parent 2a55a0e commit e7a3004
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 90 deletions.
90 changes: 15 additions & 75 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
include sources.mk
ACLOCAL_AMFLAGS = -I build-aux/m4
.PHONY: gen
.PHONY: gen FORCE
.INTERMEDIATE: $(GENBIN)

include_HEADERS = include/univalue.h
noinst_HEADERS = lib/univalue_escapes.h lib/univalue_utffilter.h
include_HEADERS = $(UNIVALUE_DIST_HEADERS_INT)
noinst_HEADERS = $(UNIVALUE_LIB_HEADERS_INT)

lib_LTLIBRARIES = libunivalue.la

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = pc/libunivalue.pc

libunivalue_la_SOURCES = \
lib/univalue.cpp \
lib/univalue_get.cpp \
lib/univalue_read.cpp \
lib/univalue_write.cpp
libunivalue_la_SOURCES = $(UNIVALUE_LIB_SOURCES_INT)

libunivalue_la_LDFLAGS = \
-version-info $(LIBUNIVALUE_CURRENT):$(LIBUNIVALUE_REVISION):$(LIBUNIVALUE_AGE) \
Expand All @@ -30,89 +27,32 @@ $(GENBIN): $(GEN_SRCS)
@echo Building $@
$(AM_V_at)c++ -I$(top_srcdir)/include -o $@ $<

gen: lib/univalue_escapes.h $(GENBIN)
@echo Updating $<
gen: $(GENBIN) FORCE
@echo Updating lib/univalue_escapes.h
$(AM_V_at)$(GENBIN) > lib/univalue_escapes.h

noinst_PROGRAMS = $(TESTS) test/test_json

TEST_DATA_DIR=test

test_unitester_SOURCES = test/unitester.cpp
test_unitester_SOURCES = $(UNIVALUE_TEST_UNITESTER_INT)
test_unitester_LDADD = libunivalue.la
test_unitester_CXXFLAGS = -I$(top_srcdir)/include -DJSON_TEST_SRC=\"$(srcdir)/$(TEST_DATA_DIR)\"
test_unitester_CXXFLAGS = -I$(top_srcdir)/include -DJSON_TEST_SRC=\"$(srcdir)/$(UNIVALUE_TEST_DATA_DIR_INT)\"
test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)

test_test_json_SOURCES = test/test_json.cpp
test_test_json_SOURCES = $(UNIVALUE_TEST_JSON_INT)
test_test_json_LDADD = libunivalue.la
test_test_json_CXXFLAGS = -I$(top_srcdir)/include
test_test_json_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)

test_no_nul_SOURCES = test/no_nul.cpp
test_no_nul_SOURCES = $(UNIVALUE_TEST_NO_NUL_INT)
test_no_nul_LDADD = libunivalue.la
test_no_nul_CXXFLAGS = -I$(top_srcdir)/include
test_no_nul_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)

test_object_SOURCES = test/object.cpp
test_object_SOURCES = $(UNIVALUE_TEST_OBJECT_INT)
test_object_LDADD = libunivalue.la
test_object_CXXFLAGS = -I$(top_srcdir)/include
test_object_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)

TEST_FILES = \
$(TEST_DATA_DIR)/fail10.json \
$(TEST_DATA_DIR)/fail11.json \
$(TEST_DATA_DIR)/fail12.json \
$(TEST_DATA_DIR)/fail13.json \
$(TEST_DATA_DIR)/fail14.json \
$(TEST_DATA_DIR)/fail15.json \
$(TEST_DATA_DIR)/fail16.json \
$(TEST_DATA_DIR)/fail17.json \
$(TEST_DATA_DIR)/fail18.json \
$(TEST_DATA_DIR)/fail19.json \
$(TEST_DATA_DIR)/fail1.json \
$(TEST_DATA_DIR)/fail20.json \
$(TEST_DATA_DIR)/fail21.json \
$(TEST_DATA_DIR)/fail22.json \
$(TEST_DATA_DIR)/fail23.json \
$(TEST_DATA_DIR)/fail24.json \
$(TEST_DATA_DIR)/fail25.json \
$(TEST_DATA_DIR)/fail26.json \
$(TEST_DATA_DIR)/fail27.json \
$(TEST_DATA_DIR)/fail28.json \
$(TEST_DATA_DIR)/fail29.json \
$(TEST_DATA_DIR)/fail2.json \
$(TEST_DATA_DIR)/fail30.json \
$(TEST_DATA_DIR)/fail31.json \
$(TEST_DATA_DIR)/fail32.json \
$(TEST_DATA_DIR)/fail33.json \
$(TEST_DATA_DIR)/fail34.json \
$(TEST_DATA_DIR)/fail35.json \
$(TEST_DATA_DIR)/fail36.json \
$(TEST_DATA_DIR)/fail37.json \
$(TEST_DATA_DIR)/fail38.json \
$(TEST_DATA_DIR)/fail39.json \
$(TEST_DATA_DIR)/fail40.json \
$(TEST_DATA_DIR)/fail41.json \
$(TEST_DATA_DIR)/fail42.json \
$(TEST_DATA_DIR)/fail44.json \
$(TEST_DATA_DIR)/fail45.json \
$(TEST_DATA_DIR)/fail3.json \
$(TEST_DATA_DIR)/fail4.json \
$(TEST_DATA_DIR)/fail5.json \
$(TEST_DATA_DIR)/fail6.json \
$(TEST_DATA_DIR)/fail7.json \
$(TEST_DATA_DIR)/fail8.json \
$(TEST_DATA_DIR)/fail9.json \
$(TEST_DATA_DIR)/pass1.json \
$(TEST_DATA_DIR)/pass2.json \
$(TEST_DATA_DIR)/pass3.json \
$(TEST_DATA_DIR)/pass4.json \
$(TEST_DATA_DIR)/round1.json \
$(TEST_DATA_DIR)/round2.json \
$(TEST_DATA_DIR)/round3.json \
$(TEST_DATA_DIR)/round4.json \
$(TEST_DATA_DIR)/round5.json \
$(TEST_DATA_DIR)/round6.json \
$(TEST_DATA_DIR)/round7.json

EXTRA_DIST=$(TEST_FILES) $(GEN_SRCS)
TEST_FILES = $(UNIVALUE_TEST_FILES_INT)

EXTRA_DIST=$(UNIVALUE_TEST_FILES_INT) $(GEN_SRCS)
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
m4_define([libunivalue_major_version], [1])
m4_define([libunivalue_minor_version], [1])
m4_define([libunivalue_micro_version], [3])
m4_define([libunivalue_interface_age], [3])
m4_define([libunivalue_micro_version], [4])
m4_define([libunivalue_interface_age], [4])
# If you need a modifier for the version number.
# Normally empty, but can be used to make "fixup" releases.
m4_define([libunivalue_extraversion], [])
Expand All @@ -14,7 +14,7 @@ m4_define([libunivalue_age], [m4_eval(libunivalue_binary_age - libunivalue_inter
m4_define([libunivalue_version], [libunivalue_major_version().libunivalue_minor_version().libunivalue_micro_version()libunivalue_extraversion()])


AC_INIT([univalue], [1.0.3],
AC_INIT([univalue], [1.0.4],
[http://github.com/jgarzik/univalue/])

dnl make the compilation flags quiet unless V=1 is used
Expand Down
2 changes: 1 addition & 1 deletion gen/gen.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2014 BitPay Inc.
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/licenses/mit-license.php.

//
// To re-create univalue_escapes.h:
Expand Down
4 changes: 1 addition & 3 deletions include/univalue.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2014 BitPay Inc.
// Copyright 2015 Bitcoin Core Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/licenses/mit-license.php.

#ifndef __UNIVALUE_H__
#define __UNIVALUE_H__
Expand All @@ -14,8 +14,6 @@
#include <map>
#include <cassert>

#include <sstream> // .get_int64()

class UniValue {
public:
enum VType { VNULL, VOBJ, VARR, VSTR, VNUM, VBOOL, };
Expand Down
2 changes: 1 addition & 1 deletion lib/univalue.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2014 BitPay Inc.
// Copyright 2015 Bitcoin Core Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <stdint.h>
#include <iomanip>
Expand Down
3 changes: 2 additions & 1 deletion lib/univalue_get.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2014 BitPay Inc.
// Copyright 2015 Bitcoin Core Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <stdint.h>
#include <errno.h>
Expand All @@ -11,6 +11,7 @@
#include <vector>
#include <limits>
#include <string>
#include <sstream>

#include "univalue.h"

Expand Down
2 changes: 1 addition & 1 deletion lib/univalue_read.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2014 BitPay Inc.
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <string.h>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion lib/univalue_utffilter.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2016 Wladimir J. van der Laan
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/licenses/mit-license.php.
#ifndef UNIVALUE_UTFFILTER_H
#define UNIVALUE_UTFFILTER_H

Expand Down
3 changes: 1 addition & 2 deletions lib/univalue_write.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright 2014 BitPay Inc.
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <iomanip>
#include <sstream>
#include <stdio.h>
#include "univalue.h"
#include "univalue_escapes.h"
Expand Down
95 changes: 95 additions & 0 deletions sources.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# - All variables are namespaced with UNIVALUE_ to avoid colliding with
# downstream makefiles.
# - All Variables ending in _HEADERS or _SOURCES confuse automake, so the
# _INT postfix is applied.
# - Convenience variables, for example a UNIVALUE_TEST_DIR should not be used
# as they interfere with automatic dependency generation
# - The %reldir% is the relative path from the Makefile.am. This allows
# downstreams to use these variables without having to manually account for
# the path change.

UNIVALUE_INCLUDE_DIR_INT = %reldir%/include

UNIVALUE_DIST_HEADERS_INT =
UNIVALUE_DIST_HEADERS_INT += %reldir%/include/univalue.h

UNIVALUE_LIB_HEADERS_INT =
UNIVALUE_LIB_HEADERS_INT += %reldir%/lib/univalue_utffilter.h
UNIVALUE_LIB_HEADERS_INT += %reldir%/lib/univalue_escapes.h

UNIVALUE_LIB_SOURCES_INT =
UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue.cpp
UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue_get.cpp
UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue_read.cpp
UNIVALUE_LIB_SOURCES_INT += %reldir%/lib/univalue_write.cpp

UNIVALUE_TEST_DATA_DIR_INT = %reldir%/test

UNIVALUE_TEST_UNITESTER_INT =
UNIVALUE_TEST_UNITESTER_INT += %reldir%/test/unitester.cpp

UNIVALUE_TEST_JSON_INT =
UNIVALUE_TEST_JSON_INT += %reldir%/test/test_json.cpp

UNIVALUE_TEST_NO_NUL_INT =
UNIVALUE_TEST_NO_NUL_INT += %reldir%/test/no_nul.cpp

UNIVALUE_TEST_OBJECT_INT =
UNIVALUE_TEST_OBJECT_INT += %reldir%/test/object.cpp

UNIVALUE_TEST_FILES_INT =
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail1.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail2.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail3.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail4.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail5.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail6.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail7.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail8.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail9.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail10.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail11.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail12.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail13.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail14.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail15.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail16.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail17.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail18.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail19.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail20.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail21.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail22.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail23.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail24.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail25.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail26.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail27.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail28.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail29.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail30.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail31.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail32.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail33.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail34.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail35.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail36.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail37.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail38.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail39.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail40.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail41.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail42.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail44.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/fail45.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/pass1.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/pass2.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/pass3.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/pass4.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/round1.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/round2.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/round3.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/round4.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/round5.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/round6.json
UNIVALUE_TEST_FILES_INT += %reldir%/test/round7.json
2 changes: 1 addition & 1 deletion test/object.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2014 BitPay Inc.
// Copyright (c) 2014-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <stdint.h>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion test/unitester.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2014 BitPay Inc.
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/licenses/mit-license.php.

#include <stdlib.h>
#include <stdio.h>
Expand Down

0 comments on commit e7a3004

Please sign in to comment.