diff --git a/cpp/meson.options b/cpp/meson.options index 668f440ee72a..bdd95d63006a 100644 --- a/cpp/meson.options +++ b/cpp/meson.options @@ -90,6 +90,12 @@ option( description: 'Arbitrary string that identifies the kind of package (for informational purposes)', ) option('parquet', type: 'feature', description: 'Build the Parquet libraries') +option( + 'parquet_build_dbps_libs', + type: 'feature', + value: 'enabled', + description: 'Build DBPS external libraries', +) option( 'parquet_build_executables', type: 'feature', diff --git a/cpp/src/parquet/meson.build b/cpp/src/parquet/meson.build index e6ff43a0baee..cac7a26b0806 100644 --- a/cpp/src/parquet/meson.build +++ b/cpp/src/parquet/meson.build @@ -99,8 +99,15 @@ if openssl_dep.found() parquet_deps += openssl_dep parquet_srcs += files( + 'encryption/aes_encryption.cc', 'encryption/crypto_factory.cc', - 'encryption/encryption_internal.cc', + 'encryption/encoding_properties.cc', + 'encryption/encryption_utils.cc', + 'encryption/external/dbpa_enum_utils.cc', + 'encryption/external/dbpa_executor.cc', + 'encryption/external/dbpa_library_wrapper.cc', + 'encryption/external/loadable_encryptor_utils.cc', + 'encryption/external_dbpa_encryption.cc', 'encryption/file_key_unwrapper.cc', 'encryption/file_key_wrapper.cc', 'encryption/file_system_key_material_store.cc', @@ -113,7 +120,65 @@ if openssl_dep.found() 'encryption/openssl_internal.cc', ) else - parquet_srcs += files('encryption/encryption_internal_nossl.cc') + parquet_srcs += files('encryption/aes_encryption_nossl.cc') +endif + +if needs_parquet_encryption or get_option('parquet_require_encryption').auto() + tcb_span_dep = dependency('tcb_span', fallback: ['tcb-span', 'tcb_span_dep']) + magic_enum_dep = dependency( + 'magic_enum_header_only', + fallback: ['magic-enum', 'magic_enum_dep'], + ) + + cmake = import('cmake') + dbps_opts = cmake.subproject_options() + + build_type = get_option('buildtype') + if build_type == 'plain' + build_type = 'Release' + elif build_type == 'debug' + build_type = 'Debug' + endif + + build_output_dir = meson.current_build_dir() + + dbps_opts.add_cmake_defines( + { + 'CMAKE_BUILD_TYPE': build_type, + 'BUILD_SHARED_LIBS': 'ON', + 'BUILD_TESTS': 'OFF', + 'BUILD_BENCHMARKS': 'OFF', + 'GTEST_BUILD_TESTS': 'OFF', + 'GTEST_BUILD_SAMPLES': 'OFF', + 'BENCHMARK_ENABLE_TESTING': 'OFF', + 'BENCHMARK_ENABLE_INSTALL': 'OFF', + # 'CMAKE_LIBRARY_OUTPUT_DIRECTORY': build_output_dir, + #'CMAKE_RUNTIME_OUTPUT_DIRECTORY': build_output_dir, + #'CMAKE_ARCHIVE_OUTPUT_DIRECTORY': build_output_dir, + #'CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG': build_output_dir, + #'CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE': build_output_dir, + #'CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG': build_output_dir, + #'CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE': build_output_dir, + #'CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG': build_output_dir, + #'CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE': build_output_dir, + #'CMAKE_BUILD_WITH_INSTALL_RPATH': 'ON', + #'CMAKE_INSTALL_RPATH': build_output_dir, + #'CMAKE_INSTALL_RPATH_USE_LINK_PATH': 'ON', + #'CMAKE_BUILD_RPATH_USE_ORIGIN': 'ON', + 'CMAKE_BUILD_WITH_INSTALL_RPATH': 'ON', + 'CMAKE_INSTALL_RPATH_USE_LINK_PATH': 'ON', + 'CMAKE_BUILD_RPATH_USE_ORIGIN': 'ON', + }, + ) + + dbps_proj = cmake.subproject('dbps_agent', options: dbps_opts) + dbps_interface_dep = declare_dependency( + include_directories: include_directories( + '../../subprojects/DataBatchProtectionService-6206fb0e27556a0df9160364caa3819e4af3fe0f/src/common', + ), + ) + + parquet_deps += [dbps_interface_dep, tcb_span_dep, magic_enum_dep] endif parquet_lib = library( @@ -123,7 +188,10 @@ parquet_lib = library( gnu_symbol_visibility: 'inlineshidden', ) -parquet_dep = declare_dependency(link_with: parquet_lib) +parquet_dep = declare_dependency( + link_with: parquet_lib, + dependencies: parquet_deps, +) subdir('api') subdir('arrow') @@ -216,6 +284,7 @@ parquet_tests = { 'writer-test': { 'sources': files( 'column_writer_test.cc', + 'encryption/external/test_utils.cc', 'file_serialize_test.cc', 'stream_writer_test.cc', ), @@ -248,7 +317,12 @@ if needs_parquet_encryption parquet_tests += { 'encryption-test': { 'sources': files( - 'encryption/encryption_internal_test.cc', + 'encryption/aes_encryption_test.cc', + 'encryption/crypto_factory_test.cc', + 'encryption/encoding_properties_test.cc', + 'encryption/external/test_utils.cc', + 'encryption/external_dbpa_encryption_test.cc', + 'encryption/per_column_encryption_test.cc', 'encryption/properties_test.cc', 'encryption/read_configurations_test.cc', 'encryption/test_encryption_util.cc', diff --git a/cpp/subprojects/dbps_agent.wrap b/cpp/subprojects/dbps_agent.wrap new file mode 100644 index 000000000000..a9cf66008de1 --- /dev/null +++ b/cpp/subprojects/dbps_agent.wrap @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +[wrap-file] +directory = DataBatchProtectionService-6206fb0e27556a0df9160364caa3819e4af3fe0f +source_url = https://github.com/protegrity/DataBatchProtectionService/archive/6206fb0e27556a0df9160364caa3819e4af3fe0f.tar.gz +source_filename = dbps_agent-6206fb0e27556a0df9160364caa3819e4af3fe0f.tar.gz +source_hash = 9c95a1fec0c9851867a776c3241d3feb59b07bd7a50e653d6214e07a8ad62419 +patch_directory = dbps_agent diff --git a/cpp/subprojects/magic-enum.wrap b/cpp/subprojects/magic-enum.wrap new file mode 100644 index 000000000000..5e4b7c7da105 --- /dev/null +++ b/cpp/subprojects/magic-enum.wrap @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +[wrap-file] +directory = magic_enum-0.9.7 +source_url = https://github.com/Neargye/magic_enum/archive/refs/tags/v0.9.7.tar.gz +source_filename = magic_enum-0.9.7.tar.gz +source_hash = b403d3dad4ef542fdc3024fa37d3a6cedb4ad33c72e31b6d9bab89dcaf69edf7 +patch_directory = magic-enum + +[provide] +magic_enum_header_only = magic_enum_dep diff --git a/cpp/subprojects/packagefiles/dbps_agent/CMakeLists.txt.patch b/cpp/subprojects/packagefiles/dbps_agent/CMakeLists.txt.patch new file mode 100644 index 000000000000..a06c90233b39 --- /dev/null +++ b/cpp/subprojects/packagefiles/dbps_agent/CMakeLists.txt.patch @@ -0,0 +1,45 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,8 +10,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # Build options + option(BUILD_TESTS "Build test executables" ON) + option(BUILD_SHARED_LIBS "Build shared libraries" ON) + + # Enable CTest and GoogleTest integration +-enable_testing() +-include(CTest) ++if(BUILD_TESTS) ++ enable_testing() ++ include(CTest) ++endif() + + # ============================================================================= + # Dependencies +@@ -520,15 +520,19 @@ endif() + + # All target (everything) + add_custom_target(all_targets + DEPENDS + libraries + executables + COMMENT "Building all targets" + ) + + # Add tests to all_targets if enabled + if(BUILD_TESTS) +- add_dependencies(all_targets tests) ++ # Only add test dependencies when tests target actually exists ++ # This prevents Meson from detecting cycles when BUILD_TESTS is OFF ++ if(TARGET tests) ++ add_dependencies(all_targets tests) ++ endif() + endif() + + # Add client shared library to all_targets if enabled + if(BUILD_SHARED_LIBS) +- add_dependencies(all_targets shared_libraries) ++ # Only add shared library dependencies when shared_libraries target exists ++ if(TARGET shared_libraries) ++ add_dependencies(all_targets shared_libraries) ++ endif() + endif() \ No newline at end of file diff --git a/cpp/subprojects/packagefiles/dbps_agent/meson.build b/cpp/subprojects/packagefiles/dbps_agent/meson.build new file mode 100644 index 000000000000..527f11cac62e --- /dev/null +++ b/cpp/subprojects/packagefiles/dbps_agent/meson.build @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +project('dbps_agent', 'cpp') + +dbps_interface_dep = declare_dependency( + include_directories: include_directories('src/common'), +) + +meson.override_dependency('dbps_interface', dbps_interface_dep) diff --git a/cpp/subprojects/packagefiles/magic-enum/meson.build b/cpp/subprojects/packagefiles/magic-enum/meson.build new file mode 100644 index 000000000000..fd877d94704f --- /dev/null +++ b/cpp/subprojects/packagefiles/magic-enum/meson.build @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +project('magic-enum', 'cpp') + +magic_enum_dep = declare_dependency( + include_directories: include_directories('include'), +) + +meson.override_dependency('magic_enum_header_only', magic_enum_dep) diff --git a/cpp/subprojects/packagefiles/tcb-span/meson.build b/cpp/subprojects/packagefiles/tcb-span/meson.build new file mode 100644 index 000000000000..99966eba78e8 --- /dev/null +++ b/cpp/subprojects/packagefiles/tcb-span/meson.build @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +project('tcb-span', 'cpp') + +tcb_span_dep = declare_dependency( + include_directories: include_directories('include'), +) + +meson.override_dependency('tcb_span', tcb_span_dep) diff --git a/cpp/subprojects/tcb-span.wrap b/cpp/subprojects/tcb-span.wrap new file mode 100644 index 000000000000..fbe7e9a0e523 --- /dev/null +++ b/cpp/subprojects/tcb-span.wrap @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +[wrap-file] +directory = span-master +source_url = https://github.com/tcbrindle/span/archive/refs/heads/master.tar.gz +source_filename = span-master.tar.gz +source_hash = e57658bd9c5984cebd8bd0758f242cbf4fa7ed1bd5251a883f68420c3b17f818 +patch_directory = tcb-span + +[provide] +tcb_span = tcb_span_dep