From cbca15b703c72fb4d6fc19a1ad7b2b6b89d6df1c Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Sun, 20 Mar 2022 13:19:13 -0400 Subject: [PATCH] Fix build with new generator Lots of contrib packages did not build. Fixes #153 Fixes #152 --- contrib/c-blosc/CMakeLists.txt | 1 + contrib/jsonnet/CMakeLists.txt | 2 +- contrib/jsonnet/examples/jsonnet_base_example.cc | 2 +- contrib/jsonnet/examples/jsonnet_formatter_example.cc | 2 +- .../jsonnet/examples/jsonnet_multiple_files_example.cc | 2 +- contrib/jsonnet/examples/jsonnet_yaml_stream_example.cc | 2 +- contrib/libzip/CMakeLists.txt | 3 +-- contrib/libzip/sandboxed.h | 5 ----- contrib/pffft/main_pffft_sandboxed.cc | 3 --- contrib/turbojpeg/CMakeLists.txt | 8 ++++++++ contrib/zopfli/CMakeLists.txt | 3 --- contrib/zstd/CMakeLists.txt | 1 - 12 files changed, 15 insertions(+), 19 deletions(-) diff --git a/contrib/c-blosc/CMakeLists.txt b/contrib/c-blosc/CMakeLists.txt index eeef8ab75..9e1939344 100644 --- a/contrib/c-blosc/CMakeLists.txt +++ b/contrib/c-blosc/CMakeLists.txt @@ -29,6 +29,7 @@ if(NOT TARGET sapi::sapi) endif() set(HIDE_SYMBOLS OFF CACHE BOOL "" FORCE) +set(PREFER_EXTERNAL_ZLIB ON CACHE BOOL "" FORCE) # prevent undefined symbol errors FetchContent_Declare( libblosc diff --git a/contrib/jsonnet/CMakeLists.txt b/contrib/jsonnet/CMakeLists.txt index e922d2aa8..687a4e586 100644 --- a/contrib/jsonnet/CMakeLists.txt +++ b/contrib/jsonnet/CMakeLists.txt @@ -29,7 +29,7 @@ FetchContent_Declare(jsonnet GIT_REPOSITORY https://github.com/google/jsonnet.git GIT_TAG v0.18.0 # 2021-12-21 ) -option(BUILD_TESTS "" OFF) # Do not build jsonnet tests +set(BUILD_TESTS OFF CACHE BOOL "" FORCE) # Do not build jsonnet tests FetchContent_MakeAvailable(jsonnet) create_directory_symlink("${jsonnet_SOURCE_DIR}" "${PROJECT_BINARY_DIR}/jsonnet") diff --git a/contrib/jsonnet/examples/jsonnet_base_example.cc b/contrib/jsonnet/examples/jsonnet_base_example.cc index 708757dce..ceeade245 100644 --- a/contrib/jsonnet/examples/jsonnet_base_example.cc +++ b/contrib/jsonnet/examples/jsonnet_base_example.cc @@ -25,7 +25,7 @@ absl::Status JsonnetMain(std::string in_file, std::string out_file) { // Initialize sandbox. JsonnetBaseSandbox sandbox(in_file, out_file); - SAPI_RETURN_IF_ERROR(sandbox.Init()) + SAPI_RETURN_IF_ERROR(sandbox.Init()); JsonnetApi api(&sandbox); diff --git a/contrib/jsonnet/examples/jsonnet_formatter_example.cc b/contrib/jsonnet/examples/jsonnet_formatter_example.cc index f74156fc6..e5b831c6b 100644 --- a/contrib/jsonnet/examples/jsonnet_formatter_example.cc +++ b/contrib/jsonnet/examples/jsonnet_formatter_example.cc @@ -58,7 +58,7 @@ absl::Status JsonnetMain(std::string in_file, std::string out_file) { // Initialize sandbox. JsonnetSapiSandbox sandbox(in_file, out_file); - SAPI_RETURN_IF_ERROR(sandbox.Init()) + SAPI_RETURN_IF_ERROR(sandbox.Init()); JsonnetApi api(&sandbox); diff --git a/contrib/jsonnet/examples/jsonnet_multiple_files_example.cc b/contrib/jsonnet/examples/jsonnet_multiple_files_example.cc index ebc52a373..d6a7780a6 100644 --- a/contrib/jsonnet/examples/jsonnet_multiple_files_example.cc +++ b/contrib/jsonnet/examples/jsonnet_multiple_files_example.cc @@ -60,7 +60,7 @@ absl::Status JsonnetMain(std::string in_file, std::string out_file) { // Initialize sandbox. JsonnetSapiSandbox sandbox(in_file, out_file); - SAPI_RETURN_IF_ERROR(sandbox.Init()) + SAPI_RETURN_IF_ERROR(sandbox.Init()); JsonnetApi api(&sandbox); diff --git a/contrib/jsonnet/examples/jsonnet_yaml_stream_example.cc b/contrib/jsonnet/examples/jsonnet_yaml_stream_example.cc index 958490aab..fb25a6bc1 100644 --- a/contrib/jsonnet/examples/jsonnet_yaml_stream_example.cc +++ b/contrib/jsonnet/examples/jsonnet_yaml_stream_example.cc @@ -25,7 +25,7 @@ absl::Status JsonnetMain(std::string in_file, std::string out_file) { // Initialize sandbox. JsonnetBaseSandbox sandbox(in_file, out_file); - SAPI_RETURN_IF_ERROR(sandbox.Init()) + SAPI_RETURN_IF_ERROR(sandbox.Init()); JsonnetApi api(&sandbox); diff --git a/contrib/libzip/CMakeLists.txt b/contrib/libzip/CMakeLists.txt index 9de29e080..365d189d5 100644 --- a/contrib/libzip/CMakeLists.txt +++ b/contrib/libzip/CMakeLists.txt @@ -27,6 +27,7 @@ if(NOT TARGET sapi::sapi) endif() set(BUILD_SHARED_LIBS off) +set(LIBZIP_DO_INSTALL off) FetchContent_Declare(libzip GIT_REPOSITORY https://github.com/nih-at/libzip/ GIT_TAG 34b13ca4e887a5aba050015e3a179069643f4e76 @@ -72,8 +73,6 @@ add_sapi_library( zip_strerror INPUTS - "${libzip_BINARY_DIR}/zipconf.h" - "${libzip_SOURCE_DIR}/lib/zip.h" "wrapper/wrapper_zip.h" LIBRARY wrapper_zip diff --git a/contrib/libzip/sandboxed.h b/contrib/libzip/sandboxed.h index 795c8b66d..324366233 100644 --- a/contrib/libzip/sandboxed.h +++ b/contrib/libzip/sandboxed.h @@ -20,11 +20,6 @@ #include -// Note: This header is required because of the bug in generator. The generator -// for some reason doesn't catch the types defined by zip (for example -// zip_uint32_t). -#include // NOLINT(build/include_order) - #include "sapi_zip.sapi.h" // NOLINT(build/include) class ZipSapiSandbox : public ZipSandbox { diff --git a/contrib/pffft/main_pffft_sandboxed.cc b/contrib/pffft/main_pffft_sandboxed.cc index a607d8659..71f41099d 100644 --- a/contrib/pffft/main_pffft_sandboxed.cc +++ b/contrib/pffft/main_pffft_sandboxed.cc @@ -26,9 +26,6 @@ #include "absl/flags/flag.h" #include "sandboxed_api/vars.h" -ABSL_DECLARE_FLAG(string, sandbox2_danger_danger_permit_all); -ABSL_DECLARE_FLAG(string, sandbox2_danger_danger_permit_all_and_log); - class PffftSapiSandbox : public PffftSandbox { public: std::unique_ptr ModifyPolicy(sandbox2::PolicyBuilder*) { diff --git a/contrib/turbojpeg/CMakeLists.txt b/contrib/turbojpeg/CMakeLists.txt index 3df69ea7d..99baf24f2 100644 --- a/contrib/turbojpeg/CMakeLists.txt +++ b/contrib/turbojpeg/CMakeLists.txt @@ -33,6 +33,14 @@ add_sapi_library(turbojpeg_sapi LIBRARY turbojpeg LIBRARY_NAME TurboJPEG NAMESPACE "turbojpeg_sapi" + FUNCTIONS + tjDestroy + tjGetErrorStr2 + tjCompress2 + tjInitCompress + tjInitDecompress + tjDecompressHeader3 + tjDecompress2 ) add_library(sapi_contrib::turbojpeg ALIAS turbojpeg_sapi) target_include_directories(turbojpeg_sapi INTERFACE diff --git a/contrib/zopfli/CMakeLists.txt b/contrib/zopfli/CMakeLists.txt index d9b187f13..095a75332 100644 --- a/contrib/zopfli/CMakeLists.txt +++ b/contrib/zopfli/CMakeLists.txt @@ -48,9 +48,6 @@ add_sapi_library( ZopfliCompressFD INPUTS - "${zopfli_SOURCE_DIR}/src/zopfli/deflate.h" - "${zopfli_SOURCE_DIR}/src/zopfli/gzip_container.h" - "${zopfli_SOURCE_DIR}/src/zopfli/zlib_container.h" wrapper/wrapper_zopfli.h LIBRARY wrapper_zopfli diff --git a/contrib/zstd/CMakeLists.txt b/contrib/zstd/CMakeLists.txt index 84442403d..5d3f1e80b 100644 --- a/contrib/zstd/CMakeLists.txt +++ b/contrib/zstd/CMakeLists.txt @@ -78,7 +78,6 @@ add_sapi_library( ZSTD_decompress_fd ZSTD_decompressStream_fd INPUTS - "${libzstd_INCLUDE_DIR}/zstd.h" wrapper/wrapper_zstd.h LIBRARY wrapper_zstd