You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2017/04/18 18:59:12 UTC
[11/12] nifi-minifi-cpp git commit: MINIFI-227: Initial Site to Site
Provenance Reporting Task implementation.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/f3f8f531/thirdparty/jsoncpp/SConstruct
----------------------------------------------------------------------
diff --git a/thirdparty/jsoncpp/SConstruct b/thirdparty/jsoncpp/SConstruct
new file mode 100644
index 0000000..f3a73f7
--- /dev/null
+++ b/thirdparty/jsoncpp/SConstruct
@@ -0,0 +1,248 @@
+"""
+Notes:
+- shared library support is buggy: it assumes that a static and dynamic library can be build from the same object files. This is not true on many platforms. For this reason it is only enabled on linux-gcc at the current time.
+
+To add a platform:
+- add its name in options allowed_values below
+- add tool initialization for this platform. Search for "if platform == 'suncc'" as an example.
+"""
+
+import os
+import os.path
+import sys
+
+JSONCPP_VERSION = open(File('#version').abspath,'rt').read().strip()
+DIST_DIR = '#dist'
+
+options = Variables()
+options.Add( EnumVariable('platform',
+ 'Platform (compiler/stl) used to build the project',
+ 'msvc71',
+ allowed_values='suncc vacpp mingw msvc6 msvc7 msvc71 msvc80 msvc90 linux-gcc'.split(),
+ ignorecase=2) )
+
+try:
+ platform = ARGUMENTS['platform']
+ if platform == 'linux-gcc':
+ CXX = 'g++' # not quite right, but env is not yet available.
+ import commands
+ version = commands.getoutput('%s -dumpversion' %CXX)
+ platform = 'linux-gcc-%s' %version
+ print "Using platform '%s'" %platform
+ LD_LIBRARY_PATH = os.environ.get('LD_LIBRARY_PATH', '')
+ LD_LIBRARY_PATH = "%s:libs/%s" %(LD_LIBRARY_PATH, platform)
+ os.environ['LD_LIBRARY_PATH'] = LD_LIBRARY_PATH
+ print "LD_LIBRARY_PATH =", LD_LIBRARY_PATH
+except KeyError:
+ print 'You must specify a "platform"'
+ sys.exit(2)
+
+print "Building using PLATFORM =", platform
+
+rootbuild_dir = Dir('#buildscons')
+build_dir = os.path.join( '#buildscons', platform )
+bin_dir = os.path.join( '#bin', platform )
+lib_dir = os.path.join( '#libs', platform )
+sconsign_dir_path = Dir(build_dir).abspath
+sconsign_path = os.path.join( sconsign_dir_path, '.sconsign.dbm' )
+
+# Ensure build directory exist (SConsignFile fail otherwise!)
+if not os.path.exists( sconsign_dir_path ):
+ os.makedirs( sconsign_dir_path )
+
+# Store all dependencies signature in a database
+SConsignFile( sconsign_path )
+
+def make_environ_vars():
+ """Returns a dictionnary with environment variable to use when compiling."""
+ # PATH is required to find the compiler
+ # TEMP is required for at least mingw
+ # LD_LIBRARY_PATH & co is required on some system for the compiler
+ vars = {}
+ for name in ('PATH', 'TEMP', 'TMP', 'LD_LIBRARY_PATH', 'LIBRARY_PATH'):
+ if name in os.environ:
+ vars[name] = os.environ[name]
+ return vars
+
+
+env = Environment( ENV = make_environ_vars(),
+ toolpath = ['scons-tools'],
+ tools=[] ) #, tools=['default'] )
+
+if platform == 'suncc':
+ env.Tool( 'sunc++' )
+ env.Tool( 'sunlink' )
+ env.Tool( 'sunar' )
+ env.Append( CCFLAGS = ['-mt'] )
+elif platform == 'vacpp':
+ env.Tool( 'default' )
+ env.Tool( 'aixcc' )
+ env['CXX'] = 'xlC_r' #scons does not pick-up the correct one !
+ # using xlC_r ensure multi-threading is enabled:
+ # http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/cuselect.htm
+ env.Append( CCFLAGS = '-qrtti=all',
+ LINKFLAGS='-bh:5' ) # -bh:5 remove duplicate symbol warning
+elif platform == 'msvc6':
+ env['MSVS_VERSION']='6.0'
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -GX /nologo /MT'
+elif platform == 'msvc70':
+ env['MSVS_VERSION']='7.0'
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -GX /nologo /MT'
+elif platform == 'msvc71':
+ env['MSVS_VERSION']='7.1'
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -GX /nologo /MT'
+elif platform == 'msvc80':
+ env['MSVS_VERSION']='8.0'
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -EHsc /nologo /MT'
+elif platform == 'msvc90':
+ env['MSVS_VERSION']='9.0'
+ # Scons 1.2 fails to detect the correct location of the platform SDK.
+ # So we propagate those from the environment. This requires that the
+ # user run vcvars32.bat before compiling.
+ if 'INCLUDE' in os.environ:
+ env['ENV']['INCLUDE'] = os.environ['INCLUDE']
+ if 'LIB' in os.environ:
+ env['ENV']['LIB'] = os.environ['LIB']
+ for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
+ env.Tool( tool )
+ env['CXXFLAGS']='-GR -EHsc /nologo /MT'
+elif platform == 'mingw':
+ env.Tool( 'mingw' )
+ env.Append( CPPDEFINES=[ "WIN32", "NDEBUG", "_MT" ] )
+elif platform.startswith('linux-gcc'):
+ env.Tool( 'default' )
+ env.Append( LIBS = ['pthread'], CCFLAGS = os.environ.get("CXXFLAGS", "-Wall"), LINKFLAGS=os.environ.get("LDFLAGS", "") )
+ env['SHARED_LIB_ENABLED'] = True
+else:
+ print "UNSUPPORTED PLATFORM."
+ env.Exit(1)
+
+env.Tool('targz')
+env.Tool('srcdist')
+env.Tool('globtool')
+
+env.Append( CPPPATH = ['#include'],
+ LIBPATH = lib_dir )
+short_platform = platform
+if short_platform.startswith('msvc'):
+ short_platform = short_platform[2:]
+# Notes: on Windows you need to rebuild the source for each variant
+# Build script does not support that yet so we only build static libraries.
+# This also fails on AIX because both dynamic and static library ends with
+# extension .a.
+env['SHARED_LIB_ENABLED'] = env.get('SHARED_LIB_ENABLED', False)
+env['LIB_PLATFORM'] = short_platform
+env['LIB_LINK_TYPE'] = 'lib' # static
+env['LIB_CRUNTIME'] = 'mt'
+env['LIB_NAME_SUFFIX'] = '${LIB_PLATFORM}_${LIB_LINK_TYPE}${LIB_CRUNTIME}' # must match autolink naming convention
+env['JSONCPP_VERSION'] = JSONCPP_VERSION
+env['BUILD_DIR'] = env.Dir(build_dir)
+env['ROOTBUILD_DIR'] = env.Dir(rootbuild_dir)
+env['DIST_DIR'] = DIST_DIR
+if 'TarGz' in env['BUILDERS']:
+ class SrcDistAdder:
+ def __init__( self, env ):
+ self.env = env
+ def __call__( self, *args, **kw ):
+ apply( self.env.SrcDist, (self.env['SRCDIST_TARGET'],) + args, kw )
+ env['SRCDIST_BUILDER'] = env.TarGz
+else: # If tarfile module is missing
+ class SrcDistAdder:
+ def __init__( self, env ):
+ pass
+ def __call__( self, *args, **kw ):
+ pass
+env['SRCDIST_ADD'] = SrcDistAdder( env )
+env['SRCDIST_TARGET'] = os.path.join( DIST_DIR, 'jsoncpp-src-%s.tar.gz' % env['JSONCPP_VERSION'] )
+
+env_testing = env.Clone( )
+env_testing.Append( LIBS = ['json_${LIB_NAME_SUFFIX}'] )
+
+def buildJSONExample( env, target_sources, target_name ):
+ env = env.Clone()
+ env.Append( CPPPATH = ['#'] )
+ exe = env.Program( target=target_name,
+ source=target_sources )
+ env['SRCDIST_ADD']( source=[target_sources] )
+ global bin_dir
+ return env.Install( bin_dir, exe )
+
+def buildJSONTests( env, target_sources, target_name ):
+ jsontests_node = buildJSONExample( env, target_sources, target_name )
+ check_alias_target = env.Alias( 'check', jsontests_node, RunJSONTests( jsontests_node, jsontests_node ) )
+ env.AlwaysBuild( check_alias_target )
+
+def buildUnitTests( env, target_sources, target_name ):
+ jsontests_node = buildJSONExample( env, target_sources, target_name )
+ check_alias_target = env.Alias( 'check', jsontests_node,
+ RunUnitTests( jsontests_node, jsontests_node ) )
+ env.AlwaysBuild( check_alias_target )
+
+def buildLibrary( env, target_sources, target_name ):
+ static_lib = env.StaticLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
+ source=target_sources )
+ global lib_dir
+ env.Install( lib_dir, static_lib )
+ if env['SHARED_LIB_ENABLED']:
+ shared_lib = env.SharedLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
+ source=target_sources )
+ env.Install( lib_dir, shared_lib )
+ env['SRCDIST_ADD']( source=[target_sources] )
+
+Export( 'env env_testing buildJSONExample buildLibrary buildJSONTests buildUnitTests' )
+
+def buildProjectInDirectory( target_directory ):
+ global build_dir
+ target_build_dir = os.path.join( build_dir, target_directory )
+ target = os.path.join( target_directory, 'sconscript' )
+ SConscript( target, build_dir=target_build_dir, duplicate=0 )
+ env['SRCDIST_ADD']( source=[target] )
+
+
+def runJSONTests_action( target, source = None, env = None ):
+ # Add test scripts to python path
+ jsontest_path = Dir( '#test' ).abspath
+ sys.path.insert( 0, jsontest_path )
+ data_path = os.path.join( jsontest_path, 'data' )
+ import runjsontests
+ return runjsontests.runAllTests( os.path.abspath(source[0].path), data_path )
+
+def runJSONTests_string( target, source = None, env = None ):
+ return 'RunJSONTests("%s")' % source[0]
+
+import SCons.Action
+ActionFactory = SCons.Action.ActionFactory
+RunJSONTests = ActionFactory(runJSONTests_action, runJSONTests_string )
+
+def runUnitTests_action( target, source = None, env = None ):
+ # Add test scripts to python path
+ jsontest_path = Dir( '#test' ).abspath
+ sys.path.insert( 0, jsontest_path )
+ import rununittests
+ return rununittests.runAllTests( os.path.abspath(source[0].path) )
+
+def runUnitTests_string( target, source = None, env = None ):
+ return 'RunUnitTests("%s")' % source[0]
+
+RunUnitTests = ActionFactory(runUnitTests_action, runUnitTests_string )
+
+env.Alias( 'check' )
+
+srcdist_cmd = env['SRCDIST_ADD']( source = """
+ AUTHORS README.md SConstruct
+ """.split() )
+env.Alias( 'src-dist', srcdist_cmd )
+
+buildProjectInDirectory( 'src/jsontestrunner' )
+buildProjectInDirectory( 'src/lib_json' )
+buildProjectInDirectory( 'src/test_lib_json' )
+#print env.Dump()
+
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/f3f8f531/thirdparty/jsoncpp/amalgamate.py
----------------------------------------------------------------------
diff --git a/thirdparty/jsoncpp/amalgamate.py b/thirdparty/jsoncpp/amalgamate.py
new file mode 100644
index 0000000..9cb2d08
--- /dev/null
+++ b/thirdparty/jsoncpp/amalgamate.py
@@ -0,0 +1,155 @@
+"""Amalgate json-cpp library sources into a single source and header file.
+
+Works with python2.6+ and python3.4+.
+
+Example of invocation (must be invoked from json-cpp top directory):
+python amalgate.py
+"""
+import os
+import os.path
+import sys
+
+class AmalgamationFile:
+ def __init__(self, top_dir):
+ self.top_dir = top_dir
+ self.blocks = []
+
+ def add_text(self, text):
+ if not text.endswith("\n"):
+ text += "\n"
+ self.blocks.append(text)
+
+ def add_file(self, relative_input_path, wrap_in_comment=False):
+ def add_marker(prefix):
+ self.add_text("")
+ self.add_text("// " + "/"*70)
+ self.add_text("// %s of content of file: %s" % (prefix, relative_input_path.replace("\\","/")))
+ self.add_text("// " + "/"*70)
+ self.add_text("")
+ add_marker("Beginning")
+ f = open(os.path.join(self.top_dir, relative_input_path), "rt")
+ content = f.read()
+ if wrap_in_comment:
+ content = "/*\n" + content + "\n*/"
+ self.add_text(content)
+ f.close()
+ add_marker("End")
+ self.add_text("\n\n\n\n")
+
+ def get_value(self):
+ return "".join(self.blocks).replace("\r\n","\n")
+
+ def write_to(self, output_path):
+ output_dir = os.path.dirname(output_path)
+ if output_dir and not os.path.isdir(output_dir):
+ os.makedirs(output_dir)
+ f = open(output_path, "wb")
+ f.write(str.encode(self.get_value(), 'UTF-8'))
+ f.close()
+
+def amalgamate_source(source_top_dir=None,
+ target_source_path=None,
+ header_include_path=None):
+ """Produces amalgated source.
+ Parameters:
+ source_top_dir: top-directory
+ target_source_path: output .cpp path
+ header_include_path: generated header path relative to target_source_path.
+ """
+ print("Amalgating header...")
+ header = AmalgamationFile(source_top_dir)
+ header.add_text("/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).")
+ header.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
+ header.add_file("LICENSE", wrap_in_comment=True)
+ header.add_text("#ifndef JSON_AMALGATED_H_INCLUDED")
+ header.add_text("# define JSON_AMALGATED_H_INCLUDED")
+ header.add_text("/// If defined, indicates that the source file is amalgated")
+ header.add_text("/// to prevent private header inclusion.")
+ header.add_text("#define JSON_IS_AMALGAMATION")
+ header.add_file("include/json/version.h")
+ #header.add_file("include/json/allocator.h") # Not available here.
+ header.add_file("include/json/config.h")
+ header.add_file("include/json/forwards.h")
+ header.add_file("include/json/features.h")
+ header.add_file("include/json/value.h")
+ header.add_file("include/json/reader.h")
+ header.add_file("include/json/writer.h")
+ header.add_file("include/json/assertions.h")
+ header.add_text("#endif //ifndef JSON_AMALGATED_H_INCLUDED")
+
+ target_header_path = os.path.join(os.path.dirname(target_source_path), header_include_path)
+ print("Writing amalgated header to %r" % target_header_path)
+ header.write_to(target_header_path)
+
+ base, ext = os.path.splitext(header_include_path)
+ forward_header_include_path = base + "-forwards" + ext
+ print("Amalgating forward header...")
+ header = AmalgamationFile(source_top_dir)
+ header.add_text("/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).")
+ header.add_text('/// It is intended to be used with #include "%s"' % forward_header_include_path)
+ header.add_text("/// This header provides forward declaration for all JsonCpp types.")
+ header.add_file("LICENSE", wrap_in_comment=True)
+ header.add_text("#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
+ header.add_text("# define JSON_FORWARD_AMALGATED_H_INCLUDED")
+ header.add_text("/// If defined, indicates that the source file is amalgated")
+ header.add_text("/// to prevent private header inclusion.")
+ header.add_text("#define JSON_IS_AMALGAMATION")
+ header.add_file("include/json/config.h")
+ header.add_file("include/json/forwards.h")
+ header.add_text("#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
+
+ target_forward_header_path = os.path.join(os.path.dirname(target_source_path),
+ forward_header_include_path)
+ print("Writing amalgated forward header to %r" % target_forward_header_path)
+ header.write_to(target_forward_header_path)
+
+ print("Amalgating source...")
+ source = AmalgamationFile(source_top_dir)
+ source.add_text("/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).")
+ source.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
+ source.add_file("LICENSE", wrap_in_comment=True)
+ source.add_text("")
+ source.add_text('#include "%s"' % header_include_path)
+ source.add_text("""
+#ifndef JSON_IS_AMALGAMATION
+#error "Compile with -I PATH_TO_JSON_DIRECTORY"
+#endif
+""")
+ source.add_text("")
+ lib_json = "src/lib_json"
+ source.add_file(os.path.join(lib_json, "json_tool.h"))
+ source.add_file(os.path.join(lib_json, "json_reader.cpp"))
+ source.add_file(os.path.join(lib_json, "json_valueiterator.inl"))
+ source.add_file(os.path.join(lib_json, "json_value.cpp"))
+ source.add_file(os.path.join(lib_json, "json_writer.cpp"))
+
+ print("Writing amalgated source to %r" % target_source_path)
+ source.write_to(target_source_path)
+
+def main():
+ usage = """%prog [options]
+Generate a single amalgated source and header file from the sources.
+"""
+ from optparse import OptionParser
+ parser = OptionParser(usage=usage)
+ parser.allow_interspersed_args = False
+ parser.add_option("-s", "--source", dest="target_source_path", action="store", default="dist/jsoncpp.cpp",
+ help="""Output .cpp source path. [Default: %default]""")
+ parser.add_option("-i", "--include", dest="header_include_path", action="store", default="json/json.h",
+ help="""Header include path. Used to include the header from the amalgated source file. [Default: %default]""")
+ parser.add_option("-t", "--top-dir", dest="top_dir", action="store", default=os.getcwd(),
+ help="""Source top-directory. [Default: %default]""")
+ parser.enable_interspersed_args()
+ options, args = parser.parse_args()
+
+ msg = amalgamate_source(source_top_dir=options.top_dir,
+ target_source_path=options.target_source_path,
+ header_include_path=options.header_include_path)
+ if msg:
+ sys.stderr.write(msg + "\n")
+ sys.exit(1)
+ else:
+ print("Source succesfully amalagated")
+
+if __name__ == "__main__":
+ main()
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/f3f8f531/thirdparty/jsoncpp/appveyor.yml
----------------------------------------------------------------------
diff --git a/thirdparty/jsoncpp/appveyor.yml b/thirdparty/jsoncpp/appveyor.yml
new file mode 100644
index 0000000..f4966a3
--- /dev/null
+++ b/thirdparty/jsoncpp/appveyor.yml
@@ -0,0 +1,35 @@
+# This is a comment.
+
+version: build.{build}
+
+os: Windows Server 2012 R2
+
+clone_folder: c:\projects\jsoncpp
+
+platform:
+ - Win32
+ - x64
+
+configuration:
+ - Debug
+ - Release
+
+# scripts to run before build
+before_build:
+ - echo "Running cmake..."
+ - cd c:\projects\jsoncpp
+ - cmake --version
+ - set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
+ - if %PLATFORM% == Win32 cmake .
+ - if %PLATFORM% == x64 cmake -G "Visual Studio 12 2013 Win64" .
+
+build:
+ project: jsoncpp.sln # path to Visual Studio solution or project
+
+deploy:
+ provider: GitHub
+ auth_token:
+ secure: K2Tp1q8pIZ7rs0Ot24ZMWuwr12Ev6Tc6QkhMjGQxoQG3ng1pXtgPasiJ45IDXGdg
+ on:
+ branch: master
+ appveyor_repo_tag: true
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/f3f8f531/thirdparty/jsoncpp/dev.makefile
----------------------------------------------------------------------
diff --git a/thirdparty/jsoncpp/dev.makefile b/thirdparty/jsoncpp/dev.makefile
new file mode 100644
index 0000000..d288b16
--- /dev/null
+++ b/thirdparty/jsoncpp/dev.makefile
@@ -0,0 +1,35 @@
+# This is only for jsoncpp developers/contributors.
+# We use this to sign releases, generate documentation, etc.
+VER?=$(shell cat version)
+
+default:
+ @echo "VER=${VER}"
+sign: jsoncpp-${VER}.tar.gz
+ gpg --armor --detach-sign $<
+ gpg --verify $<.asc
+ # Then upload .asc to the release.
+jsoncpp-%.tar.gz:
+ curl https://github.com/open-source-parsers/jsoncpp/archive/$*.tar.gz -o $@
+dox:
+ python doxybuild.py --doxygen=$$(which doxygen) --in doc/web_doxyfile.in
+ rsync -va --delete dist/doxygen/jsoncpp-api-html-${VER}/ ../jsoncpp-docs/doxygen/
+ # Then 'git add -A' and 'git push' in jsoncpp-docs.
+build:
+ mkdir -p build/debug
+ cd build/debug; cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_SHARED_LIBS=ON -G "Unix Makefiles" ../..
+ make -C build/debug
+
+# Currently, this depends on include/json/version.h generated
+# by cmake.
+test-amalgamate:
+ python2.7 amalgamate.py
+ python3.4 amalgamate.py
+ cd dist; gcc -I. -c jsoncpp.cpp
+
+valgrind:
+ valgrind --error-exitcode=42 --leak-check=full ./build/debug/src/test_lib_json/jsoncpp_test
+
+clean:
+ \rm -rf *.gz *.asc dist/
+
+.PHONY: build