Repository: mysql/mysql-router Branch: 8.0 Commit: cc0179f982bb Files: 1854 Total size: 27.1 MB Directory structure: gitextract_2ty1zw_5/ ├── .gitignore ├── CMakeLists.txt ├── License.txt ├── README.txt ├── cmake/ │ ├── Coverage.cmake │ ├── FindGMock.cmake │ ├── FindLibEvent2.cmake │ ├── FindMySQL.cmake │ ├── HarnessTesting.cmake │ ├── Plugin.cmake │ ├── TextUtils.cmake │ ├── cmake_parse_arguments.cmake │ ├── compile_flags.cmake │ ├── compiler.cmake │ ├── configure.cmake │ ├── docs.cmake │ ├── gmocktest.cmake │ ├── install_layout.cmake │ ├── libutils.cmake │ ├── mysqlx_protobuf.cmake │ ├── packaging.cmake │ ├── platform.cmake │ ├── protobuf.cmake │ ├── settings.cmake │ ├── ssl.cmake │ ├── testing.cmake │ └── version.cmake ├── config.h.in ├── doc/ │ ├── doxygen.cfg.in │ ├── router_doxygen.css │ ├── router_footer.html │ ├── router_header.html │ └── sample_mysqlrouter.conf ├── ext/ │ ├── RAPIDJSON-README │ ├── duktape/ │ │ └── duktape-2.1.0/ │ │ ├── LICENSE.txt │ │ ├── README.rst │ │ ├── extras/ │ │ │ ├── README.rst │ │ │ ├── alloc-pool/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.rst │ │ │ │ ├── duk_alloc_pool.c │ │ │ │ ├── duk_alloc_pool.h │ │ │ │ ├── ptrcomp.yaml │ │ │ │ ├── ptrcomp_fixup.h │ │ │ │ └── test.c │ │ │ ├── console/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.rst │ │ │ │ ├── duk_console.c │ │ │ │ ├── duk_console.h │ │ │ │ └── test.c │ │ │ ├── duk-v1-compat/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.rst │ │ │ │ ├── duk_v1_compat.c │ │ │ │ ├── duk_v1_compat.h │ │ │ │ ├── test.c │ │ │ │ ├── test_compile1.js │ │ │ │ ├── test_compile2.js │ │ │ │ ├── test_eval1.js │ │ │ │ └── test_eval2.js │ │ │ ├── logging/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.rst │ │ │ │ ├── duk_logging.c │ │ │ │ ├── duk_logging.h │ │ │ │ └── test.c │ │ │ ├── minimal-printf/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.rst │ │ │ │ ├── duk_minimal_printf.c │ │ │ │ ├── duk_minimal_printf.h │ │ │ │ └── test.c │ │ │ ├── module-duktape/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.rst │ │ │ │ ├── duk_module_duktape.c │ │ │ │ ├── duk_module_duktape.h │ │ │ │ └── test.c │ │ │ ├── module-node/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.rst │ │ │ │ ├── duk_module_node.c │ │ │ │ ├── duk_module_node.h │ │ │ │ └── test.c │ │ │ └── print-alert/ │ │ │ ├── Makefile │ │ │ ├── README.rst │ │ │ ├── duk_print_alert.c │ │ │ ├── duk_print_alert.h │ │ │ └── test.c │ │ ├── licenses/ │ │ │ ├── commonjs.txt │ │ │ ├── lua.txt │ │ │ ├── murmurhash2.txt │ │ │ ├── splitmix64.txt │ │ │ └── xoroshiro128plus.txt │ │ └── src/ │ │ ├── duk_config.h │ │ ├── duk_source_meta.json │ │ ├── duktape.c │ │ └── duktape.h │ ├── gmock/ │ │ ├── CHANGES │ │ ├── CMakeLists.txt │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── Makefile.am │ │ ├── README │ │ ├── build-aux/ │ │ │ └── .keep │ │ ├── configure.ac │ │ ├── include/ │ │ │ └── gmock/ │ │ │ ├── gmock-actions.h │ │ │ ├── gmock-cardinalities.h │ │ │ ├── gmock-generated-actions.h │ │ │ ├── gmock-generated-actions.h.pump │ │ │ ├── gmock-generated-function-mockers.h │ │ │ ├── gmock-generated-function-mockers.h.pump │ │ │ ├── gmock-generated-matchers.h │ │ │ ├── gmock-generated-matchers.h.pump │ │ │ ├── gmock-generated-nice-strict.h │ │ │ ├── gmock-generated-nice-strict.h.pump │ │ │ ├── gmock-matchers.h │ │ │ ├── gmock-more-actions.h │ │ │ ├── gmock-more-matchers.h │ │ │ ├── gmock-spec-builders.h │ │ │ ├── gmock.h │ │ │ └── internal/ │ │ │ ├── gmock-generated-internal-utils.h │ │ │ ├── gmock-generated-internal-utils.h.pump │ │ │ ├── gmock-internal-utils.h │ │ │ └── gmock-port.h │ │ ├── make/ │ │ │ └── Makefile │ │ ├── msvc/ │ │ │ ├── 2005/ │ │ │ │ ├── gmock.sln │ │ │ │ ├── gmock.vcproj │ │ │ │ ├── gmock_config.vsprops │ │ │ │ ├── gmock_main.vcproj │ │ │ │ └── gmock_test.vcproj │ │ │ └── 2010/ │ │ │ ├── gmock.sln │ │ │ ├── gmock.vcxproj │ │ │ ├── gmock_config.props │ │ │ ├── gmock_main.vcxproj │ │ │ └── gmock_test.vcxproj │ │ ├── scripts/ │ │ │ ├── fuse_gmock_files.py │ │ │ ├── generator/ │ │ │ │ ├── LICENSE │ │ │ │ ├── README │ │ │ │ ├── README.cppclean │ │ │ │ ├── cpp/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── ast.py │ │ │ │ │ ├── gmock_class.py │ │ │ │ │ ├── gmock_class_test.py │ │ │ │ │ ├── keywords.py │ │ │ │ │ ├── tokenize.py │ │ │ │ │ └── utils.py │ │ │ │ └── gmock_gen.py │ │ │ ├── gmock-config.in │ │ │ ├── gmock_doctor.py │ │ │ ├── upload.py │ │ │ └── upload_gmock.py │ │ ├── src/ │ │ │ ├── gmock-all.cc │ │ │ ├── gmock-cardinalities.cc │ │ │ ├── gmock-internal-utils.cc │ │ │ ├── gmock-matchers.cc │ │ │ ├── gmock-spec-builders.cc │ │ │ ├── gmock.cc │ │ │ └── gmock_main.cc │ │ └── test/ │ │ ├── gmock-actions_test.cc │ │ ├── gmock-cardinalities_test.cc │ │ ├── gmock-generated-actions_test.cc │ │ ├── gmock-generated-function-mockers_test.cc │ │ ├── gmock-generated-internal-utils_test.cc │ │ ├── gmock-generated-matchers_test.cc │ │ ├── gmock-internal-utils_test.cc │ │ ├── gmock-matchers_test.cc │ │ ├── gmock-more-actions_test.cc │ │ ├── gmock-nice-strict_test.cc │ │ ├── gmock-port_test.cc │ │ ├── gmock-spec-builders_test.cc │ │ ├── gmock_all_test.cc │ │ ├── gmock_ex_test.cc │ │ ├── gmock_leak_test.py │ │ ├── gmock_leak_test_.cc │ │ ├── gmock_link2_test.cc │ │ ├── gmock_link_test.cc │ │ ├── gmock_link_test.h │ │ ├── gmock_output_test.py │ │ ├── gmock_output_test_.cc │ │ ├── gmock_output_test_golden.txt │ │ ├── gmock_stress_test.cc │ │ ├── gmock_test.cc │ │ └── gmock_test_utils.py │ ├── gtest/ │ │ ├── CHANGES │ │ ├── CMakeLists.txt │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── Makefile.am │ │ ├── README │ │ ├── build-aux/ │ │ │ └── .keep │ │ ├── cmake/ │ │ │ └── internal_utils.cmake │ │ ├── codegear/ │ │ │ ├── gtest.cbproj │ │ │ ├── gtest.groupproj │ │ │ ├── gtest_all.cc │ │ │ ├── gtest_link.cc │ │ │ ├── gtest_main.cbproj │ │ │ └── gtest_unittest.cbproj │ │ ├── configure.ac │ │ ├── include/ │ │ │ └── gtest/ │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── gtest-param-test.h.pump │ │ │ ├── gtest-printers.h │ │ │ ├── gtest-spi.h │ │ │ ├── gtest-test-part.h │ │ │ ├── gtest-typed-test.h │ │ │ ├── gtest.h │ │ │ ├── gtest_pred_impl.h │ │ │ ├── gtest_prod.h │ │ │ └── internal/ │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-linked_ptr.h │ │ │ ├── gtest-param-util-generated.h │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-tuple.h │ │ │ ├── gtest-tuple.h.pump │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ │ ├── m4/ │ │ │ ├── acx_pthread.m4 │ │ │ └── gtest.m4 │ │ ├── make/ │ │ │ └── Makefile │ │ ├── msvc/ │ │ │ ├── gtest-md.sln │ │ │ ├── gtest-md.vcproj │ │ │ ├── gtest.sln │ │ │ ├── gtest.vcproj │ │ │ ├── gtest_main-md.vcproj │ │ │ ├── gtest_main.vcproj │ │ │ ├── gtest_prod_test-md.vcproj │ │ │ ├── gtest_prod_test.vcproj │ │ │ ├── gtest_unittest-md.vcproj │ │ │ └── gtest_unittest.vcproj │ │ ├── samples/ │ │ │ ├── prime_tables.h │ │ │ ├── sample1.cc │ │ │ ├── sample1.h │ │ │ ├── sample10_unittest.cc │ │ │ ├── sample1_unittest.cc │ │ │ ├── sample2.cc │ │ │ ├── sample2.h │ │ │ ├── sample2_unittest.cc │ │ │ ├── sample3-inl.h │ │ │ ├── sample3_unittest.cc │ │ │ ├── sample4.cc │ │ │ ├── sample4.h │ │ │ ├── sample4_unittest.cc │ │ │ ├── sample5_unittest.cc │ │ │ ├── sample6_unittest.cc │ │ │ ├── sample7_unittest.cc │ │ │ ├── sample8_unittest.cc │ │ │ └── sample9_unittest.cc │ │ ├── scripts/ │ │ │ ├── fuse_gtest_files.py │ │ │ ├── gen_gtest_pred_impl.py │ │ │ ├── gtest-config.in │ │ │ ├── pump.py │ │ │ ├── test/ │ │ │ │ └── Makefile │ │ │ ├── upload.py │ │ │ └── upload_gtest.py │ │ ├── src/ │ │ │ ├── gtest-all.cc │ │ │ ├── gtest-death-test.cc │ │ │ ├── gtest-filepath.cc │ │ │ ├── gtest-internal-inl.h │ │ │ ├── gtest-port.cc │ │ │ ├── gtest-printers.cc │ │ │ ├── gtest-test-part.cc │ │ │ ├── gtest-typed-test.cc │ │ │ ├── gtest.cc │ │ │ └── gtest_main.cc │ │ ├── test/ │ │ │ ├── gtest-death-test_ex_test.cc │ │ │ ├── gtest-death-test_test.cc │ │ │ ├── gtest-filepath_test.cc │ │ │ ├── gtest-linked_ptr_test.cc │ │ │ ├── gtest-listener_test.cc │ │ │ ├── gtest-message_test.cc │ │ │ ├── gtest-options_test.cc │ │ │ ├── gtest-param-test2_test.cc │ │ │ ├── gtest-param-test_test.cc │ │ │ ├── gtest-param-test_test.h │ │ │ ├── gtest-port_test.cc │ │ │ ├── gtest-printers_test.cc │ │ │ ├── gtest-test-part_test.cc │ │ │ ├── gtest-tuple_test.cc │ │ │ ├── gtest-typed-test2_test.cc │ │ │ ├── gtest-typed-test_test.cc │ │ │ ├── gtest-typed-test_test.h │ │ │ ├── gtest-unittest-api_test.cc │ │ │ ├── gtest_all_test.cc │ │ │ ├── gtest_break_on_failure_unittest.py │ │ │ ├── gtest_break_on_failure_unittest_.cc │ │ │ ├── gtest_catch_exceptions_test.py │ │ │ ├── gtest_catch_exceptions_test_.cc │ │ │ ├── gtest_color_test.py │ │ │ ├── gtest_color_test_.cc │ │ │ ├── gtest_env_var_test.py │ │ │ ├── gtest_env_var_test_.cc │ │ │ ├── gtest_environment_test.cc │ │ │ ├── gtest_filter_unittest.py │ │ │ ├── gtest_filter_unittest_.cc │ │ │ ├── gtest_help_test.py │ │ │ ├── gtest_help_test_.cc │ │ │ ├── gtest_list_tests_unittest.py │ │ │ ├── gtest_list_tests_unittest_.cc │ │ │ ├── gtest_main_unittest.cc │ │ │ ├── gtest_no_test_unittest.cc │ │ │ ├── gtest_output_test.py │ │ │ ├── gtest_output_test_.cc │ │ │ ├── gtest_output_test_golden_lin.txt │ │ │ ├── gtest_pred_impl_unittest.cc │ │ │ ├── gtest_premature_exit_test.cc │ │ │ ├── gtest_prod_test.cc │ │ │ ├── gtest_repeat_test.cc │ │ │ ├── gtest_shuffle_test.py │ │ │ ├── gtest_shuffle_test_.cc │ │ │ ├── gtest_sole_header_test.cc │ │ │ ├── gtest_stress_test.cc │ │ │ ├── gtest_test_utils.py │ │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ │ ├── gtest_throw_on_failure_test.py │ │ │ ├── gtest_throw_on_failure_test_.cc │ │ │ ├── gtest_uninitialized_test.py │ │ │ ├── gtest_uninitialized_test_.cc │ │ │ ├── gtest_unittest.cc │ │ │ ├── gtest_xml_outfile1_test_.cc │ │ │ ├── gtest_xml_outfile2_test_.cc │ │ │ ├── gtest_xml_outfiles_test.py │ │ │ ├── gtest_xml_output_unittest.py │ │ │ ├── gtest_xml_output_unittest_.cc │ │ │ ├── gtest_xml_test_utils.py │ │ │ ├── production.cc │ │ │ └── production.h │ │ └── xcode/ │ │ ├── Config/ │ │ │ ├── DebugProject.xcconfig │ │ │ ├── FrameworkTarget.xcconfig │ │ │ ├── General.xcconfig │ │ │ ├── ReleaseProject.xcconfig │ │ │ ├── StaticLibraryTarget.xcconfig │ │ │ └── TestTarget.xcconfig │ │ ├── Resources/ │ │ │ └── Info.plist │ │ ├── Samples/ │ │ │ └── FrameworkSample/ │ │ │ ├── Info.plist │ │ │ ├── WidgetFramework.xcodeproj/ │ │ │ │ └── project.pbxproj │ │ │ ├── runtests.sh │ │ │ ├── widget.cc │ │ │ ├── widget.h │ │ │ └── widget_test.cc │ │ ├── Scripts/ │ │ │ ├── runtests.sh │ │ │ └── versiongenerate.py │ │ └── gtest.xcodeproj/ │ │ └── project.pbxproj │ ├── protobuf/ │ │ ├── CMakeLists.txt │ │ └── protobuf-3.0.0/ │ │ ├── BUILD │ │ ├── CHANGES.txt │ │ ├── CONTRIBUTORS.txt │ │ ├── LICENSE │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── README.md │ │ ├── WORKSPACE │ │ ├── aclocal.m4 │ │ ├── ar-lib │ │ ├── autogen.sh │ │ ├── cmake/ │ │ │ ├── CMakeLists.txt │ │ │ ├── README.md │ │ │ ├── examples.cmake │ │ │ ├── extract_includes.bat.in │ │ │ ├── install.cmake │ │ │ ├── libprotobuf-lite.cmake │ │ │ ├── libprotobuf.cmake │ │ │ ├── libprotoc.cmake │ │ │ ├── protobuf-config-version.cmake.in │ │ │ ├── protobuf-config.cmake.in │ │ │ ├── protobuf-module.cmake.in │ │ │ ├── protobuf-options.cmake │ │ │ ├── protoc.cmake │ │ │ └── tests.cmake │ │ ├── compile │ │ ├── config.guess │ │ ├── config.h.in │ │ ├── config.sub │ │ ├── configure │ │ ├── configure.ac │ │ ├── conformance/ │ │ │ ├── ConformanceJava.java │ │ │ ├── ConformanceJavaLite.java │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── README.md │ │ │ ├── conformance.proto │ │ │ ├── conformance_cpp.cc │ │ │ ├── conformance_objc.m │ │ │ ├── conformance_python.py │ │ │ ├── conformance_ruby.rb │ │ │ ├── conformance_test.cc │ │ │ ├── conformance_test.h │ │ │ ├── conformance_test_runner.cc │ │ │ ├── failure_list_cpp.txt │ │ │ ├── failure_list_csharp.txt │ │ │ ├── failure_list_java.txt │ │ │ ├── failure_list_objc.txt │ │ │ ├── failure_list_python-post26.txt │ │ │ ├── failure_list_python.txt │ │ │ ├── failure_list_python_cpp.txt │ │ │ ├── failure_list_ruby.txt │ │ │ └── third_party/ │ │ │ └── jsoncpp/ │ │ │ ├── json.h │ │ │ └── jsoncpp.cpp │ │ ├── depcomp │ │ ├── editors/ │ │ │ ├── README.txt │ │ │ ├── proto.vim │ │ │ └── protobuf-mode.el │ │ ├── generate_descriptor_proto.sh │ │ ├── gmock.BUILD │ │ ├── install-sh │ │ ├── ltmain.sh │ │ ├── m4/ │ │ │ ├── ac_system_extensions.m4 │ │ │ ├── acx_check_suncc.m4 │ │ │ ├── acx_pthread.m4 │ │ │ ├── libtool.m4 │ │ │ ├── ltoptions.m4 │ │ │ ├── ltsugar.m4 │ │ │ ├── ltversion.m4 │ │ │ ├── lt~obsolete.m4 │ │ │ └── stl_hash.m4 │ │ ├── missing │ │ ├── protobuf-lite.pc.in │ │ ├── protobuf.bzl │ │ ├── protobuf.pc.in │ │ ├── six.BUILD │ │ ├── src/ │ │ │ ├── Makefile.am │ │ │ ├── Makefile.in │ │ │ ├── README.md │ │ │ └── google/ │ │ │ └── protobuf/ │ │ │ ├── any.cc │ │ │ ├── any.h │ │ │ ├── any.pb.cc │ │ │ ├── any.pb.h │ │ │ ├── any.proto │ │ │ ├── any_test.cc │ │ │ ├── any_test.proto │ │ │ ├── api.pb.cc │ │ │ ├── api.pb.h │ │ │ ├── api.proto │ │ │ ├── arena.cc │ │ │ ├── arena.h │ │ │ ├── arena_test_util.cc │ │ │ ├── arena_test_util.h │ │ │ ├── arena_unittest.cc │ │ │ ├── arenastring.cc │ │ │ ├── arenastring.h │ │ │ ├── arenastring_unittest.cc │ │ │ ├── compiler/ │ │ │ │ ├── code_generator.cc │ │ │ │ ├── code_generator.h │ │ │ │ ├── command_line_interface.cc │ │ │ │ ├── command_line_interface.h │ │ │ │ ├── command_line_interface_unittest.cc │ │ │ │ ├── cpp/ │ │ │ │ │ ├── cpp_bootstrap_unittest.cc │ │ │ │ │ ├── cpp_enum.cc │ │ │ │ │ ├── cpp_enum.h │ │ │ │ │ ├── cpp_enum_field.cc │ │ │ │ │ ├── cpp_enum_field.h │ │ │ │ │ ├── cpp_extension.cc │ │ │ │ │ ├── cpp_extension.h │ │ │ │ │ ├── cpp_field.cc │ │ │ │ │ ├── cpp_field.h │ │ │ │ │ ├── cpp_file.cc │ │ │ │ │ ├── cpp_file.h │ │ │ │ │ ├── cpp_generator.cc │ │ │ │ │ ├── cpp_generator.h │ │ │ │ │ ├── cpp_helpers.cc │ │ │ │ │ ├── cpp_helpers.h │ │ │ │ │ ├── cpp_map_field.cc │ │ │ │ │ ├── cpp_map_field.h │ │ │ │ │ ├── cpp_message.cc │ │ │ │ │ ├── cpp_message.h │ │ │ │ │ ├── cpp_message_field.cc │ │ │ │ │ ├── cpp_message_field.h │ │ │ │ │ ├── cpp_options.h │ │ │ │ │ ├── cpp_plugin_unittest.cc │ │ │ │ │ ├── cpp_primitive_field.cc │ │ │ │ │ ├── cpp_primitive_field.h │ │ │ │ │ ├── cpp_service.cc │ │ │ │ │ ├── cpp_service.h │ │ │ │ │ ├── cpp_string_field.cc │ │ │ │ │ ├── cpp_string_field.h │ │ │ │ │ ├── cpp_test_bad_identifiers.proto │ │ │ │ │ ├── cpp_test_large_enum_value.proto │ │ │ │ │ ├── cpp_unittest.cc │ │ │ │ │ ├── cpp_unittest.h │ │ │ │ │ └── metadata_test.cc │ │ │ │ ├── csharp/ │ │ │ │ │ ├── csharp_doc_comment.cc │ │ │ │ │ ├── csharp_doc_comment.h │ │ │ │ │ ├── csharp_enum.cc │ │ │ │ │ ├── csharp_enum.h │ │ │ │ │ ├── csharp_enum_field.cc │ │ │ │ │ ├── csharp_enum_field.h │ │ │ │ │ ├── csharp_field_base.cc │ │ │ │ │ ├── csharp_field_base.h │ │ │ │ │ ├── csharp_generator.cc │ │ │ │ │ ├── csharp_generator.h │ │ │ │ │ ├── csharp_generator_unittest.cc │ │ │ │ │ ├── csharp_helpers.cc │ │ │ │ │ ├── csharp_helpers.h │ │ │ │ │ ├── csharp_map_field.cc │ │ │ │ │ ├── csharp_map_field.h │ │ │ │ │ ├── csharp_message.cc │ │ │ │ │ ├── csharp_message.h │ │ │ │ │ ├── csharp_message_field.cc │ │ │ │ │ ├── csharp_message_field.h │ │ │ │ │ ├── csharp_names.h │ │ │ │ │ ├── csharp_options.h │ │ │ │ │ ├── csharp_primitive_field.cc │ │ │ │ │ ├── csharp_primitive_field.h │ │ │ │ │ ├── csharp_reflection_class.cc │ │ │ │ │ ├── csharp_reflection_class.h │ │ │ │ │ ├── csharp_repeated_enum_field.cc │ │ │ │ │ ├── csharp_repeated_enum_field.h │ │ │ │ │ ├── csharp_repeated_message_field.cc │ │ │ │ │ ├── csharp_repeated_message_field.h │ │ │ │ │ ├── csharp_repeated_primitive_field.cc │ │ │ │ │ ├── csharp_repeated_primitive_field.h │ │ │ │ │ ├── csharp_source_generator_base.cc │ │ │ │ │ ├── csharp_source_generator_base.h │ │ │ │ │ ├── csharp_wrapper_field.cc │ │ │ │ │ └── csharp_wrapper_field.h │ │ │ │ ├── importer.cc │ │ │ │ ├── importer.h │ │ │ │ ├── importer_unittest.cc │ │ │ │ ├── java/ │ │ │ │ │ ├── java_context.cc │ │ │ │ │ ├── java_context.h │ │ │ │ │ ├── java_doc_comment.cc │ │ │ │ │ ├── java_doc_comment.h │ │ │ │ │ ├── java_doc_comment_unittest.cc │ │ │ │ │ ├── java_enum.cc │ │ │ │ │ ├── java_enum.h │ │ │ │ │ ├── java_enum_field.cc │ │ │ │ │ ├── java_enum_field.h │ │ │ │ │ ├── java_enum_field_lite.cc │ │ │ │ │ ├── java_enum_field_lite.h │ │ │ │ │ ├── java_enum_lite.cc │ │ │ │ │ ├── java_enum_lite.h │ │ │ │ │ ├── java_extension.cc │ │ │ │ │ ├── java_extension.h │ │ │ │ │ ├── java_extension_lite.cc │ │ │ │ │ ├── java_extension_lite.h │ │ │ │ │ ├── java_field.cc │ │ │ │ │ ├── java_field.h │ │ │ │ │ ├── java_file.cc │ │ │ │ │ ├── java_file.h │ │ │ │ │ ├── java_generator.cc │ │ │ │ │ ├── java_generator.h │ │ │ │ │ ├── java_generator_factory.cc │ │ │ │ │ ├── java_generator_factory.h │ │ │ │ │ ├── java_helpers.cc │ │ │ │ │ ├── java_helpers.h │ │ │ │ │ ├── java_lazy_message_field.cc │ │ │ │ │ ├── java_lazy_message_field.h │ │ │ │ │ ├── java_lazy_message_field_lite.cc │ │ │ │ │ ├── java_lazy_message_field_lite.h │ │ │ │ │ ├── java_map_field.cc │ │ │ │ │ ├── java_map_field.h │ │ │ │ │ ├── java_map_field_lite.cc │ │ │ │ │ ├── java_map_field_lite.h │ │ │ │ │ ├── java_message.cc │ │ │ │ │ ├── java_message.h │ │ │ │ │ ├── java_message_builder.cc │ │ │ │ │ ├── java_message_builder.h │ │ │ │ │ ├── java_message_builder_lite.cc │ │ │ │ │ ├── java_message_builder_lite.h │ │ │ │ │ ├── java_message_field.cc │ │ │ │ │ ├── java_message_field.h │ │ │ │ │ ├── java_message_field_lite.cc │ │ │ │ │ ├── java_message_field_lite.h │ │ │ │ │ ├── java_message_lite.cc │ │ │ │ │ ├── java_message_lite.h │ │ │ │ │ ├── java_name_resolver.cc │ │ │ │ │ ├── java_name_resolver.h │ │ │ │ │ ├── java_names.h │ │ │ │ │ ├── java_options.h │ │ │ │ │ ├── java_plugin_unittest.cc │ │ │ │ │ ├── java_primitive_field.cc │ │ │ │ │ ├── java_primitive_field.h │ │ │ │ │ ├── java_primitive_field_lite.cc │ │ │ │ │ ├── java_primitive_field_lite.h │ │ │ │ │ ├── java_service.cc │ │ │ │ │ ├── java_service.h │ │ │ │ │ ├── java_shared_code_generator.cc │ │ │ │ │ ├── java_shared_code_generator.h │ │ │ │ │ ├── java_string_field.cc │ │ │ │ │ ├── java_string_field.h │ │ │ │ │ ├── java_string_field_lite.cc │ │ │ │ │ └── java_string_field_lite.h │ │ │ │ ├── javanano/ │ │ │ │ │ ├── javanano_enum.cc │ │ │ │ │ ├── javanano_enum.h │ │ │ │ │ ├── javanano_enum_field.cc │ │ │ │ │ ├── javanano_enum_field.h │ │ │ │ │ ├── javanano_extension.cc │ │ │ │ │ ├── javanano_extension.h │ │ │ │ │ ├── javanano_field.cc │ │ │ │ │ ├── javanano_field.h │ │ │ │ │ ├── javanano_file.cc │ │ │ │ │ ├── javanano_file.h │ │ │ │ │ ├── javanano_generator.cc │ │ │ │ │ ├── javanano_generator.h │ │ │ │ │ ├── javanano_helpers.cc │ │ │ │ │ ├── javanano_helpers.h │ │ │ │ │ ├── javanano_map_field.cc │ │ │ │ │ ├── javanano_map_field.h │ │ │ │ │ ├── javanano_message.cc │ │ │ │ │ ├── javanano_message.h │ │ │ │ │ ├── javanano_message_field.cc │ │ │ │ │ ├── javanano_message_field.h │ │ │ │ │ ├── javanano_params.h │ │ │ │ │ ├── javanano_primitive_field.cc │ │ │ │ │ └── javanano_primitive_field.h │ │ │ │ ├── js/ │ │ │ │ │ ├── js_generator.cc │ │ │ │ │ └── js_generator.h │ │ │ │ ├── main.cc │ │ │ │ ├── mock_code_generator.cc │ │ │ │ ├── mock_code_generator.h │ │ │ │ ├── objectivec/ │ │ │ │ │ ├── objectivec_enum.cc │ │ │ │ │ ├── objectivec_enum.h │ │ │ │ │ ├── objectivec_enum_field.cc │ │ │ │ │ ├── objectivec_enum_field.h │ │ │ │ │ ├── objectivec_extension.cc │ │ │ │ │ ├── objectivec_extension.h │ │ │ │ │ ├── objectivec_field.cc │ │ │ │ │ ├── objectivec_field.h │ │ │ │ │ ├── objectivec_file.cc │ │ │ │ │ ├── objectivec_file.h │ │ │ │ │ ├── objectivec_generator.cc │ │ │ │ │ ├── objectivec_generator.h │ │ │ │ │ ├── objectivec_helpers.cc │ │ │ │ │ ├── objectivec_helpers.h │ │ │ │ │ ├── objectivec_helpers_unittest.cc │ │ │ │ │ ├── objectivec_map_field.cc │ │ │ │ │ ├── objectivec_map_field.h │ │ │ │ │ ├── objectivec_message.cc │ │ │ │ │ ├── objectivec_message.h │ │ │ │ │ ├── objectivec_message_field.cc │ │ │ │ │ ├── objectivec_message_field.h │ │ │ │ │ ├── objectivec_oneof.cc │ │ │ │ │ ├── objectivec_oneof.h │ │ │ │ │ ├── objectivec_primitive_field.cc │ │ │ │ │ └── objectivec_primitive_field.h │ │ │ │ ├── package_info.h │ │ │ │ ├── parser.cc │ │ │ │ ├── parser.h │ │ │ │ ├── parser_unittest.cc │ │ │ │ ├── plugin.cc │ │ │ │ ├── plugin.h │ │ │ │ ├── plugin.pb.cc │ │ │ │ ├── plugin.pb.h │ │ │ │ ├── plugin.proto │ │ │ │ ├── python/ │ │ │ │ │ ├── python_generator.cc │ │ │ │ │ ├── python_generator.h │ │ │ │ │ └── python_plugin_unittest.cc │ │ │ │ ├── ruby/ │ │ │ │ │ ├── ruby_generated_code.proto │ │ │ │ │ ├── ruby_generated_code_pb.rb │ │ │ │ │ ├── ruby_generator.cc │ │ │ │ │ ├── ruby_generator.h │ │ │ │ │ └── ruby_generator_unittest.cc │ │ │ │ ├── subprocess.cc │ │ │ │ ├── subprocess.h │ │ │ │ ├── test_plugin.cc │ │ │ │ ├── zip_output_unittest.sh │ │ │ │ ├── zip_writer.cc │ │ │ │ └── zip_writer.h │ │ │ ├── descriptor.cc │ │ │ ├── descriptor.h │ │ │ ├── descriptor.pb.cc │ │ │ ├── descriptor.pb.h │ │ │ ├── descriptor.proto │ │ │ ├── descriptor_database.cc │ │ │ ├── descriptor_database.h │ │ │ ├── descriptor_database_unittest.cc │ │ │ ├── descriptor_unittest.cc │ │ │ ├── drop_unknown_fields_test.cc │ │ │ ├── duration.pb.cc │ │ │ ├── duration.pb.h │ │ │ ├── duration.proto │ │ │ ├── dynamic_message.cc │ │ │ ├── dynamic_message.h │ │ │ ├── dynamic_message_unittest.cc │ │ │ ├── empty.pb.cc │ │ │ ├── empty.pb.h │ │ │ ├── empty.proto │ │ │ ├── extension_set.cc │ │ │ ├── extension_set.h │ │ │ ├── extension_set_heavy.cc │ │ │ ├── extension_set_unittest.cc │ │ │ ├── field_mask.pb.cc │ │ │ ├── field_mask.pb.h │ │ │ ├── field_mask.proto │ │ │ ├── generated_enum_reflection.h │ │ │ ├── generated_enum_util.h │ │ │ ├── generated_message_reflection.cc │ │ │ ├── generated_message_reflection.h │ │ │ ├── generated_message_reflection_unittest.cc │ │ │ ├── generated_message_util.cc │ │ │ ├── generated_message_util.h │ │ │ ├── io/ │ │ │ │ ├── coded_stream.cc │ │ │ │ ├── coded_stream.h │ │ │ │ ├── coded_stream_inl.h │ │ │ │ ├── coded_stream_unittest.cc │ │ │ │ ├── gzip_stream.cc │ │ │ │ ├── gzip_stream.h │ │ │ │ ├── gzip_stream_unittest.sh │ │ │ │ ├── package_info.h │ │ │ │ ├── printer.cc │ │ │ │ ├── printer.h │ │ │ │ ├── printer_unittest.cc │ │ │ │ ├── strtod.cc │ │ │ │ ├── strtod.h │ │ │ │ ├── tokenizer.cc │ │ │ │ ├── tokenizer.h │ │ │ │ ├── tokenizer_unittest.cc │ │ │ │ ├── zero_copy_stream.cc │ │ │ │ ├── zero_copy_stream.h │ │ │ │ ├── zero_copy_stream_impl.cc │ │ │ │ ├── zero_copy_stream_impl.h │ │ │ │ ├── zero_copy_stream_impl_lite.cc │ │ │ │ ├── zero_copy_stream_impl_lite.h │ │ │ │ └── zero_copy_stream_unittest.cc │ │ │ ├── lite_arena_unittest.cc │ │ │ ├── lite_unittest.cc │ │ │ ├── map.h │ │ │ ├── map_entry.h │ │ │ ├── map_entry_lite.h │ │ │ ├── map_field.cc │ │ │ ├── map_field.h │ │ │ ├── map_field_inl.h │ │ │ ├── map_field_lite.h │ │ │ ├── map_field_test.cc │ │ │ ├── map_lite_test_util.cc │ │ │ ├── map_lite_test_util.h │ │ │ ├── map_lite_unittest.proto │ │ │ ├── map_proto2_unittest.proto │ │ │ ├── map_test.cc │ │ │ ├── map_test_util.cc │ │ │ ├── map_test_util.h │ │ │ ├── map_test_util_impl.h │ │ │ ├── map_type_handler.h │ │ │ ├── map_unittest.proto │ │ │ ├── message.cc │ │ │ ├── message.h │ │ │ ├── message_lite.cc │ │ │ ├── message_lite.h │ │ │ ├── message_unittest.cc │ │ │ ├── metadata.h │ │ │ ├── no_field_presence_test.cc │ │ │ ├── package_info.h │ │ │ ├── preserve_unknown_enum_test.cc │ │ │ ├── proto3_arena_lite_unittest.cc │ │ │ ├── proto3_arena_unittest.cc │ │ │ ├── proto3_lite_unittest.cc │ │ │ ├── reflection.h │ │ │ ├── reflection_internal.h │ │ │ ├── reflection_ops.cc │ │ │ ├── reflection_ops.h │ │ │ ├── reflection_ops_unittest.cc │ │ │ ├── repeated_field.cc │ │ │ ├── repeated_field.h │ │ │ ├── repeated_field_reflection_unittest.cc │ │ │ ├── repeated_field_unittest.cc │ │ │ ├── service.cc │ │ │ ├── service.h │ │ │ ├── source_context.pb.cc │ │ │ ├── source_context.pb.h │ │ │ ├── source_context.proto │ │ │ ├── struct.pb.cc │ │ │ ├── struct.pb.h │ │ │ ├── struct.proto │ │ │ ├── stubs/ │ │ │ │ ├── atomic_sequence_num.h │ │ │ │ ├── atomicops.h │ │ │ │ ├── atomicops_internals_arm64_gcc.h │ │ │ │ ├── atomicops_internals_arm_gcc.h │ │ │ │ ├── atomicops_internals_arm_qnx.h │ │ │ │ ├── atomicops_internals_atomicword_compat.h │ │ │ │ ├── atomicops_internals_generic_gcc.h │ │ │ │ ├── atomicops_internals_macosx.h │ │ │ │ ├── atomicops_internals_mips_gcc.h │ │ │ │ ├── atomicops_internals_pnacl.h │ │ │ │ ├── atomicops_internals_power.h │ │ │ │ ├── atomicops_internals_ppc_gcc.h │ │ │ │ ├── atomicops_internals_solaris.h │ │ │ │ ├── atomicops_internals_tsan.h │ │ │ │ ├── atomicops_internals_x86_gcc.cc │ │ │ │ ├── atomicops_internals_x86_gcc.h │ │ │ │ ├── atomicops_internals_x86_msvc.cc │ │ │ │ ├── atomicops_internals_x86_msvc.h │ │ │ │ ├── bytestream.cc │ │ │ │ ├── bytestream.h │ │ │ │ ├── bytestream_unittest.cc │ │ │ │ ├── callback.h │ │ │ │ ├── casts.h │ │ │ │ ├── common.cc │ │ │ │ ├── common.h │ │ │ │ ├── common_unittest.cc │ │ │ │ ├── fastmem.h │ │ │ │ ├── hash.h │ │ │ │ ├── int128.cc │ │ │ │ ├── int128.h │ │ │ │ ├── int128_unittest.cc │ │ │ │ ├── logging.h │ │ │ │ ├── macros.h │ │ │ │ ├── map_util.h │ │ │ │ ├── mathlimits.cc │ │ │ │ ├── mathlimits.h │ │ │ │ ├── mathutil.h │ │ │ │ ├── mutex.h │ │ │ │ ├── once.cc │ │ │ │ ├── once.h │ │ │ │ ├── once_unittest.cc │ │ │ │ ├── platform_macros.h │ │ │ │ ├── port.h │ │ │ │ ├── scoped_ptr.h │ │ │ │ ├── shared_ptr.h │ │ │ │ ├── singleton.h │ │ │ │ ├── status.cc │ │ │ │ ├── status.h │ │ │ │ ├── status_macros.h │ │ │ │ ├── status_test.cc │ │ │ │ ├── statusor.cc │ │ │ │ ├── statusor.h │ │ │ │ ├── statusor_test.cc │ │ │ │ ├── stl_util.h │ │ │ │ ├── stringpiece.cc │ │ │ │ ├── stringpiece.h │ │ │ │ ├── stringpiece_unittest.cc │ │ │ │ ├── stringprintf.cc │ │ │ │ ├── stringprintf.h │ │ │ │ ├── stringprintf_unittest.cc │ │ │ │ ├── structurally_valid.cc │ │ │ │ ├── structurally_valid_unittest.cc │ │ │ │ ├── strutil.cc │ │ │ │ ├── strutil.h │ │ │ │ ├── strutil_unittest.cc │ │ │ │ ├── substitute.cc │ │ │ │ ├── substitute.h │ │ │ │ ├── template_util.h │ │ │ │ ├── template_util_unittest.cc │ │ │ │ ├── time.cc │ │ │ │ ├── time.h │ │ │ │ ├── time_test.cc │ │ │ │ ├── type_traits.h │ │ │ │ └── type_traits_unittest.cc │ │ │ ├── test_util.cc │ │ │ ├── test_util.h │ │ │ ├── test_util_lite.cc │ │ │ ├── test_util_lite.h │ │ │ ├── testdata/ │ │ │ │ ├── bad_utf8_string │ │ │ │ ├── golden_message │ │ │ │ ├── golden_message_maps │ │ │ │ ├── golden_message_oneof_implemented │ │ │ │ ├── golden_message_proto3 │ │ │ │ ├── golden_packed_fields_message │ │ │ │ ├── map_test_data.txt │ │ │ │ ├── text_format_unittest_data.txt │ │ │ │ ├── text_format_unittest_data_oneof_implemented.txt │ │ │ │ ├── text_format_unittest_data_pointy.txt │ │ │ │ ├── text_format_unittest_data_pointy_oneof.txt │ │ │ │ ├── text_format_unittest_extensions_data.txt │ │ │ │ └── text_format_unittest_extensions_data_pointy.txt │ │ │ ├── testing/ │ │ │ │ ├── file.cc │ │ │ │ ├── file.h │ │ │ │ ├── googletest.cc │ │ │ │ ├── googletest.h │ │ │ │ ├── zcgunzip.cc │ │ │ │ └── zcgzip.cc │ │ │ ├── text_format.cc │ │ │ ├── text_format.h │ │ │ ├── text_format_unittest.cc │ │ │ ├── timestamp.pb.cc │ │ │ ├── timestamp.pb.h │ │ │ ├── timestamp.proto │ │ │ ├── type.pb.cc │ │ │ ├── type.pb.h │ │ │ ├── type.proto │ │ │ ├── unittest.proto │ │ │ ├── unittest_arena.proto │ │ │ ├── unittest_custom_options.proto │ │ │ ├── unittest_drop_unknown_fields.proto │ │ │ ├── unittest_embed_optimize_for.proto │ │ │ ├── unittest_empty.proto │ │ │ ├── unittest_enormous_descriptor.proto │ │ │ ├── unittest_import.proto │ │ │ ├── unittest_import_lite.proto │ │ │ ├── unittest_import_public.proto │ │ │ ├── unittest_import_public_lite.proto │ │ │ ├── unittest_lite.proto │ │ │ ├── unittest_lite_imports_nonlite.proto │ │ │ ├── unittest_mset.proto │ │ │ ├── unittest_mset_wire_format.proto │ │ │ ├── unittest_no_arena.proto │ │ │ ├── unittest_no_arena_import.proto │ │ │ ├── unittest_no_arena_lite.proto │ │ │ ├── unittest_no_field_presence.proto │ │ │ ├── unittest_no_generic_services.proto │ │ │ ├── unittest_optimize_for.proto │ │ │ ├── unittest_preserve_unknown_enum.proto │ │ │ ├── unittest_preserve_unknown_enum2.proto │ │ │ ├── unittest_proto3_arena.proto │ │ │ ├── unittest_proto3_arena_lite.proto │ │ │ ├── unittest_proto3_lite.proto │ │ │ ├── unittest_well_known_types.proto │ │ │ ├── unknown_field_set.cc │ │ │ ├── unknown_field_set.h │ │ │ ├── unknown_field_set_unittest.cc │ │ │ ├── util/ │ │ │ │ ├── field_comparator.cc │ │ │ │ ├── field_comparator.h │ │ │ │ ├── field_comparator_test.cc │ │ │ │ ├── field_mask_util.cc │ │ │ │ ├── field_mask_util.h │ │ │ │ ├── field_mask_util_test.cc │ │ │ │ ├── internal/ │ │ │ │ │ ├── constants.h │ │ │ │ │ ├── datapiece.cc │ │ │ │ │ ├── datapiece.h │ │ │ │ │ ├── default_value_objectwriter.cc │ │ │ │ │ ├── default_value_objectwriter.h │ │ │ │ │ ├── default_value_objectwriter_test.cc │ │ │ │ │ ├── error_listener.cc │ │ │ │ │ ├── error_listener.h │ │ │ │ │ ├── expecting_objectwriter.h │ │ │ │ │ ├── field_mask_utility.cc │ │ │ │ │ ├── field_mask_utility.h │ │ │ │ │ ├── json_escaping.cc │ │ │ │ │ ├── json_escaping.h │ │ │ │ │ ├── json_objectwriter.cc │ │ │ │ │ ├── json_objectwriter.h │ │ │ │ │ ├── json_objectwriter_test.cc │ │ │ │ │ ├── json_stream_parser.cc │ │ │ │ │ ├── json_stream_parser.h │ │ │ │ │ ├── json_stream_parser_test.cc │ │ │ │ │ ├── location_tracker.h │ │ │ │ │ ├── mock_error_listener.h │ │ │ │ │ ├── object_location_tracker.h │ │ │ │ │ ├── object_source.h │ │ │ │ │ ├── object_writer.cc │ │ │ │ │ ├── object_writer.h │ │ │ │ │ ├── proto_writer.cc │ │ │ │ │ ├── proto_writer.h │ │ │ │ │ ├── protostream_objectsource.cc │ │ │ │ │ ├── protostream_objectsource.h │ │ │ │ │ ├── protostream_objectsource_test.cc │ │ │ │ │ ├── protostream_objectwriter.cc │ │ │ │ │ ├── protostream_objectwriter.h │ │ │ │ │ ├── protostream_objectwriter_test.cc │ │ │ │ │ ├── structured_objectwriter.h │ │ │ │ │ ├── testdata/ │ │ │ │ │ │ ├── anys.proto │ │ │ │ │ │ ├── books.proto │ │ │ │ │ │ ├── default_value.proto │ │ │ │ │ │ ├── default_value_test.proto │ │ │ │ │ │ ├── field_mask.proto │ │ │ │ │ │ ├── maps.proto │ │ │ │ │ │ ├── oneofs.proto │ │ │ │ │ │ ├── struct.proto │ │ │ │ │ │ └── timestamp_duration.proto │ │ │ │ │ ├── type_info.cc │ │ │ │ │ ├── type_info.h │ │ │ │ │ ├── type_info_test_helper.cc │ │ │ │ │ ├── type_info_test_helper.h │ │ │ │ │ ├── utility.cc │ │ │ │ │ └── utility.h │ │ │ │ ├── json_format_proto3.proto │ │ │ │ ├── json_util.cc │ │ │ │ ├── json_util.h │ │ │ │ ├── json_util_test.cc │ │ │ │ ├── message_differencer.cc │ │ │ │ ├── message_differencer.h │ │ │ │ ├── message_differencer_unittest.cc │ │ │ │ ├── message_differencer_unittest.proto │ │ │ │ ├── time_util.cc │ │ │ │ ├── time_util.h │ │ │ │ ├── time_util_test.cc │ │ │ │ ├── type_resolver.h │ │ │ │ ├── type_resolver_util.cc │ │ │ │ ├── type_resolver_util.h │ │ │ │ └── type_resolver_util_test.cc │ │ │ ├── well_known_types_unittest.cc │ │ │ ├── wire_format.cc │ │ │ ├── wire_format.h │ │ │ ├── wire_format_lite.cc │ │ │ ├── wire_format_lite.h │ │ │ ├── wire_format_lite_inl.h │ │ │ ├── wire_format_unittest.cc │ │ │ ├── wrappers.pb.cc │ │ │ ├── wrappers.pb.h │ │ │ └── wrappers.proto │ │ ├── test-driver │ │ ├── update_file_lists.sh │ │ └── util/ │ │ └── python/ │ │ └── BUILD │ ├── rapidjson/ │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── .gitmodules │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── CMakeLists.txt │ │ ├── CMakeModules/ │ │ │ └── FindGTestSrc.cmake │ │ ├── RapidJSON.pc.in │ │ ├── RapidJSONConfig.cmake.in │ │ ├── RapidJSONConfigVersion.cmake.in │ │ ├── appveyor.yml │ │ ├── bin/ │ │ │ ├── data/ │ │ │ │ ├── glossary.json │ │ │ │ ├── menu.json │ │ │ │ ├── readme.txt │ │ │ │ ├── sample.json │ │ │ │ ├── webapp.json │ │ │ │ └── widget.json │ │ │ ├── encodings/ │ │ │ │ ├── utf16be.json │ │ │ │ ├── utf16bebom.json │ │ │ │ ├── utf16le.json │ │ │ │ ├── utf16lebom.json │ │ │ │ ├── utf32be.json │ │ │ │ ├── utf32bebom.json │ │ │ │ ├── utf32le.json │ │ │ │ ├── utf32lebom.json │ │ │ │ ├── utf8.json │ │ │ │ └── utf8bom.json │ │ │ └── types/ │ │ │ ├── booleans.json │ │ │ ├── floats.json │ │ │ ├── guids.json │ │ │ ├── integers.json │ │ │ ├── mixed.json │ │ │ ├── nulls.json │ │ │ ├── paragraphs.json │ │ │ └── readme.txt │ │ ├── doc/ │ │ │ ├── CMakeLists.txt │ │ │ ├── Doxyfile.in │ │ │ ├── Doxyfile.zh-cn.in │ │ │ ├── diagram/ │ │ │ │ ├── architecture.dot │ │ │ │ ├── insituparsing.dot │ │ │ │ ├── iterative-parser-states-diagram.dot │ │ │ │ ├── makefile │ │ │ │ ├── move1.dot │ │ │ │ ├── move2.dot │ │ │ │ ├── move3.dot │ │ │ │ ├── normalparsing.dot │ │ │ │ ├── simpledom.dot │ │ │ │ ├── tutorial.dot │ │ │ │ └── utilityclass.dot │ │ │ ├── dom.md │ │ │ ├── dom.zh-cn.md │ │ │ ├── encoding.md │ │ │ ├── encoding.zh-cn.md │ │ │ ├── faq.md │ │ │ ├── faq.zh-cn.md │ │ │ ├── features.md │ │ │ ├── features.zh-cn.md │ │ │ ├── internals.md │ │ │ ├── misc/ │ │ │ │ ├── DoxygenLayout.xml │ │ │ │ ├── doxygenextra.css │ │ │ │ ├── footer.html │ │ │ │ └── header.html │ │ │ ├── npm.md │ │ │ ├── performance.md │ │ │ ├── performance.zh-cn.md │ │ │ ├── pointer.md │ │ │ ├── pointer.zh-cn.md │ │ │ ├── sax.md │ │ │ ├── sax.zh-cn.md │ │ │ ├── schema.md │ │ │ ├── schema.zh-cn.md │ │ │ ├── stream.md │ │ │ ├── stream.zh-cn.md │ │ │ ├── tutorial.md │ │ │ └── tutorial.zh-cn.md │ │ ├── docker/ │ │ │ └── debian/ │ │ │ └── Dockerfile │ │ ├── example/ │ │ │ ├── CMakeLists.txt │ │ │ ├── capitalize/ │ │ │ │ └── capitalize.cpp │ │ │ ├── condense/ │ │ │ │ └── condense.cpp │ │ │ ├── filterkey/ │ │ │ │ └── filterkey.cpp │ │ │ ├── filterkeydom/ │ │ │ │ └── filterkeydom.cpp │ │ │ ├── jsonx/ │ │ │ │ └── jsonx.cpp │ │ │ ├── messagereader/ │ │ │ │ └── messagereader.cpp │ │ │ ├── parsebyparts/ │ │ │ │ └── parsebyparts.cpp │ │ │ ├── pretty/ │ │ │ │ └── pretty.cpp │ │ │ ├── prettyauto/ │ │ │ │ └── prettyauto.cpp │ │ │ ├── schemavalidator/ │ │ │ │ └── schemavalidator.cpp │ │ │ ├── serialize/ │ │ │ │ └── serialize.cpp │ │ │ ├── simpledom/ │ │ │ │ └── simpledom.cpp │ │ │ ├── simplereader/ │ │ │ │ └── simplereader.cpp │ │ │ ├── simplewriter/ │ │ │ │ └── simplewriter.cpp │ │ │ └── tutorial/ │ │ │ └── tutorial.cpp │ │ ├── include/ │ │ │ └── rapidjson/ │ │ │ ├── allocators.h │ │ │ ├── document.h │ │ │ ├── encodedstream.h │ │ │ ├── encodings.h │ │ │ ├── error/ │ │ │ │ ├── en.h │ │ │ │ └── error.h │ │ │ ├── filereadstream.h │ │ │ ├── filewritestream.h │ │ │ ├── fwd.h │ │ │ ├── internal/ │ │ │ │ ├── biginteger.h │ │ │ │ ├── diyfp.h │ │ │ │ ├── dtoa.h │ │ │ │ ├── ieee754.h │ │ │ │ ├── itoa.h │ │ │ │ ├── meta.h │ │ │ │ ├── pow10.h │ │ │ │ ├── regex.h │ │ │ │ ├── stack.h │ │ │ │ ├── strfunc.h │ │ │ │ ├── strtod.h │ │ │ │ └── swap.h │ │ │ ├── istreamwrapper.h │ │ │ ├── memorybuffer.h │ │ │ ├── memorystream.h │ │ │ ├── msinttypes/ │ │ │ │ ├── inttypes.h │ │ │ │ └── stdint.h │ │ │ ├── ostreamwrapper.h │ │ │ ├── pointer.h │ │ │ ├── prettywriter.h │ │ │ ├── rapidjson.h │ │ │ ├── reader.h │ │ │ ├── schema.h │ │ │ ├── stream.h │ │ │ ├── stringbuffer.h │ │ │ └── writer.h │ │ ├── include_dirs.js │ │ ├── library.json │ │ ├── license.txt │ │ ├── license_readme-oracle.txt │ │ ├── package.json │ │ ├── rapidjson.autopkg │ │ ├── readme.md │ │ ├── readme.zh-cn.md │ │ ├── test/ │ │ │ ├── CMakeLists.txt │ │ │ ├── perftest/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── misctest.cpp │ │ │ │ ├── perftest.cpp │ │ │ │ ├── perftest.h │ │ │ │ ├── platformtest.cpp │ │ │ │ ├── rapidjsontest.cpp │ │ │ │ └── schematest.cpp │ │ │ └── unittest/ │ │ │ ├── CMakeLists.txt │ │ │ ├── allocatorstest.cpp │ │ │ ├── bigintegertest.cpp │ │ │ ├── documenttest.cpp │ │ │ ├── dtoatest.cpp │ │ │ ├── encodedstreamtest.cpp │ │ │ ├── encodingstest.cpp │ │ │ ├── filestreamtest.cpp │ │ │ ├── fwdtest.cpp │ │ │ ├── istreamwrappertest.cpp │ │ │ ├── itoatest.cpp │ │ │ ├── jsoncheckertest.cpp │ │ │ ├── namespacetest.cpp │ │ │ ├── ostreamwrappertest.cpp │ │ │ ├── pointertest.cpp │ │ │ ├── prettywritertest.cpp │ │ │ ├── readertest.cpp │ │ │ ├── regextest.cpp │ │ │ ├── schematest.cpp │ │ │ ├── simdtest.cpp │ │ │ ├── strfunctest.cpp │ │ │ ├── stringbuffertest.cpp │ │ │ ├── strtodtest.cpp │ │ │ ├── unittest.cpp │ │ │ ├── unittest.h │ │ │ ├── valuetest.cpp │ │ │ └── writertest.cpp │ │ └── travis-doxygen.sh │ └── yassl/ │ ├── AUTHORS │ ├── CMakeLists.txt │ ├── COPYING │ ├── ChangeLog │ ├── FLOSS-EXCEPTIONS │ ├── INSTALL │ ├── NEWS │ ├── README │ ├── certs/ │ │ ├── ca-cert.pem │ │ ├── ca-key.pem │ │ ├── client-cert.der │ │ ├── client-cert.pem │ │ ├── client-key.der │ │ ├── client-key.pem │ │ ├── client-keyEnc.pem │ │ ├── client-keyEnc3.pem │ │ ├── dsa-cert.pem │ │ ├── dsa1024.der │ │ ├── dsa1024.pem │ │ ├── server-cert.pem │ │ ├── server-key.pem │ │ ├── server-keyEnc.pem │ │ └── taoCert.txt │ ├── examples/ │ │ ├── client/ │ │ │ ├── client.cpp │ │ │ └── client.dsp │ │ ├── echoclient/ │ │ │ ├── echoclient.cpp │ │ │ ├── echoclient.dsp │ │ │ ├── input │ │ │ └── quit │ │ ├── echoserver/ │ │ │ ├── echoserver.cpp │ │ │ └── echoserver.dsp │ │ └── server/ │ │ ├── server.cpp │ │ └── server.dsp │ ├── include/ │ │ ├── buffer.hpp │ │ ├── cert_wrapper.hpp │ │ ├── crypto_wrapper.hpp │ │ ├── factory.hpp │ │ ├── handshake.hpp │ │ ├── lock.hpp │ │ ├── log.hpp │ │ ├── openssl/ │ │ │ ├── crypto.h │ │ │ ├── des.h │ │ │ ├── des_old.h │ │ │ ├── engine.h │ │ │ ├── err.h │ │ │ ├── evp.h │ │ │ ├── generate_prefix_files.pl │ │ │ ├── hmac.h │ │ │ ├── lhash.h │ │ │ ├── md4.h │ │ │ ├── md5.h │ │ │ ├── objects.h │ │ │ ├── opensslv.h │ │ │ ├── pem.h │ │ │ ├── pkcs12.h │ │ │ ├── prefix_crypto.h │ │ │ ├── prefix_ssl.h │ │ │ ├── rand.h │ │ │ ├── rsa.h │ │ │ ├── sha.h │ │ │ ├── ssl.h │ │ │ ├── transport_types.h │ │ │ ├── x509.h │ │ │ └── x509v3.h │ │ ├── socket_wrapper.hpp │ │ ├── timer.hpp │ │ ├── yassl.hpp │ │ ├── yassl_error.hpp │ │ ├── yassl_imp.hpp │ │ ├── yassl_int.hpp │ │ └── yassl_types.hpp │ ├── lib/ │ │ └── dummy │ ├── src/ │ │ ├── buffer.cpp │ │ ├── cert_wrapper.cpp │ │ ├── crypto_wrapper.cpp │ │ ├── dummy.cpp │ │ ├── handshake.cpp │ │ ├── lock.cpp │ │ ├── log.cpp │ │ ├── make.bat │ │ ├── socket_wrapper.cpp │ │ ├── ssl.cpp │ │ ├── template_instnt.cpp │ │ ├── timer.cpp │ │ ├── yassl.cpp │ │ ├── yassl_error.cpp │ │ ├── yassl_imp.cpp │ │ └── yassl_int.cpp │ ├── taocrypt/ │ │ ├── CMakeLists.txt │ │ ├── COPYING │ │ ├── INSTALL │ │ ├── README │ │ ├── benchmark/ │ │ │ ├── benchmark.cpp │ │ │ ├── benchmark.dsp │ │ │ ├── dh1024.der │ │ │ ├── dsa1024.der │ │ │ ├── make.bat │ │ │ └── rsa1024.der │ │ ├── include/ │ │ │ ├── aes.hpp │ │ │ ├── algebra.hpp │ │ │ ├── arc4.hpp │ │ │ ├── asn.hpp │ │ │ ├── block.hpp │ │ │ ├── blowfish.hpp │ │ │ ├── coding.hpp │ │ │ ├── des.hpp │ │ │ ├── dh.hpp │ │ │ ├── dsa.hpp │ │ │ ├── error.hpp │ │ │ ├── file.hpp │ │ │ ├── hash.hpp │ │ │ ├── hc128.hpp │ │ │ ├── hmac.hpp │ │ │ ├── integer.hpp │ │ │ ├── kernelc.hpp │ │ │ ├── md2.hpp │ │ │ ├── md4.hpp │ │ │ ├── md5.hpp │ │ │ ├── misc.hpp │ │ │ ├── modarith.hpp │ │ │ ├── modes.hpp │ │ │ ├── pwdbased.hpp │ │ │ ├── rabbit.hpp │ │ │ ├── random.hpp │ │ │ ├── ripemd.hpp │ │ │ ├── rsa.hpp │ │ │ ├── runtime.hpp │ │ │ ├── sha.hpp │ │ │ ├── twofish.hpp │ │ │ ├── type_traits.hpp │ │ │ └── types.hpp │ │ ├── mySTL/ │ │ │ ├── algorithm.hpp │ │ │ ├── helpers.hpp │ │ │ ├── list.hpp │ │ │ ├── memory.hpp │ │ │ ├── memory_array.hpp │ │ │ ├── pair.hpp │ │ │ ├── stdexcept.hpp │ │ │ └── vector.hpp │ │ ├── src/ │ │ │ ├── aes.cpp │ │ │ ├── aestables.cpp │ │ │ ├── algebra.cpp │ │ │ ├── arc4.cpp │ │ │ ├── asn.cpp │ │ │ ├── bftables.cpp │ │ │ ├── blowfish.cpp │ │ │ ├── coding.cpp │ │ │ ├── des.cpp │ │ │ ├── dh.cpp │ │ │ ├── dsa.cpp │ │ │ ├── file.cpp │ │ │ ├── hash.cpp │ │ │ ├── hc128.cpp │ │ │ ├── integer.cpp │ │ │ ├── make.bat │ │ │ ├── md2.cpp │ │ │ ├── md4.cpp │ │ │ ├── md5.cpp │ │ │ ├── misc.cpp │ │ │ ├── rabbit.cpp │ │ │ ├── random.cpp │ │ │ ├── ripemd.cpp │ │ │ ├── rsa.cpp │ │ │ ├── sha.cpp │ │ │ ├── template_instnt.cpp │ │ │ ├── tftables.cpp │ │ │ └── twofish.cpp │ │ ├── taocrypt.dsp │ │ ├── taocrypt.dsw │ │ ├── test/ │ │ │ ├── make.bat │ │ │ ├── memory.cpp │ │ │ ├── test.cpp │ │ │ └── test.dsp │ │ └── test.dsw │ ├── testsuite/ │ │ ├── cipher-test.sh │ │ ├── input │ │ ├── make.bat │ │ ├── quit │ │ ├── test.hpp │ │ ├── testsuite.cpp │ │ └── testsuite.dsp │ ├── yassl.dsp │ └── yassl.dsw ├── packaging/ │ ├── README_Debian.md │ ├── WiX/ │ │ ├── CMakeLists.txt │ │ ├── CPackWixConfig.cmake │ │ ├── ca/ │ │ │ ├── CMakeLists.txt │ │ │ ├── CustomAction.cpp │ │ │ └── CustomAction.def │ │ ├── create_msi.cmake.in │ │ ├── custom_ui.wxs │ │ ├── extra.wxs.in │ │ ├── mysql_router.wxs.in │ │ ├── mysql_router_extra.wxs.in │ │ ├── mysqlrouter.conf.in │ │ └── versioninfo.rc.in │ ├── build_deb.sh │ ├── build_rpm.sh │ ├── deb-artful/ │ │ ├── changelog │ │ └── control │ ├── deb-bionic/ │ │ ├── changelog │ │ └── control │ ├── deb-common/ │ │ ├── compat │ │ ├── copyright │ │ ├── extra/ │ │ │ ├── apparmor-profile.in │ │ │ └── mysqlrouter.conf.in │ │ ├── mysql-router-dev.install │ │ ├── mysql-router-dev.lintian-overrides │ │ ├── mysql-router.install │ │ ├── mysql-router.lintian-overrides │ │ ├── mysql-router.mysqlrouter.init │ │ ├── mysql-router.postinst │ │ ├── mysql-router.postrm │ │ ├── mysql-router.preinst │ │ ├── mysql-router.prerm │ │ ├── rules │ │ └── source/ │ │ └── format │ ├── deb-jessie/ │ │ ├── changelog │ │ └── control │ ├── deb-stretch/ │ │ ├── changelog │ │ └── control │ ├── deb-trusty/ │ │ ├── changelog │ │ └── control │ ├── deb-vivid/ │ │ ├── changelog │ │ └── control │ ├── deb-wily/ │ │ ├── changelog │ │ └── control │ ├── deb-xenial/ │ │ ├── changelog │ │ └── control │ ├── deb-yakkety/ │ │ ├── changelog │ │ └── control │ ├── deb-zesty/ │ │ ├── changelog │ │ └── control │ └── rpm-oel/ │ ├── CMakeLists.txt │ ├── mysql-router.spec.in │ ├── mysqlrouter.conf.in │ ├── mysqlrouter.init │ ├── mysqlrouter.service │ └── mysqlrouter.tmpfiles.d ├── src/ │ ├── CMakeLists.txt │ ├── harness/ │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── CPPLINT.cfg │ │ ├── Doxyfile.in │ │ ├── README.txt │ │ ├── data/ │ │ │ └── main.conf │ │ ├── include/ │ │ │ ├── common.h │ │ │ ├── dim.h │ │ │ ├── harness_assert.h │ │ │ ├── hostname_validator.h │ │ │ ├── keyring/ │ │ │ │ ├── keyring.h │ │ │ │ ├── keyring_file.h │ │ │ │ ├── keyring_manager.h │ │ │ │ └── keyring_memory.h │ │ │ ├── mysql/ │ │ │ │ └── harness/ │ │ │ │ ├── arg_handler.h │ │ │ │ ├── compiler_attributes.h │ │ │ │ ├── config_parser.h │ │ │ │ ├── filesystem.h │ │ │ │ ├── loader.h │ │ │ │ ├── loader_config.h │ │ │ │ ├── logging/ │ │ │ │ │ ├── handler.h │ │ │ │ │ ├── logger.h │ │ │ │ │ ├── logging.h │ │ │ │ │ └── registry.h │ │ │ │ ├── networking/ │ │ │ │ │ ├── ip_address.h │ │ │ │ │ ├── ipv4_address.h │ │ │ │ │ ├── ipv6_address.h │ │ │ │ │ └── resolver.h │ │ │ │ └── queue.h │ │ │ ├── mysql_router_thread.h │ │ │ ├── process_launcher.h │ │ │ ├── random_generator.h │ │ │ ├── socket_operations.h │ │ │ ├── tcp_address.h │ │ │ └── unique_ptr.h │ │ ├── internal/ │ │ │ ├── README.md │ │ │ ├── checks/ │ │ │ │ └── build_all.py │ │ │ ├── exclude-from-release.txt │ │ │ └── hooks/ │ │ │ ├── pre-commit │ │ │ ├── pre-receive │ │ │ └── update │ │ ├── plugin.h.in │ │ ├── shared/ │ │ │ ├── CMakeLists.txt │ │ │ ├── include/ │ │ │ │ └── test/ │ │ │ │ └── helpers.h │ │ │ └── src/ │ │ │ └── test_helpers.cc │ │ ├── src/ │ │ │ ├── arg_handler.cc │ │ │ ├── common.cc │ │ │ ├── config_parser.cc │ │ │ ├── designator.cc │ │ │ ├── designator.h │ │ │ ├── dim.cc │ │ │ ├── exception.h │ │ │ ├── filesystem-posix.cc │ │ │ ├── filesystem-windows.cc │ │ │ ├── filesystem.cc │ │ │ ├── hostname_validator.cc │ │ │ ├── keyring/ │ │ │ │ ├── keyring_file.cc │ │ │ │ ├── keyring_manager.cc │ │ │ │ └── keyring_memory.cc │ │ │ ├── loader-posix.cc │ │ │ ├── loader-windows.cc │ │ │ ├── loader.cc │ │ │ ├── loader_config.cc │ │ │ ├── logging/ │ │ │ │ ├── handler.cc │ │ │ │ ├── logger.cc │ │ │ │ ├── logging.cc │ │ │ │ └── registry.cc │ │ │ ├── mysql_router_thread.cc │ │ │ ├── networking/ │ │ │ │ ├── ip_address.cc │ │ │ │ ├── ipv4_address.cc │ │ │ │ ├── ipv6_address.cc │ │ │ │ └── resolver.cc │ │ │ ├── process_launcher.cc │ │ │ ├── random_generator.cc │ │ │ ├── socket_operations.cc │ │ │ ├── tcp_address.cc │ │ │ ├── utilities-posix.cc │ │ │ ├── utilities-windows.cc │ │ │ ├── utilities.cc │ │ │ └── utilities.h │ │ └── tests/ │ │ ├── CMakeLists.txt │ │ ├── data/ │ │ │ ├── logger.cfg │ │ │ ├── logger.d/ │ │ │ │ ├── default.cfg │ │ │ │ ├── magic.cfg │ │ │ │ └── one.cfg │ │ │ ├── magic-alt.cfg │ │ │ ├── tests-bad-1.cfg │ │ │ ├── tests-bad-2.cfg │ │ │ ├── tests-bad-3.cfg │ │ │ ├── tests-good-1.cfg.in │ │ │ ├── tests-good-2.cfg.in │ │ │ └── tests-start-1.cfg.in │ │ ├── include/ │ │ │ ├── lifecycle.h │ │ │ └── magic.h │ │ ├── plugins/ │ │ │ ├── CMakeLists.txt │ │ │ ├── bad_one.cc │ │ │ ├── bad_two.cc │ │ │ ├── example.cc │ │ │ ├── lifecycle.cc │ │ │ ├── lifecycle2.cc │ │ │ ├── lifecycle3.cc │ │ │ └── magic.cc │ │ ├── test_bug22104451.cc │ │ ├── test_common.cc │ │ ├── test_config.cc │ │ ├── test_designator.cc │ │ ├── test_dim_and_unique_ptr.cc │ │ ├── test_filesystem.cc │ │ ├── test_hostname_validator.cc │ │ ├── test_ip_address.cc │ │ ├── test_iterator.cc │ │ ├── test_keyring.cc │ │ ├── test_keyring_manager.cc │ │ ├── test_loader.cc │ │ ├── test_loader_lifecycle.cc │ │ ├── test_logging.cc │ │ ├── test_mysql_router_thread.cc │ │ ├── test_queue.cc │ │ ├── test_random_generator.cc │ │ ├── test_resolver.cc │ │ └── test_utilities.cc │ ├── http/ │ │ ├── CMakeLists.txt │ │ ├── include/ │ │ │ └── mysqlrouter/ │ │ │ ├── http_client.h │ │ │ ├── http_client_export.h │ │ │ ├── http_common.h │ │ │ ├── http_common_export.h │ │ │ ├── http_server_component.h │ │ │ ├── http_server_export.h │ │ │ └── rest_client.h │ │ ├── src/ │ │ │ ├── CMakeLists.txt │ │ │ ├── http_client.cc │ │ │ ├── http_common.cc │ │ │ ├── http_request_impl.h │ │ │ ├── http_server_component.cc │ │ │ ├── http_server_plugin.cc │ │ │ ├── http_server_plugin.h │ │ │ ├── http_time.cc │ │ │ ├── posix_re.h │ │ │ ├── rest_cli.cc │ │ │ ├── rest_client.cc │ │ │ └── static_files.cc │ │ └── tests/ │ │ ├── CMakeLists.txt │ │ ├── test_posix_re.cc │ │ └── test_time.cc │ ├── keepalive/ │ │ ├── CMakeLists.txt │ │ ├── src/ │ │ │ └── keepalive.cc │ │ └── tests/ │ │ ├── CMakeLists.txt │ │ ├── data/ │ │ │ └── keepalive.cfg.in │ │ └── test_plugin_keepalive.cc │ ├── metadata_cache/ │ │ ├── CMakeLists.txt │ │ ├── include/ │ │ │ └── mysqlrouter/ │ │ │ └── metadata_cache.h │ │ ├── src/ │ │ │ ├── cache_api.cc │ │ │ ├── cluster_metadata.cc │ │ │ ├── cluster_metadata.h │ │ │ ├── group_replication_metadata.cc │ │ │ ├── group_replication_metadata.h │ │ │ ├── metadata.h │ │ │ ├── metadata_cache.cc │ │ │ ├── metadata_cache.h │ │ │ ├── metadata_cache_plugin.cc │ │ │ ├── metadata_factory.cc │ │ │ ├── metadata_factory.h │ │ │ ├── plugin_config.cc │ │ │ └── plugin_config.h │ │ └── tests/ │ │ ├── CMakeLists.txt │ │ ├── helper/ │ │ │ ├── mock_metadata.cc │ │ │ ├── mock_metadata.h │ │ │ └── mock_metadata_factory.cc │ │ ├── test_cache_plugin.cc │ │ ├── test_failover.cc │ │ ├── test_metadata.cc │ │ ├── test_metadata_cache.cc │ │ └── test_plugin_config.cc │ ├── mock_server/ │ │ ├── CMakeLists.txt │ │ ├── include/ │ │ │ └── mysqlrouter/ │ │ │ ├── mock_server_component.h │ │ │ ├── mock_server_export.h │ │ │ └── mock_server_global_scope.h │ │ └── src/ │ │ ├── CMakeLists.txt │ │ ├── duk_module_shim.c │ │ ├── duk_module_shim.h │ │ ├── duk_node_fs.c │ │ ├── duk_node_fs.h │ │ ├── duktape_statement_reader.cc │ │ ├── duktape_statement_reader.h │ │ ├── json_schema_embedder.cc │ │ ├── json_statement_reader.cc │ │ ├── json_statement_reader.h │ │ ├── main.cc │ │ ├── mock_server_component.cc │ │ ├── mock_server_plugin.cc │ │ ├── mock_server_plugin.h │ │ ├── mysql_protocol_common.h │ │ ├── mysql_protocol_decoder.cc │ │ ├── mysql_protocol_decoder.h │ │ ├── mysql_protocol_encoder.cc │ │ ├── mysql_protocol_encoder.h │ │ ├── mysql_protocol_utils.cc │ │ ├── mysql_protocol_utils.h │ │ ├── mysql_server_mock.cc │ │ ├── mysql_server_mock.h │ │ ├── mysql_server_mock.md │ │ ├── mysql_server_mock_schema.h │ │ ├── mysql_server_mock_schema.js │ │ ├── rest_mock_server.cc │ │ └── statement_reader.h │ ├── mysql_protocol/ │ │ ├── CMakeLists.txt │ │ ├── include/ │ │ │ └── mysqlrouter/ │ │ │ ├── mysql_protocol/ │ │ │ │ ├── base_packet.h │ │ │ │ ├── constants.h │ │ │ │ ├── error_packet.h │ │ │ │ └── handshake_packet.h │ │ │ └── mysql_protocol.h │ │ ├── src/ │ │ │ ├── base_packet.cc │ │ │ ├── error_packet.cc │ │ │ └── handshake_packet.cc │ │ └── tests/ │ │ ├── CMakeLists.txt │ │ ├── test_base_packet.cc │ │ ├── test_constants.cc │ │ ├── test_error_packet.cc │ │ └── test_handshake_packet.cc │ ├── plugin_info/ │ │ ├── CMakeLists.txt │ │ ├── src/ │ │ │ ├── library_file.cc │ │ │ ├── library_file.h │ │ │ ├── main.cc │ │ │ ├── plugin.cc │ │ │ ├── plugin.h │ │ │ ├── plugin_info_app.cc │ │ │ └── plugin_info_app.h │ │ └── tests/ │ │ ├── CMakeLists.txt │ │ └── test_plugin_info_app.cc │ ├── router/ │ │ ├── CMakeLists.txt │ │ ├── include/ │ │ │ └── mysqlrouter/ │ │ │ ├── datatypes.h │ │ │ ├── keyring_info.h │ │ │ ├── log_filter.h │ │ │ ├── my_aes.h │ │ │ ├── my_aes_impl.h │ │ │ ├── mysql_session.h │ │ │ ├── plugin_config.h │ │ │ ├── sha1.h │ │ │ ├── uri.h │ │ │ ├── utils.h │ │ │ ├── utils_sqlstring.h │ │ │ └── windows/ │ │ │ └── password_vault.h │ │ ├── src/ │ │ │ ├── CMakeLists.txt │ │ │ ├── cluster_metadata.cc │ │ │ ├── cluster_metadata.h │ │ │ ├── common/ │ │ │ │ ├── log_filter.cc │ │ │ │ ├── my_aes.cc │ │ │ │ ├── my_aes_openssl.cc │ │ │ │ ├── my_aes_yassl.cc │ │ │ │ ├── my_sha1.cc │ │ │ │ ├── mysql_session.cc │ │ │ │ └── utils_sqlstring.cc │ │ │ ├── config_files.cc │ │ │ ├── config_files.h │ │ │ ├── config_generator.cc │ │ │ ├── config_generator.h │ │ │ ├── keyring_info.cc │ │ │ ├── main.cc │ │ │ ├── plugin_config.cc │ │ │ ├── router_app.cc │ │ │ ├── router_app.h │ │ │ ├── uri.cc │ │ │ ├── utils.cc │ │ │ └── windows/ │ │ │ ├── main-windows.cc │ │ │ ├── main-windows.h │ │ │ ├── nt_servc.cc │ │ │ ├── nt_servc.h │ │ │ └── password_vault.cc │ │ └── tests/ │ │ ├── CMakeLists.txt │ │ ├── config_a.conf │ │ ├── config_b.conf │ │ ├── config_c.ini │ │ ├── issues/ │ │ │ ├── test_bug22074209.cc │ │ │ ├── test_bug22084430.cc │ │ │ ├── test_bug22572346.cc │ │ │ └── test_bug24909259.cc │ │ ├── mysqlrouter.conf.in │ │ ├── mysqlrouter_app.cc │ │ ├── mysqlrouter_consolelogger.conf.in │ │ ├── mysqlrouter_extra.conf.in │ │ ├── mysqlrouter_nologger.conf.in │ │ ├── mysqlrouter_utils.cc │ │ ├── parse_error.conf │ │ ├── router_arghandler.cc │ │ ├── test_cluster_metadata.cc │ │ ├── test_config_files.cc │ │ ├── test_config_generator.cc │ │ ├── test_configuration_errors.cc │ │ ├── test_console_output.cc │ │ ├── test_datatypes.cc │ │ ├── test_log_filter.cc │ │ ├── test_metadata_check.cc │ │ ├── test_mysql_session.cc │ │ ├── test_plugins_config.cc │ │ ├── test_uri.cc │ │ └── test_utils.cc │ ├── routing/ │ │ ├── CMakeLists.txt │ │ ├── include/ │ │ │ └── mysqlrouter/ │ │ │ └── routing.h │ │ ├── src/ │ │ │ ├── connection.cc │ │ │ ├── connection.h │ │ │ ├── connection_container.cc │ │ │ ├── connection_container.h │ │ │ ├── context.cc │ │ │ ├── context.h │ │ │ ├── dest_first_available.cc │ │ │ ├── dest_first_available.h │ │ │ ├── dest_metadata_cache.cc │ │ │ ├── dest_metadata_cache.h │ │ │ ├── dest_next_available.cc │ │ │ ├── dest_next_available.h │ │ │ ├── dest_round_robin.cc │ │ │ ├── dest_round_robin.h │ │ │ ├── destination.cc │ │ │ ├── destination.h │ │ │ ├── mysql_routing.cc │ │ │ ├── mysql_routing.h │ │ │ ├── mysql_routing_common.cc │ │ │ ├── mysql_routing_common.h │ │ │ ├── plugin_config.cc │ │ │ ├── plugin_config.h │ │ │ ├── protocol/ │ │ │ │ ├── base_protocol.h │ │ │ │ ├── classic_protocol.cc │ │ │ │ ├── classic_protocol.h │ │ │ │ ├── protocol.h │ │ │ │ ├── x_protocol.cc │ │ │ │ └── x_protocol.h │ │ │ ├── routing.cc │ │ │ ├── routing_plugin.cc │ │ │ ├── utils.cc │ │ │ └── utils.h │ │ └── tests/ │ │ ├── CMakeLists.txt │ │ ├── data/ │ │ │ └── 1route.conf.in │ │ ├── issues/ │ │ │ ├── test_bug21873666.cc │ │ │ ├── test_bug21962350.cc │ │ │ ├── test_bug22062859.cc │ │ │ └── test_bug22579989.cc │ │ ├── plugin/ │ │ │ └── test_plugin.cc │ │ ├── routing_mocks.h │ │ ├── test_block_clients.cc │ │ ├── test_classic_protocol.cc │ │ ├── test_config.cc │ │ ├── test_connection.cc │ │ ├── test_connection_container.cc │ │ ├── test_first_available.cc │ │ ├── test_metadata_cache_group.cc │ │ ├── test_next_available.cc │ │ ├── test_round_robin.cc │ │ ├── test_routing.cc │ │ ├── test_setup_named_socket_service.cc │ │ ├── test_setup_tcp_service.cc │ │ └── test_x_protocol.cc │ ├── syslog/ │ │ ├── CMakeLists.txt │ │ └── src/ │ │ └── syslog.cc │ └── x_protocol/ │ ├── CMakeLists.txt │ ├── include/ │ │ └── mysqlrouter/ │ │ └── xprotocol.h │ └── proto/ │ ├── mysqlx.proto │ ├── mysqlx_connection.proto │ ├── mysqlx_crud.proto │ ├── mysqlx_datatypes.proto │ ├── mysqlx_expect.proto │ ├── mysqlx_expr.proto │ ├── mysqlx_notice.proto │ ├── mysqlx_resultset.proto │ ├── mysqlx_session.proto │ └── mysqlx_sql.proto └── tests/ ├── CMakeLists.txt ├── component/ │ ├── CMakeLists.txt │ ├── data/ │ │ ├── bootstrap.js │ │ ├── bootstrap_access_error_at_grant.js │ │ ├── bootstrap_account_host_multiple_patterns.js │ │ ├── bootstrap_account_host_pattern_too_long.js │ │ ├── bootstrap_big_data.js │ │ ├── bootstrap_exec_time_2_seconds.js │ │ ├── bootstrap_failover_at_crash.js │ │ ├── bootstrap_failover_at_grant.js │ │ ├── bootstrap_failover_reconfigure_ok.js │ │ ├── bootstrap_failover_reconfigure_ok_3_old_users.js │ │ ├── bootstrap_failover_super_read_only_1.js │ │ ├── bootstrap_failover_super_read_only_2.js │ │ ├── bootstrap_failover_super_read_only_dead_2nd_1.js │ │ ├── bootstrap_failover_super_read_only_delete_user.js │ │ ├── bootstrap_report_host.js │ │ ├── bootstrap_unsupported_schema_version.js │ │ ├── js_test_empty_file.js │ │ ├── js_test_nesting.js │ │ ├── js_test_parse_error.js │ │ ├── js_test_require.js │ │ ├── js_test_stmts_is_array.js │ │ ├── js_test_stmts_is_coroutine.js │ │ ├── js_test_stmts_is_empty.js │ │ ├── js_test_stmts_is_function.js │ │ ├── js_test_stmts_is_string.js │ │ ├── js_test_stmts_result_has_infinity.js │ │ ├── js_test_stmts_result_has_negative_int.js │ │ ├── js_test_stmts_result_has_repeat.js │ │ ├── local_modules/ │ │ │ ├── common_statements.js │ │ │ ├── gr_memberships.js │ │ │ └── itertools.js │ │ ├── metadata_1_node.js │ │ ├── metadata_1_node_repeat.js │ │ ├── metadata_3_nodes_first_not_accessible.js │ │ ├── metadata_3_secondaries.js │ │ ├── metadata_3_secondaries_failed_to_update.js │ │ ├── metadata_3_secondaries_pass.js │ │ ├── metadata_3_secondaries_primary_failover.js │ │ ├── metadata_3_secondaries_server_removed_from_cluster.js │ │ ├── metadata_4_secondaries_partitioning.js │ │ ├── my_port.js │ │ ├── rest_server_mock.js │ │ ├── simple-client.js │ │ └── test_modules/ │ │ ├── test-require-dir-with-indexjs/ │ │ │ └── index.js │ │ ├── test-require-dir-with-packagejson/ │ │ │ ├── foo.js │ │ │ └── package.json │ │ ├── test-require-direct.js │ │ ├── test-require-nesting-1.js │ │ ├── test-require-nesting-2.js │ │ ├── test-require-nesting-3.js │ │ ├── test-require-nesting-4.js │ │ └── test-require-nesting-5.js │ ├── test_bootstrap.cc │ ├── test_bootstrap_system_deployment.cc │ ├── test_component_test_framework.cc │ ├── test_config.cc │ ├── test_logging.cc │ ├── test_master_key_reader_writer.cc │ ├── test_metadata_ttl.cc │ ├── test_mock_server.cc │ ├── test_rest_mock_server.cc │ ├── test_routing.cc │ ├── test_routing_connection.cc │ ├── test_routing_strategy.cc │ └── test_user_option.cc ├── coverage.ignore ├── fuzzers/ │ ├── CMakeLists.txt │ ├── README.txt │ ├── corpus/ │ │ ├── fuzz_router_uri/ │ │ │ ├── uri-1 │ │ │ ├── uri-2 │ │ │ └── uri-3 │ │ └── fuzz_router_uri_tostring/ │ │ └── uri-ipv6-zoneid │ ├── fuzz_router_uri.cc │ └── fuzz_router_uri_tostring.cc ├── gcoverage.sh ├── helpers/ │ ├── cmd_exec-windows.cc │ ├── cmd_exec-windows.h │ ├── cmd_exec.cc │ ├── cmd_exec.h │ ├── gtest_consoleoutput.h │ ├── master_key_test_writer.cc │ ├── mysql_session_replayer.cc │ ├── mysql_session_replayer.h │ ├── router_component_test.cc │ ├── router_component_test.h │ ├── router_test_helpers.cc │ ├── router_test_helpers.h │ ├── script_generator.cc │ ├── script_generator.h │ ├── tcp_port_pool.cc │ └── tcp_port_pool.h ├── legal/ │ ├── test_legal.cc │ └── test_project_name.cc └── tools/ └── gtest_cxx.cc ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Object files *.o *.lo *.obj # Compiled libraries *.so *.dll *.dylib *.a *.la *.lib # Executables *.exe *.out # Byte code *.pyc # Editors & Tools .idea/ *.sublime-* *~ # Folders .DS_Store /build* /gtest/** /gmock/** /harness/** /doc/html /doc/latex /mysql-server # Python *__pycache__* MANIFEST # Misc. commit.txt *.patch *.diff local.cmake packages/rpm-*/*.spec ================================================ FILE: CMakeLists.txt ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA cmake_minimum_required(VERSION 2.8.12) include(cmake/version.cmake) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) if(${CMAKE_VERSION} VERSION_GREATER "3.0") cmake_policy(SET CMP0042 NEW) cmake_policy(SET CMP0046 NEW) cmake_policy(SET CMP0048 NEW) if(${CMAKE_VERSION} VERSION_GREATER "3.1") cmake_policy(SET CMP0054 NEW) endif() project("MySQLRouter" VERSION ${PROJECT_VERSION_TEXT} LANGUAGES C CXX) else() project("MySQLRouter") endif() SET(MySQLRouter_BINARY_STAGE_DIR ${MySQLRouter_BINARY_DIR}/stage CACHE INTERNAL "STAGE_DIR") if(EXISTS "${CMAKE_SOURCE_DIR}/extra/rapidjson/") # prefer server-side rapidjson SET(RAPIDJSON_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extra/rapidjson/include/") else() SET(RAPIDJSON_INCLUDE_DIRS "${MySQLRouter_SOURCE_DIR}/ext/rapidjson/include/") endif() IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") # disable rapidjson optimisation on Solaris as the it breaks # shared objects that build with -fPIC ADD_DEFINITIONS(-DRAPIDJSON_48BITPOINTER_OPTIMIZATION=0) ENDIF() IF(EXISTS "${CMAKE_SOURCE_DIR}/rapid/plugin/x/protocol/mysqlx.proto") # use the server's protobuf files, we they exist SET(PROTOBUF_MYSQLX_DIR "${CMAKE_SOURCE_DIR}/rapid/plugin/x/protocol/") ELSE() SET(PROTOBUF_MYSQLX_DIR "${MySQLRouter_SOURCE_DIR}/src/x_protocol/proto/") ENDIF() find_package(LibEvent2 2.0 MODULE REQUIRED) include(cmake/settings.cmake) if(WITH_UNIT_TESTS) set(ENABLE_TESTS 1) endif() # Load Internal if(EXISTS "${PROJECT_SOURCE_DIR}/internal/") message(STATUS "Loading internal repository") add_subdirectory(internal) endif() # SSL # Add bundled yassl/taocrypt or system openssl. include(cmake/ssl.cmake) if(NOT WITH_SSL) set(WITH_SSL bundled) endif() MYSQL_CHECK_SSL() MESSAGE(STATUS "SSL_LIBRARIES: ${SSL_LIBRARIES}") MESSAGE(STATUS "SSL_DEFINES: ${SSL_DEFINES}") MESSAGE(STATUS "SSL_INCLUDE_DIRS: ${SSL_INCLUDE_DIRS}") IF(UNIX) OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF) ENDIF() # Required tools, libraries, etc.. include(cmake/testing.cmake) # does not enable testing include(cmake/platform.cmake) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/install_layout.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install_layout.cmake) else() include(cmake/install_layout.cmake) # needs ARCH_64BIT endif() include(cmake/configure.cmake) include(Coverage) # Harness before Compiler.cmake (compiler flags), after configure.cmake because of compiler flags include(cmake/compiler.cmake) find_package(Threads REQUIRED) include(cmake/docs.cmake) if(NOT EXISTS "${CMAKE_SOURCE_DIR}/include/mysql.h") # if we are built as part of the server-tree, don't initiate our own packaging include(cmake/packaging.cmake) endif() find_package(MySQL 5.5 REQUIRED) include_directories(${PROJECT_BINARY_DIR}/include) include(cmake/compile_flags.cmake) if(NOT EXISTS "${CMAKE_SOURCE_DIR}/include/mysql.h") # if we are build as part of the server-tree, use their protobuf include(cmake/protobuf.cmake) MYSQL_CHECK_PROTOBUF() endif() # Enable testing if(ENABLE_TESTS) enable_testing() add_subdirectory(tests) endif() # Load all modules, including plugins add_subdirectory(src) ================================================ FILE: License.txt ================================================ Licensing Information User Manual MySQL Router 8.0 __________________________________________________________________ Introduction This License Information User Manual contains Oracle's product license and other licensing information, including licensing information for third-party software which may be included in this distribution of MySQL Router 8.0. Last updated: February 2018. Licensing Information This is a release of MySQL Router 8.0, brought to you by the MySQL team at Oracle. This software is released under version 2 of the GNU General Public License (GPLv2), as set forth below, with the following additional permissions: This distribution of MySQL Router 8.0 is distributed with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in the license documentation. Without limiting your rights under the GPLv2, the authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have included with the program. Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. Election of GPLv2 For the avoidance of doubt, except that if any license choice other than GPL or LGPL is available it will apply instead, Oracle elects to use only the General Public License version 2 (GPLv2) at this time for any software where a choice of GPL license versions is made available with the language indicating that GPLv2 or any later version may be used, or where a choice of which version of the GPL is applied is otherwise unspecified. GNU General Public License Version 2.0, June 1991 The following applies to all products licensed under the GNU General Public License, Version 2.0: You may not use the identified files except in compliance with the GNU General Public License, Version 2.0 (the "License.") You may obtain a copy of the License at http://www.gnu.org/licenses/gpl-2.0.txt. A copy of the license is also reproduced below. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details. The hypothetical commands 'show w' and 'show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than 'show w' and 'show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program 'Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. Licenses for Third-Party Components The following sections contain licensing information for libraries that we have included with the MySQL Router 8.0 source and components used to test MySQL Router 8.0. We are thankful to all individuals that have created these. Google C++ Mocking Framework (Google Mock) This Oracle Product includes or references Gmock (including gtest), which is licensed to Oracle under the following terms: Copyright 2008, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Google Protocol Buffers The following software may be included in this product: Copyright 2014, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Code generated by the Protocol Buffer compiler is owned by the owner of the input file used when generating it. This code is not standalone and requires a support library to be linked with it. This support library is itself covered by the above license. OpenSSL License You are receiving a copy of OpenSSL as part of this product in object code form. The terms of the Oracle license do NOT apply to OpenSSL. OpenSSL is licensed under a double license, of the OpenSSL License and the original SSLeay license, separate from the Oracle product. If you do not wish to install this library, you may remove it, but the Oracle program might not operate properly or at all without it. LICENSE ISSUES ============== The OpenSSL toolkit stays under a double license, i.e. both the conditions of the OpenSSL License and the original SSLeay license apply to the toolkit. See below for the actual license texts. Actually both licenses are BSD-style Open Source licenses. In case of any license issues related to OpenSSL please contact openssl-core@openssl.org. OpenSSL License --------------- /* ==================================================================== * Copyright (c) 1998-2017 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ Original SSLeay License ----------------------- /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ RapidJSON v1.1.0 The following software may be included in this product: Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. If you have downloaded a copy of the RapidJSON binary from Tencent, please note that the RapidJSON binary is licensed under the MIT License. If you have downloaded a copy of the RapidJSON source code from Tencent, please note that RapidJSON source code is licensed under the MIT License, except for the third-party components listed below which are subject to different license terms. Your integration of RapidJSON into your own projects may require compliance with the MIT License, as well as the other licenses applicable to the third-party components included within RapidJSON. To avoid the problematic JSON license in your own projects, it's sufficient to exclude the bin/jsonchecker/ directory, as it's the only code under the JSON license. A copy of the MIT License is included in this file. Other dependencies and licenses: Open Source Software Licensed Under the BSD License: -------------------------------------------------------------------- The msinttypes r29 Copyright (c) 2006-2013 Alexander Chemeris All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Open Source Software Licensed Under the JSON License: -------------------------------------------------------------------- json.org Copyright (c) 2002 JSON.org All Rights Reserved. JSON_checker Copyright (c) 2002 JSON.org All Rights Reserved. Terms of the JSON License: --------------------------------------------------- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Terms of the MIT License: -------------------------------------------------------------------- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Written Offer for Source Code For any software that you receive from Oracle in binary form which is licensed under an open source license that gives you the right to receive the source code for that binary, you can obtain a copy of the applicable source code by visiting http://www.oracle.com/goto/opensourcecode. If the source code for the binary was not provided to you with the binary, you can also receive a copy of the source code on physical media by submitting a written request to the address listed below or by sending an email to Oracle using the following link: http://www.oracle.com/goto/opensourcecode/request. Oracle America, Inc. Attn: Senior Vice President Development and Engineering Legal 500 Oracle Parkway, 10th Floor Redwood Shores, CA 94065 Your request should include: * The name of the binary for which you are requesting the source code * The name and version number of the Oracle product containing the binary * The date you received the Oracle product * Your name * Your company name (if applicable) * Your return mailing address and email, and * A telephone number in the event we need to reach you. We may charge you a fee to cover the cost of physical media and processing. Your request must be sent a. within three (3) years of the date you received the Oracle product that included the binary that is the subject of your request, or b. in the case of code licensed under the GPL v3 for as long as Oracle offers spare parts or customer support for that product model. ================================================ FILE: README.txt ================================================ This repository is frozen ========================= Newer versions of MySQL Router 8.0 can be found in the MySQL Server repository: * https://github.com/mysql/mysql-server/tree/8.0/router MySQL Router 8.0 ================ This is a release of MySQL Router. For the avoidance of doubt, this particular copy of the software is released under the version 2 of the GNU General Public License. MySQL Router is brought to you by Oracle. Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. Documentation ------------- For further information about MySQL or additional documentation, see: * http://www.mysql.com * http://dev.mysql.com/doc/mysql-router/en/ You can browse the MySQL Router Reference Manual online or download it in any of several formats at the URL given earlier in this file. Source distributions include a local copy of the manual in the Docs directory. Developer documentation can be build when Doxygen 1.8.9 or greater has been installed: shell> cd build shell> cmake .. shell> make doc You can then open the folder `doc/html/index.html` in your browser. Coverage information -------------------- To build so that coverage information is generated: cmake -DENABLE_COVERAGE=1 To get coverage information, just run the program or the unit tests (do not forget to enable the unit tests if you want to run them). Once you have collected coverage information, you can generate an HTML report in `/coverage/html` using: make coverage-html There are three variables to control where the information is collected and where the reports are written: - `GCOV_BASE_DIR` is a cache variable with the full path to a base directory for the coverage information. It defaults to `${CMAKE_BUILD_DIR}/coverage`. - `GCOV_INFO_FILE` is a cache varible with the full path to the info file for the collected coverage information. It defaults to `${GCOV_BASE_DIR}/coverage.info`. - `GCOV_XML_FILE` is a cache varible with the full path to the XML file for the collected coverage information. It defaults to `${GCOV_BASE_DIR}/coverage.xml`. - `GCOV_HTML_DIR` is a cache variable with the full path to the directory where the HTML coverage report will be generated. It defaults to `${GCOV_BASE_DIR}/html`. License ------- License information can be found in the License.txt file. This distribution may include materials developed by third parties. For license and attribution notices for these materials, please refer to the documentation that accompanies this distribution (see the "Licenses for Third-Party Components" appendix) or view the online documentation at . GPLv2 Disclaimer For the avoidance of doubt, except that if any license choice other than GPL or LGPL is available it will apply instead, Oracle elects to use only the General Public License version 2 (GPLv2) at this time for any software where a choice of GPL license versions is made available with the language indicating that GPLv2 or any later version may be used, or where a choice of which version of the GPL is applied is otherwise unspecified. Licenses for Third-Party Components ----------------------------------- ### GMock and GTest Copyright 2008, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### Protobuf This license applies to all parts of Protocol Buffers except the following: - Atomicops support for generic gcc, located in src/google/protobuf/stubs/atomicops_internals_generic_gcc.h. This file is copyrighted by Red Hat Inc. - Atomicops support for AIX/POWER, located in src/google/protobuf/stubs/atomicops_internals_power.h. This file is copyrighted by Bloomberg Finance LP. Copyright 2014, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Code generated by the Protocol Buffer compiler is owned by the owner of the input file used when generating it. This code is not standalone and requires a support library to be linked with it. This support library is itself covered by the above license. ### RapidJSON Copyright (C) 2011 Milo Yip Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: cmake/Coverage.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA option(ENABLE_COVERAGE "Enable code coverage support") set(GCOV_BASE_DIR ${PROJECT_BINARY_DIR}/coverage CACHE PATH "GCov coverage base directory") set(GCOV_HTML_DIR ${GCOV_BASE_DIR}/html CACHE PATH "GCov HTML report output directory") set(GCOV_INFO_FILE ${GCOV_BASE_DIR}/coverage.info CACHE FILEPATH "GCov information file name") set(GCOV_XML_FILE ${GCOV_BASE_DIR}/coverage.xml CACHE FILEPATH "GCov XML report file name") set(LCOV_FLAGS -b ${PROJECT_BINARY_DIR} -d ${PROJECT_SOURCE_DIR} -q) set(GCOVR_FLAGS -r ${PROJECT_SOURCE_DIR}) include(TextUtils) if(ENABLE_COVERAGE) if(CMAKE_COMPILER_IS_GNUCXX) find_program(GCOV gcov) find_program(LCOV lcov) find_program(GENHTML genhtml) if(NOT (LCOV AND GCOV AND GENHTML)) set(_programs) if(NOT LCOV) list(APPEND _programs "'lcov'") endif() if(NOT GCOV) list(APPEND _programs "'gcov'") endif() if(NOT GENHTML) list(APPEND _programs "'genhtml'") endif() oxford_comma(_text ${_programs}) message(FATAL_ERROR "Could not find ${_text}, please install.") endif() add_definitions(-fprofile-arcs -ftest-coverage) link_libraries(gcov) message(STATUS "Building with coverage information") message(STATUS "Target coverage-clear added to clear coverage information") message(STATUS "Target coverage-html added to generate HTML report") add_custom_target(coverage-clear COMMAND ${LCOV} ${LCOV_FLAGS} -z COMMENT "Clearing coverage information") add_custom_target(coverage-info COMMAND ${CMAKE_COMMAND} -E make_directory ${GCOV_BASE_DIR} COMMAND ${LCOV} ${LCOV_FLAGS} -o ${GCOV_INFO_FILE} -c COMMAND ${LCOV} ${LCOV_FLAGS} -o ${GCOV_INFO_FILE} -r ${GCOV_INFO_FILE} '/usr/include/*' 'ext/*' '*/tests/*' '*/generated/*' COMMENT "Generating coverage info file ${GCOV_INFO_FILE}") add_custom_target(coverage-html DEPENDS coverage-info COMMAND ${CMAKE_COMMAND} -E make_directory ${GCOV_HTML_DIR} COMMAND ${GENHTML} -o ${GCOV_HTML_DIR} ${GCOV_INFO_FILE} COMMENT "Generating HTML report on coverage in ${GCOV_HTML_DIR}") find_program(GCOVR gcovr) if(GCOVR) add_custom_target(coverage-xml COMMAND ${CMAKE_COMMAND} -E make_directory ${GCOV_BASE_DIR} COMMAND ${GCOVR} ${GCOVR_FLAGS} -o ${GCOV_XML_FILE} --xml -e '/usr/include/.*' -e '.*/tests/.*' -e 'ext/.*' -e '.*/generated/.*' ${PROJECT_BINARY_DIR}) message(STATUS "Target coverage-xml added to generate XML report") else() message(STATUS "Target coverage-xml not built - gcovr not found") endif() else() message(FATAL_ERROR "Coverage not supported for ${CMAKE_CXX_COMPILER}") endif() endif() ================================================ FILE: cmake/FindGMock.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Find the MySQL Client Libraries and related development files # # GMOCK_FOUND - TRUE if GMock was found # GMOCK_INCLUDE_DIRS - path which contains gmock.h # GMOCK_LIBRARIES - libgmock # GMOCK_BOTH_LIBRARIES - both libgmock and libgmock-main # GMOCK_MAIN_LIBRARIES - libgmock-main set(GMOCK_FOUND FALSE) # Can not use IS_ABSOLUTE as paths with ~ (home directory) are not starting with get_filename_component(GMOCK_ROOT ${GMOCK_ROOT} ABSOLUTE) find_library(gmock_lib NAMES gmock PATHS ${GMOCK_ROOT}) find_path(gmock_inc_dir NAMES gmock/gmock.h PATHS ${GMOCK_ROOT}/include) # File containing version find_path(gmock_configure NAMES configure PATHS ${GMOCK_ROOT}) if(gmock_lib AND gmock_inc_dir AND gmock_configure) # Not the greatest place for getting the version, but best we got file(STRINGS "${gmock_configure}/configure" version_line REGEX "^PACKAGE_VERSION='.*'" ) string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" version_str ${version_line}) string(REPLACE "." ";" version_list ${version_str}) list(GET version_list 0 GMOCK_VERSION_MAJOR) list(GET version_list 1 GMOCK_VERSION_MINOR) list(GET version_list 2 GMOCK_VERSION_PATCH) set(GMOCK_VERSION "${GMOCK_VERSION_MAJOR}.${GMOCK_VERSION_MINOR}.${GMOCK_VERSION_PATCH}") if(GMock_FIND_VERSION) if(GMock_FIND_VERSION_EXACT AND (NOT GMOCK_VERSION VERSION_EQUAL GMock_FIND_VERSION)) message(FATAL_ERROR "Exact GMock v${GMock_FIND_VERSION} is required; found v${GMOCK_VERSION}") elseif(GMOCK_VERSION VERSION_LESS GMock_FIND_VERSION) message(FATAL_ERROR "GMock v${GMock_FIND_VERSION} or later is required; found v${GMOCK_VERSION}") endif() endif() set(GMOCK_FOUND TRUE) set(GMOCK_INCLUDE_DIRS ${gmock_inc_dir}) set(GMOCK_LIBRARIES ${gmock_lib}) find_library(GMOCK_MAIN_LIBRARIES NAMES gmock_main HINTS ${ENV_GMOCK_ROOT} ${GMOCK_ROOT}) set(GMOCK_BOTH_LIBRARIES ${GMOCK_MAIN_LIBRARIES} ${GMOCK_LIBRARIES}) message(STATUS "Found GMock: ${gmock_lib}") endif() if(GMock_FIND_REQUIRED AND NOT GMOCK_FOUND) message(FATAL_ERROR "Google C++ Mocking Framework not found under '${GMOCK_ROOT}'") endif() ================================================ FILE: cmake/FindLibEvent2.cmake ================================================ # Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA IF(NOT WITH_LIBEVENT) SET(WITH_LIBEVENT system) ENDIF() IF(WITH_LIBEVENT STREQUAL "system" OR WITH_LIBEVENT STREQUAL "yes") IF(NOT WIN32) SET(LIBEVENT2_INCLUDE_PATH /usr/local/include /opt/local/include) SET(LIBEVENT2_LIB_PATHS /usr/local/lib /opt/local/lib) ENDIF() # use default paths SET(HOW_TO_FIND) ELSEIF(WITH_LIBEVENT STREQUAL "bundled") MESSAGE(FATAL_ERROR "bundled libevent isn't support") ELSE() # make the users path for libevent absolute GET_FILENAME_COMPONENT(LIBEVENT_ABS_DIR "${WITH_LIBEVENT}" ABSOLUTE) SET(LIBEVENT2_INCLUDE_PATH ${LIBEVENT_ABS_DIR}/include) SET(LIBEVENT2_LIB_PATHS ${LIBEVENT_ABS_DIR}/lib) # if path specified, use that path only SET(HOW_TO_FIND NO_DEFAULT_PATH) ENDIF() FIND_PATH(LIBEVENT2_INCLUDE_DIR event2/event.h PATHS ${LIBEVENT2_INCLUDE_PATH} ${HOW_TO_FIND}) IF(WIN32) ## libevent-2.0.22 on windows is only 'event.lib' and 'event.dll' FIND_LIBRARY(LIBEVENT2_CORE NAMES event PATHS ${LIBEVENT2_LIB_PATHS} ${HOW_TO_FIND}) SET(LIBEVENT2_EXTRA) ELSE() FIND_LIBRARY(LIBEVENT2_CORE NAMES event_core PATHS ${LIBEVENT2_LIB_PATHS} ${HOW_TO_FIND}) FIND_LIBRARY(LIBEVENT2_EXTRA NAMES event_extra PATHS ${LIBEVENT2_LIB_PATHS} ${HOW_TO_FIND}) ENDIF() IF (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_CORE) SET(LibEvent2_FOUND TRUE) ELSE() SET(LibEvent2_FOUND FALSE) ENDIF() IF(LibEvent2_FIND_VERSION) IF(LibEvent2_FIND_VERSION_EXACT) SET(LIBEVENT2_VERSION_REQUEST_STR "requested == ${LibEvent2_FIND_VERSION}") ELSE() SET(LIBEVENT2_VERSION_REQUEST_STR "requested >= ${LibEvent2_FIND_VERSION}") ENDIF() ELSE() SET(LIBEVENT2_VERSION_REQUEST_STR "requested any") ENDIF() IF (LibEvent2_FOUND) # extract version number from event-config.h # # libevent-2.0 has _EVENT_VERSION # libevent-2.1 has EVENT__VERSION FILE(WRITE ${PROJECT_BINARY_DIR}/check-libevent-header-version.c "#include #include int main() { puts(LIBEVENT_VERSION); return 0; }; ") TRY_RUN(LIBEVENT_VERSION_RUN_RES LIBEVENT_VERSION_COMPILE_RES ${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}/check-libevent-header-version.c CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LIBEVENT2_INCLUDE_DIR}" COMPILE_OUTPUT_VARIABLE compile_output RUN_OUTPUT_VARIABLE version_line ) IF(NOT version_line) ## debug output in case of compile/run failures MESSAGE(STATUS "compile-result: ${LIBEVENT_VERSION_COMPILE_RES}") MESSAGE(STATUS "compile-output: ${compile_output}") MESSAGE(STATUS "run-result: ${LIBEVENT_VERSION_RUN_RES}") MESSAGE(STATUS "run-output: ${version_line}") MESSAGE(FATAL_ERROR "Could NOT find version-line in ${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h") ENDIF() STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" version_str ${version_line}) STRING(REPLACE "." ";" version_list ${version_str}) LIST(GET version_list 0 LIBEVENT2_VERSION_MAJOR) LIST(GET version_list 1 LIBEVENT2_VERSION_MINOR) LIST(GET version_list 2 LIBEVENT2_VERSION_PATCH) SET(LIBEVENT2_VERSION "${LIBEVENT2_VERSION_MAJOR}.${LIBEVENT2_VERSION_MINOR}.${LIBEVENT2_VERSION_PATCH}") IF(LibEvent2_FIND_VERSION) IF(LibEvent2_FIND_VERSION_EXACT) IF(NOT LIBEVENT2_VERSION VERSION_EQUAL "${LibEvent2_FIND_VERSION}") MESSAGE(FATAL_ERROR "Found libevent 2.x: ${LIBEVENT2_CORE}, version=${LIBEVENT2_VERSION}, but ${LIBEVENT2_VERSION_REQUEST_STR}") ENDIF() ELSE() IF(LIBEVENT2_VERSION VERSION_LESS "${LibEvent2_FIND_VERSION}") MESSAGE(FATAL_ERROR "Found libevent 2.x: ${LIBEVENT2_CORE}, version=${LIBEVENT2_VERSION}, but ${LIBEVENT2_VERSION_REQUEST_STR}") ENDIF() ENDIF() ENDIF() # we want 2.x and higher IF(NOT LibEvent2_FIND_QUIETLY) MESSAGE(STATUS "Found libevent 2.x: ${LIBEVENT2_CORE}, version=${LIBEVENT2_VERSION} (${LIBEVENT2_VERSION_REQUEST_STR})") ENDIF() ELSE() IF(LibEvent2_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could NOT find libevent 2.x libs in ${LIBEVENT2_LIB_PATHS}, headers in ${LIBEVENT2_INCLUDE_PATH}. (${LIBEVENT2_VERSION_REQUEST_STR})") ENDIF() ENDIF() # don't expose them in the cmake UI MARK_AS_ADVANCED( LIBEVENT2_INCLUDE_DIR LIBEVENT2_CORE LIBEVENT2_EXTRA LIBEVENT2_VERSION ) ================================================ FILE: cmake/FindMySQL.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Find the MySQL Client Libraries and related development files # # MySQL_FOUND - TRUE if MySQL was found # MySQL_INCLUDE_DIRS - path which contains mysql.h # MySQL_LIBRARIES - libraries provided by the MySQL installation # MySQL_VERSION - version of the MySQL Client Libraries # In Windows we are linking against the .dll if(WIN32) set(MySQL_CLIENT_LIBRARY libmysql) else() set(MySQL_CLIENT_LIBRARY mysqlclient) endif() if(WIN32) if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(PROGRAMFILES_VAR "PROGRAMW6432") else() set(PROGRAMFILES_VAR "PROGRAMFILES") endif() set(WITH_MYSQL "$ENV{${PROGRAMFILES_VAR}}/MySQL/MySQL Server*/" CACHE PATH "Installation path of MySQL Client Libraries") if(MYSQL_BUILD) STRING(TOLOWER ${MYSQL_BUILD} MYSQL_BUILD) set(MySQL_LIBRARY_PATHS ${WITH_MYSQL}/lib "$ENV{${PROGRAMFILES_VAR}}/MySQL/MySQL Server*/lib" ) else() set(MySQL_LIBRARY_PATHS ${WITH_MYSQL}/lib ${WITH_MYSQL}/lib/debug "$ENV{${PROGRAMFILES_VAR}}/MySQL/MySQL Server*/lib" ) endif() set(MySQL_INCLUDE_PATHS ${WITH_MYSQL}/include "$ENV{${PROGRAMFILES_VAR}}/MySQL/MySQL Server*/include" ) else() set(WITH_MYSQL "/usr/local/mysql" CACHE PATH "Installation path of MySQL Client Libraries") set(MySQL_LIBRARY_PATHS ${CMAKE_BINARY_DIR}/../mysql-server/lib ${WITH_MYSQL}/lib /usr/local/mysql/lib /usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu /usr/lib64 /usr/lib ) set(MySQL_INCLUDE_PATHS ${CMAKE_BINARY_DIR}/../mysql-server/include ${WITH_MYSQL}/include /usr/local/mysql/include /usr/local/include /usr/include ) endif() # test if we are located in the mysql-server-tree IF(EXISTS "${CMAKE_SOURCE_DIR}/include/mysql.h") # bundled build SET(MySQL_CLIENT_LIB libmysql) SET(MySQL_VERSION_HEADER ${CMAKE_BINARY_DIR}/include/mysql_version.h) SET(MySQL_INCLUDES ${CMAKE_SOURCE_DIR}/include) LIST(APPEND MySQL_INCLUDES ${CMAKE_SOURCE_DIR}/libbinlogevents/export) LIST(APPEND MySQL_INCLUDES ${CMAKE_BINARY_DIR}/include) ELSE() # external mysql-server install find_path(MySQL_INCLUDES mysql.h PATHS ${MySQL_INCLUDE_PATHS} PATH_SUFFIXES mysql NO_DEFAULT_PATH) if(WITH_STATIC AND NOT WIN32) find_library(MySQL_CLIENT_LIB NAMES lib${MySQL_CLIENT_LIBRARY}.a PATHS ${MySQL_LIBRARY_PATHS} PATH_SUFFIXES mysql NO_DEFAULT_PATH) else() find_library(MySQL_CLIENT_LIB NAMES ${MySQL_CLIENT_LIBRARY} PATHS ${MySQL_LIBRARY_PATHS} PATH_SUFFIXES mysql NO_DEFAULT_PATH) if(NOT WIN32) find_library(LIBDL NAMES dl) endif() endif() SET(MySQL_VERSION_HEADER ${MySQL_INCLUDES}/mysql_version.h) endif() if(MySQL_INCLUDES AND MySQL_CLIENT_LIB) set(MySQL_FOUND TRUE) set(MySQL_INCLUDE_DIRS ${MySQL_INCLUDES}) if(LIBDL) set(MySQL_LIBRARIES ${MySQL_CLIENT_LIB} ${LIBDL}) else() set(MySQL_LIBRARIES ${MySQL_CLIENT_LIB}) endif() file(STRINGS "${MySQL_VERSION_HEADER}" version_line REGEX "^#define[\t ]+MYSQL_SERVER_VERSION.*" ) string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" version_str ${version_line}) string(REPLACE "." ";" version_list ${version_str}) list(GET version_list 0 MySQL_VERSION_MAJOR) list(GET version_list 1 MySQL_VERSION_MINOR) list(GET version_list 2 MySQL_VERSION_PATCH) set(MySQL_VERSION "${MySQL_VERSION_MAJOR}.${MySQL_VERSION_MINOR}.${MySQL_VERSION_PATCH}") if(MySQL_FIND_VERSION) if(MySQL_FIND_VERSION_EXACT AND (NOT MySQL_VERSION VERSION_EQUAL MySQL_FIND_VERSION)) message(FATAL_ERROR "Exact MySQL v${MySQL_FIND_VERSION} is required; found v${MySQL_VERSION}") elseif(MySQL_VERSION VERSION_LESS MySQL_FIND_VERSION) message(FATAL_ERROR "MySQL v${MySQL_FIND_VERSION} or later is required; found v${MySQL_VERSION}") endif() endif() else() set(MySQL_FOUND FALSE) endif() if(MySQL_FOUND) message(STATUS "Found MySQL Libraries ${MySQL_VERSION}; using ${MySQL_LIBRARIES}") else() if(MySQL_FIND_REQUIRED) message(FATAL_ERROR "Could not find MySQL libraries; used ${MySQL_LIBRARY_PATHS}") endif() endif() mark_as_advanced(MySQL_LIBRARY MySQL_INCLUDE_DIRS) ================================================ FILE: cmake/HarnessTesting.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA if(NOT CMAKE_CFG_INTDIR STREQUAL ".") function(CONFIGURE_HARNESS_TEST_FILE SOURCE DESTINATION) set(HARNESS_PLUGIN_OUTPUT_DIRECTORY_orig ${HARNESS_PLUGIN_OUTPUT_DIRECTORY}) set(OUT_DIR ${PROJECT_BINARY_DIR}/tests/harness/${config_}) foreach(config_ ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${config_} config__) set(HARNESS_PLUGIN_OUTPUT_DIRECTORY ${HARNESS_PLUGIN_OUTPUT_DIRECTORY_${config__}}) configure_file(${SOURCE} ${OUT_DIR}/${config_}/${DESTINATION}) endforeach() set(HARNESS_PLUGIN_OUTPUT_DIRECTORY ${HARNESS_PLUGIN_OUTPUT_DIRECTORY_orig}) endfunction() function(CREATE_HARNESS_TEST_DIRECTORY_POST_BUILD TARGET DIRECTORY_NAME) set(OUT_DIR ${PROJECT_BINARY_DIR}/tests/harness/) foreach(config_ ${CMAKE_CONFIGURATION_TYPES}) add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${OUT_DIR}/${config_}/var/log/${DIRECTORY_NAME}) endforeach() endfunction() else() function(CONFIGURE_HARNESS_TEST_FILE SOURCE DESTINATION) set(OUT_DIR "${PROJECT_BINARY_DIR}/tests/harness") configure_file(${SOURCE} "${OUT_DIR}/${DESTINATION}") endfunction() function(CREATE_HARNESS_TEST_DIRECTORY_POST_BUILD TARGET DIRECTORY_NAME) set(OUT_DIR "${PROJECT_BINARY_DIR}/tests/harness") add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${OUT_DIR}/var/log/${DIRECTORY_NAME}") endfunction() endif() ================================================ FILE: cmake/Plugin.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # add_harness_plugin - Add a new plugin target and set install # location # # add_harness_plugin(name [NO_INSTALL] # LOG_DOMAIN domain # SOURCES file1 ... # INTERFACE directory # DESTINATION_SUFFIX string # REQUIRES plugin ...) # # The add_harness_plugin command will set up a new plugin target and # also set the install location of the target correctly. # # Plugins that are normally put under the "lib" directory of the build # root, but see the caveat in the next paragraph. # # If NO_INSTALL is provided, it will not be installed, which is useful # if the plugin is only for testing purposes. These plugins are also # left in their default location and not moved to the "lib" # directory. If you want to move the plugin to some specific # directory, you have to set the target property # LIBRARY_OUTPUT_DIRECTORY yourself. # # If LOG_DOMAIN is given, it will be used as the log domain for the # plugin. If no LOG_DOMAIN is given, the log domain will be the name # of the plugin. # # If DESTINATION_SUFFIX is provided, it will be appended to the # destination for install commands. DESTINATION_SUFFIX is optional and # default to ${HARNESS_NAME}. # # Files provided after the SOURCES keyword are the sources to build # the plugin from, while the files in the directory after INTERFACE # will be installed alongside the header files for the harness. # # For plugins, it is necessary to set the RPATH so that the plugin can # find other plugins when being loaded. This, unfortunately, means # that the plugin path need to be set at compile time and cannot be # changed after that. function(add_harness_plugin NAME) set(_options NO_INSTALL) set(_single_value LOG_DOMAIN INTERFACE DESTINATION_SUFFIX OUTPUT_NAME) set(_multi_value SOURCES REQUIRES) cmake_parse_arguments(_option "${_options}" "${_single_value}" "${_multi_value}" ${ARGN}) if(_option_UNPARSED_ARGUMENTS) message(AUTHOR_WARNING "Unrecognized arguments: ${_option_UNPARSED_ARGUMENTS}") endif() # Set default values if(NOT _option_DESTINATION_SUFFIX) set(_option_DESTINATION_SUFFIX ${HARNESS_NAME}) endif() # Set the log domain to the name of the plugin unless an explicit # log domain was given. if(NOT _option_LOG_DOMAIN) set(_option_LOG_DOMAIN "\"${NAME}\"") endif() # Add the library and ensure that the name is good for the plugin # system (no "lib" before). We are using SHARED libraries since we # intend to link against it, which is something that MODULE does not # allow. On OSX, this means that the suffix for the library becomes # .dylib, which we do not want, so we reset it here. add_library(${NAME} SHARED ${_option_SOURCES}) if(_option_OUTPUT_NAME) set_target_properties(${NAME} PROPERTIES OUTPUT_NAME ${_option_OUTPUT_NAME}) endif() target_compile_definitions(${NAME} PRIVATE MYSQL_ROUTER_LOG_DOMAIN=${_option_LOG_DOMAIN}) if(NOT WIN32) set_target_properties(${NAME} PROPERTIES PREFIX "" SUFFIX ".so") endif() # Declare the interface directory for this plugin, if present. It # will be used both when compiling the plugin as well as as for any # dependent targets. if(_option_INTERFACE) target_include_directories(${NAME} PUBLIC ${_option_INTERFACE}) execute_process( COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${_option_INTERFACE} ${MySQLRouter_BINARY_DIR}/${INSTALL_INCLUDE_DIR}) endif() # Add a dependencies on interfaces for other plugins this plugin # requires. target_link_libraries(${NAME} PUBLIC harness-library ${_option_REQUIRES}) # Need to be able to link plugins with each other if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set_target_properties(${NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif() # set library output (and runtime) directories if(NOT CMAKE_CFG_INTDIR STREQUAL ".") foreach(config ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${config} config) set_target_properties(${NAME} PROPERTIES # [SEARCH TAGS] RUNTIME_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY RUNTIME_OUTPUT_DIRECTORY_${config} ${HARNESS_PLUGIN_OUTPUT_DIRECTORY_${config}} LIBRARY_OUTPUT_DIRECTORY_${config} ${HARNESS_PLUGIN_OUTPUT_DIRECTORY_${config}}) endforeach() else() set_target_properties(${NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${HARNESS_PLUGIN_OUTPUT_DIRECTORY} RUNTIME_OUTPUT_DIRECTORY ${HARNESS_PLUGIN_OUTPUT_DIRECTORY} ) endif() # Add install rules to install the interface header files and the # plugin correctly. if(NOT _option_NO_INSTALL AND HARNESS_INSTALL_PLUGINS) if(WIN32) install(TARGETS ${NAME} RUNTIME DESTINATION ${HARNESS_INSTALL_LIBRARY_DIR}) install(FILES $ DESTINATION ${HARNESS_INSTALL_LIBRARY_DIR}) else() install(TARGETS ${NAME} LIBRARY DESTINATION ${HARNESS_INSTALL_LIBRARY_DIR}/${_option_DESTINATION_SUFFIX}) endif() if(_option_INTERFACE) file(GLOB interface_files ${_option_INTERFACE}/*.h) install(FILES ${interface_files} DESTINATION ${HARNESS_INSTALL_INCLUDE_PREFIX}/${_option_DESTINATION_SUFFIX}) endif() endif() endfunction(add_harness_plugin) ================================================ FILE: cmake/TextUtils.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA function(oxford_comma _var) if(ARGC EQUAL 2) set(${_var} "${ARGV1}" PARENT_SCOPE) elseif(ARGC EQUAL 3) set(${_var} "${ARGV1} and ${ARGV2}" PARENT_SCOPE) else() set(_count 3) set(_glue) set(_result) foreach(_arg ${ARGN}) set(_result "${_result}${_glue}${_arg}") if(_count LESS ARGC) set(_glue ", ") else() set(_glue ", and ") endif() math(EXPR _count "${_count}+1") endforeach() set(${_var} "${_result}" PARENT_SCOPE) endif() endfunction() ================================================ FILE: cmake/cmake_parse_arguments.cmake ================================================ # Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Handy macro to parse macro arguments MACRO(MYSQL_PARSE_ARGUMENTS prefix arg_names option_names) SET(DEFAULT_ARGS) FOREACH(arg_name ${arg_names}) SET(${prefix}_${arg_name}) ENDFOREACH(arg_name) FOREACH(option ${option_names}) SET(${prefix}_${option} FALSE) ENDFOREACH(option) SET(current_arg_name DEFAULT_ARGS) SET(current_arg_list) FOREACH(arg ${ARGN}) SET(larg_names ${arg_names}) LIST(FIND larg_names "${arg}" is_arg_name) IF (is_arg_name GREATER -1) SET(${prefix}_${current_arg_name} ${current_arg_list}) SET(current_arg_name ${arg}) SET(current_arg_list) ELSE (is_arg_name GREATER -1) SET(loption_names ${option_names}) LIST(FIND loption_names "${arg}" is_option) IF (is_option GREATER -1) SET(${prefix}_${arg} TRUE) ELSE (is_option GREATER -1) SET(current_arg_list ${current_arg_list} ${arg}) ENDIF (is_option GREATER -1) ENDIF (is_arg_name GREATER -1) ENDFOREACH(arg) SET(${prefix}_${current_arg_name} ${current_arg_list}) ENDMACRO() ================================================ FILE: cmake/compile_flags.cmake ================================================ # Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## ADD_COMPILE_FLAGS( COMPILE_FLAGS ) MACRO(ADD_COMPILE_FLAGS) SET(FILES "") SET(FLAGS "") SET(COMPILE_FLAGS_SEEN) FOREACH(ARG ${ARGV}) IF(ARG STREQUAL "COMPILE_FLAGS") SET(COMPILE_FLAGS_SEEN 1) ELSEIF(COMPILE_FLAGS_SEEN) LIST(APPEND FLAGS ${ARG}) ELSE() LIST(APPEND FILES ${ARG}) ENDIF() ENDFOREACH() FOREACH(FILE ${FILES}) FOREACH(FLAG ${FLAGS}) GET_SOURCE_FILE_PROPERTY(PROP ${FILE} COMPILE_FLAGS) IF(NOT PROP) SET(PROP ${FLAG}) ELSE() SET(PROP "${PROP} ${FLAG}") ENDIF() SET_SOURCE_FILES_PROPERTIES( ${FILE} PROPERTIES COMPILE_FLAGS "${PROP}" ) ENDFOREACH() ENDFOREACH() ENDMACRO() ================================================ FILE: cmake/compiler.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA include(CheckCXXCompilerFlag) # Check for C++11 support function(CHECK_CXX11) check_cxx_compiler_flag("-std=c++11" support_11) if(support_11) set(CXX11_FLAG "-std=c++11" PARENT_SCOPE) else() message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} does not support C++11 standard") endif() set(CMAKE_CXX_FLAGS ${CXX11_FLAG} PARENT_SCOPE) endfunction() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") check_cxx11() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wconversion -Wshadow") check_cxx_compiler_flag("-Wpedantic" COMPILER_HAS_WARNING_PEDANTIC) if(COMPILER_HAS_WARNING_PEDANTIC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9) # gcc 4.8 doesn't support -Wpedantic -Wno-pedantic to selectively disable set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=pedantic") endif() # bring the options in sync with the server's # GCC has this options, clang doesn't check_cxx_compiler_flag("-Wformat-security" COMPILER_HAS_WARNING_FORMAT_SECURITY) if(COMPILER_HAS_WARNING_FORMAT_SECURITY) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-security") endif() check_cxx_compiler_flag("-Wnon-virtual-dtor" COMPILER_HAS_WARNING_NON_VIRTUAL_DTOR) if(COMPILER_HAS_WARNING_NON_VIRTUAL_DTOR) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor") endif() # GCC/clang have this option # clang doesn't have its sibling: -Wsuggest-attribute=format check_cxx_compiler_flag("-Wmissing-format-attribute" COMPILER_HAS_WARNING_MISSING_FORMAT_ATTRIBUTE) if(COMPILER_HAS_WARNING_MISSING_FORMAT_ATTRIBUTE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-format-attribute") endif() # GCC/clang have this option # # FIXME: as long as protobuf-3.0.0 and gmock 1.7.0 are used, we need to disable -Wundef as it is # triggered all over the place in the headers. It should actually be enabled. check_cxx_compiler_flag("-Wundef" COMPILER_HAS_WARNING_UNDEF) if(COMPILER_HAS_WARNING_UNDEF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undef -Wno-conversion") endif() # GCC/clang have this option check_cxx_compiler_flag("-Wvla" COMPILER_HAS_WARNING_VLA) if(COMPILER_HAS_WARNING_VLA) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wvla") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAG}") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # Overview of MSVC versions: http://www.cmake.org/cmake/help/v3.3/variable/MSVC_VERSION.html if("${MSVC_VERSION}" VERSION_LESS 1800) message(FATAL_ERROR "Need at least ${CMAKE_CXX_COMPILER} 12.0") endif() # /TP is needed so .cc files are recognoized as C++ source files by MSVC set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /TP") add_definitions(-DWIN32_LEAN_AND_MEAN) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13.0) message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_VERSION} is too old; need at least SunPro 5.13.0 (aka Oracle Developer Studio 12.4)") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") else() message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} is not supported") endif() ================================================ FILE: cmake/configure.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA include(GNUInstallDirs) # installed executable location (used in config.h) if(IS_ABSOLUTE "${INSTALL_BINDIR}") set(ROUTER_BINDIR ${INSTALL_BINDIR}) else() set(ROUTER_BINDIR ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}) endif() # Configuration folder (config_folder configuration option) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(_configdir "ENV{APPDATA}") else() if(IS_ABSOLUTE ${INSTALL_CONFIGDIR}) set(_configdir ${INSTALL_CONFIGDIR}) elseif(INSTALL_CONFIGDIR STREQUAL ".") # Current working directory set(_configdir ${INSTALL_CONFIGDIR}) else() set(_configdir ${CMAKE_INSTALL_PREFIX}/${INSTALL_CONFIGDIR}) endif() endif() set(ROUTER_CONFIGDIR ${_configdir} CACHE STRING "Location of configuration file(s) (config_folder)") unset(_configdir) # Logging folder (logging_folder configuration option) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(_logdir "ENV{APPDATA}\\\\log") else() # logging folder can be set to empty to log to console if(IS_ABSOLUTE "${INSTALL_LOGDIR}") set(_logdir ${INSTALL_LOGDIR}) elseif(NOT INSTALL_LOGDIR) set(_logdir "/var/log/mysqlrouter/") else() set(_logdir ${CMAKE_INSTALL_PREFIX}/${INSTALL_LOGDIR}) endif() endif() set(ROUTER_LOGDIR ${_logdir} CACHE STRING "Location of log files; empty is console (logging_folder)") unset(_logdir) # Runtime folder (runtime_folder configuration option) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(_runtimedir "ENV{APPDATA}") else() if(IS_ABSOLUTE "${INSTALL_RUNTIMEDIR}") set(_runtimedir ${INSTALL_RUNTIMEDIR}) elseif(NOT INSTALL_RUNTIMEDIR) set(_logdir "/var/run/mysqlrouter/") else() set(_runtimedir ${CMAKE_INSTALL_PREFIX}/${INSTALL_RUNTIMEDIR}) endif() endif() set(ROUTER_RUNTIMEDIR ${_runtimedir} CACHE STRING "Location runtime files such as PID file (runtime_folder)") unset(_runtimedir) # Plugin folder (plugin_folder configuration option) if(IS_ABSOLUTE "${INSTALL_PLUGINDIR}") set(_plugindir ${INSTALL_PLUGINDIR}) else() set(_plugindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINDIR}) endif() set(ROUTER_PLUGINDIR ${_plugindir} CACHE STRING "Location MySQL Router plugins (plugin_folder)") unset(_plugindir) # Data folder (data_folder configuration option) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(_datadir "ENV{APPDATA}\\\\data") else() if(IS_ABSOLUTE "${INSTALL_DATADIR}") set(_datadir ${INSTALL_DATADIR}) elseif(NOT INSTALL_DATADIR) set(_datadir "/var/lib/mysqlrouter/") else() set(_datadir "${CMAKE_INSTALL_PREFIX}/${INSTALL_DATADIR}") endif() endif() set(ROUTER_DATADIR ${_datadir} CACHE STRING "Location of data files such as keyring file") unset(_datadir) # Generate the copyright string function(SET_COPYRIGHT TARGET) string(TIMESTAMP curr_year "%Y" UTC) set(start_year "2015") set(years "${start_year},") if(NOT curr_year STREQUAL ${start_year}) set(years "${start_year}, ${curr_year},") endif() set(${TARGET} "Copyright (c) ${years} Oracle and/or its affiliates. All rights reserved." PARENT_SCOPE) endfunction() set_copyright(ORACLE_COPYRIGHT) if(INSTALL_LAYOUT STREQUAL "STANDALONE") set(ROUTER_PLUGINDIR "{origin}/../${INSTALL_PLUGINDIR_STANDALONE}") set(ROUTER_CONFIGDIR "{origin}/../${INSTALL_CONFIGDIR_STANDALONE}") set(ROUTER_RUNTIMEDIR "{origin}/../${INSTALL_RUNTIMEDIR_STANDALONE}") set(ROUTER_LOGDIR "{origin}/../${INSTALL_LOGDIR_STANDALONE}") set(ROUTER_DATADIR "{origin}/../${INSTALL_DATADIR_STANDALONE}") endif() # Default configuration file locations (similar to MySQL Server) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(CONFIG_FILE_LOCATIONS "${ROUTER_CONFIGDIR}/${MYSQL_ROUTER_INI}" "ENV{APPDATA}/${MYSQL_ROUTER_INI}" ) else() set(CONFIG_FILE_LOCATIONS "${ROUTER_CONFIGDIR}/${MYSQL_ROUTER_INI}" "ENV{HOME}/.${MYSQL_ROUTER_INI}" ) endif() set(CONFIG_FILES ${CONFIG_FILE_LOCATIONS}) # Platform/Compiler checks INCLUDE(TestBigEndian) TEST_BIG_ENDIAN(WORDS_BIGENDIAN) INCLUDE(CheckTypeSize) CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP) CHECK_TYPE_SIZE("char *" SIZEOF_CHARP) CHECK_TYPE_SIZE("long" SIZEOF_LONG) CHECK_TYPE_SIZE("short" SIZEOF_SHORT) CHECK_TYPE_SIZE("int" SIZEOF_INT) CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T) CHECK_TYPE_SIZE("time_t" SIZEOF_TIME_T) # Platform/Compiler checks INCLUDE(TestBigEndian) TEST_BIG_ENDIAN(WORDS_BIGENDIAN) # Compiler specific features INCLUDE(CheckCSourceCompiles) CHECK_C_SOURCE_COMPILES(" void test(const char *format, ...) __attribute__((format(printf, 1, 2))); int main() { return 0; }" HAVE_ATTRIBUTE_FORMAT) MACRO(DIRNAME IN OUT) GET_FILENAME_COMPONENT(${OUT} ${IN} PATH) ENDMACRO() MACRO(FIND_REAL_LIBRARY SOFTLINK_NAME REALNAME) # We re-distribute libstdc++.so which is symlink. # There is no 'readlink' on solaris, so we use perl to follow the link: SET(PERLSCRIPT "my $link= $ARGV[0]; use Cwd qw(abs_path); my $file = abs_path($link); print $file;") EXECUTE_PROCESS( COMMAND perl -e "${PERLSCRIPT}" ${SOFTLINK_NAME} RESULT_VARIABLE result OUTPUT_VARIABLE real_library ) SET(REALNAME ${real_library}) ENDMACRO() MACRO(EXTEND_CXX_LINK_FLAGS LIBRARY_PATH) # Using the $ORIGIN token with the -R option to locate the libraries # on a path relative to the executable: SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -R'\$ORIGIN/../lib' -R${LIBRARY_PATH}") MESSAGE(STATUS "CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS}") ENDMACRO() MACRO(EXTEND_C_LINK_FLAGS LIBRARY_PATH) SET(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -R'\$ORIGIN/../lib' -R${LIBRARY_PATH}") MESSAGE(STATUS "CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS}") SET(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -R'\$ORIGIN/../lib' -R${LIBRARY_PATH}") ENDMACRO() IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCC) DIRNAME(${CMAKE_CXX_COMPILER} CXX_PATH) SET(LIB_SUFFIX "lib") IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc") SET(LIB_SUFFIX "lib/sparcv9") ENDIF() IF(SIZEOF_VOIDP EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386") SET(LIB_SUFFIX "lib/amd64") ENDIF() FIND_LIBRARY(GPP_LIBRARY_NAME NAMES "stdc++" PATHS ${CXX_PATH}/../${LIB_SUFFIX} NO_DEFAULT_PATH ) MESSAGE(STATUS "GPP_LIBRARY_NAME ${GPP_LIBRARY_NAME}") IF(GPP_LIBRARY_NAME) DIRNAME(${GPP_LIBRARY_NAME} GPP_LIBRARY_PATH) FIND_REAL_LIBRARY(${GPP_LIBRARY_NAME} real_library) MESSAGE(STATUS "INSTALL ${GPP_LIBRARY_NAME} ${real_library}") INSTALL(FILES ${GPP_LIBRARY_NAME} ${real_library} DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries) EXTEND_CXX_LINK_FLAGS(${GPP_LIBRARY_PATH}) EXECUTE_PROCESS( COMMAND sh -c "elfdump ${real_library} | grep SONAME" RESULT_VARIABLE result OUTPUT_VARIABLE sonameline ) IF(NOT result) STRING(REGEX MATCH "libstdc.*[^\n]" soname ${sonameline}) MESSAGE(STATUS "INSTALL ${GPP_LIBRARY_PATH}/${soname}") INSTALL(FILES "${GPP_LIBRARY_PATH}/${soname}" DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries) ENDIF() ENDIF() FIND_LIBRARY(GCC_LIBRARY_NAME NAMES "gcc_s" PATHS ${CXX_PATH}/../${LIB_SUFFIX} NO_DEFAULT_PATH ) IF(GCC_LIBRARY_NAME) DIRNAME(${GCC_LIBRARY_NAME} GCC_LIBRARY_PATH) FIND_REAL_LIBRARY(${GCC_LIBRARY_NAME} real_library) MESSAGE(STATUS "INSTALL ${GCC_LIBRARY_NAME} ${real_library}") INSTALL(FILES ${GCC_LIBRARY_NAME} ${real_library} DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries) EXTEND_C_LINK_FLAGS(${GCC_LIBRARY_PATH}) ENDIF() ENDIF() # check if platform supports prlimit() include(CMakePushCheckState) cmake_push_check_state() cmake_reset_check_state() include(CheckSymbolExists) set(CMAKE_REQUIRED_FLAGS -D_GNU_SOURCE) check_symbol_exists(prlimit sys/resource.h HAVE_PRLIMIT) cmake_pop_check_state() configure_file(config.h.in router_config.h @ONLY) include_directories(${PROJECT_BINARY_DIR}) ================================================ FILE: cmake/docs.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA find_package(Doxygen) if (DOXYGEN_FOUND) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/doc) configure_file(doc/doxygen.cfg.in ${PROJECT_BINARY_DIR}/doc/doxygen.cfg @ONLY) foreach(f router_footer.html router_header.html router_doxygen.css) file(COPY ${PROJECT_SOURCE_DIR}/doc/${f} DESTINATION ${PROJECT_BINARY_DIR}/doc) endforeach() add_custom_target(doc ${DOXYGEN_EXECUTABLE} doc/doxygen.cfg COMMAND pwd WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Generate MySQL Router developer documentation" VERBATIM) endif() ================================================ FILE: cmake/gmocktest.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # CMake module handling Google C++ Mocking & Testing Framework dependency # We do not add "REQUIRED" here so we can handle missing GTest # showing a better error message find_package(GMock 1.7.0) set(GTEST_ROOT "${GMOCK_ROOT}/gtest") find_package(GTest) if(NOT GTEST_FOUND OR NOT GMOCK_FOUND) message(STATUS "") message(STATUS "GMock/GTest were not found in following folder") message(STATUS " ${GMOCK_ROOT}") message(STATUS "") message(STATUS "Please make sure that GMock was compiled in the above") message(STATUS "mentioned folder as follows:") message(STATUS " shell> cd ${GMOCK_ROOT}") message(STATUS " shell> cmake .") message(STATUS " shell> make") message(STATUS "Or set the CMake variable GMOCK_ROOT pointing") message(STATUS "to the installation of GMock (which also includes GTest).") message(STATUS "") message(STATUS "GMock can be downloaded using following URL:") message(STATUS " ${GMOCK_DOWNLOAD_URL}") message(STATUS "") message(FATAL_ERROR "Please fix GMock and GTest installation (see above message)") endif() ================================================ FILE: cmake/install_layout.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Originally part of MySQL Server and Adapted for MySQL Router. # The purpose of this file is to set the default installation layout. # # The current choices of installation layout are: # # STANDALONE # Build with prefix=/usr/local/mysql, create tarball with install prefix="." # and relative links. Windows zip uses the same tarball layout but without # the build prefix. # # RPM, SLES # Build as per default RPM layout, with prefix=/usr # Note: The layout for ULN RPMs differs, see the "RPM" section. # # DEB # Build as per default Debian layout, with prefix=/usr # Note: previous layout is now named DEBSRV4 # # DEBSRV4 # Build as per STANDALONE, prefix=/opt/mysql/mysql-router-$major.$minor # # SVR4 # Solaris package layout suitable for pkg* tools, prefix=/opt/mysql/mysql-router # # FREEBSD, GLIBC, OSX, TARGZ # Build with prefix=/usr/local/mysql, create tarball with install prefix="." # and relative links. # # WIN # Windows zip : same as tarball layout but without the build prefix # # To force a directory layout, use -DINSTALL_LAYOUT=. # # The default is STANDALONE. # # Note : At present, RPM and SLES layouts are similar. This is also true # for layouts like FREEBSD, GLIBC, OSX, TARGZ. However, they provide # opportunity to fine-tune deployment for each platform without # affecting all other types of deployment. # # There is the possibility to further fine-tune installation directories. # Several variables can be overwritten: # # - INSTALL_BINDIR (directory with client executables and scripts) # - INSTALL_SBINDIR (directory with mysqld) # - INSTALL_SCRIPTDIR (several scripts, rarely used) # # - INSTALL_LIBDIR (directory with client end embedded libraries) # - INSTALL_PLUGINDIR (directory for plugins) # # - INSTALL_INCLUDEDIR (directory for MySQL headers) # # - INSTALL_DOCDIR (documentation) # - INSTALL_DOCREADMEDIR (readme and similar) # - INSTALL_MANDIR (man pages) # - INSTALL_INFODIR (info pages) # # - INSTALL_SHAREDIR (location of aclocal/mysql.m4) # - INSTALL_MYSQLSHAREDIR (MySQL character sets and localized error messages) # - INSTALL_MYSQLTESTDIR (mysqlrouter-test) # - INSTALL_SQLBENCHDIR (sql-bench) # - INSTALL_SUPPORTFILESDIR (various extra support files) # # - INSTALL_MYSQLDATADIR (data directory) # - INSTALL_SECURE_FILE_PRIVDIR (--secure-file-priv directory) # # When changing this page, _please_ do not forget to update public Wiki # http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths IF(NOT INSTALL_LAYOUT) IF(WIN32) SET(DEFAULT_INSTALL_LAYOUT "WIN") ELSE() SET(DEFAULT_INSTALL_LAYOUT "DEFAULT") ENDIF() ENDIF() if(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) SET(DEFAULT_INSTALL_LAYOUT "STANDALONE") endif() SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}" CACHE STRING "Installation directory layout. Options are: TARGZ (as in tar.gz installer), WIN (as in zip installer), STANDALONE, RPM, DEB, DEBSRV4, SVR4, FREEBSD, GLIBC, OSX, SLES") message(STATUS "Installation layout set to ${DEFAULT_INSTALL_LAYOUT}") IF(UNIX) IF(INSTALL_LAYOUT STREQUAL "RPM" OR INSTALL_LAYOUT STREQUAL "SLES" OR INSTALL_LAYOUT STREQUAL "DEB") SET(default_prefix "/usr") ELSEIF(INSTALL_LAYOUT STREQUAL "DEBSVR4") SET(default_prefix "/opt/mysql/router-${PROJECT_VERSION}") # This is required to avoid "cpack -GDEB" default of prefix=/usr SET(CPACK_SET_DESTDIR ON) ELSEIF(INSTALL_LAYOUT STREQUAL "SVR4") SET(default_prefix "/opt/mysql/router") ELSE() SET(default_prefix "/usr/local") ENDIF() IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) SET(CMAKE_INSTALL_PREFIX ${default_prefix} CACHE PATH "install prefix" FORCE) ENDIF() SET(VALID_INSTALL_LAYOUTS "RPM" "DEB" "DEBSVR4" "SVR4" "FREEBSD" "GLIBC" "OSX" "TARGZ" "SLES" "STANDALONE" "DEFAULT") LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" ind) IF(ind EQUAL -1) MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}." " Choose between ${VALID_INSTALL_LAYOUTS}" ) ENDIF() ENDIF() IF(WIN32) SET(VALID_INSTALL_LAYOUTS "TARGZ" "STANDALONE" "WIN") LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" ind) IF(ind EQUAL -1) MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}." " Choose between ${VALID_INSTALL_LAYOUTS}" ) ENDIF() ENDIF() # # DEFAULT_SECURE_FILE_PRIV_DIR # IF(INSTALL_LAYOUT STREQUAL "STANDALONE" OR INSTALL_LAYOUT STREQUAL "DEFAULT" OR INSTALL_LAYOUT STREQUAL "WIN") SET(secure_file_priv_path "") ELSEIF(INSTALL_LAYOUT STREQUAL "RPM" OR INSTALL_LAYOUT STREQUAL "SLES" OR INSTALL_LAYOUT STREQUAL "SVR4" OR INSTALL_LAYOUT STREQUAL "DEB" OR INSTALL_LAYOUT STREQUAL "DEBSVR4") SET(secure_file_priv_path "/var/lib/mysqlrouter-files") ELSE() SET(secure_file_priv_path "${default_prefix}/mysqlrouter-files") ENDIF() # # STANDALONE layout # SET(INSTALL_BINDIR_STANDALONE "bin") SET(INSTALL_SBINDIR_STANDALONE "bin") SET(INSTALL_SCRIPTDIR_STANDALONE "scripts") SET(INSTALL_LOGDIR_STANDALONE "") SET(INSTALL_CONFIGDIR_STANDALONE ".") SET(INSTALL_RUNTIMEDIR_STANDALONE "run") SET(INSTALL_DATADIR_STANDALONE "data") # SET(INSTALL_LIBDIR_STANDALONE "lib") if(WIN32) SET(INSTALL_PLUGINDIR_STANDALONE "lib") else() SET(INSTALL_PLUGINDIR_STANDALONE "lib/mysqlrouter") endif() # SET(INSTALL_INCLUDEDIR_STANDALONE "include") # SET(INSTALL_DOCDIR_STANDALONE "share/doc/mysqlrouter") SET(INSTALL_DOCREADMEDIR_STANDALONE ".") SET(INSTALL_MANDIR_STANDALONE "man") SET(INSTALL_INFODIR_STANDALONE "share/doc/mysqlrouter") # SET(INSTALL_SHAREDIR_STANDALONE "share") SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share") SET(INSTALL_MYSQLTESTDIR_STANDALONE "share/mysqlrouter/test") SET(INSTALL_SQLBENCHDIR_STANDALONE ".") SET(INSTALL_SUPPORTFILESDIR_STANDALONE "share/mysqlrouter/support-files") # SET(INSTALL_MYSQLDATADIR_STANDALONE "data") SET(INSTALL_PLUGINTESTDIR_STANDALONE ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_STANDALONE ${secure_file_priv_path}) # # DEFAULT layout # SET(INSTALL_BINDIR_DEFAULT "bin") SET(INSTALL_SBINDIR_DEFAULT "bin") SET(INSTALL_SCRIPTDIR_DEFAULT "scripts") SET(INSTALL_LOGDIR_DEFAULT "/var/local/mysqlrouter/log") SET(INSTALL_CONFIGDIR_DEFAULT "etc/mysqlrouter") SET(INSTALL_RUNTIMEDIR_DEFAULT "/var/local/mysqlrouter/run") SET(INSTALL_DATADIR_DEFAULT "/var/local/mysqlrouter/data") # SET(INSTALL_LIBDIR_DEFAULT "lib") SET(INSTALL_PLUGINDIR_DEFAULT "lib/mysqlrouter") # SET(INSTALL_INCLUDEDIR_DEFAULT "include") # SET(INSTALL_DOCDIR_DEFAULT "share/doc/mysqlrouter") SET(INSTALL_DOCREADMEDIR_DEFAULT ".") SET(INSTALL_MANDIR_DEFAULT "man") SET(INSTALL_INFODIR_DEFAULT "share/doc/mysqlrouter") # SET(INSTALL_SHAREDIR_DEFAULT "share") SET(INSTALL_MYSQLSHAREDIR_DEFAULT "share") SET(INSTALL_MYSQLTESTDIR_DEFAULT "share/mysqlrouter/test") SET(INSTALL_SQLBENCHDIR_DEFAULT ".") SET(INSTALL_SUPPORTFILESDIR_DEFAULT "share/mysqlrouter/support-files") # SET(INSTALL_MYSQLDATADIR_DEFAULT "data") SET(INSTALL_PLUGINTESTDIR_DEFAULT ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_DEFAULT ${secure_file_priv_path}) # # WIN layout # SET(INSTALL_BINDIR_WIN "bin") SET(INSTALL_SBINDIR_WIN "bin") SET(INSTALL_SCRIPTDIR_WIN "scripts") SET(INSTALL_LOGDIR_WIN "log/mysqlrouter") SET(INSTALL_CONFIGDIR_WIN ".") SET(INSTALL_RUNTIMEDIR_WIN ".") SET(INSTALL_DATADIR_WIN ".") # SET(INSTALL_LIBDIR_WIN "lib") SET(INSTALL_PLUGINDIR_WIN "lib") # SET(INSTALL_INCLUDEDIR_WIN "include") # SET(INSTALL_DOCDIR_WIN "docs") SET(INSTALL_DOCREADMEDIR_WIN ".") SET(INSTALL_MANDIR_WIN "man") SET(INSTALL_INFODIR_WIN "docs") # SET(INSTALL_SHAREDIR_WIN "share") SET(INSTALL_MYSQLSHAREDIR_WIN "share") SET(INSTALL_MYSQLTESTDIR_WIN "mysqlrouter-test") SET(INSTALL_SQLBENCHDIR_WIN ".") SET(INSTALL_SUPPORTFILESDIR_WIN "support-files") # SET(INSTALL_MYSQLDATADIR_WIN "data") SET(INSTALL_PLUGINTESTDIR_WIN ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_WIN ${secure_file_priv_path}) # # FREEBSD layout # SET(INSTALL_BINDIR_FREEBSD "bin") SET(INSTALL_SBINDIR_FREEBSD "bin") SET(INSTALL_SCRIPTDIR_FREEBSD "scripts") SET(INSTALL_LOGDIR_FREEBSD "/var/log/mysqlrouter") SET(INSTALL_CONFIGDIR_FREEBSD "/etc/mysqlrouter") SET(INSTALL_RUNTIMEDIR_FREEBSD "/var/run/mysqlrouter") SET(INSTALL_DATADIR_FREEBSD "/var/lib/mysqlrouter") # SET(INSTALL_LIBDIR_FREEBSD "lib") SET(INSTALL_PLUGINDIR_FREEBSD "lib/mysqlrouter") # SET(INSTALL_INCLUDEDIR_FREEBSD "include") # SET(INSTALL_DOCDIR_FREEBSD "docs") SET(INSTALL_DOCREADMEDIR_FREEBSD ".") SET(INSTALL_MANDIR_FREEBSD "man") SET(INSTALL_INFODIR_FREEBSD "docs") # SET(INSTALL_SHAREDIR_FREEBSD "share") SET(INSTALL_MYSQLSHAREDIR_FREEBSD "share") SET(INSTALL_MYSQLTESTDIR_FREEBSD "mysqlrouter-test") SET(INSTALL_SQLBENCHDIR_FREEBSD ".") SET(INSTALL_SUPPORTFILESDIR_FREEBSD "support-files") # SET(INSTALL_MYSQLDATADIR_FREEBSD "data") SET(INSTALL_PLUGINTESTDIR_FREEBSD ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_FREEBSD ${secure_file_priv_path}) # # GLIBC layout # SET(INSTALL_BINDIR_GLIBC "bin") SET(INSTALL_SBINDIR_GLIBC "bin") SET(INSTALL_SCRIPTDIR_GLIBC "scripts") SET(INSTALL_LOGDIR_GLIBC "/var/log/mysqlrouter") SET(INSTALL_CONFIGDIR_GLIBC "/etc/mysqlrouter") SET(INSTALL_RUNTIMEDIR_GLIBC "/var/run/mysqlrouter") SET(INSTALL_DATADIR_GLIBC "/var/lib/mysqlrouter") # SET(INSTALL_LIBDIR_GLIBC "lib") SET(INSTALL_PLUGINDIR_GLIBC "lib/mysqlrouter") # SET(INSTALL_INCLUDEDIR_GLIBC "include") # SET(INSTALL_DOCDIR_GLIBC "docs") SET(INSTALL_DOCREADMEDIR_GLIBC ".") SET(INSTALL_MANDIR_GLIBC "man") SET(INSTALL_INFODIR_GLIBC "docs") # SET(INSTALL_SHAREDIR_GLIBC "share") SET(INSTALL_MYSQLSHAREDIR_GLIBC "share") SET(INSTALL_MYSQLTESTDIR_GLIBC "mysqlrouter-test") SET(INSTALL_SQLBENCHDIR_GLIBC ".") SET(INSTALL_SUPPORTFILESDIR_GLIBC "support-files") # SET(INSTALL_MYSQLDATADIR_GLIBC "data") SET(INSTALL_PLUGINTESTDIR_GLIBC ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_GLIBC ${secure_file_priv_path}) # # OSX layout # SET(INSTALL_BINDIR_OSX "bin") SET(INSTALL_SBINDIR_OSX "bin") SET(INSTALL_SCRIPTDIR_OSX "scripts") SET(INSTALL_LOGDIR_OSX "/var/log/mysqlrouter") SET(INSTALL_CONFIGDIR_OSX "/etc/mysqlrouter") SET(INSTALL_RUNTIMEDIR_OSX "/var/run/mysqlrouter") SET(INSTALL_DATADIR_OSX "/var/lib/mysqlrouter") # SET(INSTALL_LIBDIR_OSX "lib") SET(INSTALL_PLUGINDIR_OSX "lib/mysqlrouter") # SET(INSTALL_INCLUDEDIR_OSX "include") # SET(INSTALL_DOCDIR_OSX "docs") SET(INSTALL_DOCREADMEDIR_OSX ".") SET(INSTALL_MANDIR_OSX "man") SET(INSTALL_INFODIR_OSX "docs") # SET(INSTALL_SHAREDIR_OSX "share") SET(INSTALL_MYSQLSHAREDIR_OSX "share") SET(INSTALL_MYSQLTESTDIR_OSX "mysqlrouter-test") SET(INSTALL_SQLBENCHDIR_OSX ".") SET(INSTALL_SUPPORTFILESDIR_OSX "support-files") # SET(INSTALL_MYSQLDATADIR_OSX "data") SET(INSTALL_PLUGINTESTDIR_OSX ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_OSX ${secure_file_priv_path}) # # TARGZ layout # SET(INSTALL_BINDIR_TARGZ "bin") SET(INSTALL_SBINDIR_TARGZ "bin") SET(INSTALL_SCRIPTDIR_TARGZ "scripts") SET(INSTALL_LOGDIR_TARGZ "") SET(INSTALL_CONFIGDIR_TARGZ "/etc/mysqlrouter") SET(INSTALL_RUNTIMEDIR_TARGZ "/var/run/mysqlrouter") SET(INSTALL_DATADIR_TARGZ "/var/lib/mysqlrouter") # SET(INSTALL_LIBDIR_TARGZ "lib") SET(INSTALL_PLUGINDIR_TARGZ "lib/mysqlrouter") # SET(INSTALL_INCLUDEDIR_TARGZ "include") # SET(INSTALL_DOCDIR_TARGZ "docs") SET(INSTALL_DOCREADMEDIR_TARGZ ".") SET(INSTALL_MANDIR_TARGZ "man") SET(INSTALL_INFODIR_TARGZ "docs") # SET(INSTALL_SHAREDIR_TARGZ "share") SET(INSTALL_MYSQLSHAREDIR_TARGZ "share") SET(INSTALL_MYSQLTESTDIR_TARGZ "mysqlrouter-test") SET(INSTALL_SQLBENCHDIR_TARGZ ".") SET(INSTALL_SUPPORTFILESDIR_TARGZ "support-files") # SET(INSTALL_MYSQLDATADIR_TARGZ "data") SET(INSTALL_PLUGINTESTDIR_TARGZ ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_TARGZ ${secure_file_priv_path}) # # RPM layout # # See "packaging/rpm-uln/mysql-5.5-libdir.patch" for the differences # which apply to RPMs in ULN (Oracle Linux), that patch file will # be applied at build time via "rpmbuild". # SET(INSTALL_BINDIR_RPM "bin") SET(INSTALL_SBINDIR_RPM "sbin") SET(INSTALL_SCRIPTDIR_RPM "bin") SET(INSTALL_LOGDIR_RPM "/var/log/mysqlrouter") SET(INSTALL_CONFIGDIR_RPM "/etc/mysqlrouter") SET(INSTALL_RUNTIMEDIR_RPM "/var/run/mysqlrouter") SET(INSTALL_DATADIR_RPM "/var/lib/mysqlrouter") # IF(ARCH_64BIT) SET(INSTALL_LIBDIR_RPM "lib64") SET(INSTALL_PLUGINDIR_RPM "lib64/mysqlrouter") ELSE() SET(INSTALL_LIBDIR_RPM "lib") SET(INSTALL_PLUGINDIR_RPM "lib/mysqlrouter") ENDIF() # SET(INSTALL_INCLUDEDIR_RPM "include/mysql") # #SET(INSTALL_DOCDIR_RPM unset - installed directly by RPM) #SET(INSTALL_DOCREADMEDIR_RPM unset - installed directly by RPM) SET(INSTALL_INFODIR_RPM "share/info") SET(INSTALL_MANDIR_RPM "share/man") # SET(INSTALL_SHAREDIR_RPM "share") SET(INSTALL_MYSQLSHAREDIR_RPM "share/mysql-router") SET(INSTALL_MYSQLTESTDIR_RPM "share/mysql-router-test") SET(INSTALL_SQLBENCHDIR_RPM "") SET(INSTALL_SUPPORTFILESDIR_RPM "share/mysql-router") # SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysqlrouter") SET(INSTALL_PLUGINTESTDIR_RPM ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_RPM ${secure_file_priv_path}) # # SLES layout # SET(INSTALL_BINDIR_SLES "bin") SET(INSTALL_SBINDIR_SLES "sbin") SET(INSTALL_SCRIPTDIR_SLES "bin") SET(INSTALL_LOGDIR_SLES "/var/log/mysqlrouter") SET(INSTALL_CONFIGDIR_SLES "/etc/mysqlrouter") SET(INSTALL_RUNTIMEDIR_SLES "/var/run/mysqlrouter") SET(INSTALL_DATADIR_SLES "/var/lib/mysqlrouter") # IF(ARCH_64BIT) SET(INSTALL_LIBDIR_SLES "lib64") SET(INSTALL_PLUGINDIR_SLES "lib64/mysqlrouter") ELSE() SET(INSTALL_LIBDIR_SLES "lib") SET(INSTALL_PLUGINDIR_SLES "lib/mysqlrouter") ENDIF() # SET(INSTALL_INCLUDEDIR_SLES "include/mysqlrouter") # #SET(INSTALL_DOCDIR_SLES unset - installed directly by SLES) #SET(INSTALL_DOCREADMEDIR_SLES unset - installed directly by SLES) SET(INSTALL_INFODIR_SLES "share/info") SET(INSTALL_MANDIR_SLES "share/man") # SET(INSTALL_SHAREDIR_SLES "share") SET(INSTALL_MYSQLSHAREDIR_SLES "share/mysql-router") SET(INSTALL_MYSQLTESTDIR_SLES "share/mysqlrouter-test") SET(INSTALL_SQLBENCHDIR_SLES "") SET(INSTALL_SUPPORTFILESDIR_SLES "share/mysql") # SET(INSTALL_MYSQLDATADIR_SLES "/var/lib/mysqlrouter") SET(INSTALL_PLUGINTESTDIR_SLES ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_SLES ${secure_file_priv_path}) # # DEB layout # SET(INSTALL_BINDIR_DEB "bin") SET(INSTALL_SBINDIR_DEB "sbin") SET(INSTALL_SCRIPTDIR_DEB "bin") SET(INSTALL_LOGDIR_DEB "/var/log/mysqlrouter") SET(INSTALL_CONFIGDIR_DEB "/etc/mysqlrouter") SET(INSTALL_RUNTIMEDIR_DEB "/var/run/mysqlrouter") SET(INSTALL_DATADIR_DEB "/var/lib/mysqlrouter") # IF(ARCH_64BIT) SET(INSTALL_LIBDIR_DEB "lib/x86_64-linux-gnu") SET(INSTALL_PLUGINDIR_DEB "lib/x86_64-linux-gnu/mysqlrouter") ELSE() SET(INSTALL_LIBDIR_DEB "lib/i386-linux-gnu") SET(INSTALL_PLUGINDIR_DEB "lib/i386-linux-gnu/mysqlrouter") ENDIF() # SET(INSTALL_INCLUDEDIR_DEB "include/mysql/router") # SET(INSTALL_DOCDIR_DEB "share/mysql-router/docs") SET(INSTALL_DOCREADMEDIR_DEB "share/mysql-router/docs") SET(INSTALL_MANDIR_DEB "share/man") SET(INSTALL_INFODIR_DEB "share/mysql-router/docs") # SET(INSTALL_SHAREDIR_DEB "share") SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql-router") SET(INSTALL_MYSQLTESTDIR_DEB "lib/mysql-router-test") SET(INSTALL_SQLBENCHDIR_DEB "lib/mysql-router") SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql-router") # SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysqlrouter") SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_DEB ${secure_file_priv_path}) # # DEBSVR4 layout # SET(INSTALL_BINDIR_DEBSVR4 "bin") SET(INSTALL_SBINDIR_DEBSVR4 "bin") SET(INSTALL_SCRIPTDIR_DEBSVR4 "scripts") SET(INSTALL_LOGDIR_DEBSVR4 "/var/opt/mysqlrouter") SET(INSTALL_CONFIGDIR_DEBSVR4 "/etc/opt/mysqlrouter") SET(INSTALL_RUNTIMEDIR_DEBSVR4 "/var/opt/mysqlrouter") SET(INSTALL_DATADIR_DEBSVR4 "/var/opt/mysqlrouter") # SET(INSTALL_LIBDIR_DEBSVR4 "lib") SET(INSTALL_PLUGINDIR_DEBSVR4 "lib/mysqlrouter") # SET(INSTALL_INCLUDEDIR_DEBSVR4 "include") # SET(INSTALL_DOCDIR_DEBSVR4 "docs") SET(INSTALL_DOCREADMEDIR_DEBSVR4 ".") SET(INSTALL_MANDIR_DEBSVR4 "man") SET(INSTALL_INFODIR_DEBSVR4 "docs") # SET(INSTALL_SHAREDIR_DEBSVR4 "share") SET(INSTALL_MYSQLSHAREDIR_DEBSVR4 "share") SET(INSTALL_MYSQLTESTDIR_DEBSVR4 "mysqlrouter-test") SET(INSTALL_SQLBENCHDIR_DEBSVR4 ".") SET(INSTALL_SUPPORTFILESDIR_DEBSVR4 "support-files") # SET(INSTALL_MYSQLDATADIR_DEBSVR4 "/var/lib/mysqlrouter") SET(INSTALL_PLUGINTESTDIR_DEBSVR4 ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_DEBSVR4 ${secure_file_priv_path}) # # SVR4 layout # SET(INSTALL_BINDIR_SVR4 "bin") SET(INSTALL_SBINDIR_SVR4 "bin") SET(INSTALL_SCRIPTDIR_SVR4 "scripts") SET(INSTALL_LOGDIR_SVR4 "/var/opt/mysqlrouter") SET(INSTALL_CONFIGDIR_SVR4 "/etc/opt/mysqlrouter") SET(INSTALL_RUNTIMEDIR_SVR4 "/var/opt/mysqlrouter") SET(INSTALL_DATADIR_SVR4 "/var/opt/mysqlrouter") # SET(INSTALL_LIBDIR_SVR4 "lib") SET(INSTALL_PLUGINDIR_SVR4 "lib/mysqlrouter") # SET(INSTALL_INCLUDEDIR_SVR4 "include") # SET(INSTALL_DOCDIR_SVR4 "docs") SET(INSTALL_DOCREADMEDIR_SVR4 ".") SET(INSTALL_MANDIR_SVR4 "man") SET(INSTALL_INFODIR_SVR4 "docs") # SET(INSTALL_SHAREDIR_SVR4 "share") SET(INSTALL_MYSQLSHAREDIR_SVR4 "share") SET(INSTALL_MYSQLTESTDIR_SVR4 "mysqlrouter-test") SET(INSTALL_SQLBENCHDIR_SVR4 ".") SET(INSTALL_SUPPORTFILESDIR_SVR4 "support-files") # SET(INSTALL_MYSQLDATADIR_SVR4 "/var/lib/mysqlrouter") SET(INSTALL_PLUGINTESTDIR_SVR4 ${plugin_tests}) SET(INSTALL_SECURE_FILE_PRIVDIR_SVR4 ${secure_file_priv_path}) # Clear cached variables if install layout was changed IF(OLD_INSTALL_LAYOUT) IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUT) SET(FORCE FORCE) ENDIF() ENDIF() SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "") # Set INSTALL_FOODIR variables for chosen layout (for example, INSTALL_BINDIR # will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE # layout is chosen) FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA PLUGINTEST SECURE_FILE_PRIV LOG CONFIG RUNTIME DATA) SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} CACHE STRING "${var} installation directory" ${FORCE}) MARK_AS_ADVANCED(INSTALL_${var}DIR) ENDFOREACH() # Set up the rpath correctly based on the information provided. # This set a relative rpath for when using install layouts that # require this. The default is to use absolute paths, which are used # for all other layouts. SET(CMAKE_INSTALL_RPATH) if(INSTALL_LAYOUT STREQUAL "STANDALONE" OR INSTALL_LAYOUT STREQUAL "DEFAULT" OR INSTALL_LAYOUT STREQUAL "WIN") # rpath for lib/mysqlrouter/ plugins that want to find lib/ set(RPATH_PLUGIN_TO_LIB "${RPATH_ORIGIN}/../") set(RPATH_PLUGIN_TO_PLUGIN "${RPATH_ORIGIN}/") # rpath for lib/ libraries that want to find other libs in lib/ set(RPATH_LIBRARY_TO_LIB "${RPATH_ORIGIN}/") # rpath for bin/ binaries that want to find other libs in lib/ set(RPATH_BINARY_TO_LIB "${RPATH_ORIGIN}/../${INSTALL_LIBDIR}/") else() # rpath for lib/mysqlrouter/ plugins that want to find lib/ set(RPATH_PLUGIN_TO_LIB "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}") set(RPATH_PLUGIN_TO_PLUGIN "${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINDIR}") # rpath for lib/ libraries that want to find other libs in lib/ set(RPATH_LIBRARY_TO_LIB "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}") # rpath for bin/ binaries that want to find other libs in lib/ set(RPATH_BINARY_TO_LIB "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}") endif() # plugins may depend on other plugins # plugins may depend on libs in lib/ # executables may depend on libs in lib/ LIST(APPEND CMAKE_INSTALL_RPATH ${RPATH_PLUGIN_TO_LIB} ${RPATH_PLUGIN_TO_PLUGIN} ${RPATH_LIBRARY_TO_LIB} ${RPATH_BINARY_TO_LIB}) LIST(REMOVE_DUPLICATES CMAKE_INSTALL_RPATH) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # # Set DEFAULT_SECURE_FILE_PRIV_DIR # This is used as default value for --secure-file-priv # IF(INSTALL_SECURE_FILE_PRIVDIR) SET(DEFAULT_SECURE_FILE_PRIV_DIR "\"${INSTALL_SECURE_FILE_PRIVDIR}\"" CACHE INTERNAL "default --secure-file-priv directory" FORCE) ELSE() SET(DEFAULT_SECURE_FILE_PRIV_DIR \"\" CACHE INTERNAL "default --secure-file-priv directory" FORCE) ENDIF() ================================================ FILE: cmake/libutils.cmake ================================================ # Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # This file exports macros that emulate some functionality found in GNU libtool # on Unix systems. One such feature is convenience libraries. In this context, # convenience library is a static library that can be linked to shared library # On systems that force position-independent code, linking into shared library # normally requires compilation with a special flag (often -fPIC). To enable # linking static libraries to shared, we compile source files that come into # static library with the PIC flag (${CMAKE_SHARED_LIBRARY_C_FLAGS} in CMake) # Some systems, like Windows or OSX do not need special compilation (Windows # never uses PIC and OSX always uses it). # # The intention behind convenience libraries is simplify the build and to reduce # excessive recompiles. # Except for convenience libraries, this file provides macros to merge static # libraries (we need it for mysqlclient) and to create shared library out of # convenience libraries(again, for mysqlclient) # Following macros are exported # - ADD_CONVENIENCE_LIBRARY(target source1...sourceN) # This macro creates convenience library. The functionality is similar to # ADD_LIBRARY(target STATIC source1...sourceN), the difference is that resulting # library can always be linked to shared library # # - MERGE_LIBRARIES(target [STATIC|SHARED|MODULE] [linklib1 .... linklibN] # [EXPORTS exported_func1 .... exported_func_N] # [OUTPUT_NAME output_name] # This macro merges several static libraries into a single one or creates a shared # library from several convenience libraries # Important global flags # - WITH_PIC : If set, it is assumed that everything is compiled as position # independent code (that is CFLAGS/CMAKE_C_FLAGS contain -fPIC or equivalent) # If defined, ADD_CONVENIENCE_LIBRARY does not add PIC flag to compile flags # # - DISABLE_SHARED: If set, it is assumed that shared libraries are not produced # during the build. ADD_CONVENIENCE_LIBRARY does not add anything to compile flags INCLUDE(CheckCCompilerFlag) GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) IF(WIN32 OR APPLE OR WITH_PIC OR DISABLE_SHARED OR NOT CMAKE_SHARED_LIBRARY_C_FLAGS) SET(_SKIP_PIC 1) ENDIF() INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) # CREATE_EXPORT_FILE (VAR target api_functions) # Internal macro, used to create source file for shared libraries that # otherwise consists entirely of "convenience" libraries. On Windows, # also exports API functions as dllexport. On unix, creates a dummy file # that references all exports and this prevents linker from creating an # empty library(there are unportable alternatives, --whole-archive) MACRO(CREATE_EXPORT_FILE VAR TARGET API_FUNCTIONS) IF(WIN32) SET(DUMMY ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_dummy.c) SET(EXPORTS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_exports.def) CONFIGURE_FILE_CONTENT("" ${DUMMY}) SET(CONTENT "EXPORTS\n") FOREACH(FUNC ${API_FUNCTIONS}) SET(CONTENT "${CONTENT} ${FUNC}\n") ENDFOREACH() CONFIGURE_FILE_CONTENT(${CONTENT} ${EXPORTS}) SET(${VAR} ${DUMMY} ${EXPORTS}) ELSE() SET(EXPORTS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_exports_file.cc) SET(CONTENT) FOREACH(FUNC ${API_FUNCTIONS}) SET(CONTENT "${CONTENT} extern void* ${FUNC}\;\n") ENDFOREACH() SET(CONTENT "${CONTENT} void *${TARGET}_api_funcs[] = {\n") FOREACH(FUNC ${API_FUNCTIONS}) SET(CONTENT "${CONTENT} &${FUNC},\n") ENDFOREACH() SET(CONTENT "${CONTENT} (void *)0\n}\;") CONFIGURE_FILE_CONTENT(${CONTENT} ${EXPORTS}) SET(${VAR} ${EXPORTS}) ENDIF() ENDMACRO() # MYSQL_ADD_CONVENIENCE_LIBRARY(name source1...sourceN) # Create static library that can be linked to shared library. # On systems that force position-independent code, adds -fPIC or # equivalent flag to compile flags. MACRO(ADD_CONVENIENCE_LIBRARY) SET(TARGET ${ARGV0}) SET(SOURCES ${ARGN}) LIST(REMOVE_AT SOURCES 0) ADD_LIBRARY(${TARGET} STATIC ${SOURCES}) IF(NOT _SKIP_PIC) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}") ENDIF() ENDMACRO() MACRO(ADD_CONVENIENCE_LIBRARY_DLL) SET(TARGET ${ARGV0}) SET(SOURCES ${ARGN}) LIST(REMOVE_AT SOURCES 0) ADD_LIBRARY(${TARGET} SHARED ${SOURCES}) IF(NOT _SKIP_PIC) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}") ENDIF() ENDMACRO() # Write content to file, using CONFIGURE_FILE # The advantage compared to FILE(WRITE) is that timestamp # does not change if file already has the same content MACRO(CONFIGURE_FILE_CONTENT content file) SET(CMAKE_CONFIGURABLE_FILE_CONTENT "${content}\n") CONFIGURE_FILE( ${MYSQL_CMAKE_SCRIPT_DIR}/configurable_file_content.in ${file} @ONLY) ENDMACRO() # Merge static libraries into a big static lib. The resulting library # should not not have dependencies on other static libraries. # We use it in MySQL to merge mysys,dbug,vio etc into mysqlclient MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE) # To produce a library we need at least one source file. # It is created by ADD_CUSTOM_COMMAND below and will # also help to track dependencies. SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_depends.cpp) ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE}) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}) SET(OSLIBS) FOREACH(LIB ${LIBS_TO_MERGE}) GET_TARGET_PROPERTY(LIB_LOCATION ${LIB} LOCATION) GET_TARGET_PROPERTY(LIB_TYPE ${LIB} TYPE) IF(NOT LIB_LOCATION) # 3rd party library like libz.so. Make sure that everything # that links to our library links to this one as well. LIST(APPEND OSLIBS ${LIB}) ELSE() # This is a target in current project # (can be a static or shared lib) IF(LIB_TYPE STREQUAL "STATIC_LIBRARY") SET(STATIC_LIBS ${STATIC_LIBS} ${LIB_LOCATION}) ADD_DEPENDENCIES(${TARGET} ${LIB}) # Extract dependend OS libraries GET_DEPENDEND_OS_LIBS(${LIB} LIB_OSLIBS) LIST(APPEND OSLIBS ${LIB_OSLIBS}) ELSE() # This is a shared library our static lib depends on. LIST(APPEND OSLIBS ${LIB}) ENDIF() ENDIF() ENDFOREACH() IF(OSLIBS) LIST(REMOVE_DUPLICATES OSLIBS) TARGET_LINK_LIBRARIES(${TARGET} ${OSLIBS}) MESSAGE(STATUS "Library ${TARGET} depends on OSLIBS ${OSLIBS}") ENDIF() IF(STATIC_LIBS) LIST(REMOVE_DUPLICATES STATIC_LIBS) ENDIF() # Make the generated dummy source file depended on all static input # libs. If input lib changes,the source file is touched # which causes the desired effect (relink). ADD_CUSTOM_COMMAND( OUTPUT ${SOURCE_FILE} COMMAND ${CMAKE_COMMAND} -E touch ${SOURCE_FILE} DEPENDS ${STATIC_LIBS}) IF(MSVC) # To merge libs, just pass them to lib.exe command line. SET(LINKER_EXTRA_FLAGS "") FOREACH(LIB ${STATIC_LIBS}) SET(LINKER_EXTRA_FLAGS "${LINKER_EXTRA_FLAGS} ${LIB}") ENDFOREACH() SET_TARGET_PROPERTIES(${TARGET} PROPERTIES STATIC_LIBRARY_FLAGS "${LINKER_EXTRA_FLAGS}") ELSE() GET_TARGET_PROPERTY(TARGET_LOCATION ${TARGET} LOCATION) IF(APPLE) # Use OSX's libtool to merge archives (ihandles universal # binaries properly) ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD COMMAND rm ${TARGET_LOCATION} COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION} ${STATIC_LIBS} ) ELSE() # Generic Unix or MinGW. In post-build step, call # script, that extracts objects from archives with "ar x" # and repacks them with "ar r" SET(TARGET ${TARGET}) CONFIGURE_FILE( ${MYSQL_CMAKE_SCRIPT_DIR}/merge_archives_unix.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake @ONLY ) ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD COMMAND rm ${TARGET_LOCATION} COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake ) ENDIF() ENDIF() ENDMACRO() # Create libs from libs. # Merges static libraries, creates shared libraries out of convenience libraries. # MERGE_LIBRARIES(target [STATIC|SHARED|MODULE] # [linklib1 .... linklibN] # [EXPORTS exported_func1 .... exportedFuncN] # [OUTPUT_NAME output_name] #) MACRO(MERGE_LIBRARIES) MYSQL_PARSE_ARGUMENTS(ARG "EXPORTS;OUTPUT_NAME;COMPONENT" "STATIC;SHARED;MODULE;NOINSTALL" ${ARGN} ) LIST(GET ARG_DEFAULT_ARGS 0 TARGET) SET(LIBS ${ARG_DEFAULT_ARGS}) LIST(REMOVE_AT LIBS 0) IF(ARG_STATIC) IF (NOT ARG_OUTPUT_NAME) SET(ARG_OUTPUT_NAME ${TARGET}) ENDIF() MERGE_STATIC_LIBS(${TARGET} ${ARG_OUTPUT_NAME} "${LIBS}") ELSEIF(ARG_SHARED OR ARG_MODULE) IF(ARG_SHARED) SET(LIBTYPE SHARED) ELSE() SET(LIBTYPE MODULE) ENDIF() # check for non-PIC libraries IF(NOT _SKIP_PIC) FOREACH(LIB ${LIBS}) GET_TARGET_PROPERTY(${LIB} TYPE LIBTYPE) IF(LIBTYPE STREQUAL "STATIC_LIBRARY") GET_TARGET_PROPERTY(LIB COMPILE_FLAGS LIB_COMPILE_FLAGS) STRING(REPLACE "${CMAKE_SHARED_LIBRARY_C_FLAGS}" "" LIB_COMPILE_FLAGS ${LIB_COMPILE_FLAG}) IF(NOT LIB_COMPILE_FLAGS MATCHES "") MESSAGE(FATAL_ERROR "Attempted to link non-PIC static library ${LIB} to shared library ${TARGET}\n" "Please use ADD_CONVENIENCE_LIBRARY, instead of ADD_LIBRARY for ${LIB}" ) ENDIF() ENDIF() ENDFOREACH() ENDIF() CREATE_EXPORT_FILE(SRC ${TARGET} "${ARG_EXPORTS}") IF(NOT ARG_NOINSTALL) ADD_VERSION_INFO(${TARGET} SHARED SRC) ENDIF() ADD_LIBRARY(${TARGET} ${LIBTYPE} ${SRC}) TARGET_LINK_LIBRARIES(${TARGET} ${LIBS}) IF(ARG_OUTPUT_NAME) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME "${ARG_OUTPUT_NAME}") ENDIF() ELSE() MESSAGE(FATAL_ERROR "Unknown library type") ENDIF() IF(NOT ARG_NOINSTALL) IF(ARG_COMPONENT) SET(COMP COMPONENT ${ARG_COMPONENT}) ENDIF() MYSQL_INSTALL_TARGETS(${TARGET} DESTINATION "${INSTALL_LIBDIR}" ${COMP}) ENDIF() SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_INTERFACE_LIBRARIES "") ENDMACRO() FUNCTION(GET_DEPENDEND_OS_LIBS target result) SET(deps ${${target}_LIB_DEPENDS}) IF(deps) FOREACH(lib ${deps}) # Filter out keywords for used for debug vs optimized builds IF(NOT lib MATCHES "general" AND NOT lib MATCHES "debug" AND NOT lib MATCHES "optimized") GET_TARGET_PROPERTY(lib_location ${lib} LOCATION) IF(NOT lib_location) SET(ret ${ret} ${lib}) ENDIF() ENDIF() ENDFOREACH() ENDIF() SET(${result} ${ret} PARENT_SCOPE) ENDFUNCTION() # We try to hide the symbols in yassl/zlib to avoid name clashes with # other libraries like openssl. FUNCTION(RESTRICT_SYMBOL_EXPORTS target) IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN) IF(HAVE_VISIBILITY_HIDDEN) GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS) IF(NOT COMPILE_FLAGS) # Avoid COMPILE_FLAGS-NOTFOUND SET(COMPILE_FLAGS) ENDIF() SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -fvisibility=hidden") ENDIF() ENDIF() ENDFUNCTION() ================================================ FILE: cmake/mysqlx_protobuf.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA IF(MSVC) SET(MYSQLX_PROTOBUF_MSVC_DISABLED_WARNINGS "/wd4267 /wd4244") ENDIF() # Standard PROTOBUF_GENERATE_CPP modified to generate both # protobuf and protobuf-lite C++ files. FUNCTION(MYSQLX_PROTOBUF_GENERATE_CPP SRCS HDRS) IF(NOT ARGN) MESSAGE(SEND_ERROR "Error: MYSQLX_PROTOBUF_GENERATE_CPP() called without any proto files") RETURN() ENDIF() SET(${SRCS}) SET(${HDRS}) FOREACH(FIL ${ARGN}) GET_FILENAME_COMPONENT(ABS_FIL ${FIL} ABSOLUTE) GET_FILENAME_COMPONENT(FIL_WE ${FIL} NAME_WE) LIST(APPEND ${SRCS} "${PROJECT_BINARY_DIR}/generated/protobuf/${FIL_WE}.pb.cc") LIST(APPEND ${HDRS} "${PROJECT_BINARY_DIR}/generated/protobuf/${FIL_WE}.pb.h") ADD_CUSTOM_COMMAND( OUTPUT "${PROJECT_BINARY_DIR}/generated/protobuf/${FIL_WE}.pb.cc" "${PROJECT_BINARY_DIR}/generated/protobuf/${FIL_WE}.pb.h" COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_BINARY_DIR}/generated/protobuf" COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ARGS --cpp_out=dllexport_decl=X_PROTOCOL_API:${PROJECT_BINARY_DIR}/generated/protobuf -I "${PROTOBUF_MYSQLX_DIR}" -I "${PROTOBUF_INCLUDE_DIR}" ${ABS_FIL} DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} COMMENT "Running C++ protocol buffer compiler on ${FIL}" VERBATIM) ENDFOREACH() SET_SOURCE_FILES_PROPERTIES( ${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) IF(MSVC) ADD_COMPILE_FLAGS(${${SRCS}} COMPILE_FLAGS ${MYSQLX_PROTOBUF_MSVC_DISABLED_WARNINGS}) ENDIF() SET(${SRCS} ${${SRCS}} PARENT_SCOPE) SET(${HDRS} ${${HDRS}} PARENT_SCOPE) ENDFUNCTION() ================================================ FILE: cmake/packaging.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA if(NOT WIN32) set(CPACK_PACKAGE_NAME "mysql-router") else() set(CPACK_PACKAGE_NAME "MySQL Router") endif() if(NOT GPL) MakeNonGPLPackageName(CPACK_PACKAGE_NAME) endif() set(CPACK_PACKAGE_VENDOR "Oracle") set(CPACK_PACKAGE_CONTACT "MySQL Release Engineering ") set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION_TEXT}) set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) set(EXTRA_NAME_SUFFIX "" CACHE STRING "Extra text in package name") if(WIN32) include(CheckTypeSize) if(CMAKE_SIZEOF_VOID_P MATCHES 8) set(CPACK_SYSTEM_NAME "windows-x86-64bit") else() set(CPACK_SYSTEM_NAME "windows-x86-32bit") endif() set(CPACK_PACKAGE_FILE_NAME "mysql-router${EXTRA_NAME_SUFFIX}-${CPACK_PACKAGE_VERSION}${PROJECT_PACKAGE_EXTRAS}-${CPACK_SYSTEM_NAME}") endif() # # Source Distribution # set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.txt") set(CPACK_SOURCE_GENERATOR "ZIP;TGZ") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}${PROJECT_PACKAGE_EXTRAS}") # We ignore all files in the root of the repository and then # exclude from the list which we want to keep. file(GLOB cpack_source_ignore_files "${PROJECT_SOURCE_DIR}/*") set(src_dir ${PROJECT_SOURCE_DIR}) set(source_include "${src_dir}/cmake" "${src_dir}/include" "${src_dir}/doc" "${src_dir}/ext" "${src_dir}/src" "${src_dir}/tests" "${src_dir}/tools" "${src_dir}/packaging" "${src_dir}/CMakeLists.txt" "${src_dir}/config.h.in" "${src_dir}/README.txt" "${src_dir}/License.txt") list(REMOVE_ITEM cpack_source_ignore_files ${source_include}) list(APPEND cpack_source_ignore_files "${src_dir}/harness/.gitignore") # We need to escape the dots string(REPLACE "." "\\\\." cpack_source_ignore_files "${cpack_source_ignore_files}") set(CPACK_SOURCE_IGNORE_FILES "${cpack_source_ignore_files}") include(CPack) # # RPM-based # if(CMAKE_SYSTEM_NAME STREQUAL "Linux") add_subdirectory("${PROJECT_SOURCE_DIR}/packaging/rpm-oel") endif() # # MSI for Windows # if(CMAKE_SYSTEM_NAME STREQUAL "Windows") add_subdirectory("${PROJECT_SOURCE_DIR}/packaging/WiX") endif() ================================================ FILE: cmake/platform.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Figure out a nice name for Platform and Architecture if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") string(SUBSTRING ${CMAKE_SYSTEM} 7 2 DARWIN_VERSION) if(DARWIN_VERSION STREQUAL "17") set(PLATFORM_NAME "OS X v10.13") elseif(DARWIN_VERSION STREQUAL "16") set(PLATFORM_NAME "OS X v10.12") elseif(DARWIN_VERSION STREQUAL "15") set(PLATFORM_NAME "OS X v10.11") elseif(DARWIN_VERSION STREQUAL "14") set(PLATFORM_NAME "OS X v10.10") elseif(DARWIN_VERSION STREQUAL "13") set(PLATFORM_NAME "OS X v10.9") else() message(FATAL_ERROR "Unsupported version of MacOS X") endif() set(RPATH_ORIGIN "@loader_path") set(CMAKE_INSTALL_NAME_DIR "@rpath") elseif(CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") set(RPATH_ORIGIN "\$ORIGIN") set(PLATFORM_NAME "Windows/Cygwin") else() set(RPATH_ORIGIN "\$ORIGIN") set(PLATFORM_NAME ${CMAKE_SYSTEM_NAME}) endif() # Whether we deal with 32 or 64 CPU architecture/compiler if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(ARCH_64BIT 1) else() set(ARCH_64BIT 0) endif() ================================================ FILE: cmake/protobuf.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Usage: # # cmake -DWITH_PROTOBUF="bundled"|"system" # # Default is "bundled" # Other values will be ignored, and we fall back to "bundled" # MACRO(RESET_PROTOBUF_VARIABLES) UNSET(PROTOBUF_INCLUDE_DIR CACHE) UNSET(PROTOBUF_INCLUDE_DIR) UNSET(PROTOBUF_INCLUDE_DIRS CACHE) UNSET(PROTOBUF_INCLUDE_DIRS) UNSET(PROTOBUF_LIBRARIES CACHE) UNSET(PROTOBUF_LIBRARIES) UNSET(PROTOBUF_LIBRARY CACHE) UNSET(PROTOBUF_LIBRARY) UNSET(PROTOBUF_LITE_LIBRARY CACHE) UNSET(PROTOBUF_LITE_LIBRARY) UNSET(PROTOBUF_PROTOC_EXECUTABLE CACHE) UNSET(PROTOBUF_PROTOC_EXECUTABLE) ENDMACRO() MACRO(ECHO_PROTOBUF_VARIABLES) MESSAGE(STATUS "PROTOBUF_INCLUDE_DIR ${PROTOBUF_INCLUDE_DIR}") MESSAGE(STATUS "PROTOBUF_LIBRARY ${PROTOBUF_LIBRARY}") MESSAGE(STATUS "PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE}") ENDMACRO() MACRO(COULD_NOT_FIND_PROTOBUF) ECHO_PROTOBUF_VARIABLES() MESSAGE(STATUS "Could not find (the correct version of) protobuf.") MESSAGE(STATUS "MySQL currently requires at least protobuf version 2.5") MESSAGE(FATAL_ERROR "You can build with the bundled sources" ) ENDMACRO() SET(BUNDLED_PROTO_SRCDIR ${MySQLRouter_SOURCE_DIR}/ext/protobuf/protobuf-3.0.0/src) MACRO(MYSQL_USE_BUNDLED_PROTOBUF) SET(WITH_PROTOBUF "bundled" CACHE INTERNAL "Bundled protoc and protobuf library") # Set the same variables as FindProtobuf.cmake SET(PROTOBUF_FOUND 1 CACHE INTERNAL "") SET(PROTOBUF_INCLUDE_DIR ${BUNDLED_PROTO_SRCDIR} CACHE INTERNAL "") SET(PROTOBUF_INCLUDE_DIRS ${BUNDLED_PROTO_SRCDIR} CACHE INTERNAL "") SET(PROTOBUF_LIBRARY libprotobuf_3_0 CACHE INTERNAL "") SET(PROTOBUF_LIBRARIES libprotobuf_3_0 CACHE INTERNAL "") SET(PROTOBUF_PROTOC_EXECUTABLE protoc_3_0 CACHE INTERNAL "") SET(PROTOBUF_PROTOC_LIBRARY protoclib_3_0 CACHE INTERNAL "") SET(PROTOBUF_LITE_LIBRARY protobuf-lite CACHE INTERNAL "") ADD_SUBDIRECTORY(ext/protobuf) ENDMACRO() MACRO(MYSQL_CHECK_PROTOBUF) IF (NOT WITH_PROTOBUF OR NOT WITH_PROTOBUF STREQUAL "system") SET(WITH_PROTOBUF "bundled") ENDIF() MESSAGE(STATUS "WITH_PROTOBUF=${WITH_PROTOBUF}") IF(WITH_PROTOBUF STREQUAL "bundled") MYSQL_USE_BUNDLED_PROTOBUF() ELSE() FIND_PACKAGE(Protobuf) ENDIF() IF(NOT PROTOBUF_FOUND) MESSAGE(WARNING "Protobuf could not be found") ENDIF() IF(PROTOBUF_FOUND) # Verify protobuf version number. Version information looks like: # // The current version, represented as a single integer to make comparison # // easier: major * 10^6 + minor * 10^3 + micro # #define GOOGLE_PROTOBUF_VERSION 3000000 FILE(STRINGS "${PROTOBUF_INCLUDE_DIR}/google/protobuf/stubs/common.h" PROTOBUF_VERSION_NUMBER REGEX "^#define[\t ]+GOOGLE_PROTOBUF_VERSION[\t ][0-9]+.*" ) STRING(REGEX REPLACE "^.*GOOGLE_PROTOBUF_VERSION[\t ]([0-9])[0-9][0-9]([0-9])[0-9][0-9].*$" "\\1" PROTOBUF_MAJOR_VERSION "${PROTOBUF_VERSION_NUMBER}") STRING(REGEX REPLACE "^.*GOOGLE_PROTOBUF_VERSION[\t ]([0-9])[0-9][0-9]([0-9])[0-9][0-9].*$" "\\2" PROTOBUF_MINOR_VERSION "${PROTOBUF_VERSION_NUMBER}") MESSAGE(STATUS "protobuf version is ${PROTOBUF_MAJOR_VERSION}.${PROTOBUF_MINOR_VERSION}") IF("${PROTOBUF_MAJOR_VERSION}.${PROTOBUF_MINOR_VERSION}" VERSION_LESS "2.5") COULD_NOT_FIND_PROTOBUF() ENDIF() ENDIF() ENDMACRO() ================================================ FILE: cmake/settings.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Settings for building MySQL Router # General set(MYSQL_ROUTER_TARGET "mysqlrouter" CACHE STRING "Name of the MySQL Router application") # Also used in CMAKE_INSTALL_PREFIX set(MYSQL_ROUTER_NAME "MySQL Router" CACHE STRING "MySQL Router project name") set(MYSQL_ROUTER_INI "mysqlrouter.conf" CACHE STRING "Name of default configuration file") # Command line options for CMake option(ENABLE_TESTS "Enable Tests" NO) option(WITH_STATIC "Enable static linkage of external libraries" NO) option(GPL "Produce GNU GPLv2 source and binaries" YES) IF(MYSQL_SERVER_SUFFIX STREQUAL "-enterprise-commercial-advanced" OR DEB_PRODUCT STREQUAL "commercial") # if the server's cmake options for 'commercial' builds are set, use them. SET(GPL 0) ENDIF() # MySQL Harness set(HARNESS_NAME "mysqlrouter" CACHE STRING "Name of Harness") ================================================ FILE: cmake/ssl.cmake ================================================ # Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # We support different versions of SSL: # - "bundled" uses source code in /ext/yassl # - "system" (typically) uses headers/libraries in /usr/lib and /usr/lib64 # - a custom installation of openssl can be used like this # - cmake -DCMAKE_PREFIX_PATH= -DWITH_SSL="system" # or # - cmake -DWITH_SSL= # # The default value for WITH_SSL is "bundled" # set in cmake/build_configurations/feature_set.cmake # # For custom build/install of openssl, see the accompanying README and # INSTALL* files. When building with gcc, you must build the shared libraries # (in addition to the static ones): # ./config --prefix= --shared; make; make install # On some platforms (mac) you need to choose 32/64 bit architecture. # Build/Install of openssl on windows is slightly different: you need to run # perl and nmake. You might also need to # 'set path=\bin;%PATH% # in order to find the .dll files at runtime. SET(WITH_SSL_DOC "bundled (use yassl)") SET(WITH_SSL_DOC "${WITH_SSL_DOC}, yes (prefer os library if present, otherwise use bundled)") SET(WITH_SSL_DOC "${WITH_SSL_DOC}, system (use os library)") SET(WITH_SSL_DOC "${WITH_SSL_DOC}, ") MACRO (CHANGE_SSL_SETTINGS string) SET(WITH_SSL ${string} CACHE STRING ${WITH_SSL_DOC} FORCE) ENDMACRO() MACRO (MYSQL_USE_BUNDLED_SSL) IF (NOT TARGET yassl) SET(INC_DIRS ${PROJECT_SOURCE_DIR}/ext/yassl/include ${PROJECT_SOURCE_DIR}/ext/yassl/taocrypt/include ) SET(SSL_LIBRARIES router_yassl router_taocrypt) IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBSOCKET}) ENDIF() SET(SSL_INCLUDE_DIRS ${INC_DIRS}) SET(SSL_INTERNAL_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/ext/yassl/taocrypt/mySTL) SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED") CHANGE_SSL_SETTINGS("bundled") ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/ext/yassl) GET_TARGET_PROPERTY(src router_yassl SOURCES) FOREACH(file ${src}) SET(SSL_SOURCES ${SSL_SOURCES} ${PROJECT_SOURCE_DIR}/ext/yassl/${file}) ENDFOREACH() GET_TARGET_PROPERTY(src router_taocrypt SOURCES) FOREACH(file ${src}) SET(SSL_SOURCES ${SSL_SOURCES} ${PROJECT_SOURCE_DIR}/ext/yassl/taocrypt/${file}) ENDFOREACH() ENDIF() ENDMACRO() # MYSQL_CHECK_SSL # # Provides the following configure options: # WITH_SSL=[yes|bundled|system|] MACRO (MYSQL_CHECK_SSL) IF(NOT WITH_SSL) IF(WIN32) CHANGE_SSL_SETTINGS("bundled") ENDIF() ENDIF() # See if WITH_SSL is of the form FILE(GLOB WITH_SSL_HEADER ${WITH_SSL}/include/openssl/ssl.h) IF (WITH_SSL_HEADER) SET(WITH_SSL_PATH ${WITH_SSL} CACHE PATH "path to custom SSL installation") ENDIF() IF(WITH_SSL STREQUAL "bundled") MYSQL_USE_BUNDLED_SSL() # Reset some variables, in case we switch from /path/to/ssl to "bundled". IF (WITH_SSL_PATH) UNSET(WITH_SSL_PATH) UNSET(WITH_SSL_PATH CACHE) ENDIF() IF (OPENSSL_ROOT_DIR) UNSET(OPENSSL_ROOT_DIR) UNSET(OPENSSL_ROOT_DIR CACHE) ENDIF() IF (OPENSSL_INCLUDE_DIR) UNSET(OPENSSL_INCLUDE_DIR) UNSET(OPENSSL_INCLUDE_DIR CACHE) ENDIF() IF (WIN32 AND OPENSSL_APPLINK_C) UNSET(OPENSSL_APPLINK_C) UNSET(OPENSSL_APPLINK_C CACHE) ENDIF() IF (OPENSSL_LIBRARY) UNSET(OPENSSL_LIBRARY) UNSET(OPENSSL_LIBRARY CACHE) ENDIF() IF (CRYPTO_LIBRARY) UNSET(CRYPTO_LIBRARY) UNSET(CRYPTO_LIBRARY CACHE) ENDIF() ELSEIF(WITH_SSL STREQUAL "system" OR WITH_SSL STREQUAL "yes" OR WITH_SSL_PATH ) # First search in WITH_SSL_PATH. FIND_PATH(OPENSSL_ROOT_DIR NAMES include/openssl/ssl.h NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH HINTS ${WITH_SSL_PATH} ) # Then search in standard places (if not found above). FIND_PATH(OPENSSL_ROOT_DIR NAMES include/openssl/ssl.h ) FIND_PATH(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h HINTS ${OPENSSL_ROOT_DIR}/include ) IF (WIN32) FIND_FILE(OPENSSL_APPLINK_C NAMES openssl/applink.c HINTS ${OPENSSL_ROOT_DIR}/include ) MESSAGE(STATUS "OPENSSL_APPLINK_C ${OPENSSL_APPLINK_C}") ENDIF() # On mac this list is <.dylib;.so;.a> # We prefer static libraries, so we revert it here. IF (WITH_SSL_PATH) LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) MESSAGE(STATUS "suffixes <${CMAKE_FIND_LIBRARY_SUFFIXES}>") ENDIF() FIND_LIBRARY(OPENSSL_LIBRARY NAMES ssl ssleay32 ssleay32MD HINTS ${OPENSSL_ROOT_DIR}/lib) FIND_LIBRARY(CRYPTO_LIBRARY NAMES crypto libeay32 HINTS ${OPENSSL_ROOT_DIR}/lib) IF (WITH_SSL_PATH) LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) ENDIF() # Verify version number. Version information looks like: # #define OPENSSL_VERSION_NUMBER 0x1000103fL # Encoded as MNNFFPPS: major minor fix patch status FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" OPENSSL_VERSION_NUMBER REGEX "^#[ ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*" ) STRING(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1" OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}" ) IF(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARY AND CRYPTO_LIBRARY AND OPENSSL_MAJOR_VERSION STREQUAL "1" ) SET(OPENSSL_FOUND TRUE) ELSE() SET(OPENSSL_FOUND FALSE) ENDIF() # If we are invoked with -DWITH_SSL=/path/to/custom/openssl # and we have found static libraries, then link them statically # into our executables and libraries. # Adding IMPORTED_LOCATION allows MERGE_STATIC_LIBS # to get LOCATION and do correct dependency analysis. SET(MY_CRYPTO_LIBRARY "${CRYPTO_LIBRARY}") SET(MY_OPENSSL_LIBRARY "${OPENSSL_LIBRARY}") IF (WITH_SSL_PATH AND NOT TARGET imported_crypto) GET_FILENAME_COMPONENT(CRYPTO_EXT "${CRYPTO_LIBRARY}" EXT) GET_FILENAME_COMPONENT(OPENSSL_EXT "${OPENSSL_LIBRARY}" EXT) IF (CRYPTO_EXT STREQUAL ".a") SET(MY_CRYPTO_LIBRARY imported_crypto) ADD_LIBRARY(imported_crypto STATIC IMPORTED) SET_TARGET_PROPERTIES(imported_crypto PROPERTIES IMPORTED_LOCATION "${CRYPTO_LIBRARY}") ENDIF() IF (OPENSSL_EXT STREQUAL ".a") SET(MY_OPENSSL_LIBRARY imported_openssl) ADD_LIBRARY(imported_openssl STATIC IMPORTED) SET_TARGET_PROPERTIES(imported_openssl PROPERTIES IMPORTED_LOCATION "${OPENSSL_LIBRARY}") ENDIF() ENDIF() MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}") MESSAGE(STATUS "OPENSSL_LIBRARY = ${OPENSSL_LIBRARY}") MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}") MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}") INCLUDE(CheckSymbolExists) SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h" HAVE_SHA512_DIGEST_LENGTH) IF(OPENSSL_FOUND AND HAVE_SHA512_DIGEST_LENGTH) SET(SSL_SOURCES "") SET(SSL_LIBRARIES ${MY_OPENSSL_LIBRARY} ${MY_CRYPTO_LIBRARY}) IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBSOCKET}) ENDIF() IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(SSL_LIBRARIES ${SSL_LIBRARIES}) SET(SSL_LIBRARIES_DL ${LIBDL}) ENDIF() MESSAGE(STATUS "SSL_LIBRARIES = ${SSL_LIBRARIES}") SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) SET(SSL_INTERNAL_INCLUDE_DIRS "") SET(SSL_DEFINES "-DHAVE_OPENSSL") ELSE() UNSET(WITH_SSL_PATH) UNSET(WITH_SSL_PATH CACHE) UNSET(OPENSSL_ROOT_DIR) UNSET(OPENSSL_ROOT_DIR CACHE) UNSET(OPENSSL_INCLUDE_DIR) UNSET(OPENSSL_INCLUDE_DIR CACHE) UNSET(OPENSSL_APPLINK_C) UNSET(OPENSSL_APPLINK_C CACHE) UNSET(OPENSSL_LIBRARY) UNSET(OPENSSL_LIBRARY CACHE) UNSET(CRYPTO_LIBRARY) UNSET(CRYPTO_LIBRARY CACHE) MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. " "Make sure you've specified a supported SSL version. " "Consult the documentation for WITH_SSL alternatives") ENDIF() ELSE() MESSAGE(SEND_ERROR "Wrong option or path for WITH_SSL. " "Valid options are : ${WITH_SSL_DOC}") ENDIF() ENDMACRO() # Many executables will depend on libeay32.dll and ssleay32.dll at runtime. # In order to ensure we find the right version(s), we copy them into # the same directory as the executables. # NOTE: Using dlls will likely crash in malloc/free, # see INSTALL.W32 which comes with the openssl sources. # So we should be linking static versions of the libraries. MACRO (COPY_OPENSSL_DLLS target_name out_dir) IF (WIN32 AND WITH_SSL_PATH) GET_FILENAME_COMPONENT(CRYPTO_NAME "${CRYPTO_LIBRARY}" NAME_WE) GET_FILENAME_COMPONENT(OPENSSL_NAME "${OPENSSL_LIBRARY}" NAME_WE) FILE(GLOB HAVE_CRYPTO_DLL "${WITH_SSL_PATH}/bin/${CRYPTO_NAME}.dll") FILE(GLOB HAVE_OPENSSL_DLL "${WITH_SSL_PATH}/bin/${OPENSSL_NAME}.dll") IF (HAVE_CRYPTO_DLL AND HAVE_OPENSSL_DLL) ADD_CUSTOM_COMMAND(TARGET ${target_name} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${WITH_SSL_PATH}/bin/${CRYPTO_NAME}.dll" "${out_dir}/${CRYPTO_NAME}.dll" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${WITH_SSL_PATH}/bin/${OPENSSL_NAME}.dll" "${out_dir}/${OPENSSL_NAME}.dll" ) ENDIF() ENDIF() ENDMACRO() ================================================ FILE: cmake/testing.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA set(_TEST_RUNTIME_DIR ${PROJECT_BINARY_DIR}/tests) # We include GMock without touching the compile flags. GMock can # handle that itself. It will also indirectly create targets for gmock # and gtest. # # Two alternatives for locating GMock *source code*: # 1. If WITH_GMOCK is given, this is expected to be the location of # the *source code*. # 2. If WITH_GMOCK is not given, it will look in the 'ext' directory # in the source root. if(ENABLE_TESTS) if(TARGET gmock) # don't build gmock, if the parent already built it # copying from unittest/gunit/CMakeFiles.txt # this should all be global-variables or a cmake/ file if(NOT DOWNLOAD_ROOT) set(DOWNLOAD_ROOT ${CMAKE_SOURCE_DIR}/source_downloads) endif() # We want googletest version 1.8, which also contains googlemock. set(GMOCK_PACKAGE_NAME "release-1.8.0") if(DEFINED ENV{WITH_GMOCK} AND NOT DEFINED WITH_GMOCK) file(TO_CMAKE_PATH "$ENV{WITH_GMOCK}" WITH_GMOCK) ENDIF() if(LOCAL_GMOCK_ZIP AND NOT ${LOCAL_GMOCK_ZIP} MATCHES ".*${GMOCK_PACKAGE_NAME}\\.zip") set(LOCAL_GMOCK_ZIP 0) endif() if(WITH_GMOCK) ## Did we get a full path name, including file name? if(${WITH_GMOCK} MATCHES ".*\\.zip") GET_FILENAME_COMPONENT(GMOCK_DIR ${WITH_GMOCK} PATH) GET_FILENAME_COMPONENT(GMOCK_ZIP ${WITH_GMOCK} NAME) FIND_FILE(LOCAL_GMOCK_ZIP NAMES ${GMOCK_ZIP} PATHS ${GMOCK_DIR} NO_DEFAULT_PATH ) else() ## Did we get a path name to the directory of the .zip file? ## Check for both release-x.y.z.zip and googletest-release-x.y.z.zip FIND_FILE(LOCAL_GMOCK_ZIP NAMES "${GMOCK_PACKAGE_NAME}.zip" "googletest-${GMOCK_PACKAGE_NAME}.zip" PATHS ${WITH_GMOCK} NO_DEFAULT_PATH ) ## If WITH_GMOCK is a directory, use it for download. set(DOWNLOAD_ROOT ${WITH_GMOCK}) endif() MESSAGE(STATUS "Local gmock zip ${LOCAL_GMOCK_ZIP}") endif() set(GMOCK_SOURCE_DIR ${DOWNLOAD_ROOT}/googletest-${GMOCK_PACKAGE_NAME}/googlemock) set(GTEST_SOURCE_DIR ${DOWNLOAD_ROOT}/googletest-${GMOCK_PACKAGE_NAME}/googletest) # introduce some compat set(GTEST_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}) message("yyy seting GTEST_INCLUDE_DIRS to ${GTEST_INCLUDE_DIRS}") ADD_LIBRARY(gmock_main STATIC ${GMOCK_SOURCE_DIR}/src/gmock_main.cc) target_link_libraries(gmock_main gmock) target_include_directories(gmock_main PUBLIC ${GMOCK_INCLUDE_DIRS}) ADD_LIBRARY(gtest_main STATIC ${GTEST_SOURCE_DIR}/src/gtest_main.cc) target_include_directories(gtest_main PUBLIC ${GMOCK_INCLUDE_DIRS}) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set_target_properties(gtest_main gmock_main PROPERTIES COMPILE_FLAGS "-Wno-undef -Wno-conversion") endif() set(TEST_LIBRARIES gmock gtest gmock_main gtest_main) else() if(WITH_GMOCK) # There is a known gtest/gmock bug that surfaces with the gcc-6.x causing tests crashes: # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833450 # We have a patch for it in the gmock we bundle but if the user wants to use # it's own gtest/gmock we need to prevent it if the gcc-6.x is used if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "6.0" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "6.0")) message(FATAL_ERROR "Parameter WITH_GMOCK is not supported for gcc-6 or greater." "You need to either disable the tests or use the bundled gmock (removing WITH_GMOCK parameter).") endif() set(_gmock_root ${WITH_GMOCK}) set(_gtest_root ${WITH_GMOCK}/gtest) elseif(EXISTS "${CMAKE_SOURCE_DIR}/ext/gmock/CMakeLists.txt") if(NOT EXISTS "${CMAKE_SOURCE_DIR}/ext/gtest/CMakeLists.txt") message(FATAL_ERROR "Cannot find GTest repository under ${CMAKE_SOURCE_DIR}/ext/gtest") endif() set(_gmock_root "${CMAKE_SOURCE_DIR}/ext/gmock") set(_gtest_root "${CMAKE_SOURCE_DIR}/ext/gtest") elseif(GMOCK_SOURCE_DIR) # means we are part of the server and GMOCK was downloaded set(_gmock_root ${GMOCK_SOURCE_DIR}) set(_gtest_root ${GMOCK_SOURCE_DIR}/gtest) else() # means we are part of the server and GMOCK is missing # act as other server components, disable the tests SET (ENABLE_TESTS 0) SET (ENABLE_TESTS 0 PARENT_SCOPE) endif() if (ENABLE_TESTS) if(NOT EXISTS "${_gmock_root}/CMakeLists.txt") message(WARNING "Unable to find GMock source, not possible to build tests. Either " "disable tests with ENABLE_TESTS=no or download the source code " "for GMock (available at https://github.com/google/googlemock) and " "set WITH_GMOCK to the directory of the unpacked source code.") endif() message(STATUS "Found GMock source under ${_gmock_root}") add_subdirectory(${_gmock_root} ext/gmock) # Setting variables that are normally discovered using FindXXX.cmake set(GTEST_INCLUDE_DIRS ${_gtest_root}/include) message("yyy seting GTEST_INCLUDE_DIRS to ${GTEST_INCLUDE_DIRS}") set(GTEST_LIBRARIES gtest) set(GTEST_MAIN_LIBRARIES gtest_main) set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) set(GMOCK_INCLUDE_DIRS ${_gmock_root}/include) set(GMOCK_LIBRARIES gmock) set(GMOCK_MAIN_LIBRARIES gmock_main) set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARIES} ${GMOCK_MAIN_LIBRARIES}) set(TEST_LIBRARIES ${GMOCK_BOTH_LIBRARIES} ${GTEST_BOTH_LIBRARIES}) # Since GMock and GTest do not set # INTERFACE_SYSTEM_INCLUDE_DIRECTORIES, we do that here. This means # that any targets that reference one of these libraries will # "automatically" have the include directories for these libraries # added to their build flags. We cannot use "SYSTEM" since that is # not available in 2.8.9 (it was introduced in 2.8.12). target_include_directories(gmock PUBLIC ${GMOCK_INCLUDE_DIRS}) target_include_directories(gmock_main PUBLIC ${GMOCK_INCLUDE_DIRS}) target_include_directories(gtest PUBLIC ${GTEST_INCLUDE_DIRS}) target_include_directories(gtest_main PUBLIC ${GTEST_INCLUDE_DIRS}) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set (comp_flags_ "-Wno-undef -Wno-missing-field-initializers") if(COMPILER_HAS_WARNING_MISSING_FORMAT_ATTRIBUTE) set(comp_flags_ "${comp_flags_} -Wno-missing-format-attribute") endif() set_target_properties(gtest gtest_main gmock gmock_main PROPERTIES COMPILE_FLAGS "${comp_flags_}") endif() endif() endif() endif() # Set {RUNTIME,LIBRARY}_OUTPUT_DIRECTORY properties of a target to the stage dir. # On unix platforms this is just one directory, but on Windows it's per build-type, # e.g. build/stage/Debug/lib, build/stage/Release/lib, etc function(set_target_output_directory target target_output_directory dirname) if(NOT CMAKE_CFG_INTDIR STREQUAL ".") foreach(config_ ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${config_} config__) set_property(TARGET ${target} PROPERTY ${target_output_directory}_${config__} ${MySQLRouter_BINARY_STAGE_DIR}/${config_}/${dirname}) endforeach() else() set_property(TARGET ${target} PROPERTY ${target_output_directory} ${MySQLRouter_BINARY_STAGE_DIR}/${dirname}) endif() endfunction() # Prepare staging area foreach(dir etc;run;log;bin;lib) if(NOT CMAKE_CFG_INTDIR STREQUAL ".") foreach(config_ ${CMAKE_CONFIGURATION_TYPES}) file(MAKE_DIRECTORY ${MySQLRouter_BINARY_STAGE_DIR}/${config_}/${dir}) endforeach() else() file(MAKE_DIRECTORY ${MySQLRouter_BINARY_STAGE_DIR}/${dir}) endif() endforeach() function(add_test_file FILE) set(one_value_args MODULE LABEL ENVIRONMENT) set(multi_value_args LIB_DEPENDS INCLUDE_DIRS) cmake_parse_arguments(TEST "" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(NOT TEST_MODULE) message(FATAL_ERROR "Module name missing for test file ${FILE}") endif() get_filename_component(test_ext ${FILE} EXT) get_filename_component(runtime_dir ${FILE} PATH) # Not using DIRECTORY because of CMake >=2.8.11 requirement set(runtime_dir ${PROJECT_BINARY_DIR}/tests/${TEST_MODULE}) if(test_ext STREQUAL ".cc") # Tests written in C++ get_filename_component(test_target ${FILE} NAME_WE) string(REGEX REPLACE "^test_" "" test_target ${test_target}) set(test_target "test_${TEST_MODULE}_${test_target}") set(test_name "tests/${TEST_MODULE}/${test_target}") add_executable(${test_target} ${FILE}) target_link_libraries(${test_target} gtest gtest_main gmock gmock_main routertest_helpers router_lib harness-library ${CMAKE_THREAD_LIBS_INIT}) foreach(libtarget ${TEST_LIB_DEPENDS}) #add_dependencies(${test_target} ${libtarget}) target_link_libraries(${test_target} ${libtarget}) endforeach() foreach(include_dir ${TEST_INCLUDE_DIRS}) target_include_directories(${test_target} PUBLIC ${include_dir}) endforeach() set_target_properties(${test_target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${runtime_dir}/) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # silence undefined use of macro-vars in gtest. # we can't use #pragma's due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431 to # supress it locally. set_target_properties( ${test_target} PROPERTIES COMPILE_FLAGS "-Wno-undef -Wno-conversion") endif() if(WITH_VALGRIND) FIND_PROGRAM(VALGRIND valgrind) SET(TEST_WRAPPER ${VALGRIND} --error-exitcode=1) endif() add_test(NAME ${test_name} COMMAND ${TEST_WRAPPER} $ --gtest_output=xml:${runtime_dir}/${test_target}.xml) SET(TEST_ENV_PREFIX "STAGE_DIR=${MySQLRouter_BINARY_STAGE_DIR};CMAKE_SOURCE_DIR=${MySQLRouter_SOURCE_DIR};CMAKE_BINARY_DIR=${MySQLRouter_BINARY_DIR}") if(WITH_VALGRIND) SET(TEST_ENV_PREFIX "${TEST_ENV_PREFIX};WITH_VALGRIND=1") endif() if (WIN32) # PATH's separator ";" needs to be escaped as CMAKE's test-env is also separated by ; ... STRING(REPLACE ";" "\\;" ESC_ENV_PATH "$ENV{PATH}") ## win32 has single and multi-configuration builds set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${TEST_ENV_PREFIX};PATH=$\;$\;$\;$\;$\;${ESC_ENV_PATH};${TEST_ENVIRONMENT}") else() set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${TEST_ENV_PREFIX};LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH};DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH};${TEST_ENVIRONMENT}") endif() else() message(ERROR "Unknown test type; file '${FILE}'") endif() endfunction(add_test_file) function(add_test_dir DIR_NAME) set(one_value_args MODULE ENVIRONMENT) set(multi_value_args LIB_DEPENDS INCLUDE_DIRS) cmake_parse_arguments(TEST "" "${one_value_args}" "${multi_value_args}" ${ARGN}) if(NOT TEST_MODULE) message(FATAL_ERROR "Module name missing for test folder ${DIR_NAME}") endif() get_filename_component(abs_path ${DIR_NAME} ABSOLUTE) file(GLOB test_files RELATIVE ${abs_path} ${abs_path}/*.cc) foreach(test_file ${test_files}) if(NOT ${test_file} MATCHES "^helper") add_test_file(${abs_path}/${test_file} MODULE ${TEST_MODULE} ENVIRONMENT ${TEST_ENVIRONMENT} LIB_DEPENDS ${TEST_LIB_DEPENDS} INCLUDE_DIRS ${TEST_INCLUDE_DIRS} ) endif() endforeach(test_file) endfunction(add_test_dir) ================================================ FILE: cmake/version.cmake ================================================ # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is also distributed with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have included with MySQL. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Version information of MySQL Router # Project version, has to be an X.Y.Z number since it is used with the # "project" CMake command set(PROJECT_VERSION_TEXT "8.0.12") # Can be arbitrary test that is added to the package file names after # the version, but before the extensions. set(PROJECT_PACKAGE_EXTRAS "") set(PROJECT_EDITION "GPL community edition" CACHE STRING "Edition of MySQL Router") # create a string that is allowed in a RPM spec "release" field set(RPM_EXTRA_VERSION "${PROJECT_PACKAGE_EXTRAS}") if(RPM_EXTRA_VERSION) string(REGEX REPLACE "[^A-Za-z0-9]" "" RPM_EXTRA_VERSION "${RPM_EXTRA_VERSION}") set(RPM_EXTRA_VERSION ".${RPM_EXTRA_VERSION}") endif() # Nothing below this line needs change when releasing # Older CMake version do not set PROJECT_VERSION if(${CMAKE_VERSION} VERSION_LESS "3.0") # We can not use project() to set version information string(REPLACE "." ";" version_list ${PROJECT_VERSION_TEXT}) list(GET version_list 0 major) list(GET version_list 1 minor) list(GET version_list 2 patch) set(MySQLRouter_VERSION_MAJOR ${major}) set(MySQLRouter_VERSION_MINOR ${minor}) set(MySQLRouter_VERSION_PATCH ${patch}) set(PROJECT_VERSION_MAJOR ${major}) set(PROJECT_VERSION_MINOR ${minor}) set(PROJECT_VERSION_PATCH ${patch}) set(MySQLRouter_VERSION ${PROJECT_VERSION_TEXT}) set(PROJECT_VERSION ${PROJECT_VERSION_TEXT}) endif() ================================================ FILE: config.h.in ================================================ /* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the Free Software Foundation. This program is also distributed with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in included license documentation. The authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have included with MySQL. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // Generated from config.h.in // MySQL Router version #define MYSQL_ROUTER_VERSION "@MySQLRouter_VERSION@" #define MYSQL_ROUTER_VERSION_MAJOR @MySQLRouter_VERSION_MAJOR@ #define MYSQL_ROUTER_VERSION_MINOR @MySQLRouter_VERSION_MINOR@ #define MYSQL_ROUTER_VERSION_PATCH @MySQLRouter_VERSION_PATCH@ #define MYSQL_ROUTER_VERSION_EDITION "@PROJECT_EDITION@" // Package information #define MYSQL_ROUTER_PACKAGE_NAME "@MYSQL_ROUTER_NAME@" #define MYSQL_ROUTER_PACKAGE_PLATFORM "@PLATFORM_NAME@" #define MYSQL_ROUTER_PACKAGE_ARCH_CPU "@CMAKE_SYSTEM_PROCESSOR@" #define MYSQL_ROUTER_PACKAGE_ARCH_64BIT @ARCH_64BIT@ // Legal #define COPYRIGHT "@ORACLE_COPYRIGHT@" #define WELCOME \ "@ORACLE_COPYRIGHT@"\ "\n\n"\ "Oracle is a registered trademark of Oracle Corporation and/or its\n"\ "affiliates. Other names may be trademarks of their respective\n"\ "owners.\n\n"\ "Start MySQL Router.\n" // Compiler features #ifdef _MSC_VER #if (_MSC_VER < 1700) #define noexcept #endif #endif // Defaults #define CONFIG_FILES R"cfg(@CONFIG_FILES@)cfg" #define MYSQL_ROUTER_BINARY_FOLDER "@ROUTER_BINDIR@" #define MYSQL_ROUTER_PLUGIN_FOLDER "@ROUTER_PLUGINDIR@" #define MYSQL_ROUTER_CONFIG_FOLDER "@ROUTER_CONFIGDIR@" #define MYSQL_ROUTER_RUNTIME_FOLDER "@ROUTER_RUNTIMEDIR@" #define MYSQL_ROUTER_LOGGING_FOLDER "@ROUTER_LOGDIR@" #define MYSQL_ROUTER_DATA_FOLDER "@ROUTER_DATADIR@" // Plaform specific #cmakedefine SIZEOF_VOIDP @SIZEOF_VOIDP@ #cmakedefine SIZEOF_CHARP @SIZEOF_CHARP@ #cmakedefine SIZEOF_LONG @SIZEOF_LONG@ #cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@ #cmakedefine SIZEOF_INT @SIZEOF_INT@ #cmakedefine SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@ #cmakedefine SIZEOF_OFF_T @SIZEOF_OFF_T@ #cmakedefine SIZEOF_TIME_T @SIZEOF_TIME_T@ /* Endianess */ #cmakedefine WORDS_BIGENDIAN 1 #cmakedefine ENABLE_TESTS /* Compiler specific features */ #cmakedefine HAVE_ATTRIBUTE_FORMAT 1 // Platform specific libraries #cmakedefine HAVE_PRLIMIT 1 ================================================ FILE: doc/doxygen.cfg.in ================================================ # Generated from doc/doxygen.cfg.in # This file describes the settings to be used by Doxygen for MySQL Router. DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "MySQL Router" PROJECT_NUMBER = PROJECT_BRIEF = "Route MySQL connections" PROJECT_LOGO = OUTPUT_DIRECTORY = doc OUTPUT_LANGUAGE = English GENERATE_LATEX = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = NO OPTIMIZE_OUTPUT_FOR_C = NO EXTENSION_MAPPING = cc=C++ MARKDOWN_SUPPORT = YES AUTOLINK_SUPPORT = YES BUILTIN_STL_SUPPORT = YES EXTRACT_PRIVATE = YES INTERNAL_DOCS = YES CASE_SENSE_NAMES = NO RECURSIVE = YES INPUT = @MySQLRouter_SOURCE_DIR@/README.md @MySQLRouter_SOURCE_DIR@/ STRIP_FROM_PATH = @MySQLRouter_SOURCE_DIR@/ EXCLUDE += @MySQLRouter_SOURCE_DIR@/ext EXCLUDE += @MySQLRouter_SOURCE_DIR@/packaging EXCLUDE += @MySQLRouter_SOURCE_DIR@/cmake EXCLUDE_PATTERNS = EXCLUDE_PATTERNS += *.txt USE_MDFILE_AS_MAINPAGE = @MySQLRouter_SOURCE_DIR@/README.md HTML_HEADER = @MySQLRouter_SOURCE_DIR@/doc/router_header.html HTML_FOOTER = @MySQLRouter_SOURCE_DIR@/doc/router_footer.html HTML_EXTRA_STYLESHEET = @MySQLRouter_SOURCE_DIR@/doc/router_doxygen.css ALIASES += devnote="
\n\internal \n" ALIASES += enddevnote="\endinternal \n
" WARN_IF_UNDOCUMENTED = NO WARN_AS_ERROR = YES ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS # allow to include every file EXAMPLE_PATH = @PROJECT_SOURCE_DIR@ ================================================ FILE: doc/router_doxygen.css ================================================ .fragment { font-size: 80% !important; } .textblock, .memitem { width: 600px !important; } .memdoc p { } .devnote h6 { font-color: orange; font-weight: bold; font-size: inherit; margin: 0; padding: 0; } .devnote p { margin: 0; } .devnote { border-left: solid 3px orange; padding-left: 3px; margin-bottom: 5px; } ================================================ FILE: doc/router_footer.html ================================================ ================================================ FILE: doc/router_header.html ================================================ $projectname: $title $title $treeview $search $mathjax $extrastylesheet
$projectname  $projectnumber
$projectbrief
$projectbrief
$searchbox
================================================ FILE: doc/sample_mysqlrouter.conf ================================================ # MySQL Router sample configuration # # The following is a sample configuration file which shows # most of the plugins available and most of their options. # # The paths used are defaults and should be adapted based # on how MySQL Router was installed, for example, using the # CMake option CMAKE_INSTALL_PREFIX # # The logging_folder is kept empty so message go to the # console. # #[DEFAULT] #logging_folder = #plugin_folder = /usr/local/lib/mysqlrouter #config_folder = /etc/mysql #runtime_folder = /var/run #data_folder = /var/lib #keyring_path = /var/lib/keyring-data #master_key_path = /var/lib/keyring-key #[logger] #level = INFO #[routing:basic_failover] # To be more transparent, use MySQL Server port 3306 #bind_port = 7001 #routing_strategy = first-available #mode = read-write #destinations = mysql-server1:3306,mysql-server2 # If no plugin is configured which starts a service, keepalive # will make sure MySQL Router will not immediately exit. It is # safe to remove once Router is configured. [keepalive] interval = 60 ================================================ FILE: ext/RAPIDJSON-README ================================================ Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the Free Software Foundation. This program is also distributed with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in included license documentation. The authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have included with MySQL. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ---- The rapidjson library included in this directory is based on https://github.com/miloyip/rapidjson, version 1.1.0. The folder lib/jsonchecker is removed so that we don't include any code licensed under the JSON License. ================================================ FILE: ext/duktape/duktape-2.1.0/LICENSE.txt ================================================ =============== Duktape license =============== (http://opensource.org/licenses/MIT) Copyright (c) 2013-2017 by Duktape authors (see AUTHORS.rst) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: ext/duktape/duktape-2.1.0/README.rst ================================================ ======= Duktape ======= Duktape is a small and portable Ecmascript E5/E5.1 implementation. It is intended to be easily embeddable into C programs, with a C API similar in spirit to Lua's. Duktape supports the full E5/E5.1 feature set (with some semantics updated from ES2015+) including errors, Unicode strings, and regular expressions, a subset of Ecmascript 2015 (E6) and Ecmascript 2016 (E7) features (e.g. computed property names, Proxy objects, exponentiation operator, Reflect), ES2015 ArrayBuffer/TypedView, Node.js Buffer, and WHATWG Encoding API living standard. Duktape also provides a number of custom features such as error tracebacks, additional data types for better C integration, combined reference counting and mark-and sweep garbage collector, object finalizers, co-operative threads a.k.a. coroutines, tail calls, a built-in debugger protocol, function bytecode dump/load, and so on. Bundled extra modules provide functionality such as CommonJS module loading and a logging framework. You can browse Duktape programmer's API and other documentation at: * http://duktape.org/ In particular, you should read the getting started section: * http://duktape.org/guide.html#gettingstarted More examples and how-to articles are in the Duktape Wiki: * http://wiki.duktape.org/ To build an example command line tool with interactive evaluation (REPL) and the ability to run script files:: $ cd $ make -f Makefile.cmdline [...] $ ./duk ((o) Duktape duk> print('Hello world!'); Hello world! = undefined $ ./duk mandel.js [...] To integrate Duktape into your program: * Use ``tools/configure.py`` to prepare Duktape source and header files for build:: # Duktape options can be customized via command line options. # In this example, enable "fastint" support and disable ES2015 # Proxy support $ python2 tools/configure.py --output-directory duktape-src \ -DDUK_USE_FASTINT -UDUK_USE_ES6_PROXY * The output directory (duktape-src) will then contain ``duktape.c``, ``duktape.h``, and ``duk_config.h`` which you include in your build. For more details, see: * http://duktape.org/guide.html#compiling * http://wiki.duktape.org/Configuring.html This distributable contains: * Pre-configured Duktape header and source files using the Duktape default configuration: * ``src/``: main Duktape library in a "single source file" format (duktape.c, duktape.h, and duk_config.h). * ``src-noline/``: contains a variant of ``src/duktape.c`` with no ``#line`` directives which is preferable for some users. See discussion in https://github.com/svaarala/duktape/pull/363. * ``src-separate/``: main Duktape library in multiple files format. * ``src-input/``: raw input source files used by ``configure.py`` which recreates the combined/separate prepared sources with specific options. * ``tools/``: various Python tools, such as ``configure.py`` for preparing a ``duk_config.h`` header and Duktape source files for compilation, see http://wiki.duktape.org/Configuring.html. * ``config/``: configuration metadata for ``configure.py``. * ``examples/``: further examples for using Duktape. Although Duktape itself is widely portable, some of the examples are Linux only. For instance the ``eventloop`` example illustrates how ``setTimeout()`` and other standard timer functions could be implemented on Unix/Linux. * ``extras/``: utilities and modules which don't comfortably fit into the main Duktape library because of footprint or portability concerns. Extras are maintained and bug fixed code, but don't have the same version guarantees as the main Duktape library. * ``polyfills/``: a few replacement suggestions for non-standard Javascript functions provided by other implementations. * ``debugger/``: a debugger with a web UI, see ``debugger/README.rst`` and https://github.com/svaarala/duktape/blob/master/doc/debugger.rst for details on Duktape debugger support. Also contains a JSON debug proxy (one written in Node.js and another in DukLuv) to make talking to the debug target easier. * ``licenses/``: licensing information. You can find release notes at: * https://github.com/svaarala/duktape/blob/master/RELEASES.rst (summary of all versions) * https://github.com/svaarala/duktape/blob/master/doc/release-notes-v2-1.rst (more detailed notes for this version) This distributable contains Duktape version 2.1.0, created from git commit 1f1f51a4f9595ffe8def0e9ba45b20f14679393a (v2.1.0). Duktape is copyrighted by its authors (see ``AUTHORS.rst``) and licensed under the MIT license (see ``LICENSE.txt``). String hashing algorithms are based on the algorithm from Lua (MIT license), djb2 hash, and Murmurhash2 (MIT license). Pseudorandom number generator algorithms are based on Adi Shamir's three-op algorithm, xoroshiro128+ (public domain), and SplitMix64 (public domain). Duktape module loader is based on the CommonJS module loading specification (without sharing any code), CommonJS is under the MIT license. Have fun! Sami Vaarala (sami.vaarala@iki.fi) ================================================ FILE: ext/duktape/duktape-2.1.0/extras/README.rst ================================================ ============== Duktape extras ============== Extra modules and utilities. Extras provide functionality that doesn't comfortably fit into the main Duktape library, perhaps for footprint or portability reasons, but are still useful for most users. Extras are maintained and will be bug fixed. However, they don't have the same semantic versioning guarantees like the main Duktape library. Extras may be dropped without warning as Duktape is versioned. For instance, if an extra breaks due to Duktape changes and there is no time to fix it, the missing extra won't block a release and will be dropped. ================================================ FILE: ext/duktape/duktape-2.1.0/extras/alloc-pool/Makefile ================================================ # For manual testing; say 'make' in extras/alloc-pool and run ./test. DEFS= #DEFS+='-DDUK_ALLOC_POOL_DEBUG' .PHONY: test test: rm -rf ./prep echo 'DUK_USE_FATAL_HANDLER:' > opts.yaml echo ' verbatim: "#define DUK_USE_FATAL_HANDLER(udata,msg) my_fatal((msg))"' >> opts.yaml python2 ../../tools/configure.py \ --output-directory ./prep \ --option-file ./opts.yaml \ --fixup-line 'extern void my_fatal(const char *msg);' gcc -std=c99 -Wall -Wextra -m32 -Os -otest \ -I./prep ./prep/duktape.c \ $(DEFS) \ duk_alloc_pool.c test.c \ -lm ./test 'print("foo", "bar", 1, 2, 3)' ./test 'alert("foo", "bar", 1, 2, 3)' .PHONY: ptrcomptest ptrcomptest: rm -rf ./prep echo 'DUK_USE_FATAL_HANDLER:' > opts.yaml echo ' verbatim: "#define DUK_USE_FATAL_HANDLER(udata,msg) my_fatal((msg))"' >> opts.yaml python2 ../../tools/configure.py \ --output-directory ./prep \ --option-file ./opts.yaml \ --fixup-line 'extern void my_fatal(const char *msg);' \ --option-file ../../config/examples/low_memory.yaml \ --option-file ptrcomp.yaml \ --fixup-file ptrcomp_fixup.h gcc -std=c99 -Wall -Wextra -m32 -Os -optrcomptest \ -I. -I./prep ./prep/duktape.c \ $(DEFS) \ duk_alloc_pool.c test.c \ -lm ./ptrcomptest 'print("foo", "bar", 1, 2, 3)' ./ptrcomptest 'alert("foo", "bar", 1, 2, 3)' ================================================ FILE: ext/duktape/duktape-2.1.0/extras/alloc-pool/README.rst ================================================ ===================================== Pool allocator for low memory targets ===================================== A simple pool allocator which satisfies allocations from preallocated pools containing blocks of a certain size. The caller provides a continuous memory region and a pool configuration when initializing the allocator. The pool configuration specifies the block sizes used, and parameters to control how many entries are allocated for each block size. The parameters are specified with respect to an arbitrary floating point scaling parameter ``t`` as follows:: bytes = A*t + B count = floor(bytes / block_size) = floor((A*t + B) / block_size) A: constant which indicates how quickly more bytes are assigned for this block size as the total allocation grows B: constant which indicates the base allocation for this block size, i.e. the allocated needed by Duktape initialization Pool initialization finds the largest floating point ``t`` which still fits in the memory region provided. Any leftover bytes are sprinkled to the pools to minimize wasted space. A pool configuration can be written manually (by trial and error) or using some automatic tooling such as ``pool_simulator.py``. When using pointer compression only a single global pool is supported. This reduces code footprint and is usually sufficient in low memory targets. Pointer compression functions are defined as inline functions in ``duk_alloc_pool.h`` to allow the compiler to inline pointer compression when appropriate. As a side effect ``duk_config.h`` must include ``duk_alloc_pool.h`` so that the declarations are visible when compiling Duktape. ================================================ FILE: ext/duktape/duktape-2.1.0/extras/alloc-pool/duk_alloc_pool.c ================================================ /* * Pool allocator for low memory targets. */ #include #include #include #include #include #include "duktape.h" #include "duk_alloc_pool.h" /* Define to enable some debug printfs. */ /* #define DUK_ALLOC_POOL_DEBUG */ #if defined(DUK_ALLOC_POOL_ROMPTR_COMPRESSION) #if 0 /* This extern declaration is provided by duktape.h, array provided by duktape.c. */ extern const void * const duk_rom_compressed_pointers[]; #endif const void *duk_alloc_pool_romptr_low = NULL; const void *duk_alloc_pool_romptr_high = NULL; static void duk__alloc_pool_romptr_init(void); #endif #if defined(DUK_USE_HEAPPTR16) void *duk_alloc_pool_ptrcomp_base = NULL; #endif #if defined(DUK_ALLOC_POOL_DEBUG) static void duk__alloc_pool_dprintf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); } #endif /* * Pool initialization */ void *duk_alloc_pool_init(char *buffer, size_t size, const duk_pool_config *configs, duk_pool_state *states, int num_pools, duk_pool_global *global) { double t_min, t_max, t_curr, x; int step, i, j, n; size_t total; char *p; /* XXX: check that 'size' is not too large when using pointer * compression. */ /* To optimize pool counts first come up with a 't' which still allows * total pool size to fit within user provided region. After that * sprinkle any remaining bytes to the counts. Binary search with a * fixed step count; last round uses 't_min' as 't_curr' to ensure it * succeeds. */ t_min = 0.0; /* Unless config is insane, this should always be "good". */ t_max = 1e6; for (step = 0; ; step++) { if (step >= 100) { /* Force "known good", rerun config, and break out. * Deals with rounding corner cases where t_curr is * persistently "bad" even though t_min is a valid * solution. */ t_curr = t_min; } else { t_curr = (t_min + t_max) / 2.0; } for (i = 0, total = 0; i < num_pools; i++) { states[i].size = configs[i].size; /* Target bytes = A*t + B ==> target count = (A*t + B) / block_size. * Rely on A and B being small enough so that 'x' won't wrap. */ x = ((double) configs[i].a * t_curr + (double) configs[i].b) / (double) configs[i].size; states[i].count = (unsigned int) x; total += (size_t) states[i].size * (size_t) states[i].count; if (total > size) { goto bad; } } /* t_curr is good. */ #if defined(DUK_ALLOC_POOL_DEBUG) duk__alloc_pool_dprintf("duk_alloc_pool_init: step=%d, t=[%lf %lf %lf] -> total %ld/%ld (good)\n", step, t_min, t_curr, t_max, (long) total, (long) size); #endif if (step >= 100) { /* Keep state[] initialization state. The state was * created using the highest 't_min'. */ break; } t_min = t_curr; continue; bad: /* t_curr is bad. */ #if defined(DUK_ALLOC_POOL_DEBUG) duk__alloc_pool_dprintf("duk_alloc_pool_init: step=%d, t=[%lf %lf %lf] -> total %ld/%ld (bad)\n", step, t_min, t_curr, t_max, (long) total, (long) size); #endif if (step >= 1000) { /* Cannot find any good solution; shouldn't happen * unless config is bad or 'size' is so small that * even a baseline allocation won't fit. */ return NULL; } t_max = t_curr; /* continue */ } /* The base configuration is now good; sprinkle any leftovers to * pools in descending order. Note that for good t_curr, 'total' * indicates allocated bytes so far and 'size - total' indicates * leftovers. */ for (i = num_pools - 1; i >= 0; i--) { while (size - total >= states[i].size) { /* Ignore potential wrapping of states[i].count as the count * is 32 bits and shouldn't wrap in practice. */ states[i].count++; total += states[i].size; #if defined(DUK_ALLOC_POOL_DEBUG) duk__alloc_pool_dprintf("duk_alloc_pool_init: sprinkle %ld bytes (%ld left after)\n", (long) states[i].size, (long) (size - total)); #endif } } /* Pool counts are final. Allocate the user supplied region based * on the final counts, initialize free lists for each block size, * and otherwise finalize 'state' for use. */ p = buffer; global->states = states; global->num_pools = num_pools; #if defined(DUK_USE_HEAPPTR16) /* Register global base value for pointer compression, assumes * a single active pool -4 allows a single subtract to be used and * still ensures no non-NULL pointer encodes to zero. */ duk_alloc_pool_ptrcomp_base = (void *) (p - 4); #endif for (i = 0; i < num_pools; i++) { n = states[i].count; if (n > 0) { states[i].first = (duk_pool_free *) p; for (j = 0; j < n; j++) { char *p_next = p + states[i].size; ((duk_pool_free *) p)->next = (j == n - 1) ? (duk_pool_free *) NULL : (duk_pool_free *) p_next; p = p_next; } } else { states[i].first = (duk_pool_free *) NULL; } states[i].alloc_end = p; /* All members of 'state' now initialized. */ #if defined(DUK_ALLOC_POOL_DEBUG) duk__alloc_pool_dprintf("duk_alloc_pool_init: block size %5ld, count %5ld, %8ld total bytes, " "end %p\n", (long) states[i].size, (long) states[i].count, (long) states[i].size * (long) states[i].count, (void *) states[i].alloc_end); #endif } #if defined(DUK_ALLOC_POOL_ROMPTR_COMPRESSION) /* ROM pointer compression precomputation. Assumes a single active * pool. */ duk__alloc_pool_romptr_init(); #endif /* Use 'global' as udata. */ return (void *) global; } /* * Allocation providers */ void *duk_alloc_pool(void *udata, duk_size_t size) { duk_pool_global *g = (duk_pool_global *) udata; int i, n; #if defined(DUK_ALLOC_POOL_DEBUG) duk__alloc_pool_dprintf("duk_alloc_pool: %p %ld\n", udata, (long) size); #endif if (size == 0) { return NULL; } for (i = 0, n = g->num_pools; i < n; i++) { duk_pool_state *st = g->states + i; if (size <= st->size && st->first != NULL) { duk_pool_free *res = st->first; st->first = res->next; return (void *) res; } /* Allocation doesn't fit or no free entries, try to borrow * from the next block size. There's no support for preventing * a borrow at present. */ } return NULL; } void *duk_realloc_pool(void *udata, void *ptr, duk_size_t size) { duk_pool_global *g = (duk_pool_global *) udata; int i, j, n; #if defined(DUK_ALLOC_POOL_DEBUG) duk__alloc_pool_dprintf("duk_realloc_pool: %p %p %ld\n", udata, ptr, (long) size); #endif if (ptr == NULL) { return duk_alloc_pool(udata, size); } if (size == 0) { duk_free_pool(udata, ptr); return NULL; } /* Non-NULL pointers are necessarily from the pool so we should * always be able to find the allocation. */ for (i = 0, n = g->num_pools; i < n; i++) { duk_pool_state *st = g->states + i; char *new_ptr; /* Because 'ptr' is assumed to be in the pool and pools are * allocated in sequence, it suffices to check for end pointer * only. */ if ((char *) ptr >= st->alloc_end) { continue; } if (size <= st->size) { /* Allocation still fits existing allocation. Check if * we can shrink the allocation to a smaller block size * (smallest possible). */ for (j = 0; j < i; j++) { duk_pool_state *st2 = g->states + j; if (size <= st2->size && st2->first != NULL) { #if defined(DUK_ALLOC_POOL_DEBUG) duk__alloc_pool_dprintf("duk_realloc_pool: shrink, block size %ld -> %ld\n", (long) st->size, (long) st2->size); #endif new_ptr = (char *) st2->first; st2->first = ((duk_pool_free *) new_ptr)->next; memcpy((void *) new_ptr, (const void *) ptr, (size_t) size); ((duk_pool_free *) ptr)->next = st->first; st->first = (duk_pool_free *) ptr; return (void *) new_ptr; } } /* Failed to shrink; return existing pointer. */ return ptr; } /* Find first free larger block. */ for (j = i + 1; j < n; j++) { duk_pool_state *st2 = g->states + j; if (size <= st2->size && st2->first != NULL) { new_ptr = (char *) st2->first; st2->first = ((duk_pool_free *) new_ptr)->next; memcpy((void *) new_ptr, (const void *) ptr, (size_t) st->size); ((duk_pool_free *) ptr)->next = st->first; st->first = (duk_pool_free *) ptr; return (void *) new_ptr; } } /* Failed to resize. */ return NULL; } /* We should never be here because 'ptr' should be a valid pool * entry and thus always found above. */ return NULL; } void duk_free_pool(void *udata, void *ptr) { duk_pool_global *g = (duk_pool_global *) udata; int i, n; #if defined(DUK_ALLOC_POOL_DEBUG) duk__alloc_pool_dprintf("duk_free_pool: %p %p\n", udata, ptr); #endif if (ptr == NULL) { return; } for (i = 0, n = g->num_pools; i < n; i++) { duk_pool_state *st = g->states + i; /* Enough to check end address only. */ if ((char *) ptr >= st->alloc_end) { continue; } ((duk_pool_free *) ptr)->next = st->first; st->first = (duk_pool_free *) ptr; return; } /* We should never be here because 'ptr' should be a valid pool * entry and thus always found above. */ } /* * Pointer compression */ #if defined(DUK_ALLOC_POOL_ROMPTR_COMPRESSION) static void duk__alloc_pool_romptr_init(void) { /* Scan ROM pointer range for faster detection of "is 'p' a ROM pointer" * later on. */ const void * const * ptrs = (const void * const *) duk_rom_compressed_pointers; duk_alloc_pool_romptr_low = duk_alloc_pool_romptr_high = (const void *) *ptrs; while (*ptrs) { if (*ptrs > duk_alloc_pool_romptr_high) { duk_alloc_pool_romptr_high = (const void *) *ptrs; } if (*ptrs < duk_alloc_pool_romptr_low) { duk_alloc_pool_romptr_low = (const void *) *ptrs; } ptrs++; } } #endif /* Encode/decode functions are defined in the header to allow inlining. */ #if defined(DUK_ALLOC_POOL_ROMPTR_COMPRESSION) duk_uint16_t duk_alloc_pool_enc16_rom(void *ptr) { /* The if-condition should be the fastest possible check * for "is 'ptr' in ROM?". If pointer is in ROM, we'd like * to compress it quickly. Here we just scan a ~1K array * which is very bad for performance. */ const void * const * ptrs = duk_rom_compressed_pointers; while (*ptrs) { if (*ptrs == ptr) { return DUK_ALLOC_POOL_ROMPTR_FIRST + (duk_uint16_t) (ptrs - duk_rom_compressed_pointers); } ptrs++; } /* We should really never be here: Duktape should only be * compressing pointers which are in the ROM compressed * pointers list, which are known at 'make dist' time. * We go on, causing a pointer compression error. */ return 0; } #endif ================================================ FILE: ext/duktape/duktape-2.1.0/extras/alloc-pool/duk_alloc_pool.h ================================================ #if !defined(DUK_ALLOC_POOL_H_INCLUDED) #define DUK_ALLOC_POOL_H_INCLUDED #include "duktape.h" /* Pointer compression with ROM strings/objects: * * For now, use DUK_USE_ROM_OBJECTS to signal the need for compressed ROM * pointers. DUK_USE_ROM_PTRCOMP_FIRST is provided for the ROM pointer * compression range minimum to avoid duplication in user code. */ #if defined(DUK_USE_ROM_OBJECTS) && defined(DUK_USE_HEAPPTR16) #define DUK_ALLOC_POOL_ROMPTR_COMPRESSION #define DUK_ALLOC_POOL_ROMPTR_FIRST DUK_USE_ROM_PTRCOMP_FIRST /* This extern declaration is provided by duktape.h, array provided by duktape.c. * Because duk_config.h may include this file (to get the inline functions) we * need to forward declare this also here. */ extern const void * const duk_rom_compressed_pointers[]; #endif /* Pool configuration for a certain block size. */ typedef struct { unsigned int size; unsigned int a; /* bytes (not count) to allocate: a*t + b, t is an arbitrary scale parameter */ unsigned int b; } duk_pool_config; /* Freelist entry, must fit into the smallest block size. */ struct duk_pool_free; typedef struct duk_pool_free duk_pool_free; struct duk_pool_free { duk_pool_free *next; }; /* Pool state for a certain block size. */ typedef struct { duk_pool_free *first; char *alloc_end; unsigned int size; unsigned int count; } duk_pool_state; /* Top level state for all pools. Pointer to this struct is used as the allocator * userdata pointer. */ typedef struct { int num_pools; duk_pool_state *states; } duk_pool_global; /* Initialize a pool allocator, arguments: * - buffer and size: continuous region to use for pool * - config: configuration for pools in ascending block size * - state: state for pools, matches config order * - num_pools: number of entries in 'config' and 'state' * - global: global state structure * * The 'config', 'state', and 'global' pointers must be valid beyond the init * call, as long as the pool is used. * * Returns a void pointer to be used as userdata for the allocator functions. * Concretely the return value will be "(void *) global", i.e. the global * state struct. If pool init fails, the return value will be NULL. */ void *duk_alloc_pool_init(char *buffer, size_t size, const duk_pool_config *configs, duk_pool_state *states, int num_pools, duk_pool_global *global); /* Duktape allocation providers. Typing matches Duktape requirements. */ void *duk_alloc_pool(void *udata, duk_size_t size); void *duk_realloc_pool(void *udata, void *ptr, duk_size_t size); void duk_free_pool(void *udata, void *ptr); /* Duktape pointer compression global state (assumes single pool). */ #if defined(DUK_USE_ROM_OBJECTS) && defined(DUK_USE_HEAPPTR16) extern const void *duk_alloc_pool_romptr_low; extern const void *duk_alloc_pool_romptr_high; duk_uint16_t duk_alloc_pool_enc16_rom(void *ptr); #endif #if defined(DUK_USE_HEAPPTR16) extern void *duk_alloc_pool_ptrcomp_base; #endif #if 0 duk_uint16_t duk_alloc_pool_enc16(void *ptr); void *duk_alloc_pool_dec16(duk_uint16_t val); #endif /* Inlined pointer compression functions. Gcc and clang -Os won't in * practice inline these because it's more size efficient (by about * 3kB) to use explicit calls instead. Having these defined inline * here allows performance optimized builds to inline pointer compression * operations. * * Pointer compression assumes there's a single globally registered memory * pool which makes pointer compression more efficient. This would be easy * to fix by adding a userdata pointer to the compression functions and * plumbing the heap userdata from the compression/decompression macros. */ #if defined(DUK_USE_HEAPPTR16) static inline duk_uint16_t duk_alloc_pool_enc16(void *ptr) { if (ptr == NULL) { /* With 'return 0' gcc and clang -Os generate inefficient code. * For example, gcc -Os generates: * * 0804911d : * 804911d: 55 push %ebp * 804911e: 85 c0 test %eax,%eax * 8049120: 89 e5 mov %esp,%ebp * 8049122: 74 0b je 804912f * 8049124: 2b 05 e4 90 07 08 sub 0x80790e4,%eax * 804912a: c1 e8 02 shr $0x2,%eax * 804912d: eb 02 jmp 8049131 * 804912f: 31 c0 xor %eax,%eax * 8049131: 5d pop %ebp * 8049132: c3 ret * * The NULL path checks %eax for zero; if it is zero, a zero * is unnecessarily loaded into %eax again. The non-zero path * has an unnecessary jump as a side effect of this. * * Using 'return (duk_uint16_t) (intptr_t) ptr;' generates similarly * inefficient code; not sure how to make the result better. */ return 0; } #if defined(DUK_ALLOC_POOL_ROMPTR_COMPRESSION) if (ptr >= duk_alloc_pool_romptr_low && ptr <= duk_alloc_pool_romptr_high) { /* This is complex enough now to need a separate function. */ return duk_alloc_pool_enc16_rom(ptr); } #endif return (duk_uint16_t) (((size_t) ((char *) ptr - (char *) duk_alloc_pool_ptrcomp_base)) >> 2); } static inline void *duk_alloc_pool_dec16(duk_uint16_t val) { if (val == 0) { /* As with enc16 the gcc and clang -Os output is inefficient, * e.g. gcc -Os: * * 08049133 : * 8049133: 55 push %ebp * 8049134: 66 85 c0 test %ax,%ax * 8049137: 89 e5 mov %esp,%ebp * 8049139: 74 0e je 8049149 * 804913b: 8b 15 e4 90 07 08 mov 0x80790e4,%edx * 8049141: 0f b7 c0 movzwl %ax,%eax * 8049144: 8d 04 82 lea (%edx,%eax,4),%eax * 8049147: eb 02 jmp 804914b * 8049149: 31 c0 xor %eax,%eax * 804914b: 5d pop %ebp * 804914c: c3 ret */ return NULL; } #if defined(DUK_ALLOC_POOL_ROMPTR_COMPRESSION) if (val >= DUK_ALLOC_POOL_ROMPTR_FIRST) { /* This is a blind lookup, could check index validity. * Duktape should never decompress a pointer which would * be out-of-bounds here. */ return (void *) (intptr_t) (duk_rom_compressed_pointers[val - DUK_ALLOC_POOL_ROMPTR_FIRST]); } #endif return (void *) ((char *) duk_alloc_pool_ptrcomp_base + (((size_t) val) << 2)); } #endif #endif /* DUK_ALLOC_POOL_H_INCLUDED */ ================================================ FILE: ext/duktape/duktape-2.1.0/extras/alloc-pool/ptrcomp.yaml ================================================ DUK_USE_REFCOUNT16: true DUK_USE_STRHASH16: true DUK_USE_STRLEN16: true DUK_USE_BUFLEN16: true DUK_USE_OBJSIZES16: true DUK_USE_HSTRING_CLEN: false DUK_USE_HOBJECT_HASH_PART: false DUK_USE_HEAPPTR16: true DUK_USE_HEAPPTR_ENC16: verbatim: "#define DUK_USE_HEAPPTR_ENC16(ud,p) duk_alloc_pool_enc16((p))" DUK_USE_HEAPPTR_DEC16: verbatim: "#define DUK_USE_HEAPPTR_DEC16(ud,p) duk_alloc_pool_dec16((p))" #DUK_USE_ROM_OBJECTS: true #DUK_USE_ROM_STRINGS: true #DUK_USE_ROM_GLOBAL_INHERIT: true ================================================ FILE: ext/duktape/duktape-2.1.0/extras/alloc-pool/ptrcomp_fixup.h ================================================ /* To provide declarations for inline pointer compression functions. */ #include "duk_alloc_pool.h" ================================================ FILE: ext/duktape/duktape-2.1.0/extras/alloc-pool/test.c ================================================ #include #include #include "duktape.h" #include "duk_alloc_pool.h" void my_fatal(const char *msg) { fprintf(stderr, "*** FATAL: %s\n", msg ? msg : "no message"); fflush(stderr); abort(); } static duk_ret_t my_print(duk_context *ctx) { duk_push_string(ctx, " "); duk_insert(ctx, 0); duk_join(ctx, duk_get_top(ctx) - 1); printf("%s\n", duk_safe_to_string(ctx, -1)); return 1; } static void dump_pool_state(duk_pool_global *g) { int i; long total_size = 0; long total_used = 0; for (i = 0; i < g->num_pools; i++) { duk_pool_state *st = g->states + i; int free, used; duk_pool_free *f; for (free = 0, f = st->first; f; f = f->next) { free++; } used = st->count - free; printf("Pool %2d: block size %5d, count %4d/%4d, bytes %6d/%6d\n", i, (int) st->size, used, (int) st->count, (int) st->size * used, (int) st->size * (int) st->count); total_size += (long) st->size * (long) st->count; total_used += (long) st->size * (long) used; } printf("=== Total: %ld/%ld, free %ld\n", (long) total_used, (long) total_size, (long) (total_size - total_used)); } int main(int argc, char *argv[]) { duk_context *ctx; int i; int exitcode = 0; /* NOTE! This pool configuration is NOT a good pool configuration * for practical use (and is not intended to be one). A production * pool configuration should be created using measurements. */ const duk_pool_config pool_configs[15] = { { 16, 20, 200 }, { 20, 40, 100 }, { 24, 40, 100 }, { 32, 60, 50 }, { 40, 60, 50 }, { 48, 60, 50 }, { 56, 60, 50 }, { 64, 60, 50 }, { 80, 60, 50 }, { 256, 100, 10 }, { 1024, 20, 2 }, { 2048, 20, 2 }, { 4096, 100, 2 }, { 6144, 60, 2 }, { 8192, 100, 2 }, }; duk_pool_state pool_states[15]; /* Count must match pool_configs[]. */ duk_pool_global pool_global; char buffer[200000]; void *pool_udata; pool_udata = duk_alloc_pool_init(buffer, sizeof(buffer), pool_configs, pool_states, sizeof(pool_configs) / sizeof(duk_pool_config), &pool_global); if (!pool_udata) { return 1; } printf("Pool after pool init:\n"); dump_pool_state(&pool_global); ctx = duk_create_heap(duk_alloc_pool, duk_realloc_pool, duk_free_pool, pool_udata, NULL); if (!ctx) { return 1; } printf("Pool after Duktape heap creation:\n"); dump_pool_state(&pool_global); duk_push_c_function(ctx, my_print, DUK_VARARGS); duk_put_global_string(ctx, "print"); duk_push_c_function(ctx, my_print, DUK_VARARGS); duk_put_global_string(ctx, "alert"); printf("top after init: %ld\n", (long) duk_get_top(ctx)); for (i = 1; i < argc; i++) { printf("Evaling: %s\n", argv[i]); if (duk_peval_string(ctx, argv[i]) != 0) { exitcode = 1; } printf("--> %s\n", duk_safe_to_string(ctx, -1)); duk_pop(ctx); } printf("Pool after evaling code:\n"); dump_pool_state(&pool_global); printf("Done\n"); duk_destroy_heap(ctx); return exitcode; } ================================================ FILE: ext/duktape/duktape-2.1.0/extras/console/Makefile ================================================ # For manual testing; say 'make' in extras/print-alert and run ./test. .PHONY: test test: gcc -std=c99 -Wall -Wextra -o $@ -I../../src/ -I. ../../src/duktape.c duk_console.c test.c -lm ./test 'console.assert(true, "not shown");' ./test 'console.assert(false, "shown", { foo: 123 });' ./test 'console.log(1, 2, 3, { foo: "bar" });' ./test 'a={}; b={}; a.ref=b; console.log(a,b); b.ref=a; console.log(a,b)' # circular ref ./test 'console.trace(1, 2, 3)' ./test 'console.dir({ foo: 123, bar: [ "foo", "bar" ]});' ================================================ FILE: ext/duktape/duktape-2.1.0/extras/console/README.rst ================================================ ========================= Minimal 'console' binding ========================= Duktape doesn't provide a ``console`` binding (for example ``console.log``) by default because it would be a portability issue for some targets. Instead, an application should provide its own ``console`` binding. This directory contains an example binding: * Add ``duk_console.c`` to list of C sources to compile. * Ensure ``duk_console.h`` is in the include path. * Include the extra header in calling code and initialize the bindings:: #include "duktape.h" #include "duk_console.h" /* After initializing the Duktape heap or when creating a new * thread with a new global environment: */ duk_console_init(ctx, 0 /*flags*/); Use the ``DUK_CONSOLE_PROXY_WRAPPER`` to enable a Proxy wrapper for the console object. The wrapper allows all undefined methods (for example, ``console.foo``) to be handled as no-ops instead of throwing an error. See ``duk_console.h`` for full flags list. * After these steps, ``console`` will be registered to the global object and is ready to use. ================================================ FILE: ext/duktape/duktape-2.1.0/extras/console/duk_console.c ================================================ /* * Minimal 'console' binding. * * https://github.com/DeveloperToolsWG/console-object/blob/master/api.md * https://developers.google.com/web/tools/chrome-devtools/debug/console/console-reference * https://developer.mozilla.org/en/docs/Web/API/console */ #include #include #include "duktape.h" #include "duk_console.h" /* XXX: Add some form of log level filtering. */ /* XXX: For now logs everything to stdout, V8/Node.js logs debug/info level * to stdout, warn and above to stderr. Should this extra do the same? */ /* XXX: Should all output be written via e.g. console.write(formattedMsg)? * This would make it easier for user code to redirect all console output * to a custom backend. */ /* XXX: For now output is not flushed, add a flush flag, or maybe add flush * to info level and above only. */ /* XXX: Init console object using duk_def_prop() when that call is available. */ static duk_ret_t duk__console_log_helper(duk_context *ctx, const char *error_name) { duk_idx_t i, n; n = duk_get_top(ctx); duk_get_global_string(ctx, "console"); duk_get_prop_string(ctx, -1, "format"); for (i = 0; i < n; i++) { if (duk_check_type_mask(ctx, i, DUK_TYPE_MASK_OBJECT)) { /* Slow path formatting. */ duk_dup(ctx, -1); /* console.format */ duk_dup(ctx, i); duk_call(ctx, 1); duk_replace(ctx, i); /* arg[i] = console.format(arg[i]); */ } } duk_pop_2(ctx); duk_push_string(ctx, " "); duk_insert(ctx, 0); duk_join(ctx, n); if (error_name) { duk_push_error_object(ctx, DUK_ERR_ERROR, "%s", duk_require_string(ctx, -1)); duk_push_string(ctx, "name"); duk_push_string(ctx, error_name); duk_def_prop(ctx, -3, DUK_DEFPROP_FORCE | DUK_DEFPROP_HAVE_VALUE); /* to get e.g. 'Trace: 1 2 3' */ duk_get_prop_string(ctx, -1, "stack"); } printf("%s\n", duk_to_string(ctx, -1)); return 0; } static duk_ret_t duk__console_assert(duk_context *ctx) { if (duk_to_boolean(ctx, 0)) { return 0; } duk_remove(ctx, 0); return duk__console_log_helper(ctx, "AssertionError"); } static duk_ret_t duk__console_log(duk_context *ctx) { return duk__console_log_helper(ctx, NULL); } static duk_ret_t duk__console_trace(duk_context *ctx) { return duk__console_log_helper(ctx, "Trace"); } static duk_ret_t duk__console_info(duk_context *ctx) { return duk__console_log_helper(ctx, NULL); } static duk_ret_t duk__console_warn(duk_context *ctx) { return duk__console_log_helper(ctx, NULL); } static duk_ret_t duk__console_error(duk_context *ctx) { return duk__console_log_helper(ctx, "Error"); } static duk_ret_t duk__console_dir(duk_context *ctx) { /* For now, just share the formatting of .log() */ return duk__console_log_helper(ctx, 0); } static void duk__console_reg_vararg_func(duk_context *ctx, duk_c_function func, const char *name) { duk_push_c_function(ctx, func, DUK_VARARGS); duk_push_string(ctx, "name"); duk_push_string(ctx, name); duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE | DUK_DEFPROP_FORCE); /* Improve stacktraces by displaying function name */ duk_put_prop_string(ctx, -2, name); } void duk_console_init(duk_context *ctx, duk_uint_t flags) { duk_push_object(ctx); /* Custom function to format objects; user can replace. * For now, try JX-formatting and if that fails, fall back * to ToString(v). */ duk_eval_string(ctx, "(function (E) {" "return function format(v){" "try{" "return E('jx',v);" "}catch(e){" "return String(v);" /* String() allows symbols, ToString() internal algorithm doesn't. */ "}" "};" "})(Duktape.enc)"); duk_put_prop_string(ctx, -2, "format"); duk__console_reg_vararg_func(ctx, duk__console_assert, "assert"); duk__console_reg_vararg_func(ctx, duk__console_log, "log"); duk__console_reg_vararg_func(ctx, duk__console_log, "debug"); /* alias to console.log */ duk__console_reg_vararg_func(ctx, duk__console_trace, "trace"); duk__console_reg_vararg_func(ctx, duk__console_info, "info"); duk__console_reg_vararg_func(ctx, duk__console_warn, "warn"); duk__console_reg_vararg_func(ctx, duk__console_error, "error"); duk__console_reg_vararg_func(ctx, duk__console_error, "exception"); /* alias to console.error */ duk__console_reg_vararg_func(ctx, duk__console_dir, "dir"); duk_put_global_string(ctx, "console"); /* Proxy wrapping: ensures any undefined console method calls are * ignored silently. This is required specifically by the * DeveloperToolsWG proposal (and is implemented also by Firefox: * https://bugzilla.mozilla.org/show_bug.cgi?id=629607). */ if (flags & DUK_CONSOLE_PROXY_WRAPPER) { /* Tolerate errors: Proxy may be disabled. */ duk_peval_string_noresult(ctx, "(function(){" "var D=function(){};" "console=new Proxy(console,{" "get:function(t,k){" "var v=t[k];" "return typeof v==='function'?v:D;" "}" "});" "})();" ); } } ================================================ FILE: ext/duktape/duktape-2.1.0/extras/console/duk_console.h ================================================ #if !defined(DUK_CONSOLE_H_INCLUDED) #define DUK_CONSOLE_H_INCLUDED #include "duktape.h" /* Use a proxy wrapper to make undefined methods (console.foo()) no-ops. */ #define DUK_CONSOLE_PROXY_WRAPPER (1 << 0) extern void duk_console_init(duk_context *ctx, duk_uint_t flags); #endif /* DUK_CONSOLE_H_INCLUDED */ ================================================ FILE: ext/duktape/duktape-2.1.0/extras/console/test.c ================================================ #include #include "duktape.h" #include "duk_console.h" int main(int argc, char *argv[]) { duk_context *ctx; int i; int exitcode = 0; ctx = duk_create_heap_default(); if (!ctx) { return 1; } duk_console_init(ctx, DUK_CONSOLE_PROXY_WRAPPER /*flags*/); printf("top after init: %ld\n", (long) duk_get_top(ctx)); for (i = 1; i < argc; i++) { printf("Evaling: %s\n", argv[i]); if (duk_peval_string(ctx, argv[i]) != 0) { exitcode = 1; } printf("--> %s\n", duk_safe_to_string(ctx, -1)); duk_pop(ctx); } printf("Done\n"); duk_destroy_heap(ctx); return exitcode; } ================================================ FILE: ext/duktape/duktape-2.1.0/extras/duk-v1-compat/Makefile ================================================ # For manual testing; say 'make' in extras/duk-v1-compat and run ./test. .PHONY: test test: gcc -std=c99 -Wall -Wextra -o $@ -I../../src/ -I. ../../src/duktape.c duk_v1_compat.c test.c -lm ./test ================================================ FILE: ext/duktape/duktape-2.1.0/extras/duk-v1-compat/README.rst ================================================ ================================ Duktape V1 compatibility helpers ================================ Provides helpers for migrating from Duktape 1.x to 2.x: * Add ``duk_v1_compat.c`` to list of C sources to compile. * Ensure ``duk_v1_compat.h`` is in the include path. * Include the extra header in calling code:: #include "duktape.h" #include "duk_v1_compat.h" /* ... */ duk_dump_context_stdout(ctx); /* Removed in Duktape 2.x. */ The helpers don't restore full 1.x compatibility because some API calls such as ``duk_safe_call()`` have changed in an incompatible manner. The old APIs are documented in: * http://duktape.org/1.5.0/api.html ================================================ FILE: ext/duktape/duktape-2.1.0/extras/duk-v1-compat/duk_v1_compat.c ================================================ #include #include "duktape.h" #include "duk_v1_compat.h" /* * duk_dump_context_{stdout,stderr}() */ void duk_dump_context_stdout(duk_context *ctx) { duk_push_context_dump(ctx); fprintf(stdout, "%s\n", duk_safe_to_string(ctx, -1)); duk_pop(ctx); } void duk_dump_context_stderr(duk_context *ctx) { duk_push_context_dump(ctx); fprintf(stderr, "%s\n", duk_safe_to_string(ctx, -1)); duk_pop(ctx); } /* * duk_push_string_file() and duk_push_string_file_raw() */ const char *duk_push_string_file_raw(duk_context *ctx, const char *path, duk_uint_t flags) { FILE *f = NULL; char *buf; long sz; /* ANSI C typing */ if (!path) { goto fail; } f = fopen(path, "rb"); if (!f) { goto fail; } if (fseek(f, 0, SEEK_END) < 0) { goto fail; } sz = ftell(f); if (sz < 0) { goto fail; } if (fseek(f, 0, SEEK_SET) < 0) { goto fail; } buf = (char *) duk_push_fixed_buffer(ctx, (duk_size_t) sz); if ((size_t) fread(buf, 1, (size_t) sz, f) != (size_t) sz) { duk_pop(ctx); goto fail; } (void) fclose(f); /* ignore fclose() error */ return duk_buffer_to_string(ctx, -1); fail: if (f) { (void) fclose(f); /* ignore fclose() error */ } if (flags & DUK_STRING_PUSH_SAFE) { duk_push_undefined(ctx); } else { duk_error(ctx, DUK_ERR_TYPE_ERROR, "read file error"); } return NULL; } /* * duk_eval_file(), duk_compile_file(), and their variants */ void duk_eval_file(duk_context *ctx, const char *path) { duk_push_string_file_raw(ctx, path, 0); duk_push_string(ctx, path); duk_compile(ctx, DUK_COMPILE_EVAL); duk_push_global_object(ctx); /* 'this' binding */ duk_call_method(ctx, 0); } void duk_eval_file_noresult(duk_context *ctx, const char *path) { duk_eval_file(ctx, path); duk_pop(ctx); } duk_int_t duk_peval_file(duk_context *ctx, const char *path) { duk_int_t rc; duk_push_string_file_raw(ctx, path, DUK_STRING_PUSH_SAFE); duk_push_string(ctx, path); rc = duk_pcompile(ctx, DUK_COMPILE_EVAL); if (rc != 0) { return rc; } duk_push_global_object(ctx); /* 'this' binding */ rc = duk_pcall_method(ctx, 0); return rc; } duk_int_t duk_peval_file_noresult(duk_context *ctx, const char *path) { duk_int_t rc; rc = duk_peval_file(ctx, path); duk_pop(ctx); return rc; } void duk_compile_file(duk_context *ctx, duk_uint_t flags, const char *path) { duk_push_string_file_raw(ctx, path, 0); duk_push_string(ctx, path); duk_compile(ctx, flags); } duk_int_t duk_pcompile_file(duk_context *ctx, duk_uint_t flags, const char *path) { duk_int_t rc; duk_push_string_file_raw(ctx, path, DUK_STRING_PUSH_SAFE); duk_push_string(ctx, path); rc = duk_pcompile(ctx, flags); return rc; } /* * duk_to_defaultvalue() */ void duk_to_defaultvalue(duk_context *ctx, duk_idx_t idx, duk_int_t hint) { duk_require_type_mask(ctx, idx, DUK_TYPE_MASK_OBJECT | DUK_TYPE_MASK_BUFFER | DUK_TYPE_MASK_LIGHTFUNC); duk_to_primitive(ctx, idx, hint); } ================================================ FILE: ext/duktape/duktape-2.1.0/extras/duk-v1-compat/duk_v1_compat.h ================================================ #if !defined(DUK_V1_COMPAT_INCLUDED) #define DUK_V1_COMPAT_INCLUDED #include "duktape.h" /* Straight flag rename */ #if !defined(DUK_ENUM_INCLUDE_INTERNAL) #define DUK_ENUM_INCLUDE_INTERNAL DUK_ENUM_INCLUDE_HIDDEN #endif /* Flags for duk_push_string_file_raw() */ #define DUK_STRING_PUSH_SAFE (1 << 0) /* no error if file does not exist */ extern void duk_dump_context_stdout(duk_context *ctx); extern void duk_dump_context_stderr(duk_context *ctx); extern const char *duk_push_string_file_raw(duk_context *ctx, const char *path, duk_uint_t flags); extern void duk_eval_file(duk_context *ctx, const char *path); extern void duk_eval_file_noresult(duk_context *ctx, const char *path); extern duk_int_t duk_peval_file(duk_context *ctx, const char *path); extern duk_int_t duk_peval_file_noresult(duk_context *ctx, const char *path); extern void duk_compile_file(duk_context *ctx, duk_uint_t flags, const char *path); extern duk_int_t duk_pcompile_file(duk_context *ctx, duk_uint_t flags, const char *path); extern void duk_to_defaultvalue(duk_context *ctx, duk_idx_t idx, duk_int_t hint); #define duk_push_string_file(ctx,path) \ duk_push_string_file_raw((ctx), (path), 0) #endif /* DUK_V1_COMPAT_INCLUDED */ ================================================ FILE: ext/duktape/duktape-2.1.0/extras/duk-v1-compat/test.c ================================================ #include #include "duktape.h" #include "duk_v1_compat.h" static duk_ret_t my_print(duk_context *ctx) { duk_push_string(ctx, " "); duk_insert(ctx, 0); duk_join(ctx, duk_get_top(ctx) - 1); printf("%s\n", duk_to_string(ctx, -1)); fflush(stdout); return 0; } int main(int argc, char *argv[]) { duk_context *ctx; int i; duk_int_t rc; ctx = duk_create_heap_default(); if (!ctx) { return 1; } /* Minimal print() provider. */ duk_push_c_function(ctx, my_print, DUK_VARARGS); duk_put_global_string(ctx, "print"); printf("top after init: %ld\n", (long) duk_get_top(ctx)); for (i = 1; i < argc; i++) { printf("Evaling: %s\n", argv[i]); (void) duk_peval_string(ctx, argv[i]); printf("--> %s\n", duk_safe_to_string(ctx, -1)); duk_pop(ctx); } /* Test duk_dump_context_{stdout,stderr}() */ duk_push_string(ctx, "dump to stdout"); duk_dump_context_stdout(ctx); duk_pop(ctx); duk_push_string(ctx, "dump to stderr"); duk_dump_context_stderr(ctx); duk_pop(ctx); /* Test duk_eval_file() and related. */ printf("top before duk_eval_file(): %ld\n", (long) duk_get_top(ctx)); duk_eval_file(ctx, "test_eval1.js"); printf("top after duk_eval_file(): %ld\n", (long) duk_get_top(ctx)); printf(" --> %s\n", duk_safe_to_string(ctx, -1)); duk_pop(ctx); printf("top before duk_eval_file_noresult(): %ld\n", (long) duk_get_top(ctx)); duk_eval_file_noresult(ctx, "test_eval1.js"); printf("top after duk_eval_file_noresult(): %ld\n", (long) duk_get_top(ctx)); printf("top before duk_peval_file(): %ld\n", (long) duk_get_top(ctx)); rc = duk_peval_file(ctx, "test_eval1.js"); printf("top after duk_peval_file(): %ld\n", (long) duk_get_top(ctx)); printf(" --> %ld, %s\n", (long) rc, duk_safe_to_string(ctx, -1)); duk_pop(ctx); printf("top before duk_peval_file(): %ld\n", (long) duk_get_top(ctx)); rc = duk_peval_file(ctx, "test_eval2.js"); printf("top after duk_peval_file(): %ld\n", (long) duk_get_top(ctx)); printf(" --> %ld, %s\n", (long) rc, duk_safe_to_string(ctx, -1)); duk_pop(ctx); printf("top before duk_peval_file_noresult(): %ld\n", (long) duk_get_top(ctx)); rc = duk_peval_file_noresult(ctx, "test_eval1.js"); printf("top after duk_peval_file_noresult(): %ld\n", (long) duk_get_top(ctx)); printf(" --> %ld\n", (long) rc); printf("top before duk_peval_file_noresult(): %ld\n", (long) duk_get_top(ctx)); rc = duk_peval_file_noresult(ctx, "test_eval2.js"); printf("top after duk_peval_file_noresult(): %ld\n", (long) duk_get_top(ctx)); printf(" --> %ld\n", (long) rc); /* Test duk_compile_file() and related. */ printf("top before duk_compile_file(): %ld\n", (long) duk_get_top(ctx)); duk_compile_file(ctx, 0, "test_compile1.js"); printf("top after duk_compile_file(): %ld\n", (long) duk_get_top(ctx)); duk_call(ctx, 0); duk_pop(ctx); printf("top before duk_pcompile_file(): %ld\n", (long) duk_get_top(ctx)); rc = duk_pcompile_file(ctx, 0, "test_compile1.js"); printf("top after duk_pcompile_file(): %ld\n", (long) duk_get_top(ctx)); printf(" --> %ld: %s\n", (long) rc, duk_safe_to_string(ctx, -1)); duk_pop(ctx); printf("top before duk_pcompile_file(): %ld\n", (long) duk_get_top(ctx)); rc = duk_pcompile_file(ctx, 0, "test_compile2.js"); printf("top after duk_pcompile_file(): %ld\n", (long) duk_get_top(ctx)); printf(" --> %ld: %s\n", (long) rc, duk_safe_to_string(ctx, -1)); duk_pop(ctx); printf("Done\n"); duk_destroy_heap(ctx); return 0; } ================================================ FILE: ext/duktape/duktape-2.1.0/extras/duk-v1-compat/test_compile1.js ================================================ // File to compile, no error print('Hello from test_compile1.js'); print(new Error('test error for traceback (shows filename)').stack); ================================================ FILE: ext/duktape/duktape-2.1.0/extras/duk-v1-compat/test_compile2.js ================================================ // File to compile, syntax error print('Hello from test_compile2.js'); = y +; ================================================ FILE: ext/duktape/duktape-2.1.0/extras/duk-v1-compat/test_eval1.js ================================================ // File to eval, no error print('Hello from test_eval1.js'); print(new Error('test error for traceback (shows filename)').stack); 123; ================================================ FILE: ext/duktape/duktape-2.1.0/extras/duk-v1-compat/test_eval2.js ================================================ // File to eval, throws error print('Hello from test_eval2.js'); print(new Error('test error for traceback (shows filename)').stack); throw new Error('aiee'); ================================================ FILE: ext/duktape/duktape-2.1.0/extras/logging/Makefile ================================================ # For manual testing; say 'make' in extras/logging and run ./test. .PHONY: test test: gcc -std=c99 -Wall -Wextra -otest -I../../src ../../src/duktape.c duk_logging.c test.c -lm ./test 'L = new Duktape.Logger(); L.trace("testing"); L.l = 0; L.trace("testing 2");' ./test 'L = new Duktape.Logger(); L.debug("testing"); L.l = 1; L.debug("testing 2");' ./test 'L = new Duktape.Logger(); L.info("testing");' ./test 'L = new Duktape.Logger(); L.warn("testing");' ./test 'L = new Duktape.Logger(); L.error("testing");' ./test 'L = new Duktape.Logger(); L.fatal("testing");' ./test 'L = new Duktape.Logger(); L.info("testing"); L.n = "loggerName"; L.info("new name");' ./test 'L = new Duktape.Logger("argname"); L.info("testing");' ================================================ FILE: ext/duktape/duktape-2.1.0/extras/logging/README.rst ================================================ ======================================== Duktape 1.x compatible logging framework ======================================== The default ``Duktape.Logger`` object and the logging related C API calls (``duk_log()``, ``duk_log_va()``) were removed in Duktape 2.x because they depended on stdout/stderr and were thus a portability issue for some targets (there were also other issues, such as the logging framework not always matching user expectations). This directory contains Duktape 1.x compatible ``Duktape.Logger`` object and logging API calls: * Add ``duk_logging.c`` to list of C sources to compile. * Ensure ``duk_logging.h`` is in the include path. * Include the extra header in calling code and initialize the bindings:: #include "duktape.h" #include "duk_logging.h" /* After initializing the Duktape heap or when creating a new * thread with a new global environment: */ duk_logging_init(ctx, 0 /*flags*/); See ``duk_logging.h`` for available flags. * After these steps, ``Duktape.Logger`` will be registered to the ``Duktape`` object and is ready to use. See https://github.com/svaarala/duktape/blob/master/doc/logging.rst and http://wiki.duktape.org/HowtoLogging.html for more information on the logging framework design and functionality. ================================================ FILE: ext/duktape/duktape-2.1.0/extras/logging/duk_logging.c ================================================ /* * Logging support */ #include #include #include #include "duktape.h" #include "duk_logging.h" /* XXX: uses stderr always for now, configurable? */ #define DUK_LOGGING_FLUSH /* Duktape 1.x: flush stderr */ /* 3-letter log level strings. */ static const char duk__log_level_strings[] = { 'T', 'R', 'C', 'D', 'B', 'G', 'I', 'N', 'F', 'W', 'R', 'N', 'E', 'R', 'R', 'F', 'T', 'L' }; /* Log method names. */ static const char *duk__log_method_names[] = { "trace", "debug", "info", "warn", "error", "fatal" }; /* Constructor. */ static duk_ret_t duk__logger_constructor(duk_context *ctx) { duk_idx_t nargs; /* Calling as a non-constructor is not meaningful. */ if (!duk_is_constructor_call(ctx)) { return DUK_RET_TYPE_ERROR; } nargs = duk_get_top(ctx); duk_set_top(ctx, 1); duk_push_this(ctx); /* [ name this ] */ if (nargs == 0) { /* Automatic defaulting of logger name from caller. This * would work poorly with tail calls, but constructor calls * are currently never tail calls, so tail calls are not an * issue now. */ duk_inspect_callstack_entry(ctx, -2); if (duk_is_object(ctx, -1)) { if (duk_get_prop_string(ctx, -1, "function")) { if (duk_get_prop_string(ctx, -1, "fileName")) { if (duk_is_string(ctx, -1)) { duk_replace(ctx, 0); } } } } /* Leave values on stack on purpose, ignored below. */ /* Stripping the filename might be a good idea * ("/foo/bar/quux.js" -> logger name "quux"), * but now used verbatim. */ } /* The stack is unbalanced here on purpose; we only rely on the * initial two values: [ name this ]. */ if (duk_is_string(ctx, 0)) { duk_dup(ctx, 0); duk_put_prop_string(ctx, 1, "n"); } else { /* don't set 'n' at all, inherited value is used as name */ } duk_compact(ctx, 1); return 0; /* keep default instance */ } /* Default function to format objects. Tries to use toLogString() but falls * back to toString(). Any errors are propagated out without catching. */ static duk_ret_t duk__logger_prototype_fmt(duk_context *ctx) { if (duk_get_prop_string(ctx, 0, "toLogString")) { /* [ arg toLogString ] */ duk_dup(ctx, 0); duk_call_method(ctx, 0); /* [ arg result ] */ return 1; } /* [ arg undefined ] */ duk_pop(ctx); duk_to_string(ctx, 0); return 1; } /* Default function to write a formatted log line. Writes to stderr, * appending a newline to the log line. * * The argument is a buffer; avoid coercing the buffer to a string to * avoid string table traffic. */ static duk_ret_t duk__logger_prototype_raw(duk_context *ctx) { const char *data; duk_size_t data_len; data = (const char *) duk_require_buffer(ctx, 0, &data_len); fwrite((const void *) data, 1, data_len, stderr); fputc((int) '\n', stderr); #if defined(DUK_LOGGING_FLUSH) fflush(stderr); #endif return 0; } /* Log frontend shared helper, magic value indicates log level. Provides * frontend functions: trace(), debug(), info(), warn(), error(), fatal(). * This needs to have small footprint, reasonable performance, minimal * memory churn, etc. */ static duk_ret_t duk__logger_prototype_log_shared(duk_context *ctx) { duk_double_t now; duk_time_components comp; duk_small_int_t entry_lev; duk_small_int_t logger_lev; duk_int_t nargs; duk_int_t i; duk_size_t tot_len; const duk_uint8_t *arg_str; duk_size_t arg_len; duk_uint8_t *buf, *p; const duk_uint8_t *q; duk_uint8_t date_buf[32]; /* maximum format length is 24+1 (NUL), round up. */ duk_size_t date_len; duk_small_int_t rc; /* XXX: sanitize to printable (and maybe ASCII) */ /* XXX: better multiline */ /* * Logger arguments are: * * magic: log level (0-5) * this: logger * stack: plain log args * * We want to minimize memory churn so a two-pass approach * is used: first pass formats arguments and computes final * string length, second pass copies strings into a buffer * allocated directly with the correct size. If the backend * function plays nice, it won't coerce the buffer to a string * (and thus intern it). */ entry_lev = duk_get_current_magic(ctx); if (entry_lev < DUK_LOG_TRACE || entry_lev > DUK_LOG_FATAL) { /* Should never happen, check just in case. */ return 0; } nargs = duk_get_top(ctx); /* [ arg1 ... argN this ] */ /* * Log level check */ duk_push_this(ctx); duk_get_prop_string(ctx, -1, "l"); logger_lev = (duk_small_int_t) duk_get_int(ctx, -1); if (entry_lev < logger_lev) { return 0; } /* log level could be popped but that's not necessary */ now = duk_get_now(ctx); duk_time_to_components(ctx, now, &comp); sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", (int) comp.year, (int) comp.month + 1, (int) comp.day, (int) comp.hours, (int) comp.minutes, (int) comp.seconds, (int) comp.milliseconds); date_len = strlen((const char *) date_buf); duk_get_prop_string(ctx, -2, "n"); duk_to_string(ctx, -1); /* [ arg1 ... argN this loggerLevel loggerName ] */ /* * Pass 1 */ /* Line format: