diff --git a/MODULE.bazel b/MODULE.bazel index df156ebb5..10be24d5e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -13,6 +13,9 @@ bazel_dep(name = "rules_python", version = "1.9.0") bazel_dep(name = "rules_shell", version = "0.6.1") bazel_dep(name = "bazel_lib", version = "3.2.0") +cc_compatibility_proxy = use_extension("@rules_cc//cc:extensions.bzl", "compatibility_proxy") +use_repo(cc_compatibility_proxy, "cc_compatibility_proxy") + # Dev dependencies bazel_dep(name = "gazelle", version = "0.41.0", dev_dependency = True, repo_name = "bazel_gazelle") bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.9.0", dev_dependency = True) diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index 6d6dbd586..48b053b1f 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -94,6 +94,7 @@ use_repo( "bison", "cares", "curl", + "examples_libarchive", "examples_zlib", "expat", "flex", @@ -141,6 +142,12 @@ use_repo( bazel_dep(name = "bazel_skylib", version = "1.9.0") bazel_dep(name = "bazel_lib", version = "3.2.0") +bazel_lib_toolchains = use_extension("@bazel_lib//lib:extensions.bzl", "toolchains") +bazel_lib_toolchains.coreutils() +use_repo(bazel_lib_toolchains, "coreutils_toolchains") + +register_toolchains("@coreutils_toolchains//:all") + # Support the integration tests new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository") diff --git a/examples/integration_tests/transitive_matrix/BUILD.bazel b/examples/integration_tests/transitive_matrix/BUILD.bazel new file mode 100644 index 000000000..f0da1eaab --- /dev/null +++ b/examples/integration_tests/transitive_matrix/BUILD.bazel @@ -0,0 +1,73 @@ +exports_files( + [ + "app.c", + "linkage_test.sh", + ], + visibility = ["//visibility:public"], +) + +filegroup( + name = "foreign_app_srcs", + srcs = [ + "CMakeLists.txt", + "app.c", + ], + visibility = ["//visibility:public"], +) + +test_suite( + name = "linkage_tests", + tests = [ + ":cc_binary_linkage_tests", + ":cmake_linkage_tests", + ], +) + +test_suite( + name = "cc_binary_tests", + tests = [ + ":cc_binary_linkage_tests", + ], +) + +test_suite( + name = "cmake_tests", + tests = [ + ":cmake_linkage_tests", + ], +) + +test_suite( + name = "provider_parity_tests", + tests = [ + "//integration_tests/transitive_matrix/provider_parity:tests", + ], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ":provider_parity_tests", + ], +) + +test_suite( + name = "cc_binary_linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cc_direct:linkage_tests", + "//integration_tests/transitive_matrix/cc_dynamic:linkage_tests", + "//integration_tests/transitive_matrix/cc_static:linkage_tests", + "//integration_tests/transitive_matrix/cc_wrap:linkage_tests", + ], +) + +test_suite( + name = "cmake_linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cmake_direct:linkage_tests", + "//integration_tests/transitive_matrix/cmake_dynamic:linkage_tests", + "//integration_tests/transitive_matrix/cmake_static:linkage_tests", + "//integration_tests/transitive_matrix/cmake_wrap:linkage_tests", + ], +) diff --git a/examples/integration_tests/transitive_matrix/CMakeLists.txt b/examples/integration_tests/transitive_matrix/CMakeLists.txt new file mode 100644 index 000000000..97d887d90 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 3.15) + +project(transitive_cc_foreign_libarchive_matrix C) + +set(LIBARCHIVE_LIBRARY_NAME "archive" CACHE STRING "Library name to find for libarchive") +set(ZLIB_LIBRARY_NAME "" CACHE STRING "Optional library name to find for zlib") + +if(APPLE) + set(CMAKE_INSTALL_NAME_DIR "@rpath") + set(CMAKE_MACOSX_RPATH ON) +endif() + +function(matrix_add_dependency target library_name header_name) + find_library( + APP_FOUND_LIBRARY + NAMES ${library_name} + REQUIRED + ) + find_path( + APP_FOUND_INCLUDE_DIR + NAMES ${header_name} + REQUIRED + ) + target_link_libraries(${target} PRIVATE "${APP_FOUND_LIBRARY}") + target_include_directories(${target} PRIVATE "${APP_FOUND_INCLUDE_DIR}") + unset(APP_FOUND_LIBRARY CACHE) + unset(APP_FOUND_INCLUDE_DIR CACHE) +endfunction() + +function(matrix_add_optional_dependency target library_name header_name) + if(NOT library_name) + return() + endif() + find_library(APP_FOUND_LIBRARY NAMES ${library_name}) + find_path(APP_FOUND_INCLUDE_DIR NAMES ${header_name}) + if(APP_FOUND_LIBRARY AND APP_FOUND_INCLUDE_DIR) + target_link_libraries(${target} PRIVATE "${APP_FOUND_LIBRARY}") + target_include_directories(${target} PRIVATE "${APP_FOUND_INCLUDE_DIR}") + endif() + unset(APP_FOUND_LIBRARY CACHE) + unset(APP_FOUND_INCLUDE_DIR CACHE) +endfunction() + +add_executable(app app.c) +matrix_add_dependency(app "${LIBARCHIVE_LIBRARY_NAME}" archive.h) +matrix_add_optional_dependency(app "${ZLIB_LIBRARY_NAME}" zlib.h) +if(CMAKE_DL_LIBS) + target_link_libraries(app PRIVATE "${CMAKE_DL_LIBS}") +endif() +install(TARGETS app RUNTIME DESTINATION bin) diff --git a/examples/integration_tests/transitive_matrix/README.md b/examples/integration_tests/transitive_matrix/README.md new file mode 100644 index 000000000..4d4921c62 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/README.md @@ -0,0 +1,210 @@ +# Transitive zlib/libarchive native/foreign matrix + +This directory tests a real upstream C dependency graph: + +```text +app binary -> libarchive -> zlib +``` + +Both zlib and libarchive are built from source. zlib targets are modeled after +`examples/third_party/zlib/BUILD.zlib.bazel`; libarchive has matching source +targets in `examples/third_party/libarchive/BUILD.libarchive.bazel`. + +## Goals + +- Confirm source-built zlib and libarchive can be substituted across native + `cc_*` and foreign_cc producers. +- Confirm final binaries link correctly through the transitive + `app -> libarchive -> zlib` path. +- Confirm produced binaries and shared libraries record the expected + static-versus-shared dependency shape. +- Confirm foreign_cc-produced `CcInfo` has semantic parity with comparable + native `cc_*` provider targets after normalizing implementation-specific + filenames and symlink shapes. + +## Matrix and layout + +The layout is divided into two sections: + +1. `cc_*` and `cmake_*` directories contain the matrix linkage tests for every + scenario involving the transitive path from `app` to `zlib`. There are 48 + scenarios in total. +2. `provider_parity` contains `CcInfo` provider parity tests for zlib and + libarchive producers. + +For the matrix tests, the package prefix identifies the app consumer: + +| Package prefix | Role | +| -------------- | -------------------- | +| `cc_*` | `cc_binary` consumer | +| `cmake_*` | `cmake` consumer | + +The package suffix identifies how the app consumes libarchive: + +| Package suffix | Role | +| -------------- | -------------------------------------------------------------------------- | +| `*_static` | app consuming a static libarchive producer through `deps` | +| `*_direct` | app consuming a foreign shared libarchive producer directly through `deps` | +| `*_wrap` | app consuming native shared libarchive through a `cc_library` wrapper | +| `*_dynamic` | app consuming native shared libarchive through `dynamic_deps` | + +Because Windows has long-path limits, leaf packages and targets use short IDs. +The context for each scenario is described in the individual `BUILD.bazel` +file. The leaf packages also prevent different targets in the same package from +producing conflicting DLLs, such as multiple differently linked `archive.dll` +files in one package output directory. + +## Scenarios + +The matrix suite implements 48 app build scenarios, with one linkage test per +scenario. The scenarios are enumerated from four zlib +producer shapes, four libarchive producer shapes, and the valid app link modes +for each libarchive output shape. Each libarchive producer shape is crossed +with the four zlib producer shapes, giving 16 libarchive producer targets. + +### Producers + +| Producer | Shape | Target family | +| ---------- | --------------- | --------------------------------------------------------- | +| zlib | static | `@examples_zlib//:zlib_static` | +| zlib | foreign static | `@examples_zlib//:zlib_foreign_static` | +| zlib | dynamic wrapper | `@examples_zlib//:zlib_dynamic` | +| zlib | foreign shared | `@examples_zlib//:zlib_foreign_shared` | +| libarchive | static | `@examples_libarchive//:libarchive_static_zlib_*` | +| libarchive | foreign static | `@examples_libarchive//:libarchive_foreign_static_zlib_*` | +| libarchive | dynamic wrapper | `@examples_libarchive//:libarchive_dynamic_zlib_*` | +| libarchive | foreign shared | `@examples_libarchive//:libarchive_foreign_shared_zlib_*` | + +See [BUILD.zlib.bazel](../../third_party/zlib/BUILD.zlib.bazel) and +[BUILD.libarchive.bazel](../../third_party/libarchive/BUILD.libarchive.bazel). + +### Consumers + +Each leaf package lists one explicit scenario-level macro call. The call site +shows the app producer, app link mode, `deps`, `dynamic_deps` where applicable, +`linkstatic` where applicable. + +Except for `cmake_static`, the app-level consumer only links libarchive as a +direct dep; zlib enters transitively through the selected libarchive target. +`cmake_static` is the exception: those CMake app targets list zlib directly as +well, because CMake owns the final static link command. In the native +`cc_binary` static cases, Bazel traverses `CcInfo` from libarchive and adds the +required zlib archive to the final link line. A foreign_cc CMake app instead +receives staged libraries and link flags, then the upstream CMake project +decides what to pass to its `target_link_libraries`. A raw static libarchive +path does not carry a CMake transitive link interface for zlib, so these cases +name zlib explicitly to model a complete upstream static link. + +| App package | ID | Consumer | linkstatic | Link mode (libarchive) | Link mode (zlib) | BUILD file | +| --------------- | -------- | ----------- | ---------- | ------------------------ | --------------------- | -------------------------------------------------------- | +| `cc_static` | `s001` | `cc_binary` | `True` | native static | native static | [cc_static/s001](cc_static/s001/BUILD.bazel) | +| `cc_static` | `s002` | `cc_binary` | `False` | native static | native static | [cc_static/s002](cc_static/s002/BUILD.bazel) | +| `cc_static` | `s003` | `cc_binary` | `True` | native static | foreign_cc static | [cc_static/s003](cc_static/s003/BUILD.bazel) | +| `cc_static` | `s004` | `cc_binary` | `False` | native static | foreign_cc static | [cc_static/s004](cc_static/s004/BUILD.bazel) | +| `cc_static` | `s005` | `cc_binary` | `True` | native static | native shared wrapper | [cc_static/s005](cc_static/s005/BUILD.bazel) | +| `cc_static` | `s006` | `cc_binary` | `False` | native static | native shared wrapper | [cc_static/s006](cc_static/s006/BUILD.bazel) | +| `cc_static` | `s007` | `cc_binary` | `True` | native static | foreign_cc shared | [cc_static/s007](cc_static/s007/BUILD.bazel) | +| `cc_static` | `s008` | `cc_binary` | `False` | native static | foreign_cc shared | [cc_static/s008](cc_static/s008/BUILD.bazel) | +| `cc_static` | `s009` | `cc_binary` | `True` | foreign_cc static | native static | [cc_static/s009](cc_static/s009/BUILD.bazel) | +| `cc_static` | `s010` | `cc_binary` | `False` | foreign_cc static | native static | [cc_static/s010](cc_static/s010/BUILD.bazel) | +| `cc_static` | `s011` | `cc_binary` | `True` | foreign_cc static | foreign_cc static | [cc_static/s011](cc_static/s011/BUILD.bazel) | +| `cc_static` | `s012` | `cc_binary` | `False` | foreign_cc static | foreign_cc static | [cc_static/s012](cc_static/s012/BUILD.bazel) | +| `cc_static` | `s013` | `cc_binary` | `True` | foreign_cc static | native shared wrapper | [cc_static/s013](cc_static/s013/BUILD.bazel) | +| `cc_static` | `s014` | `cc_binary` | `False` | foreign_cc static | native shared wrapper | [cc_static/s014](cc_static/s014/BUILD.bazel) | +| `cc_static` | `s015` | `cc_binary` | `True` | foreign_cc static | foreign_cc shared | [cc_static/s015](cc_static/s015/BUILD.bazel) | +| `cc_static` | `s016` | `cc_binary` | `False` | foreign_cc static | foreign_cc shared | [cc_static/s016](cc_static/s016/BUILD.bazel) | +| `cc_direct` | `d001` | `cc_binary` | `False` | foreign_cc shared | native static | [cc_direct/d001](cc_direct/d001/BUILD.bazel) | +| `cc_direct` | `d002` | `cc_binary` | `False` | foreign_cc shared | foreign_cc static | [cc_direct/d002](cc_direct/d002/BUILD.bazel) | +| `cc_direct` | `d003` | `cc_binary` | `False` | foreign_cc shared | native shared wrapper | [cc_direct/d003](cc_direct/d003/BUILD.bazel) | +| `cc_direct` | `d004` | `cc_binary` | `False` | foreign_cc shared | foreign_cc shared | [cc_direct/d004](cc_direct/d004/BUILD.bazel) | +| `cc_dynamic` | `dyn001` | `cc_binary` | `False` | native cc_shared_library | native static | [cc_dynamic/dyn001](cc_dynamic/dyn001/BUILD.bazel) | +| `cc_dynamic` | `dyn002` | `cc_binary` | `False` | native cc_shared_library | foreign_cc static | [cc_dynamic/dyn002](cc_dynamic/dyn002/BUILD.bazel) | +| `cc_dynamic` | `dyn003` | `cc_binary` | `False` | native cc_shared_library | native shared wrapper | [cc_dynamic/dyn003](cc_dynamic/dyn003/BUILD.bazel) | +| `cc_dynamic` | `dyn004` | `cc_binary` | `False` | native cc_shared_library | foreign_cc shared | [cc_dynamic/dyn004](cc_dynamic/dyn004/BUILD.bazel) | +| `cc_wrap` | `w001` | `cc_binary` | `False` | native dynamic wrapper | native static | [cc_wrap/w001](cc_wrap/w001/BUILD.bazel) | +| `cc_wrap` | `w002` | `cc_binary` | `False` | native dynamic wrapper | foreign_cc static | [cc_wrap/w002](cc_wrap/w002/BUILD.bazel) | +| `cc_wrap` | `w003` | `cc_binary` | `False` | native dynamic wrapper | native shared wrapper | [cc_wrap/w003](cc_wrap/w003/BUILD.bazel) | +| `cc_wrap` | `w004` | `cc_binary` | `False` | native dynamic wrapper | foreign_cc shared | [cc_wrap/w004](cc_wrap/w004/BUILD.bazel) | +| `cmake_static` | `s001` | `cmake` | `-` | native static | native static | [cmake_static/s001](cmake_static/s001/BUILD.bazel) | +| `cmake_static` | `s002` | `cmake` | `-` | native static | foreign_cc static | [cmake_static/s002](cmake_static/s002/BUILD.bazel) | +| `cmake_static` | `s003` | `cmake` | `-` | native static | native shared wrapper | [cmake_static/s003](cmake_static/s003/BUILD.bazel) | +| `cmake_static` | `s004` | `cmake` | `-` | native static | foreign_cc shared | [cmake_static/s004](cmake_static/s004/BUILD.bazel) | +| `cmake_static` | `s005` | `cmake` | `-` | foreign_cc static | native static | [cmake_static/s005](cmake_static/s005/BUILD.bazel) | +| `cmake_static` | `s006` | `cmake` | `-` | foreign_cc static | foreign_cc static | [cmake_static/s006](cmake_static/s006/BUILD.bazel) | +| `cmake_static` | `s007` | `cmake` | `-` | foreign_cc static | native shared wrapper | [cmake_static/s007](cmake_static/s007/BUILD.bazel) | +| `cmake_static` | `s008` | `cmake` | `-` | foreign_cc static | foreign_cc shared | [cmake_static/s008](cmake_static/s008/BUILD.bazel) | +| `cmake_direct` | `d001` | `cmake` | `-` | foreign_cc shared | native static | [cmake_direct/d001](cmake_direct/d001/BUILD.bazel) | +| `cmake_direct` | `d002` | `cmake` | `-` | foreign_cc shared | foreign_cc static | [cmake_direct/d002](cmake_direct/d002/BUILD.bazel) | +| `cmake_direct` | `d003` | `cmake` | `-` | foreign_cc shared | native shared wrapper | [cmake_direct/d003](cmake_direct/d003/BUILD.bazel) | +| `cmake_direct` | `d004` | `cmake` | `-` | foreign_cc shared | foreign_cc shared | [cmake_direct/d004](cmake_direct/d004/BUILD.bazel) | +| `cmake_dynamic` | `dyn001` | `cmake` | `-` | native cc_shared_library | native static | [cmake_dynamic/dyn001](cmake_dynamic/dyn001/BUILD.bazel) | +| `cmake_dynamic` | `dyn002` | `cmake` | `-` | native cc_shared_library | foreign_cc static | [cmake_dynamic/dyn002](cmake_dynamic/dyn002/BUILD.bazel) | +| `cmake_dynamic` | `dyn003` | `cmake` | `-` | native cc_shared_library | native shared wrapper | [cmake_dynamic/dyn003](cmake_dynamic/dyn003/BUILD.bazel) | +| `cmake_dynamic` | `dyn004` | `cmake` | `-` | native cc_shared_library | foreign_cc shared | [cmake_dynamic/dyn004](cmake_dynamic/dyn004/BUILD.bazel) | +| `cmake_wrap` | `w001` | `cmake` | `-` | native dynamic wrapper | native static | [cmake_wrap/w001](cmake_wrap/w001/BUILD.bazel) | +| `cmake_wrap` | `w002` | `cmake` | `-` | native dynamic wrapper | foreign_cc static | [cmake_wrap/w002](cmake_wrap/w002/BUILD.bazel) | +| `cmake_wrap` | `w003` | `cmake` | `-` | native dynamic wrapper | native shared wrapper | [cmake_wrap/w003](cmake_wrap/w003/BUILD.bazel) | +| `cmake_wrap` | `w004` | `cmake` | `-` | native dynamic wrapper | foreign_cc shared | [cmake_wrap/w004](cmake_wrap/w004/BUILD.bazel) | + +## Tests + +### Linkage assertion + +Each scenario also runs a linkage test against the produced app and, when +libarchive is shared, the produced libarchive shared library. The test inspects +loader-visible dependency metadata and checks the expected link shape: + +| Link shape | Expected metadata assertion | +| ------------------------------ | ------------------------------------------- | +| static libarchive, static zlib | app has no dynamic libarchive or zlib dep | +| static libarchive, shared zlib | app has a dynamic zlib dep only | +| shared libarchive, static zlib | app has libarchive; libarchive lacks zlib | +| shared libarchive, shared zlib | app has libarchive; libarchive has zlib | + +On Linux this uses `readelf -d`, on macOS it uses `otool -L`, and on Windows it +uses `objdump -p`. + +### Provider parity + +The provider tests compare `CcInfo` from a foreign_cc target against a native +`cc_*` target that is intended to expose the same contract: + +zlib targets are under `@examples_zlib//`: + +| Foreign target | Native comparison target | Platform | +| ---------------------- | ------------------------ | --------------------- | +| `:zlib_foreign_static` | `:zlib_static` | Linux, macOS, Windows | +| `:zlib_foreign_shared` | `:zlib_dynamic` | Linux, macOS, Windows | + +libarchive targets are under `@examples_libarchive//`: + +| Foreign target | Native comparison target | Platform | +| ------------------------------------------------ | ----------------------------------------- | --------------------- | +| `:libarchive_foreign_static_zlib_static` | `:libarchive_static_zlib_static` | Linux, macOS, Windows | +| `:libarchive_foreign_static_zlib_foreign_static` | `:libarchive_static_zlib_foreign_static` | Linux, macOS, Windows | +| `:libarchive_foreign_static_zlib_dynamic` | `:libarchive_static_zlib_dynamic` | Linux, macOS, Windows | +| `:libarchive_foreign_static_zlib_foreign_shared` | `:libarchive_static_zlib_foreign_shared` | Linux, macOS, Windows | +| `:libarchive_foreign_shared_zlib_dynamic` | `:libarchive_dynamic_zlib_dynamic` | Linux, macOS, Windows | +| `:libarchive_foreign_shared_zlib_foreign_shared` | `:libarchive_dynamic_zlib_foreign_shared` | Linux, macOS, Windows | + +The comparison projects `CcInfo` down to the parts that should be semantically +equivalent: + +- compilation context: defines, local defines, whether headers are present, and + whether include paths are present +- linking context: static, dynamic, and interface library names; user link + flags; and whether dynamic/interface libraries use Bazel solib symlinks with + non-solib resolved files + +Version suffixes, import-library spelling differences, and solib path prefixes +are normalized because they are representation details rather than provider +contract differences. + +## Run + +From `examples/`: + +```bash +bazel test //integration_tests/transitive_matrix:tests --test_output=errors +bazel test //integration_tests/transitive_matrix/... --test_output=errors +``` diff --git a/examples/integration_tests/transitive_matrix/app.c b/examples/integration_tests/transitive_matrix/app.c new file mode 100644 index 000000000..0078ba60e --- /dev/null +++ b/examples/integration_tests/transitive_matrix/app.c @@ -0,0 +1,295 @@ +#define _GNU_SOURCE + +#include +#include + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#elif defined(__APPLE__) +#include +#include +#else +#include +#endif + +#include +#include +#include + +static const char* kPayload = "rules_foreign_cc_transitive_test"; +static const char* kExpected = + "expected libarchive+zlib loaded: payload=rules_foreign_cc_transitive_test"; + +static void fail_archive(const char* operation, struct archive* archive) { + const char* error = archive_error_string(archive); + fprintf(stderr, "%s failed: %s\n", operation, + error ? error : "unknown error"); + exit(1); +} + +static void fail_message(const char* message) { + fprintf(stderr, "%s\n", message); + exit(1); +} + +#ifdef _WIN32 +static const char* kLibarchiveModuleNames[] = { + "archive.dll", + "libarchive.dll", + NULL, +}; + +static const char* kZlibModuleNames[] = { + "zlib1.dll", + "libz.dll", + "z.dll", + NULL, +}; + +static const void* find_loaded_symbol(const char* const* module_names, + const char* symbol_name) { + const char* const* module_name; + + for (module_name = module_names; *module_name != NULL; ++module_name) { + HMODULE module = GetModuleHandleA(*module_name); + FARPROC symbol; + + if (module == NULL) { + continue; + } + + symbol = GetProcAddress(module, symbol_name); + if (symbol != NULL) { + return (const void*)symbol; + } + } + return NULL; +} +#endif + +static void print_loaded_path(const char* name, const void* symbol) { +#ifdef _WIN32 + HMODULE module = NULL; + char path[MAX_PATH]; + DWORD length; + + if (symbol != NULL && + GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | + GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + (LPCSTR)symbol, &module)) { + length = GetModuleFileNameA(module, path, sizeof(path)); + if (length > 0 && length < sizeof(path)) { + printf("loaded %s: %s\n", name, path); + return; + } + } + printf("loaded %s: \n", name); +#else + Dl_info info; + + if (symbol != NULL && dladdr(symbol, &info) != 0 && + info.dli_fname != NULL) { + printf("loaded %s: %s\n", name, info.dli_fname); + return; + } + printf("loaded %s: \n", name); +#endif +} + +#ifdef __APPLE__ +static int starts_with(const char* text, const char* prefix) { + return strncmp(text, prefix, strlen(prefix)) == 0; +} + +static int ends_with(const char* text, const char* suffix) { + size_t text_length = strlen(text); + size_t suffix_length = strlen(suffix); + + return text_length >= suffix_length && + strcmp(text + text_length - suffix_length, suffix) == 0; +} + +static int is_system_library_path(const char* path) { + return starts_with(path, "/usr/lib/") || + starts_with(path, "/System/Library/"); +} + +static int is_zlib_image_path(const char* path) { + const char* basename = strrchr(path, '/'); + + basename = basename != NULL ? basename + 1 : path; + return strcmp(basename, "libz.dylib") == 0 || + (starts_with(basename, "libz.") && ends_with(basename, ".dylib")); +} + +static const char* find_loaded_zlib_image_path(int prefer_non_system) { + uint32_t image_count = _dyld_image_count(); + uint32_t index; + + for (index = 0; index < image_count; ++index) { + const char* path = _dyld_get_image_name(index); + + if (path == NULL || !is_zlib_image_path(path)) { + continue; + } + if (prefer_non_system && is_system_library_path(path)) { + continue; + } + return path; + } + return NULL; +} + +static void print_loaded_zlib_path(void) { + const char* path = find_loaded_zlib_image_path(1); + + if (path == NULL) { + path = find_loaded_zlib_image_path(0); + } + if (path != NULL) { + printf("loaded zlib: %s\n", path); + return; + } + print_loaded_path("zlib", NULL); +} +#endif + +static void print_loaded_symbol_path(const char* name, + const void* fallback_symbol, + const char* symbol_name +#ifdef _WIN32 + , + const char* const* module_names +#endif +) { +#ifdef _WIN32 + const void* symbol = find_loaded_symbol(module_names, symbol_name); + print_loaded_path(name, symbol != NULL ? symbol : fallback_symbol); +#else + (void)symbol_name; + print_loaded_path(name, fallback_symbol); +#endif +} + +static void print_optional_loaded_symbol_path(const char* name, + const char* symbol_name) { +#ifdef _WIN32 + const void* symbol; + + if (strcmp(name, "zlib") == 0) { + symbol = find_loaded_symbol(kZlibModuleNames, symbol_name); + print_loaded_path(name, symbol); + return; + } + print_loaded_path(name, NULL); +#elif defined(__APPLE__) + if (strcmp(name, "zlib") == 0) { + (void)symbol_name; + print_loaded_zlib_path(); + return; + } + print_loaded_path(name, NULL); +#else + print_loaded_path(name, dlsym(RTLD_DEFAULT, symbol_name)); +#endif +} + +static size_t write_archive(char* buffer, size_t buffer_size) { + struct archive* archive = archive_write_new(); + struct archive_entry* entry = archive_entry_new(); + size_t used = 0; + + if (archive == NULL || entry == NULL) { + fail_message("failed to allocate libarchive writer"); + } + if (archive_write_add_filter_gzip(archive) != ARCHIVE_OK) { + fail_archive("archive_write_add_filter_gzip", archive); + } + if (archive_write_set_format_pax_restricted(archive) != ARCHIVE_OK) { + fail_archive("archive_write_set_format_pax_restricted", archive); + } + if (archive_write_open_memory(archive, buffer, buffer_size, &used) != + ARCHIVE_OK) { + fail_archive("archive_write_open_memory", archive); + } + + archive_entry_set_pathname(entry, "payload.txt"); + archive_entry_set_size(entry, (la_int64_t)strlen(kPayload)); + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_perm(entry, 0644); + + if (archive_write_header(archive, entry) != ARCHIVE_OK) { + fail_archive("archive_write_header", archive); + } + if (archive_write_data(archive, kPayload, strlen(kPayload)) < 0) { + fail_archive("archive_write_data", archive); + } + archive_entry_free(entry); + + if (archive_write_close(archive) != ARCHIVE_OK) { + fail_archive("archive_write_close", archive); + } + if (archive_write_free(archive) != ARCHIVE_OK) { + fail_message("archive_write_free failed"); + } + return used; +} + +static void read_archive(const char* buffer, size_t used) { + struct archive* archive = archive_read_new(); + struct archive_entry* entry = NULL; + char payload[128] = {0}; + la_ssize_t read_bytes; + + if (archive == NULL) { + fail_message("failed to allocate libarchive reader"); + } + if (archive_read_support_filter_gzip(archive) != ARCHIVE_OK) { + fail_archive("archive_read_support_filter_gzip", archive); + } + if (archive_read_support_format_tar(archive) != ARCHIVE_OK) { + fail_archive("archive_read_support_format_tar", archive); + } + if (archive_read_open_memory(archive, buffer, used) != ARCHIVE_OK) { + fail_archive("archive_read_open_memory", archive); + } + if (archive_read_next_header(archive, &entry) != ARCHIVE_OK) { + fail_archive("archive_read_next_header", archive); + } + if (strcmp(archive_entry_pathname(entry), "payload.txt") != 0) { + fail_message("unexpected archive entry path"); + } + + read_bytes = archive_read_data(archive, payload, sizeof(payload) - 1); + if (read_bytes < 0) { + fail_archive("archive_read_data", archive); + } + payload[read_bytes] = '\0'; + if (strcmp(payload, kPayload) != 0) { + fail_message("unexpected archive payload"); + } + + if (archive_read_close(archive) != ARCHIVE_OK) { + fail_archive("archive_read_close", archive); + } + if (archive_read_free(archive) != ARCHIVE_OK) { + fail_message("archive_read_free failed"); + } +} + +int main(void) { + char buffer[8192]; + size_t used = write_archive(buffer, sizeof(buffer)); + read_archive(buffer, used); + puts(kExpected); + print_loaded_symbol_path("libarchive", (const void*)&archive_read_new, + "archive_read_new" +#ifdef _WIN32 + , + kLibarchiveModuleNames +#endif + ); + print_optional_loaded_symbol_path("zlib", "zlibVersion"); + return 0; +} diff --git a/examples/integration_tests/transitive_matrix/cc_direct/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_direct/BUILD.bazel new file mode 100644 index 000000000..43649eaba --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_direct/BUILD.bazel @@ -0,0 +1,18 @@ +test_suite( + name = "linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cc_direct/d001:linkage_tests", + "//integration_tests/transitive_matrix/cc_direct/d002:linkage_tests", + "//integration_tests/transitive_matrix/cc_direct/d003:linkage_tests", + "//integration_tests/transitive_matrix/cc_direct/d004:linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_direct/d001/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_direct/d001/BUILD.bazel new file mode 100644 index 000000000..41d6132c5 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_direct/d001/BUILD.bazel @@ -0,0 +1,34 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary direct deps +# app: cc_binary(linkstatic = False) +# libarchive: foreign_cc shared +# zlib: native static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_foreign_shared_zlib_static", + libarchive_static_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_foreign_shared_zlib_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_direct:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_direct:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_direct/d002/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_direct/d002/BUILD.bazel new file mode 100644 index 000000000..b00c48e31 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_direct/d002/BUILD.bazel @@ -0,0 +1,34 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary direct deps +# app: cc_binary(linkstatic = False) +# libarchive: foreign_cc shared +# zlib: foreign_cc static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_foreign_shared_zlib_foreign_static", + libarchive_static_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_foreign_shared_zlib_foreign_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_direct:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_direct:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_direct/d003/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_direct/d003/BUILD.bazel new file mode 100644 index 000000000..086d075b3 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_direct/d003/BUILD.bazel @@ -0,0 +1,34 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary direct deps +# app: cc_binary(linkstatic = False) +# libarchive: foreign_cc shared +# zlib: native shared wrapper +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_foreign_shared_zlib_dynamic", + libarchive_shared_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_foreign_shared_zlib_dynamic"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_direct:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_direct:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_direct/d004/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_direct/d004/BUILD.bazel new file mode 100644 index 000000000..f0a52c9b0 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_direct/d004/BUILD.bazel @@ -0,0 +1,34 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary direct deps +# app: cc_binary(linkstatic = False) +# libarchive: foreign_cc shared +# zlib: foreign_cc shared +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_foreign_shared_zlib_foreign_shared", + libarchive_shared_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_foreign_shared_zlib_foreign_shared"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_direct:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_direct:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_dynamic/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_dynamic/BUILD.bazel new file mode 100644 index 000000000..2b3e927bd --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_dynamic/BUILD.bazel @@ -0,0 +1,18 @@ +test_suite( + name = "linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cc_dynamic/dyn001:linkage_tests", + "//integration_tests/transitive_matrix/cc_dynamic/dyn002:linkage_tests", + "//integration_tests/transitive_matrix/cc_dynamic/dyn003:linkage_tests", + "//integration_tests/transitive_matrix/cc_dynamic/dyn004:linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_dynamic/dyn001/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_dynamic/dyn001/BUILD.bazel new file mode 100644 index 000000000..71e0fb77e --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_dynamic/dyn001/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary dynamic_deps +# app: cc_binary(linkstatic = False) +# libarchive: native cc_shared_library +# zlib: native static +cc_binary_consumer_test( + name = "t", + dynamic_deps = ["@examples_libarchive//:libarchive_shared_zlib_static"], + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_static", + libarchive_static_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_headers"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_dynamic:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_dynamic:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_dynamic/dyn002/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_dynamic/dyn002/BUILD.bazel new file mode 100644 index 000000000..2828ba868 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_dynamic/dyn002/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary dynamic_deps +# app: cc_binary(linkstatic = False) +# libarchive: native cc_shared_library +# zlib: foreign_cc static +cc_binary_consumer_test( + name = "t", + dynamic_deps = ["@examples_libarchive//:libarchive_shared_zlib_foreign_static"], + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_foreign_static", + libarchive_static_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_headers"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_dynamic:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_dynamic:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_dynamic/dyn003/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_dynamic/dyn003/BUILD.bazel new file mode 100644 index 000000000..308a6eb65 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_dynamic/dyn003/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary dynamic_deps +# app: cc_binary(linkstatic = False) +# libarchive: native cc_shared_library +# zlib: native shared wrapper +cc_binary_consumer_test( + name = "t", + dynamic_deps = ["@examples_libarchive//:libarchive_shared_zlib_dynamic"], + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_dynamic", + libarchive_shared_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_headers"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_dynamic:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_dynamic:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_dynamic/dyn004/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_dynamic/dyn004/BUILD.bazel new file mode 100644 index 000000000..8a5775e50 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_dynamic/dyn004/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary dynamic_deps +# app: cc_binary(linkstatic = False) +# libarchive: native cc_shared_library +# zlib: foreign_cc shared +cc_binary_consumer_test( + name = "t", + dynamic_deps = ["@examples_libarchive//:libarchive_shared_zlib_foreign_shared"], + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_foreign_shared", + libarchive_shared_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_headers"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_dynamic:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_dynamic:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/BUILD.bazel new file mode 100644 index 000000000..855d840e0 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/BUILD.bazel @@ -0,0 +1,30 @@ +test_suite( + name = "linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cc_static/s001:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s002:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s003:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s004:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s005:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s006:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s007:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s008:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s009:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s010:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s011:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s012:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s013:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s014:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s015:linkage_tests", + "//integration_tests/transitive_matrix/cc_static/s016:linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s001/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s001/BUILD.bazel new file mode 100644 index 000000000..f3ace68c0 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s001/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = True) +# libarchive: native static +# zlib: native static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + linkstatic = True, + deps = ["@examples_libarchive//:libarchive_static_zlib_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s002/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s002/BUILD.bazel new file mode 100644 index 000000000..e6c0da51c --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s002/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = False) +# libarchive: native static +# zlib: native static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_static_zlib_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s003/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s003/BUILD.bazel new file mode 100644 index 000000000..d3173924b --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s003/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = True) +# libarchive: native static +# zlib: foreign_cc static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + linkstatic = True, + deps = ["@examples_libarchive//:libarchive_static_zlib_foreign_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s004/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s004/BUILD.bazel new file mode 100644 index 000000000..2e40ffd1e --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s004/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = False) +# libarchive: native static +# zlib: foreign_cc static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_static_zlib_foreign_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s005/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s005/BUILD.bazel new file mode 100644 index 000000000..67e6f778e --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s005/BUILD.bazel @@ -0,0 +1,33 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = True) +# libarchive: native static +# zlib: native shared wrapper +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + linkstatic = True, + deps = ["@examples_libarchive//:libarchive_static_zlib_dynamic"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s006/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s006/BUILD.bazel new file mode 100644 index 000000000..23eb846e8 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s006/BUILD.bazel @@ -0,0 +1,33 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = False) +# libarchive: native static +# zlib: native shared wrapper +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_static_zlib_dynamic"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s007/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s007/BUILD.bazel new file mode 100644 index 000000000..8b02e4c13 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s007/BUILD.bazel @@ -0,0 +1,33 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = True) +# libarchive: native static +# zlib: foreign_cc shared +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + linkstatic = True, + deps = ["@examples_libarchive//:libarchive_static_zlib_foreign_shared"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s008/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s008/BUILD.bazel new file mode 100644 index 000000000..ac94da685 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s008/BUILD.bazel @@ -0,0 +1,33 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = False) +# libarchive: native static +# zlib: foreign_cc shared +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_static_zlib_foreign_shared"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s009/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s009/BUILD.bazel new file mode 100644 index 000000000..046c6e468 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s009/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = True) +# libarchive: foreign_cc static +# zlib: native static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + linkstatic = True, + deps = ["@examples_libarchive//:libarchive_foreign_static_zlib_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s010/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s010/BUILD.bazel new file mode 100644 index 000000000..f9377649b --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s010/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = False) +# libarchive: foreign_cc static +# zlib: native static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_foreign_static_zlib_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s011/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s011/BUILD.bazel new file mode 100644 index 000000000..a17e2cdab --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s011/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = True) +# libarchive: foreign_cc static +# zlib: foreign_cc static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + linkstatic = True, + deps = ["@examples_libarchive//:libarchive_foreign_static_zlib_foreign_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s012/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s012/BUILD.bazel new file mode 100644 index 000000000..f6dc94690 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s012/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = False) +# libarchive: foreign_cc static +# zlib: foreign_cc static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_foreign_static_zlib_foreign_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s013/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s013/BUILD.bazel new file mode 100644 index 000000000..4ed8956eb --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s013/BUILD.bazel @@ -0,0 +1,33 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = True) +# libarchive: foreign_cc static +# zlib: native shared wrapper +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + linkstatic = True, + deps = ["@examples_libarchive//:libarchive_foreign_static_zlib_dynamic"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s014/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s014/BUILD.bazel new file mode 100644 index 000000000..aec208958 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s014/BUILD.bazel @@ -0,0 +1,33 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = False) +# libarchive: foreign_cc static +# zlib: native shared wrapper +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_foreign_static_zlib_dynamic"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s015/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s015/BUILD.bazel new file mode 100644 index 000000000..48dd6f9ca --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s015/BUILD.bazel @@ -0,0 +1,33 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = True) +# libarchive: foreign_cc static +# zlib: foreign_cc shared +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + linkstatic = True, + deps = ["@examples_libarchive//:libarchive_foreign_static_zlib_foreign_shared"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_static/s016/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_static/s016/BUILD.bazel new file mode 100644 index 000000000..29b96521b --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_static/s016/BUILD.bazel @@ -0,0 +1,33 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary static deps +# app: cc_binary(linkstatic = False) +# libarchive: foreign_cc static +# zlib: foreign_cc shared +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_foreign_static_zlib_foreign_shared"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_wrap/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_wrap/BUILD.bazel new file mode 100644 index 000000000..00b2d3e43 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_wrap/BUILD.bazel @@ -0,0 +1,18 @@ +test_suite( + name = "linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cc_wrap/w001:linkage_tests", + "//integration_tests/transitive_matrix/cc_wrap/w002:linkage_tests", + "//integration_tests/transitive_matrix/cc_wrap/w003:linkage_tests", + "//integration_tests/transitive_matrix/cc_wrap/w004:linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_wrap/w001/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_wrap/w001/BUILD.bazel new file mode 100644 index 000000000..bbdcbab48 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_wrap/w001/BUILD.bazel @@ -0,0 +1,34 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary native dynamic wrapper +# app: cc_binary(linkstatic = False) +# libarchive: native dynamic wrapper +# zlib: native static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_static", + libarchive_static_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_dynamic_zlib_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_wrap:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_wrap:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_wrap/w002/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_wrap/w002/BUILD.bazel new file mode 100644 index 000000000..30f07d40a --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_wrap/w002/BUILD.bazel @@ -0,0 +1,34 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary native dynamic wrapper +# app: cc_binary(linkstatic = False) +# libarchive: native dynamic wrapper +# zlib: foreign_cc static +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_foreign_static", + libarchive_static_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_dynamic_zlib_foreign_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_wrap:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_wrap:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_wrap/w003/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_wrap/w003/BUILD.bazel new file mode 100644 index 000000000..2044ffa43 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_wrap/w003/BUILD.bazel @@ -0,0 +1,34 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary native dynamic wrapper +# app: cc_binary(linkstatic = False) +# libarchive: native dynamic wrapper +# zlib: native shared wrapper +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_dynamic", + libarchive_shared_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_dynamic_zlib_dynamic"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_wrap:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_wrap:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cc_wrap/w004/BUILD.bazel b/examples/integration_tests/transitive_matrix/cc_wrap/w004/BUILD.bazel new file mode 100644 index 000000000..b23f5b347 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cc_wrap/w004/BUILD.bazel @@ -0,0 +1,34 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cc_binary_consumer_test", + "expected_linkage", +) + +# cc_binary native dynamic wrapper +# app: cc_binary(linkstatic = False) +# libarchive: native dynamic wrapper +# zlib: foreign_cc shared +cc_binary_consumer_test( + name = "t", + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_foreign_shared", + libarchive_shared_deps = ["zlib"], + ), + linkstatic = False, + deps = ["@examples_libarchive//:libarchive_dynamic_zlib_foreign_shared"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cc_wrap:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cc_wrap:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_direct/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_direct/BUILD.bazel new file mode 100644 index 000000000..edff326a5 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_direct/BUILD.bazel @@ -0,0 +1,18 @@ +test_suite( + name = "linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cmake_direct/d001:linkage_tests", + "//integration_tests/transitive_matrix/cmake_direct/d002:linkage_tests", + "//integration_tests/transitive_matrix/cmake_direct/d003:linkage_tests", + "//integration_tests/transitive_matrix/cmake_direct/d004:linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_direct/d001/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_direct/d001/BUILD.bazel new file mode 100644 index 000000000..1c546fe6e --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_direct/d001/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake direct deps +# app: cmake() +# libarchive: foreign_cc shared +# zlib: native static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries(libarchive = "archive"), + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_foreign_shared_zlib_static", + libarchive_static_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_foreign_shared_zlib_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_direct:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_direct:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_direct/d002/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_direct/d002/BUILD.bazel new file mode 100644 index 000000000..3cc8f65aa --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_direct/d002/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake direct deps +# app: cmake() +# libarchive: foreign_cc shared +# zlib: foreign_cc static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries(libarchive = "archive"), + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_foreign_shared_zlib_foreign_static", + libarchive_static_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_foreign_shared_zlib_foreign_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_direct:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_direct:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_direct/d003/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_direct/d003/BUILD.bazel new file mode 100644 index 000000000..4c74b604b --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_direct/d003/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake direct deps +# app: cmake() +# libarchive: foreign_cc shared +# zlib: native shared wrapper +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries(libarchive = "archive"), + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_foreign_shared_zlib_dynamic", + libarchive_shared_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_foreign_shared_zlib_dynamic"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_direct:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_direct:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_direct/d004/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_direct/d004/BUILD.bazel new file mode 100644 index 000000000..78e2e08ae --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_direct/d004/BUILD.bazel @@ -0,0 +1,35 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake direct deps +# app: cmake() +# libarchive: foreign_cc shared +# zlib: foreign_cc shared +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries(libarchive = "archive"), + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_foreign_shared_zlib_foreign_shared", + libarchive_shared_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_foreign_shared_zlib_foreign_shared"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_direct:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_direct:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_dynamic/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_dynamic/BUILD.bazel new file mode 100644 index 000000000..640811f1b --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_dynamic/BUILD.bazel @@ -0,0 +1,18 @@ +test_suite( + name = "linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cmake_dynamic/dyn001:linkage_tests", + "//integration_tests/transitive_matrix/cmake_dynamic/dyn002:linkage_tests", + "//integration_tests/transitive_matrix/cmake_dynamic/dyn003:linkage_tests", + "//integration_tests/transitive_matrix/cmake_dynamic/dyn004:linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn001/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn001/BUILD.bazel new file mode 100644 index 000000000..b9c73c5c6 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn001/BUILD.bazel @@ -0,0 +1,39 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake dynamic_deps +# app: cmake() +# libarchive: native cc_shared_library +# zlib: native static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive_zlib_static", + libarchive_windows = "libarchive_shared_zlib_static.if", + ), + dynamic_deps = ["@examples_libarchive//:libarchive_shared_zlib_static"], + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_static", + libarchive_static_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_headers"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_dynamic:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_dynamic:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn002/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn002/BUILD.bazel new file mode 100644 index 000000000..8a1197244 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn002/BUILD.bazel @@ -0,0 +1,39 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake dynamic_deps +# app: cmake() +# libarchive: native cc_shared_library +# zlib: foreign_cc static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive_zlib_foreign_static", + libarchive_windows = "libarchive_shared_zlib_foreign_static.if", + ), + dynamic_deps = ["@examples_libarchive//:libarchive_shared_zlib_foreign_static"], + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_foreign_static", + libarchive_static_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_headers"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_dynamic:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_dynamic:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn003/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn003/BUILD.bazel new file mode 100644 index 000000000..76df1748f --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn003/BUILD.bazel @@ -0,0 +1,39 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake dynamic_deps +# app: cmake() +# libarchive: native cc_shared_library +# zlib: native shared wrapper +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive_zlib_dynamic", + libarchive_windows = "libarchive_shared_zlib_dynamic.if", + ), + dynamic_deps = ["@examples_libarchive//:libarchive_shared_zlib_dynamic"], + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_dynamic", + libarchive_shared_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_headers"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_dynamic:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_dynamic:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn004/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn004/BUILD.bazel new file mode 100644 index 000000000..bcc2f8ce6 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_dynamic/dyn004/BUILD.bazel @@ -0,0 +1,39 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake dynamic_deps +# app: cmake() +# libarchive: native cc_shared_library +# zlib: foreign_cc shared +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive_zlib_foreign_shared", + libarchive_windows = "libarchive_shared_zlib_foreign_shared.if", + ), + dynamic_deps = ["@examples_libarchive//:libarchive_shared_zlib_foreign_shared"], + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_foreign_shared", + libarchive_shared_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_headers"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_dynamic:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_dynamic:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_static/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_static/BUILD.bazel new file mode 100644 index 000000000..264c6ed29 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_static/BUILD.bazel @@ -0,0 +1,22 @@ +test_suite( + name = "linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cmake_static/s001:linkage_tests", + "//integration_tests/transitive_matrix/cmake_static/s002:linkage_tests", + "//integration_tests/transitive_matrix/cmake_static/s003:linkage_tests", + "//integration_tests/transitive_matrix/cmake_static/s004:linkage_tests", + "//integration_tests/transitive_matrix/cmake_static/s005:linkage_tests", + "//integration_tests/transitive_matrix/cmake_static/s006:linkage_tests", + "//integration_tests/transitive_matrix/cmake_static/s007:linkage_tests", + "//integration_tests/transitive_matrix/cmake_static/s008:linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_static/s001/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_static/s001/BUILD.bazel new file mode 100644 index 000000000..cacbfd8d9 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_static/s001/BUILD.bazel @@ -0,0 +1,42 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake static deps +# app: cmake() +# libarchive: native static +# zlib: native static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "libarchive_static_zlib_static", + zlib = "z", + ), + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + deps = [ + "@examples_libarchive//:libarchive_static_zlib_static", + "@examples_zlib//:zlib_static", + ], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_static/s002/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_static/s002/BUILD.bazel new file mode 100644 index 000000000..66a0a0cd0 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_static/s002/BUILD.bazel @@ -0,0 +1,43 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake static deps +# app: cmake() +# libarchive: native static +# zlib: foreign_cc static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "libarchive_static_zlib_foreign_static", + zlib = "z", + zlib_windows = "zlib", + ), + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + deps = [ + "@examples_libarchive//:libarchive_static_zlib_foreign_static", + "@examples_zlib//:zlib_foreign_static", + ], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_static/s003/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_static/s003/BUILD.bazel new file mode 100644 index 000000000..3edbf8dd7 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_static/s003/BUILD.bazel @@ -0,0 +1,41 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake static deps +# app: cmake() +# libarchive: native static +# zlib: native shared wrapper +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "libarchive_static_zlib_dynamic", + zlib = "z", + zlib_windows = "zlib_shared.if", + ), + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + deps = [ + "@examples_libarchive//:libarchive_static_zlib_dynamic", + "@examples_zlib//:zlib_dynamic", + ], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_static/s004/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_static/s004/BUILD.bazel new file mode 100644 index 000000000..5f9d003a7 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_static/s004/BUILD.bazel @@ -0,0 +1,41 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake static deps +# app: cmake() +# libarchive: native static +# zlib: foreign_cc shared +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "libarchive_static_zlib_foreign_shared", + zlib = "z", + zlib_windows = "zlib1", + ), + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + deps = [ + "@examples_libarchive//:libarchive_static_zlib_foreign_shared", + "@examples_zlib//:zlib_foreign_shared", + ], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_static/s005/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_static/s005/BUILD.bazel new file mode 100644 index 000000000..2bd297059 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_static/s005/BUILD.bazel @@ -0,0 +1,42 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake static deps +# app: cmake() +# libarchive: foreign_cc static +# zlib: native static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive", + zlib = "z", + ), + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + deps = [ + "@examples_libarchive//:libarchive_foreign_static_zlib_static", + "@examples_zlib//:zlib_static", + ], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_static/s006/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_static/s006/BUILD.bazel new file mode 100644 index 000000000..902af32b1 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_static/s006/BUILD.bazel @@ -0,0 +1,43 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake static deps +# app: cmake() +# libarchive: foreign_cc static +# zlib: foreign_cc static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive", + zlib = "z", + zlib_windows = "zlib", + ), + expected_linkage = expected_linkage( + app_static_deps = [ + "libarchive", + "zlib", + ], + ), + deps = [ + "@examples_libarchive//:libarchive_foreign_static_zlib_foreign_static", + "@examples_zlib//:zlib_foreign_static", + ], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_static/s007/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_static/s007/BUILD.bazel new file mode 100644 index 000000000..b8ba98efe --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_static/s007/BUILD.bazel @@ -0,0 +1,41 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake static deps +# app: cmake() +# libarchive: foreign_cc static +# zlib: native shared wrapper +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive", + zlib = "z", + zlib_windows = "zlib_shared.if", + ), + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + deps = [ + "@examples_libarchive//:libarchive_foreign_static_zlib_dynamic", + "@examples_zlib//:zlib_dynamic", + ], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_static/s008/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_static/s008/BUILD.bazel new file mode 100644 index 000000000..4f5e9f435 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_static/s008/BUILD.bazel @@ -0,0 +1,41 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake static deps +# app: cmake() +# libarchive: foreign_cc static +# zlib: foreign_cc shared +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive", + zlib = "z", + zlib_windows = "zlib1", + ), + expected_linkage = expected_linkage( + app_shared_deps = ["zlib"], + app_static_deps = ["libarchive"], + ), + deps = [ + "@examples_libarchive//:libarchive_foreign_static_zlib_foreign_shared", + "@examples_zlib//:zlib_foreign_shared", + ], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_static:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_wrap/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_wrap/BUILD.bazel new file mode 100644 index 000000000..71c24c255 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_wrap/BUILD.bazel @@ -0,0 +1,18 @@ +test_suite( + name = "linkage_tests", + tests = [ + "//integration_tests/transitive_matrix/cmake_wrap/w001:linkage_tests", + "//integration_tests/transitive_matrix/cmake_wrap/w002:linkage_tests", + "//integration_tests/transitive_matrix/cmake_wrap/w003:linkage_tests", + "//integration_tests/transitive_matrix/cmake_wrap/w004:linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_wrap/w001/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_wrap/w001/BUILD.bazel new file mode 100644 index 000000000..0f3a54b34 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_wrap/w001/BUILD.bazel @@ -0,0 +1,38 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake native dynamic wrapper +# app: cmake() +# libarchive: native dynamic wrapper +# zlib: native static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive_zlib_static", + libarchive_windows = "libarchive_shared_zlib_static.if", + ), + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_static", + libarchive_static_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_dynamic_zlib_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_wrap:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_wrap:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_wrap/w002/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_wrap/w002/BUILD.bazel new file mode 100644 index 000000000..bb37a2591 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_wrap/w002/BUILD.bazel @@ -0,0 +1,38 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake native dynamic wrapper +# app: cmake() +# libarchive: native dynamic wrapper +# zlib: foreign_cc static +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive_zlib_foreign_static", + libarchive_windows = "libarchive_shared_zlib_foreign_static.if", + ), + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_foreign_static", + libarchive_static_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_dynamic_zlib_foreign_static"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_wrap:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_wrap:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_wrap/w003/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_wrap/w003/BUILD.bazel new file mode 100644 index 000000000..cb6385adc --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_wrap/w003/BUILD.bazel @@ -0,0 +1,38 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake native dynamic wrapper +# app: cmake() +# libarchive: native dynamic wrapper +# zlib: native shared wrapper +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive_zlib_dynamic", + libarchive_windows = "libarchive_shared_zlib_dynamic.if", + ), + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_dynamic", + libarchive_shared_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_dynamic_zlib_dynamic"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_wrap:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_wrap:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/cmake_wrap/w004/BUILD.bazel b/examples/integration_tests/transitive_matrix/cmake_wrap/w004/BUILD.bazel new file mode 100644 index 000000000..bae7b14b3 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/cmake_wrap/w004/BUILD.bazel @@ -0,0 +1,38 @@ +load( + "//integration_tests/transitive_matrix:consumer_tests.bzl", + "cmake_cache_entries", + "cmake_consumer_test", + "expected_linkage", +) + +# foreign_cc cmake native dynamic wrapper +# app: cmake() +# libarchive: native dynamic wrapper +# zlib: foreign_cc shared +cmake_consumer_test( + name = "t", + cache_entries = cmake_cache_entries( + libarchive = "archive_zlib_foreign_shared", + libarchive_windows = "libarchive_shared_zlib_foreign_shared.if", + ), + expected_linkage = expected_linkage( + app_shared_deps = ["libarchive"], + libarchive = "@examples_libarchive//:libarchive_shared_zlib_foreign_shared", + libarchive_shared_deps = ["zlib"], + ), + deps = ["@examples_libarchive//:libarchive_dynamic_zlib_foreign_shared"], +) + +test_suite( + name = "linkage_tests", + tests = [":t_linkage_test"], + visibility = ["//integration_tests/transitive_matrix/cmake_wrap:__pkg__"], +) + +test_suite( + name = "tests", + tests = [ + ":linkage_tests", + ], + visibility = ["//integration_tests/transitive_matrix/cmake_wrap:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/consumer_tests.bzl b/examples/integration_tests/transitive_matrix/consumer_tests.bzl new file mode 100644 index 000000000..46c32ed17 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/consumer_tests.bzl @@ -0,0 +1,215 @@ +"""Consumer app/linkage test macros for the transitive native/foreign matrix.""" + +load("@rules_cc//cc:defs.bzl", "cc_binary") +load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake") +load("@rules_shell//shell:sh_test.bzl", "sh_test") + +_ALL_SUPPORTED_PLATFORMS = select({ + "@platforms//os:linux": [], + "@platforms//os:macos": [], + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], +}) + +_APP_LINKOPTS = select({ + "@platforms//os:linux": ["-ldl"], + "//conditions:default": [], +}) + +_APP_SRC = "//integration_tests/transitive_matrix:app.c" +_CONSUMER_BINARY = select({ + "@platforms//os:windows": ["app.exe"], + "//conditions:default": ["app"], +}) +_FOREIGN_APP_SRCS = "//integration_tests/transitive_matrix:foreign_app_srcs" + +def expected_linkage( + app_shared_deps = [], + app_static_deps = [], + libarchive = None, + libarchive_shared_deps = [], + libarchive_static_deps = []): + """Returns linkage expectations for a consumer test. + + Args: + app_shared_deps: Logical libraries expected as app dynamic deps. + app_static_deps: Logical libraries not expected as app dynamic deps. + libarchive: Optional libarchive target label to inspect for transitive + dynamic deps. + libarchive_shared_deps: Logical libraries expected as libarchive dynamic deps. + libarchive_static_deps: Logical libraries not expected as libarchive dynamic deps. + + Returns: + A struct containing linkage expectations for the app and libarchive. + """ + return struct( + app_shared_deps = app_shared_deps, + app_static_deps = app_static_deps, + libarchive = libarchive, + libarchive_shared_deps = libarchive_shared_deps, + libarchive_static_deps = libarchive_static_deps, + ) + +def cmake_cache_entries( + libarchive, + libarchive_windows = None, + zlib = None, + zlib_windows = None): + """Returns CMake cache entries for platform-specific dependency names. + + Args: + libarchive: Default libarchive library name. + libarchive_windows: Optional Windows libarchive import library name. + zlib: Optional default zlib library name. + zlib_windows: Optional Windows zlib import library name. + + Returns: + A select() expression for the CMake cache entries. + """ + default_entries = { + "LIBARCHIVE_LIBRARY_NAME": libarchive, + } + windows_entries = { + "LIBARCHIVE_LIBRARY_NAME": libarchive_windows or libarchive, + } + + if zlib: + default_entries["ZLIB_LIBRARY_NAME"] = zlib + windows_entries["ZLIB_LIBRARY_NAME"] = zlib_windows or zlib + + return select({ + "@platforms//os:windows": windows_entries, + "//conditions:default": default_entries, + }) + +def linkage_test( + name, + binary, + expected_linkage, + target_compatible_with, + tags = []): + """Creates a shell test that validates expected binary linkage. + + Args: + name: Name of the generated sh_test target. + binary: Label of the binary to inspect. + expected_linkage: Linkage expectations returned by expected_linkage(). + target_compatible_with: Platform compatibility for generated targets. + tags: Additional tags to apply to the generated sh_test target. + """ + manifest_name = name + "_manifest" + libarchive = expected_linkage.libarchive + checks = [] + + for library in expected_linkage.app_shared_deps: + checks.append(("app", "dynamic", library, binary)) + for library in expected_linkage.app_static_deps: + checks.append(("app", "static", library, binary)) + + if expected_linkage.libarchive_shared_deps or expected_linkage.libarchive_static_deps: + if not libarchive: + fail("libarchive linkage checks require expected_linkage.libarchive") + + for library in expected_linkage.libarchive_shared_deps: + checks.append(("libarchive", "dynamic", library, libarchive)) + for library in expected_linkage.libarchive_static_deps: + checks.append(("libarchive", "static", library, libarchive)) + + # Linkage manifest rows are tab-separated: + # + # check + # + # Examples: + # + # check app dynamic libarchive + # check libarchive dynamic zlib + # check app static zlib + # + # `dynamic` means the inspected file must have a loader-visible dependency + # on the library. `static` means it must not. + native.genrule( + name = manifest_name, + srcs = [binary] + ([libarchive] if libarchive else []), + outs = [name + ".linkage_manifest"], + cmd = "\n".join( + ["rm -f \"$@\""] + [ + "printf 'check\\t%s\\t%s\\t%s\\t%s\\n' '{}' '{}' '{}' '$(rlocationpaths {})' >> \"$@\"".format( + inspect_name, + expected, + library, + inspect_label, + ) + for inspect_name, expected, library, inspect_label in checks + ], + ), + target_compatible_with = target_compatible_with, + ) + + sh_test( + name = name, + size = "small", + srcs = ["//integration_tests/transitive_matrix:linkage_test.sh"], + args = [ + "$(rlocationpath :{})".format(manifest_name), + ], + data = [ + ":" + manifest_name, + binary, + "@bazel_tools//tools/bash/runfiles", + ] + ([libarchive] if libarchive else []), + tags = tags + ["manual"], + target_compatible_with = target_compatible_with, + ) + +def cc_binary_consumer_test( + name, + deps, + expected_linkage, + dynamic_deps = [], + linkstatic = False, + linkopts = _APP_LINKOPTS, + target_compatible_with = _ALL_SUPPORTED_PLATFORMS, + tags = []): + cc_binary( + name = name, + srcs = [_APP_SRC], + dynamic_deps = dynamic_deps, + linkopts = linkopts, + linkstatic = linkstatic, + target_compatible_with = target_compatible_with, + deps = deps, + ) + + linkage_test( + name = name + "_linkage_test", + binary = ":" + name, + expected_linkage = expected_linkage, + tags = tags, + target_compatible_with = target_compatible_with, + ) + +def cmake_consumer_test( + name, + deps, + cache_entries, + expected_linkage, + dynamic_deps = [], + target_compatible_with = _ALL_SUPPORTED_PLATFORMS, + tags = []): + cmake( + name = name, + cache_entries = cache_entries, + dynamic_deps = dynamic_deps, + lib_source = _FOREIGN_APP_SRCS, + out_binaries = _CONSUMER_BINARY, + target_compatible_with = target_compatible_with, + deps = deps, + ) + + linkage_test( + name = name + "_linkage_test", + binary = ":" + name, + expected_linkage = expected_linkage, + tags = tags, + target_compatible_with = target_compatible_with, + ) diff --git a/examples/integration_tests/transitive_matrix/linkage_test.sh b/examples/integration_tests/transitive_matrix/linkage_test.sh new file mode 100755 index 000000000..c162c48f6 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/linkage_test.sh @@ -0,0 +1,229 @@ +#!/usr/bin/env bash + +set -euo pipefail + +set +u +f=bazel_tools/tools/bash/runfiles/runfiles.bash +source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -d ' ' -f 2-)" 2>/dev/null || \ + source "$0.runfiles/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -d ' ' -f 2-)" 2>/dev/null || { + echo >&2 "cannot find $f" + exit 1 + } +set -u + +if [[ "$#" -ne 1 ]]; then + echo >&2 "usage: linkage_test.sh " + exit 1 +fi + +manifest="$(rlocation "$1")" +if [[ -z "$manifest" || ! -f "$manifest" ]]; then + echo >&2 "linkage manifest not found: $1" + exit 1 +fi + +is_shared_candidate() { + case "$(basename "$1")" in + *.so|*.so.*|*.dylib|*.dll) + return 0 + ;; + esac + return 1 +} + +resolve_inspect_file() { + local inspect_name="$1" + local candidate_blob="$2" + local candidate + local resolved + + for candidate in $candidate_blob; do + case "$inspect_name" in + app) + is_shared_candidate "$candidate" && continue + ;; + libarchive) + is_shared_candidate "$candidate" || continue + ;; + *) + echo >&2 "unknown inspect target: $inspect_name" + exit 1 + ;; + esac + + resolved="$(rlocation "$candidate")" + if [[ -n "$resolved" && -f "$resolved" ]]; then + printf '%s\n' "$resolved" + return + fi + done + + echo >&2 "could not resolve inspect file for $inspect_name" + echo >&2 "candidates: $candidate_blob" + exit 1 +} + +inspect_dynamic_deps() { + local inspect_file="$1" + local output_file="$2" + local objdump_path + + case "$OSTYPE" in + darwin*) + otool -L "$inspect_file" >"$output_file" + ;; + msys*|cygwin*) + inspect_file="$(objdump_input_path "$inspect_file")" + objdump_path="$(find_objdump)" + "$objdump_path" -p "$inspect_file" >"$output_file" || true + ;; + *) + readelf -d "$inspect_file" >"$output_file" + ;; + esac +} + +objdump_input_path() { + local inspect_file="$1" + local resolved + + if command -v cygpath >/dev/null; then + inspect_file="$(cygpath -u "$inspect_file" 2>/dev/null || printf '%s\n' "$inspect_file")" + fi + + if command -v readlink >/dev/null; then + resolved="$(readlink -f "$inspect_file" 2>/dev/null || true)" + if [[ -n "$resolved" ]]; then + inspect_file="$resolved" + fi + fi + + printf '%s\n' "$inspect_file" +} + +find_objdump() { + local path + local paths=() + + for path in objdump x86_64-w64-mingw32-objdump; do + if command -v "$path" >/dev/null; then + command -v "$path" + return + fi + done + + paths+=( + "/usr/bin/objdump.exe" + "/mingw64/bin/objdump.exe" + "/ucrt64/bin/objdump.exe" + "/clang64/bin/objdump.exe" + "/c/msys64/usr/bin/objdump.exe" + "/c/msys64/mingw64/bin/objdump.exe" + "/c/msys64/ucrt64/bin/objdump.exe" + "/c/msys64/clang64/bin/objdump.exe" + "/c/cygwin64/bin/objdump.exe" + "/c/tools/StrawberryPerl/c/bin/objdump.exe" + "/c/tools/StrawberryPerl/c/x86_64-w64-mingw32/bin/objdump.exe" + "/cygdrive/c/msys64/usr/bin/objdump.exe" + "/cygdrive/c/msys64/mingw64/bin/objdump.exe" + "/cygdrive/c/msys64/ucrt64/bin/objdump.exe" + "/cygdrive/c/msys64/clang64/bin/objdump.exe" + "/cygdrive/c/cygwin64/bin/objdump.exe" + "/cygdrive/c/tools/StrawberryPerl/c/bin/objdump.exe" + "/cygdrive/c/tools/StrawberryPerl/c/x86_64-w64-mingw32/bin/objdump.exe" + ) + + for path in "${paths[@]}"; do + if [[ -x "$path" ]]; then + printf '%s\n' "$path" + return + fi + done + + echo >&2 "objdump not found; install MSYS/Cygwin binutils or add objdump.exe to PATH" + exit 1 +} + +shared_pattern_for() { + local library="$1" + + case "$OSTYPE:$library" in + darwin*:libarchive) + echo 'libarchive.*\.dylib' + ;; + darwin*:zlib) + echo 'libz.*\.dylib' + ;; + msys*:libarchive|cygwin*:libarchive) + echo 'archive.*\.dll|libarchive.*\.dll' + ;; + msys*:zlib|cygwin*:zlib) + echo 'zlib1?\.dll' + ;; + *:libarchive) + echo 'Shared library: \[.*libarchive.*\.so' + ;; + *:zlib) + echo 'Shared library: \[.*libz\.so' + ;; + *) + echo >&2 "unknown logical library: $library" + exit 1 + ;; + esac +} + +verify_linkage() { + local inspect_name="$1" + local expected_linkage="$2" + local library="$3" + local candidate_blob="$4" + local inspect_file + local output_file + local pattern + + inspect_file="$(resolve_inspect_file "$inspect_name" "$candidate_blob")" + output_file="${TEST_TMPDIR:-.}/linkage-${inspect_name}-${library}-${RANDOM}.txt" + inspect_dynamic_deps "$inspect_file" "$output_file" + pattern="$(shared_pattern_for "$library")" + + if [[ "$expected_linkage" == "dynamic" ]]; then + grep -Eqi "$pattern" "$output_file" || { + echo >&2 "$inspect_name should dynamically link $library" + echo >&2 "inspect file: $inspect_file" + cat "$output_file" >&2 + rm -f "$output_file" + exit 1 + } + elif [[ "$expected_linkage" == "static" ]]; then + if grep -Eqi "$pattern" "$output_file"; then + echo >&2 "$inspect_name should statically link $library" + echo >&2 "inspect file: $inspect_file" + cat "$output_file" >&2 + rm -f "$output_file" + exit 1 + fi + else + echo >&2 "unknown linkage mode: $expected_linkage" + rm -f "$output_file" + exit 1 + fi + + rm -f "$output_file" +} + +while IFS=$'\t' read -r record inspect_name expected_linkage library candidates; do + case "$record" in + ""|"#"?*) + ;; + check) + verify_linkage "$inspect_name" "$expected_linkage" "$library" "$candidates" + ;; + *) + echo >&2 "unknown linkage manifest record: $record" + exit 1 + ;; + esac +done <"$manifest" diff --git a/examples/integration_tests/transitive_matrix/provider_parity/BUILD.bazel b/examples/integration_tests/transitive_matrix/provider_parity/BUILD.bazel new file mode 100644 index 000000000..42e254cb3 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/provider_parity/BUILD.bazel @@ -0,0 +1,95 @@ +load("//integration_tests/transitive_matrix:provider_semantic_parity_tests.bzl", "provider_semantic_parity_test") + +ALL_SUPPORTED_PLATFORMS = select({ + "@platforms//os:linux": [], + "@platforms//os:macos": [], + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], +}) + +# Provider parity: zlib static +provider_semantic_parity_test( + name = "p001", + size = "small", + actual = "@examples_zlib//:zlib_foreign_static", + expected = "@examples_zlib//:zlib_static", + target_compatible_with = ALL_SUPPORTED_PLATFORMS, +) + +# Provider parity: zlib shared +provider_semantic_parity_test( + name = "p002", + size = "small", + actual = "@examples_zlib//:zlib_foreign_shared", + expected = "@examples_zlib//:zlib_dynamic", + target_compatible_with = ALL_SUPPORTED_PLATFORMS, +) + +# Provider parity: libarchive static -> native static zlib +provider_semantic_parity_test( + name = "p003", + size = "small", + actual = "@examples_libarchive//:libarchive_foreign_static_zlib_static", + expected = "@examples_libarchive//:libarchive_static_zlib_static", + target_compatible_with = ALL_SUPPORTED_PLATFORMS, +) + +# Provider parity: libarchive static -> foreign_cc static zlib +provider_semantic_parity_test( + name = "p004", + size = "small", + actual = "@examples_libarchive//:libarchive_foreign_static_zlib_foreign_static", + expected = "@examples_libarchive//:libarchive_static_zlib_foreign_static", + target_compatible_with = ALL_SUPPORTED_PLATFORMS, +) + +# Provider parity: libarchive static -> native shared zlib wrapper +provider_semantic_parity_test( + name = "p005", + size = "small", + actual = "@examples_libarchive//:libarchive_foreign_static_zlib_dynamic", + expected = "@examples_libarchive//:libarchive_static_zlib_dynamic", + target_compatible_with = ALL_SUPPORTED_PLATFORMS, +) + +# Provider parity: libarchive static -> foreign_cc shared zlib +provider_semantic_parity_test( + name = "p006", + size = "small", + actual = "@examples_libarchive//:libarchive_foreign_static_zlib_foreign_shared", + expected = "@examples_libarchive//:libarchive_static_zlib_foreign_shared", + target_compatible_with = ALL_SUPPORTED_PLATFORMS, +) + +# Provider parity: libarchive shared -> native shared zlib wrapper +provider_semantic_parity_test( + name = "p007", + size = "small", + actual = "@examples_libarchive//:libarchive_foreign_shared_zlib_dynamic", + expected = "@examples_libarchive//:libarchive_dynamic_zlib_dynamic", + target_compatible_with = ALL_SUPPORTED_PLATFORMS, +) + +# Provider parity: libarchive shared -> foreign_cc shared zlib +provider_semantic_parity_test( + name = "p008", + size = "small", + actual = "@examples_libarchive//:libarchive_foreign_shared_zlib_foreign_shared", + expected = "@examples_libarchive//:libarchive_dynamic_zlib_foreign_shared", + target_compatible_with = ALL_SUPPORTED_PLATFORMS, +) + +test_suite( + name = "tests", + tests = [ + ":p001", + ":p002", + ":p003", + ":p004", + ":p005", + ":p006", + ":p007", + ":p008", + ], + visibility = ["//integration_tests/transitive_matrix:__pkg__"], +) diff --git a/examples/integration_tests/transitive_matrix/provider_semantic_parity_tests.bzl b/examples/integration_tests/transitive_matrix/provider_semantic_parity_tests.bzl new file mode 100644 index 000000000..878961e20 --- /dev/null +++ b/examples/integration_tests/transitive_matrix/provider_semantic_parity_tests.bzl @@ -0,0 +1,182 @@ +"""Provider parity tests for the transitive native/foreign matrix.""" + +load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") +load("@rules_cc//cc:defs.bzl", "CcInfo") + +def _all_digits(value): + for char in value.elems(): + if char < "0" or char > "9": + return False + return bool(value) + +def _canonical_library_name(name): + lower_name = name.lower() + if lower_name in ["z.lib", "zlib.lib", "zlib1.lib", "zlib1.if.lib", "zlib_shared.if.lib"]: + return "zlib.lib" + if lower_name in ["z.dll", "zlib.dll", "zlib1.dll"]: + return "zlib.dll" + if lower_name.startswith("archive_zlib_") and lower_name.endswith(".if.lib"): + return "archive.lib" + if lower_name.startswith("libarchive_shared_zlib_") and lower_name.endswith(".if.lib"): + return "archive.lib" + if lower_name in ["archive.lib", "archive.if.lib", "libarchive_shared.if.lib"]: + return "archive.lib" + if lower_name.startswith("archive_zlib_") and lower_name.endswith(".dll"): + return "archive.dll" + if lower_name in ["archive.dll", "libarchive.dll"]: + return "archive.dll" + if lower_name.startswith("libarchive_static_zlib_") and lower_name.endswith(".lib"): + return "archive.lib" + if lower_name.startswith("liblibarchive_static_zlib_") and lower_name.endswith(".a"): + return "libarchive.a" + if name.endswith(".pic.a"): + return _canonical_library_name(name[:-len(".pic.a")] + ".a") + if lower_name.startswith("libarchive_zlib_") and ".so" in lower_name: + return "libarchive.so" + so_index = name.find(".so") + if so_index != -1: + return name[:so_index] + ".so" + if lower_name.startswith("libarchive_zlib_") and lower_name.endswith(".dylib"): + return "libarchive.dylib" + if name.endswith(".dylib"): + stem = name[:-len(".dylib")] + parts = stem.split(".") + if len(parts) > 1 and all([_all_digits(part) for part in parts[1:]]): + return parts[0] + ".dylib" + return name + +def _dedupe_sorted(values): + return sorted({value: None for value in values}.keys()) + +def _is_solib_path(short_path): + return short_path.startswith("_solib_") + +def _libraries_to_link(linking_context): + libraries = [] + user_link_flags = [] + for linker_input in linking_context.linker_inputs.to_list(): + user_link_flags.extend(linker_input.user_link_flags) + libraries.extend(linker_input.libraries) + return struct( + libraries = libraries, + user_link_flags = _dedupe_sorted(user_link_flags), + ) + +def _compilation_projection(compilation_context): + external_includes = getattr(compilation_context, "external_includes", depset()) + local_defines = getattr(compilation_context, "local_defines", depset()) + include_paths = ( + compilation_context.includes.to_list() + + compilation_context.quote_includes.to_list() + + compilation_context.system_includes.to_list() + + external_includes.to_list() + ) + return struct( + defines = _dedupe_sorted(compilation_context.defines.to_list()), + has_headers = bool(compilation_context.headers.to_list()), + has_include_paths = bool(include_paths), + local_defines = _dedupe_sorted(local_defines.to_list()), + ) + +def _library_path_shapes(libraries, library_attr, resolved_attr): + shapes = {} + for library in libraries: + library_file = getattr(library, library_attr) + resolved_file = getattr(library, resolved_attr) + if not library_file and not resolved_file: + continue + + name = _canonical_library_name( + library_file.basename if library_file else resolved_file.basename, + ) + if name not in shapes: + shapes[name] = { + "all_libraries_are_solibs": True, + "all_resolved_libraries_are_not_solibs": True, + "has_library": False, + "has_resolved_library": False, + } + + shape = shapes[name] + if library_file: + shape["has_library"] = True + if not _is_solib_path(library_file.short_path): + shape["all_libraries_are_solibs"] = False + if resolved_file: + shape["has_resolved_library"] = True + if _is_solib_path(resolved_file.short_path): + shape["all_resolved_libraries_are_not_solibs"] = False + + return [ + struct( + all_libraries_are_solibs = shapes[name]["all_libraries_are_solibs"], + all_resolved_libraries_are_not_solibs = shapes[name]["all_resolved_libraries_are_not_solibs"], + has_library = shapes[name]["has_library"], + has_resolved_library = shapes[name]["has_resolved_library"], + name = name, + ) + for name in sorted(shapes.keys()) + ] + +def _linking_projection(linking_context): + linking_inputs = _libraries_to_link(linking_context) + static_libraries = [] + dynamic_libraries = [] + interface_libraries = [] + for library in linking_inputs.libraries: + if library.static_library: + static_libraries.append(_canonical_library_name(library.static_library.basename)) + if library.pic_static_library: + static_libraries.append(_canonical_library_name(library.pic_static_library.basename)) + if library.dynamic_library: + dynamic_libraries.append(_canonical_library_name(library.dynamic_library.basename)) + if library.interface_library: + interface_libraries.append(_canonical_library_name(library.interface_library.basename)) + return struct( + dynamic_library_path_shapes = _library_path_shapes( + linking_inputs.libraries, + "dynamic_library", + "resolved_symlink_dynamic_library", + ), + dynamic_libraries = _dedupe_sorted(dynamic_libraries), + interface_library_path_shapes = _library_path_shapes( + linking_inputs.libraries, + "interface_library", + "resolved_symlink_interface_library", + ), + interface_libraries = _dedupe_sorted(interface_libraries), + static_libraries = _dedupe_sorted(static_libraries), + user_link_flags = linking_inputs.user_link_flags, + ) + +def _cc_info_projection(target): + cc_info = target[CcInfo] + return struct( + compilation = _compilation_projection(cc_info.compilation_context), + linking = _linking_projection(cc_info.linking_context), + ) + +def _provider_semantic_parity_test_impl(ctx): + env = analysistest.begin(ctx) + actual = _cc_info_projection(analysistest.target_under_test(env)) + expected = _cc_info_projection(ctx.attr.expected) + + asserts.equals(env, expected.compilation, actual.compilation, "compilation context") + asserts.equals(env, expected.linking, actual.linking, "linking context") + + return analysistest.end(env) + +_provider_semantic_parity_test = analysistest.make( + _provider_semantic_parity_test_impl, + attrs = { + "expected": attr.label(mandatory = True, providers = [CcInfo]), + }, +) + +def provider_semantic_parity_test(name, actual, expected, **kwargs): + _provider_semantic_parity_test( + name = name, + target_under_test = actual, + expected = expected, + **kwargs + ) diff --git a/examples/third_party/MODULE.bazel b/examples/third_party/MODULE.bazel index c5c763012..57ab108ec 100644 --- a/examples/third_party/MODULE.bazel +++ b/examples/third_party/MODULE.bazel @@ -71,6 +71,7 @@ use_repo( "bison", "cares", "curl", + "examples_libarchive", "examples_zlib", "expat", "flex", diff --git a/examples/third_party/libarchive/BUILD.bazel b/examples/third_party/libarchive/BUILD.bazel new file mode 100644 index 000000000..86b902380 --- /dev/null +++ b/examples/third_party/libarchive/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + +exports_files( + [ + "BUILD.libarchive.bazel", + "libarchive_config_darwin.h", + "libarchive_config_linux.h", + "libarchive_config_windows.h", + ], + visibility = ["//visibility:public"], +) + +cc_library( + name = "config_darwin", + hdrs = ["libarchive_config_darwin.h"], + includes = ["."], + visibility = ["//visibility:public"], +) + +cc_library( + name = "config_linux", + hdrs = ["libarchive_config_linux.h"], + includes = ["."], + visibility = ["//visibility:public"], +) + +cc_library( + name = "config_windows", + hdrs = ["libarchive_config_windows.h"], + includes = ["."], + visibility = ["//visibility:public"], +) diff --git a/examples/third_party/libarchive/BUILD.libarchive.bazel b/examples/third_party/libarchive/BUILD.libarchive.bazel new file mode 100644 index 000000000..84c43b0cc --- /dev/null +++ b/examples/third_party/libarchive/BUILD.libarchive.bazel @@ -0,0 +1,594 @@ +load("@rules_cc//cc:defs.bzl", "cc_import", "cc_library", "cc_shared_library") +load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake") + +package(default_visibility = ["//visibility:public"]) + +ALL_SUPPORTED_PLATFORMS = select({ + "@platforms//os:linux": [], + "@platforms//os:macos": [], + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], +}) + +LIBARCHIVE_SHARED_LIB = select({ + "@platforms//os:macos": [ + "libarchive.dylib", + "libarchive.13.dylib", + "libarchive.13.7.7.dylib", + ], + "@platforms//os:windows": ["archive.dll"], + "//conditions:default": [ + "libarchive.so", + "libarchive.so.13", + "libarchive.so.13.7.7", + ], +}) + +LIBARCHIVE_INTERFACE_LIB = select({ + "@platforms//os:windows": ["archive.lib"], + "//conditions:default": [], +}) + +LIBARCHIVE_STATIC_LIB = select({ + "@platforms//os:windows": ["archive.lib"], + "//conditions:default": ["libarchive.a"], +}) + +LIBARCHIVE_COMMON_SRCS = glob( + ["libarchive/*.c"], + exclude = [ + "libarchive/archive_disk_acl_darwin.c", + "libarchive/archive_disk_acl_freebsd.c", + "libarchive/archive_disk_acl_linux.c", + "libarchive/archive_disk_acl_sunos.c", + "libarchive/archive_entry_copy_bhfi.c", + "libarchive/archive_read_disk_windows.c", + "libarchive/archive_read_disk_posix.c", + "libarchive/archive_windows.c", + "libarchive/archive_write_disk_posix.c", + "libarchive/archive_write_disk_windows.c", + "libarchive/filter_fork_windows.c", + "libarchive/filter_fork_posix.c", + ], +) + +LIBARCHIVE_PUBLIC_HDRS = [ + "libarchive/archive.h", + "libarchive/archive_entry.h", +] + +LIBARCHIVE_PRIVATE_HDRS = glob( + ["libarchive/*.h"], + exclude = LIBARCHIVE_PUBLIC_HDRS, +) + +LIBARCHIVE_CONFIG_DEPS = select({ + "@platforms//os:macos": ["@rules_foreign_cc_examples_third_party//libarchive:config_darwin"], + "@platforms//os:windows": ["@rules_foreign_cc_examples_third_party//libarchive:config_windows"], + "//conditions:default": ["@rules_foreign_cc_examples_third_party//libarchive:config_linux"], +}) + +LIBARCHIVE_COPTS = select({ + "@platforms//os:macos": ["-DPLATFORM_CONFIG_H=\\\"libarchive_config_darwin.h\\\""], + "@platforms//os:windows": ["/DPLATFORM_CONFIG_H=\\\"libarchive_config_windows.h\\\""], + "//conditions:default": ["-DPLATFORM_CONFIG_H=\\\"libarchive_config_linux.h\\\""], +}) + select({ + "@platforms//os:windows": [], + "//conditions:default": [ + "-Wno-deprecated-non-prototype", + "-Wno-implicit-function-declaration", + "-Wno-unused-function", + "-Wno-unused-variable", + ], +}) + +LIBARCHIVE_STATIC_DEFINES = select({ + "@platforms//os:windows": ["LIBARCHIVE_STATIC"], + "//conditions:default": [], +}) + +LIBARCHIVE_SRCS = select({ + "@platforms//os:macos": LIBARCHIVE_COMMON_SRCS + [ + "libarchive/archive_disk_acl_darwin.c", + "libarchive/archive_read_disk_posix.c", + "libarchive/archive_write_disk_posix.c", + "libarchive/filter_fork_posix.c", + ], + "@platforms//os:windows": LIBARCHIVE_COMMON_SRCS + [ + "libarchive/archive_read_disk_windows.c", + "libarchive/archive_windows.c", + "libarchive/archive_write_disk_windows.c", + "libarchive/filter_fork_windows.c", + ], + "//conditions:default": LIBARCHIVE_COMMON_SRCS + [ + "libarchive/archive_read_disk_posix.c", + "libarchive/archive_write_disk_posix.c", + "libarchive/filter_fork_posix.c", + ], +}) + +LIBARCHIVE_STATIC_COPTS = LIBARCHIVE_COPTS + [ + "-DLIBARCHIVE_STATIC", +] + +LIBARCHIVE_SHARED_FEATURES = select({ + "@platforms//os:macos": ["set_install_name"], + "@platforms//os:windows": [], + "//conditions:default": ["set_soname"], +}) + +LIBARCHIVE_CMAKE_CACHE = { + "CMAKE_BUILD_TYPE": "RELEASE", + "CMAKE_POLICY_DEFAULT_CMP0074": "NEW", + "CMAKE_POLICY_VERSION_MINIMUM": "3.5", + "ENABLE_ACL": "OFF", + "ENABLE_BZip2": "OFF", + "ENABLE_CAT": "OFF", + "ENABLE_CPIO": "OFF", + "ENABLE_EXPAT": "OFF", + "ENABLE_ICONV": "OFF", + "ENABLE_INSTALL": "ON", + "ENABLE_LIBB2": "OFF", + "ENABLE_LIBXML2": "OFF", + "ENABLE_LZ4": "OFF", + "ENABLE_LZMA": "OFF", + "ENABLE_LZO": "OFF", + "ENABLE_MBEDTLS": "OFF", + "ENABLE_NETTLE": "OFF", + "ENABLE_OPENSSL": "OFF", + "ENABLE_PCRE2POSIX": "OFF", + "ENABLE_PCREPOSIX": "OFF", + "ENABLE_TAR": "OFF", + "ENABLE_TEST": "OFF", + "ENABLE_UNZIP": "OFF", + "ENABLE_XATTR": "OFF", + "ENABLE_ZLIB": "ON", + "ENABLE_ZSTD": "OFF", +} + +LIBARCHIVE_STATIC_CMAKE_CACHE = dict(LIBARCHIVE_CMAKE_CACHE.items() + { + "BUILD_SHARED_LIBS": "OFF", +}.items()) + +LIBARCHIVE_SHARED_CMAKE_CACHE = dict(LIBARCHIVE_CMAKE_CACHE.items() + { + "BUILD_SHARED_LIBS": "ON", +}.items()) + +filegroup( + name = "all_srcs", + srcs = glob( + include = ["**"], + exclude = ["*.bazel"], + ), +) + +cc_library( + name = "libarchive_headers", + hdrs = LIBARCHIVE_PUBLIC_HDRS, + includes = ["libarchive"], + linkstatic = True, +) + +cc_library( + name = "libarchive_static_zlib_static", + srcs = LIBARCHIVE_SRCS + LIBARCHIVE_PRIVATE_HDRS, + hdrs = LIBARCHIVE_PUBLIC_HDRS, + copts = LIBARCHIVE_STATIC_COPTS, + defines = LIBARCHIVE_STATIC_DEFINES, + implementation_deps = LIBARCHIVE_CONFIG_DEPS, + includes = ["libarchive"], + linkstatic = True, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_static"], +) + +cc_library( + name = "libarchive_static_zlib_foreign_static", + srcs = LIBARCHIVE_SRCS + LIBARCHIVE_PRIVATE_HDRS, + hdrs = LIBARCHIVE_PUBLIC_HDRS, + copts = LIBARCHIVE_STATIC_COPTS, + defines = LIBARCHIVE_STATIC_DEFINES, + implementation_deps = LIBARCHIVE_CONFIG_DEPS, + includes = ["libarchive"], + linkstatic = True, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_foreign_static"], +) + +cc_library( + name = "libarchive_static_zlib_dynamic", + srcs = LIBARCHIVE_SRCS + LIBARCHIVE_PRIVATE_HDRS, + hdrs = LIBARCHIVE_PUBLIC_HDRS, + copts = LIBARCHIVE_STATIC_COPTS, + defines = LIBARCHIVE_STATIC_DEFINES, + implementation_deps = LIBARCHIVE_CONFIG_DEPS, + includes = ["libarchive"], + linkstatic = True, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_dynamic"], +) + +cc_library( + name = "libarchive_static_zlib_foreign_shared", + srcs = LIBARCHIVE_SRCS + LIBARCHIVE_PRIVATE_HDRS, + hdrs = LIBARCHIVE_PUBLIC_HDRS, + copts = LIBARCHIVE_STATIC_COPTS, + defines = LIBARCHIVE_STATIC_DEFINES, + implementation_deps = LIBARCHIVE_CONFIG_DEPS, + includes = ["libarchive"], + linkstatic = True, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_foreign_shared"], +) + +cc_library( + name = "libarchive_impl_zlib_static", + srcs = LIBARCHIVE_SRCS + LIBARCHIVE_PRIVATE_HDRS, + hdrs = LIBARCHIVE_PUBLIC_HDRS, + copts = LIBARCHIVE_COPTS, + implementation_deps = LIBARCHIVE_CONFIG_DEPS, + includes = ["libarchive"], + linkstatic = True, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_static"], +) + +cc_library( + name = "libarchive_impl_zlib_foreign_static", + srcs = LIBARCHIVE_SRCS + LIBARCHIVE_PRIVATE_HDRS, + hdrs = LIBARCHIVE_PUBLIC_HDRS, + copts = LIBARCHIVE_COPTS, + implementation_deps = LIBARCHIVE_CONFIG_DEPS, + includes = ["libarchive"], + linkstatic = True, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_foreign_static"], +) + +cc_library( + name = "libarchive_impl_zlib_dynamic", + srcs = LIBARCHIVE_SRCS + LIBARCHIVE_PRIVATE_HDRS, + hdrs = LIBARCHIVE_PUBLIC_HDRS, + copts = LIBARCHIVE_COPTS, + implementation_deps = LIBARCHIVE_CONFIG_DEPS, + includes = ["libarchive"], + linkstatic = True, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_dynamic_headers"], +) + +cc_library( + name = "libarchive_impl_zlib_foreign_shared", + srcs = LIBARCHIVE_SRCS + LIBARCHIVE_PRIVATE_HDRS, + hdrs = LIBARCHIVE_PUBLIC_HDRS, + copts = LIBARCHIVE_COPTS, + implementation_deps = LIBARCHIVE_CONFIG_DEPS, + includes = ["libarchive"], + linkstatic = True, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_foreign_shared"], +) + +cc_shared_library( + name = "libarchive_shared_zlib_static", + features = LIBARCHIVE_SHARED_FEATURES, + shared_lib_name = select({ + "@platforms//os:macos": "libarchive_zlib_static.dylib", + "@platforms//os:windows": "archive_zlib_static.dll", + "//conditions:default": "libarchive_zlib_static.so", + }), + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = [":libarchive_impl_zlib_static"], +) + +filegroup( + name = "libarchive_shared_zlib_static_interface_library", + srcs = [":libarchive_shared_zlib_static"], + output_group = "interface_library", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_import( + name = "libarchive_shared_zlib_static_import", + interface_library = ":libarchive_shared_zlib_static_interface_library", + shared_library = ":libarchive_shared_zlib_static", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_library( + name = "libarchive_dynamic_zlib_static", + srcs = select({ + "@platforms//os:windows": [], + "//conditions:default": [":libarchive_shared_zlib_static"], + }), + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = [":libarchive_headers"] + select({ + "@platforms//os:windows": [":libarchive_shared_zlib_static_import"], + "//conditions:default": [], + }), +) + +cc_shared_library( + name = "libarchive_shared_zlib_foreign_static", + features = LIBARCHIVE_SHARED_FEATURES, + shared_lib_name = select({ + "@platforms//os:macos": "libarchive_zlib_foreign_static.dylib", + "@platforms//os:windows": "archive_zlib_foreign_static.dll", + "//conditions:default": "libarchive_zlib_foreign_static.so", + }), + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = [":libarchive_impl_zlib_foreign_static"], +) + +filegroup( + name = "libarchive_shared_zlib_foreign_static_interface_library", + srcs = [":libarchive_shared_zlib_foreign_static"], + output_group = "interface_library", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_import( + name = "libarchive_shared_zlib_foreign_static_import", + interface_library = ":libarchive_shared_zlib_foreign_static_interface_library", + shared_library = ":libarchive_shared_zlib_foreign_static", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_library( + name = "libarchive_dynamic_zlib_foreign_static", + srcs = select({ + "@platforms//os:windows": [], + "//conditions:default": [":libarchive_shared_zlib_foreign_static"], + }), + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = [":libarchive_headers"] + select({ + "@platforms//os:windows": [":libarchive_shared_zlib_foreign_static_import"], + "//conditions:default": [], + }), +) + +cc_shared_library( + name = "libarchive_shared_zlib_dynamic", + dynamic_deps = ["@examples_zlib//:zlib_shared"], + features = LIBARCHIVE_SHARED_FEATURES, + shared_lib_name = select({ + "@platforms//os:macos": "libarchive_zlib_dynamic.dylib", + "@platforms//os:windows": "archive_zlib_dynamic.dll", + "//conditions:default": "libarchive_zlib_dynamic.so", + }), + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = [":libarchive_impl_zlib_dynamic"], +) + +filegroup( + name = "libarchive_shared_zlib_dynamic_interface_library", + srcs = [":libarchive_shared_zlib_dynamic"], + output_group = "interface_library", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_import( + name = "libarchive_shared_zlib_dynamic_import", + interface_library = ":libarchive_shared_zlib_dynamic_interface_library", + shared_library = ":libarchive_shared_zlib_dynamic", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_library( + name = "libarchive_dynamic_zlib_dynamic", + srcs = select({ + "@platforms//os:windows": [], + "//conditions:default": [":libarchive_shared_zlib_dynamic"], + }), + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = [ + ":libarchive_headers", + "@examples_zlib//:zlib_dynamic", + ] + select({ + "@platforms//os:windows": [":libarchive_shared_zlib_dynamic_import"], + "//conditions:default": [], + }), +) + +cc_shared_library( + name = "libarchive_shared_zlib_foreign_shared", + features = LIBARCHIVE_SHARED_FEATURES, + shared_lib_name = select({ + "@platforms//os:macos": "libarchive_zlib_foreign_shared.dylib", + "@platforms//os:windows": "archive_zlib_foreign_shared.dll", + "//conditions:default": "libarchive_zlib_foreign_shared.so", + }), + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = [":libarchive_impl_zlib_foreign_shared"], +) + +filegroup( + name = "libarchive_shared_zlib_foreign_shared_interface_library", + srcs = [":libarchive_shared_zlib_foreign_shared"], + output_group = "interface_library", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_import( + name = "libarchive_shared_zlib_foreign_shared_import", + interface_library = ":libarchive_shared_zlib_foreign_shared_interface_library", + shared_library = ":libarchive_shared_zlib_foreign_shared", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_library( + name = "libarchive_dynamic_zlib_foreign_shared", + srcs = select({ + "@platforms//os:windows": [], + "//conditions:default": [":libarchive_shared_zlib_foreign_shared"], + }), + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = [ + ":libarchive_headers", + "@examples_zlib//:zlib_foreign_shared", + ] + select({ + "@platforms//os:windows": [":libarchive_shared_zlib_foreign_shared_import"], + "//conditions:default": [], + }), +) + +cmake( + name = "libarchive_foreign_static_zlib_static", + cache_entries = select({ + "@platforms//os:windows": dict(LIBARCHIVE_STATIC_CMAKE_CACHE.items() + { + "ZLIB_INCLUDE_DIR": "$$EXT_BUILD_DEPS/include", + "ZLIB_LIBRARY": "$$EXT_BUILD_DEPS/lib/z.lib", + }.items()), + "//conditions:default": dict(LIBARCHIVE_STATIC_CMAKE_CACHE.items() + { + "CMAKE_C_FLAGS": "$${CMAKE_C_FLAGS:-} -fPIC", + "ZLIB_ROOT": "$$EXT_BUILD_DEPS/zlib_static", + }.items()), + }), + defines = select({ + "@platforms//os:windows": ["LIBARCHIVE_STATIC"], + "//conditions:default": [], + }), + lib_source = ":all_srcs", + out_static_libs = LIBARCHIVE_STATIC_LIB, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_static"], +) + +cmake( + name = "libarchive_foreign_static_zlib_foreign_static", + cache_entries = dict(LIBARCHIVE_STATIC_CMAKE_CACHE.items() + { + "CMAKE_C_FLAGS": "$${CMAKE_C_FLAGS:-} -fPIC", + "ZLIB_ROOT": "$$EXT_BUILD_DEPS/zlib", + }.items()), + defines = select({ + "@platforms//os:windows": ["LIBARCHIVE_STATIC"], + "//conditions:default": [], + }), + lib_source = ":all_srcs", + out_static_libs = LIBARCHIVE_STATIC_LIB, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_foreign_static"], +) + +cmake( + name = "libarchive_foreign_static_zlib_dynamic", + cache_entries = select({ + "@platforms//os:windows": dict(LIBARCHIVE_STATIC_CMAKE_CACHE.items() + { + "CMAKE_C_FLAGS": "$${CMAKE_C_FLAGS:-} -fPIC", + "ZLIB_INCLUDE_DIR": "$$EXT_BUILD_DEPS/include", + "ZLIB_LIBRARY": "$$EXT_BUILD_DEPS/include/zlib_shared.if.lib", + }.items()), + "//conditions:default": dict(LIBARCHIVE_STATIC_CMAKE_CACHE.items() + { + "CMAKE_C_FLAGS": "$${CMAKE_C_FLAGS:-} -fPIC", + "ZLIB_ROOT": "$$EXT_BUILD_DEPS/zlib_dynamic", + }.items()), + }), + defines = select({ + "@platforms//os:windows": ["LIBARCHIVE_STATIC"], + "//conditions:default": [], + }), + lib_source = ":all_srcs", + out_static_libs = LIBARCHIVE_STATIC_LIB, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_dynamic"], +) + +cmake( + name = "libarchive_foreign_static_zlib_foreign_shared", + cache_entries = dict(LIBARCHIVE_STATIC_CMAKE_CACHE.items() + { + "CMAKE_C_FLAGS": "$${CMAKE_C_FLAGS:-} -fPIC", + "ZLIB_ROOT": "$$EXT_BUILD_DEPS/zlib_foreign_shared", + }.items()), + defines = select({ + "@platforms//os:windows": ["LIBARCHIVE_STATIC"], + "//conditions:default": [], + }), + lib_source = ":all_srcs", + out_static_libs = LIBARCHIVE_STATIC_LIB, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_foreign_shared"], +) + +cmake( + name = "libarchive_foreign_shared_zlib_static", + cache_entries = select({ + "@platforms//os:windows": dict(LIBARCHIVE_SHARED_CMAKE_CACHE.items() + { + "ZLIB_INCLUDE_DIR": "$$EXT_BUILD_DEPS/include", + "ZLIB_LIBRARY": "$$EXT_BUILD_DEPS/lib/z.lib", + }.items()), + "//conditions:default": dict(LIBARCHIVE_SHARED_CMAKE_CACHE.items() + { + "ZLIB_ROOT": "$$EXT_BUILD_DEPS/zlib_static", + }.items()), + }), + lib_source = ":all_srcs", + out_interface_libs = LIBARCHIVE_INTERFACE_LIB, + out_shared_libs = LIBARCHIVE_SHARED_LIB, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_static"], +) + +cmake( + name = "libarchive_foreign_shared_zlib_foreign_static", + cache_entries = dict(LIBARCHIVE_SHARED_CMAKE_CACHE.items() + { + "ZLIB_ROOT": "$$EXT_BUILD_DEPS/zlib", + }.items()), + lib_source = ":all_srcs", + out_interface_libs = LIBARCHIVE_INTERFACE_LIB, + out_shared_libs = LIBARCHIVE_SHARED_LIB, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_foreign_static"], +) + +cmake( + name = "libarchive_foreign_shared_zlib_dynamic", + cache_entries = select({ + "@platforms//os:windows": dict(LIBARCHIVE_SHARED_CMAKE_CACHE.items() + { + "ZLIB_INCLUDE_DIR": "$$EXT_BUILD_DEPS/include", + "ZLIB_LIBRARY": "$$EXT_BUILD_DEPS/include/zlib_shared.if.lib", + }.items()), + "//conditions:default": dict(LIBARCHIVE_SHARED_CMAKE_CACHE.items() + { + "ZLIB_ROOT": "$$EXT_BUILD_DEPS/zlib_dynamic", + }.items()), + }), + lib_source = ":all_srcs", + out_interface_libs = LIBARCHIVE_INTERFACE_LIB, + out_shared_libs = LIBARCHIVE_SHARED_LIB, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_dynamic"], +) + +cmake( + name = "libarchive_foreign_shared_zlib_foreign_shared", + cache_entries = dict(LIBARCHIVE_SHARED_CMAKE_CACHE.items() + { + "ZLIB_ROOT": "$$EXT_BUILD_DEPS/zlib_foreign_shared", + }.items()), + lib_source = ":all_srcs", + out_interface_libs = LIBARCHIVE_INTERFACE_LIB, + out_shared_libs = LIBARCHIVE_SHARED_LIB, + target_compatible_with = ALL_SUPPORTED_PLATFORMS, + deps = ["@examples_zlib//:zlib_foreign_shared"], +) diff --git a/examples/third_party/libarchive/libarchive_config_darwin.h b/examples/third_party/libarchive/libarchive_config_darwin.h new file mode 100644 index 000000000..1483589de --- /dev/null +++ b/examples/third_party/libarchive/libarchive_config_darwin.h @@ -0,0 +1,1468 @@ +/* config.h. Best-effort Darwin config for libarchive 3.7.7 native cc_library + * examples. */ +#define __LIBARCHIVE_CONFIG_H_INCLUDED 1 + +/* + * Ensure we have C99-style int64_t, etc, all defined. + */ + +/* First, we need to know if the system has already defined them. */ +#define HAVE_INT16_T +#define HAVE_INT32_T +#define HAVE_INT64_T +#define HAVE_INTMAX_T + +#define HAVE_UINT8_T +#define HAVE_UINT16_T +#define HAVE_UINT32_T +#define HAVE_UINT64_T +#define HAVE_UINTMAX_T + +/* We might have the types we want under other spellings. */ +/* #undef HAVE___INT64 */ +/* #undef HAVE_U_INT64_T */ +/* #undef HAVE_UNSIGNED___INT64 */ + +/* The sizes of various standard integer types. */ +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#define SIZEOF_LONG 8 +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_UNSIGNED_SHORT 2 +#define SIZEOF_UNSIGNED 4 +#define SIZEOF_UNSIGNED_LONG 8 +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +/* + * If we lack int64_t, define it to the first of __int64, int, long, and long + * long that exists and is the right size. + */ +#if !defined(HAVE_INT64_T) && defined(HAVE___INT64) +typedef __int64 int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZEOF_INT == 8 +typedef int int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZEOF_LONG == 8 +typedef long int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZEOF_LONG_LONG == 8 +typedef long long int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) +#error No 64-bit integer type was found. +#endif + +/* + * Similarly for int32_t + */ +#if !defined(HAVE_INT32_T) && SIZEOF_INT == 4 +typedef int int32_t; +#define HAVE_INT32_T +#endif + +#if !defined(HAVE_INT32_T) && SIZEOF_LONG == 4 +typedef long int32_t; +#define HAVE_INT32_T +#endif + +#if !defined(HAVE_INT32_T) +#error No 32-bit integer type was found. +#endif + +/* + * Similarly for int16_t + */ +#if !defined(HAVE_INT16_T) && SIZEOF_INT == 2 +typedef int int16_t; +#define HAVE_INT16_T +#endif + +#if !defined(HAVE_INT16_T) && SIZEOF_SHORT == 2 +typedef short int16_t; +#define HAVE_INT16_T +#endif + +#if !defined(HAVE_INT16_T) +#error No 16-bit integer type was found. +#endif + +/* + * Similarly for uint64_t + */ +#if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64) +typedef unsigned __int64 uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED == 8 +typedef unsigned uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED_LONG == 8 +typedef unsigned long uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED_LONG_LONG == 8 +typedef unsigned long long uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) +#error No 64-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint32_t + */ +#if !defined(HAVE_UINT32_T) && SIZEOF_UNSIGNED == 4 +typedef unsigned uint32_t; +#define HAVE_UINT32_T +#endif + +#if !defined(HAVE_UINT32_T) && SIZEOF_UNSIGNED_LONG == 4 +typedef unsigned long uint32_t; +#define HAVE_UINT32_T +#endif + +#if !defined(HAVE_UINT32_T) +#error No 32-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint16_t + */ +#if !defined(HAVE_UINT16_T) && SIZEOF_UNSIGNED == 2 +typedef unsigned uint16_t; +#define HAVE_UINT16_T +#endif + +#if !defined(HAVE_UINT16_T) && SIZEOF_UNSIGNED_SHORT == 2 +typedef unsigned short uint16_t; +#define HAVE_UINT16_T +#endif + +#if !defined(HAVE_UINT16_T) +#error No 16-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint8_t + */ +#if !defined(HAVE_UINT8_T) +typedef unsigned char uint8_t; +#define HAVE_UINT8_T +#endif + +#if !defined(HAVE_UINT8_T) +#error No 8-bit unsigned integer type was found. +#endif + +/* Define intmax_t and uintmax_t if they are not already defined. */ +#if !defined(HAVE_INTMAX_T) +typedef int64_t intmax_t; +#endif + +#if !defined(HAVE_UINTMAX_T) +typedef uint64_t uintmax_t; +#endif + +/* Define ZLIB_WINAPI if zlib was built on Visual Studio. */ +/* #undef ZLIB_WINAPI */ + +/* Darwin ACL support */ +/* #undef ARCHIVE_ACL_DARWIN */ + +/* FreeBSD ACL support */ +/* #undef ARCHIVE_ACL_FREEBSD */ + +/* FreeBSD NFSv4 ACL support */ +/* #undef ARCHIVE_ACL_FREEBSD_NFS4 */ + +/* Linux POSIX.1e ACL support via libacl */ +/* #undef ARCHIVE_ACL_LIBACL */ + +/* Linux NFSv4 ACL support via librichacl */ +/* #undef ARCHIVE_ACL_LIBRICHACL */ + +/* Solaris ACL support */ +/* #undef ARCHIVE_ACL_SUNOS */ + +/* Solaris NFSv4 ACL support */ +/* #undef ARCHIVE_ACL_SUNOS_NFS4 */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_LIBC */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_LIBSYSTEM */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_MBEDTLS */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_NETTLE */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_OPENSSL */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_WIN */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_LIBC */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_NETTLE */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_MBEDTLS */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_OPENSSL */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_LIBC */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_LIBSYSTEM */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_MBEDTLS */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_NETTLE */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_OPENSSL */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_WIN */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBC */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC2 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBC2 */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC3 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBC3 */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBSYSTEM */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_MBEDTLS */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_NETTLE */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_OPENSSL */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_WIN */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBC */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC2 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBC2 */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC3 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBC3 */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBSYSTEM */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_MBEDTLS */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_NETTLE */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_OPENSSL */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_WIN */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBC */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC2 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBC2 */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC3 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBC3 */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBSYSTEM */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_MBEDTLS */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_NETTLE */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_OPENSSL */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_WIN */ + +/* AIX xattr support */ +/* #undef ARCHIVE_XATTR_AIX */ + +/* Darwin xattr support */ +/* #undef ARCHIVE_XATTR_DARWIN */ + +/* FreeBSD xattr support */ +/* #undef ARCHIVE_XATTR_FREEBSD */ + +/* Linux xattr support */ +/* #undef ARCHIVE_XATTR_LINUX */ + +/* Version number of bsdcpio */ +#define BSDCPIO_VERSION_STRING "3.7.7" + +/* Version number of bsdtar */ +#define BSDTAR_VERSION_STRING "3.7.7" + +/* Version number of bsdcat */ +#define BSDCAT_VERSION_STRING "3.7.7" + +/* Version number of bsdunzip */ +#define BSDUNZIP_VERSION_STRING "3.7.7" + +/* Define to 1 if you have the `acl_create_entry' function. */ +/* #undef HAVE_ACL_CREATE_ENTRY */ + +/* Define to 1 if you have the `acl_get_fd_np' function. */ +/* #undef HAVE_ACL_GET_FD_NP */ + +/* Define to 1 if you have the `acl_get_link' function. */ +/* #undef HAVE_ACL_GET_LINK */ + +/* Define to 1 if you have the `acl_get_link_np' function. */ +/* #undef HAVE_ACL_GET_LINK_NP */ + +/* Define to 1 if you have the `acl_get_perm' function. */ +/* #undef HAVE_ACL_GET_PERM */ + +/* Define to 1 if you have the `acl_get_perm_np' function. */ +/* #undef HAVE_ACL_GET_PERM_NP */ + +/* Define to 1 if you have the `acl_init' function. */ +/* #undef HAVE_ACL_INIT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ACL_LIBACL_H */ + +/* Define to 1 if the system has the type `acl_permset_t'. */ +/* #undef HAVE_ACL_PERMSET_T */ + +/* Define to 1 if you have the `acl_set_fd' function. */ +/* #undef HAVE_ACL_SET_FD */ + +/* Define to 1 if you have the `acl_set_fd_np' function. */ +/* #undef HAVE_ACL_SET_FD_NP */ + +/* Define to 1 if you have the `acl_set_file' function. */ +/* #undef HAVE_ACL_SET_FILE */ + +/* Define to 1 if you have the `arc4random_buf' function. */ +/* #undef HAVE_ARC4RANDOM_BUF */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ATTR_XATTR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BCRYPT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BSDXML_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BZLIB_H */ + +/* Define to 1 if you have the `chflags' function. */ +/* #undef HAVE_CHFLAGS */ + +/* Define to 1 if you have the `chown' function. */ +#define HAVE_CHOWN 1 + +/* Define to 1 if you have the `chroot' function. */ +#define HAVE_CHROOT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_COPYFILE_H */ + +/* Define to 1 if you have the `ctime_r' function. */ +#define HAVE_CTIME_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the `cygwin_conv_path' function. */ +/* #undef HAVE_CYGWIN_CONV_PATH */ + +/* Define to 1 if you have the declaration of `ACE_GETACL', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACE_GETACL */ + +/* Define to 1 if you have the declaration of `ACE_GETACLCNT', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACE_GETACLCNT */ + +/* Define to 1 if you have the declaration of `ACE_SETACL', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACE_SETACL */ + +/* Define to 1 if you have the declaration of `ACL_SYNCHRONIZE', and to 0 if + you don't. */ +/* #undef HAVE_DECL_ACL_SYNCHRONIZE */ + +/* Define to 1 if you have the declaration of `ACL_TYPE_EXTENDED', and to 0 if + you don't. */ +/* #undef HAVE_DECL_ACL_TYPE_EXTENDED */ + +/* Define to 1 if you have the declaration of `ACL_TYPE_NFS4', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACL_TYPE_NFS4 */ + +/* Define to 1 if you have the declaration of `ACL_USER', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACL_USER */ + +/* Define to 1 if you have the declaration of `INT32_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_INT32_MAX 1 + +/* Define to 1 if you have the declaration of `INT32_MIN', and to 0 if you + don't. */ +#define HAVE_DECL_INT32_MIN 1 + +/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_INT64_MAX 1 + +/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you + don't. */ +#define HAVE_DECL_INT64_MIN 1 + +/* Define to 1 if you have the declaration of `INTMAX_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_INTMAX_MAX 1 + +/* Define to 1 if you have the declaration of `INTMAX_MIN', and to 0 if you + don't. */ +#define HAVE_DECL_INTMAX_MIN 1 + +/* Define to 1 if you have the declaration of `SETACL', and to 0 if you don't. + */ +/* #undef HAVE_DECL_SETACL */ + +/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_SIZE_MAX 1 + +/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_SSIZE_MAX 1 + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_R 1 + +/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_UINT32_MAX 1 + +/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_UINT64_MAX 1 + +/* Define to 1 if you have the declaration of `UINTMAX_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_UINTMAX_MAX 1 + +/* Define to 1 if you have the declaration of `XATTR_NOFOLLOW', and to 0 if + you don't. */ +/* #undef HAVE_DECL_XATTR_NOFOLLOW */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DIRECT_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the `dirfd' function. */ +#define HAVE_DIRFD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if nl_langinfo supports D_MD_ORDER */ +/* #undef HAVE_D_MD_ORDER */ + +/* A possible errno value for invalid file format errors */ +/* #undef HAVE_EFTYPE */ + +/* A possible errno value for invalid file format errors */ +#define HAVE_EILSEQ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_EXPAT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_EXT2FS_EXT2_FS_H */ + +/* Define to 1 if you have the `extattr_get_file' function. */ +/* #undef HAVE_EXTATTR_GET_FILE */ + +/* Define to 1 if you have the `extattr_list_file' function. */ +/* #undef HAVE_EXTATTR_LIST_FILE */ + +/* Define to 1 if you have the `extattr_set_fd' function. */ +/* #undef HAVE_EXTATTR_SET_FD */ + +/* Define to 1 if you have the `extattr_set_file' function. */ +/* #undef HAVE_EXTATTR_SET_FILE */ + +/* Define to 1 if EXTATTR_NAMESPACE_USER is defined in sys/extattr.h. */ +/* #undef HAVE_DECL_EXTATTR_NAMESPACE_USER */ + +/* Define to 1 if you have the declaration of `GETACL', and to 0 if you don't. + */ +/* #undef HAVE_DECL_GETACL */ + +/* Define to 1 if you have the declaration of `GETACLCNT', and to 0 if you + don't. */ +/* #undef HAVE_DECL_GETACLCNT */ + +/* Define to 1 if you have the `fchdir' function. */ +#define HAVE_FCHDIR 1 + +/* Define to 1 if you have the `fchflags' function. */ +/* #undef HAVE_FCHFLAGS */ + +/* Define to 1 if you have the `fchmod' function. */ +#define HAVE_FCHMOD 1 + +/* Define to 1 if you have the `fchown' function. */ +#define HAVE_FCHOWN 1 + +/* Define to 1 if you have the `fcntl' function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fdopendir' function. */ +#define HAVE_FDOPENDIR 1 + +/* Define to 1 if you have the `fgetea' function. */ +/* #undef HAVE_FGETEA */ + +/* Define to 1 if you have the `fgetxattr' function. */ +/* #undef HAVE_FGETXATTR */ + +/* Define to 1 if you have the `flistea' function. */ +/* #undef HAVE_FLISTEA */ + +/* Define to 1 if you have the `flistxattr' function. */ +/* #undef HAVE_FLISTXATTR */ + +/* Define to 1 if you have the `fnmatch' function. */ +#define HAVE_FNMATCH 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FNMATCH_H 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the `fsetea' function. */ +/* #undef HAVE_FSETEA */ + +/* Define to 1 if you have the `fsetxattr' function. */ +/* #undef HAVE_FSETXATTR */ + +/* Define to 1 if you have the `fstat' function. */ +#define HAVE_FSTAT 1 + +/* Define to 1 if you have the `fstatat' function. */ +#define HAVE_FSTATAT 1 + +/* Define to 1 if you have the `fstatfs' function. */ +#define HAVE_FSTATFS 1 + +/* Define to 1 if you have the `fstatvfs' function. */ +#define HAVE_FSTATVFS 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `futimens' function. */ +#define HAVE_FUTIMENS 1 + +/* Define to 1 if you have the `futimes' function. */ +#define HAVE_FUTIMES 1 + +/* Define to 1 if you have the `futimesat' function. */ +#define HAVE_FUTIMESAT 1 + +/* Define to 1 if you have the `getea' function. */ +/* #undef HAVE_GETEA */ + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `getgrgid_r' function. */ +#define HAVE_GETGRGID_R 1 + +/* Define to 1 if you have the `getgrnam_r' function. */ +#define HAVE_GETGRNAM_R 1 + +/* Define to 1 if you have the `getline' function. */ +#define HAVE_GETLINE 1 + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 + +/* Define to 1 if you have the `getpwnam_r' function. */ +#define HAVE_GETPWNAM_R 1 + +/* Define to 1 if you have the `getpwuid_r' function. */ +#define HAVE_GETPWUID_R 1 + +/* Define to 1 if you have the `getvfsbyname' function. */ +/* #undef HAVE_GETVFSBYNAME */ + +/* Define to 1 if you have the `getxattr' function. */ +/* #undef HAVE_GETXATTR */ + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GRP_H 1 + +/* Define to 1 if you have the `iconv' function. */ +/* #undef HAVE_ICONV */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ICONV_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LANGINFO_H 1 + +/* Define to 1 if you have the `lchflags' function. */ +/* #undef HAVE_LCHFLAGS */ + +/* Define to 1 if you have the `lchmod' function. */ +#define HAVE_LCHMOD 1 + +/* Define to 1 if you have the `lchown' function. */ +#define HAVE_LCHOWN 1 + +/* Define to 1 if you have the `lgetea' function. */ +/* #undef HAVE_LGETEA */ + +/* Define to 1 if you have the `lgetxattr' function. */ +/* #undef HAVE_LGETXATTR */ + +/* Define to 1 if you have the `acl' library (-lacl). */ +/* #undef HAVE_LIBACL */ + +/* Define to 1 if you have the `attr' library (-lattr). */ +/* #undef HAVE_LIBATTR */ + +/* Define to 1 if you have the `bsdxml' library (-lbsdxml). */ +/* #undef HAVE_LIBBSDXML */ + +/* Define to 1 if you have the `bz2' library (-lbz2). */ +/* #undef HAVE_LIBBZ2 */ + +/* Define to 1 if you have the `b2' library (-lb2). */ +/* #undef HAVE_LIBB2 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BLAKE2_H */ + +/* Define to 1 if you have the `charset' library (-lcharset). */ +/* #undef HAVE_LIBCHARSET */ + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +/* #undef HAVE_LIBCRYPTO */ + +/* Define to 1 if you have the `expat' library (-lexpat). */ +/* #undef HAVE_LIBEXPAT */ + +/* Define to 1 if you have the `gcc' library (-lgcc). */ +/* #undef HAVE_LIBGCC */ + +/* Define to 1 if you have the `lz4' library (-llz4). */ +/* #undef HAVE_LIBLZ4 */ + +/* Define to 1 if you have the `lzma' library (-llzma). */ +/* #undef HAVE_LIBLZMA */ + +/* Define to 1 if you have the `lzmadec' library (-llzmadec). */ +/* #undef HAVE_LIBLZMADEC */ + +/* Define to 1 if you have the `lzo2' library (-llzo2). */ +/* #undef HAVE_LIBLZO2 */ + +/* Define to 1 if you have the `mbedcrypto' library (-lmbedcrypto). */ +/* #undef HAVE_LIBMBEDCRYPTO */ + +/* Define to 1 if you have the `nettle' library (-lnettle). */ +/* #undef HAVE_LIBNETTLE */ + +/* Define to 1 if you have the `pcre' library (-lpcre). */ +/* #undef HAVE_LIBPCRE */ + +/* Define to 1 if you have the `pcreposix' library (-lpcreposix). */ +/* #undef HAVE_LIBPCREPOSIX */ + +/* Define to 1 if you have the `pcre2-8' library (-lpcre2-8). */ +/* #undef HAVE_LIBPCRE2 */ + +/* Define to 1 if you have the `pcreposix' library (-lpcre2posix). */ +/* #undef HAVE_LIBPCRE2POSIX */ + +/* Define to 1 if you have the `xml2' library (-lxml2). */ +/* #undef HAVE_LIBXML2 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBXML_XMLREADER_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBXML_XMLWRITER_H */ + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the `zstd' library (-lzstd). */ +/* #undef HAVE_LIBZSTD */ + +/* Define to 1 if you have the ZSTD_compressStream function. */ +/* #undef HAVE_ZSTD_compressStream */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `link' function. */ +#define HAVE_LINK 1 + +/* Define to 1 if you have the `linkat' function. */ +#define HAVE_LINKAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_FIEMAP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_FS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_MAGIC_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_TYPES_H 1 + +/* Define to 1 if you have the `listea' function. */ +/* #undef HAVE_LISTEA */ + +/* Define to 1 if you have the `listxattr' function. */ +/* #undef HAVE_LISTXATTR */ + +/* Define to 1 if you have the `llistea' function. */ +/* #undef HAVE_LLISTEA */ + +/* Define to 1 if you have the `llistxattr' function. */ +/* #undef HAVE_LLISTXATTR */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LOCALCHARSET_H */ + +/* Define to 1 if you have the `locale_charset' function. */ +/* #undef HAVE_LOCALE_CHARSET */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if the system has the type `long long int'. */ +/* #undef HAVE_LONG_LONG_INT */ + +/* Define to 1 if you have the `lsetea' function. */ +/* #undef HAVE_LSETEA */ + +/* Define to 1 if you have the `lsetxattr' function. */ +/* #undef HAVE_LSETXATTR */ + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if `lstat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the `lutimes' function. */ +#define HAVE_LUTIMES 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZ4HC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZ4_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZMADEC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZMA_H */ + +/* Define to 1 if you have a working `lzma_stream_encoder_mt' function. */ +/* #undef HAVE_LZMA_STREAM_ENCODER_MT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZO_LZO1X_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZO_LZOCONF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MBEDTLS_AES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MBEDTLS_MD_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MBEDTLS_PKCS5_H */ + +/* Define to 1 if you have the `mbrtowc' function. */ +#define HAVE_MBRTOWC 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MEMBERSHIP_H */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkdir' function. */ +#define HAVE_MKDIR 1 + +/* Define to 1 if you have the `mkfifo' function. */ +#define HAVE_MKFIFO 1 + +/* Define to 1 if you have the `mknod' function. */ +#define HAVE_MKNOD 1 + +/* Define to 1 if you have the `mkstemp' function. */ +#define HAVE_MKSTEMP 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_AES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_HMAC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_MD5_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_PBKDF2_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_RIPEMD160_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_SHA_H */ + +/* Define to 1 if you have the `nl_langinfo' function. */ +#define HAVE_NL_LANGINFO 1 + +/* Define to 1 if you have the `openat' function. */ +#define HAVE_OPENAT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_EVP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PATHS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PCREPOSIX_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PCRE2POSIX_H */ + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* Define to 1 if you have the `PKCS5_PBKDF2_HMAC_SHA1' function. */ +/* #undef HAVE_PKCS5_PBKDF2_HMAC_SHA1 */ + +/* Define to 1 if you have the `poll' function. */ +#define HAVE_POLL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_POLL_H 1 + +/* Define to 1 if you have the `posix_spawnp' function. */ +#define HAVE_POSIX_SPAWNP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PROCESS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `readdir_r' function. */ +#define HAVE_READDIR_R 1 + +/* Define to 1 if you have the `readlink' function. */ +#define HAVE_READLINK 1 + +/* Define to 1 if you have the `readlinkat' function. */ +#define HAVE_READLINKAT 1 + +/* Define to 1 if you have the `readpassphrase' function. */ +/* #undef HAVE_READPASSPHRASE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_READPASSPHRASE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_REGEX_H 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SPAWN_H 1 + +/* Define to 1 if you have the `statfs' function. */ +#define HAVE_STATFS 1 + +/* Define to 1 if you have the `statvfs' function. */ +#define HAVE_STATVFS 1 + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_STAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strnlen' function. */ +#define HAVE_STRNLEN 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if the system has the type `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS */ + +/* Define to 1 if `f_iosize' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_IOSIZE */ + +/* Define to 1 if `f_namemax' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_NAMEMAX */ + +/* Define to 1 if `f_iosize' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_IOSIZE */ + +/* Define to 1 if `st_birthtime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */ + +/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if `st_flags' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_FLAGS */ + +/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_mtime_n' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIME_N */ + +/* Define to 1 if `st_mtime_usec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIME_USEC */ + +/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 + +/* Define to 1 if `st_umtime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_UMTIME */ + +/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */ +#define HAVE_STRUCT_TM_TM_GMTOFF 1 + +/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM___TM_GMTOFF */ + +/* Define to 1 if you have `struct vfsconf'. */ +/* #undef HAVE_STRUCT_VFSCONF */ + +/* Define to 1 if you have `struct xvfsconf'. */ +/* #undef HAVE_STRUCT_XVFSCONF */ + +/* Define to 1 if you have the `symlink' function. */ +#define HAVE_SYMLINK 1 + +/* Define to 1 if you have the `sysconf' function. */ +#define HAVE_SYSCONF 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ACL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_CDEFS_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EA_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EXTATTR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MOUNT_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_RICHACL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSMACROS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UTIME_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTSNAME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_VFS_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_XATTR_H 1 + +/* Define to 1 if you have the `timegm' function. */ +#define HAVE_TIMEGM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the `tzset' function. */ +#define HAVE_TZSET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unlinkat' function. */ +#define HAVE_UNLINKAT 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#define HAVE_UNSETENV 1 + +/* Define to 1 if the system has the type `unsigned long long'. */ +/* #undef HAVE_UNSIGNED_LONG_LONG */ + +/* Define to 1 if the system has the type `unsigned long long int'. */ +/* #undef HAVE_UNSIGNED_LONG_LONG_INT */ + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the `utimensat' function. */ +#define HAVE_UTIMENSAT 1 + +/* Define to 1 if you have the `utimes' function. */ +#define HAVE_UTIMES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if you have the `vfork' function. */ +#define HAVE_VFORK 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if the system has the type `wchar_t'. */ +#define HAVE_WCHAR_T 1 + +/* Define to 1 if you have the `wcrtomb' function. */ +#define HAVE_WCRTOMB 1 + +/* Define to 1 if you have the `wcscmp' function. */ +#define HAVE_WCSCMP 1 + +/* Define to 1 if you have the `wcscpy' function. */ +#define HAVE_WCSCPY 1 + +/* Define to 1 if you have the `wcslen' function. */ +#define HAVE_WCSLEN 1 + +/* Define to 1 if you have the `wctomb' function. */ +#define HAVE_WCTOMB 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCTYPE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINCRYPT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINIOCTL_H */ + +/* Define to 1 if you have _CrtSetReportMode in */ +/* #undef HAVE__CrtSetReportMode */ + +/* Define to 1 if you have the `wmemcmp' function. */ +#define HAVE_WMEMCMP 1 + +/* Define to 1 if you have the `wmemcpy' function. */ +#define HAVE_WMEMCPY 1 + +/* Define to 1 if you have the `wmemmove' function. */ +#define HAVE_WMEMMOVE 1 + +/* Define to 1 if you have a working EXT2_IOC_GETFLAGS */ +/* #undef HAVE_WORKING_EXT2_IOC_GETFLAGS */ + +/* Define to 1 if you have a working FS_IOC_GETFLAGS */ +#define HAVE_WORKING_FS_IOC_GETFLAGS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ZLIB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ZSTD_H */ + +/* Define to 1 if you have the `ctime_s' function. */ +/* #undef HAVE_CTIME_S */ + +/* Define to 1 if you have the `_fseeki64' function. */ +/* #undef HAVE__FSEEKI64 */ + +/* Define to 1 if you have the `_get_timezone' function. */ +/* #undef HAVE__GET_TIMEZONE */ + +/* Define to 1 if you have the `gmtime_s' function. */ +/* #undef HAVE_GMTIME_S */ + +/* Define to 1 if you have the `localtime_s' function. */ +/* #undef HAVE_LOCALTIME_S */ + +/* Define to 1 if you have the `_mkgmtime' function. */ +/* #undef HAVE__MKGMTIME */ + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST + +/* Version number of libarchive as a single integer */ +#define LIBARCHIVE_VERSION_NUMBER "3007007" + +/* Version number of libarchive */ +#define LIBARCHIVE_VERSION_STRING "3.7.7" + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +/* #undef LSTAT_FOLLOWS_SLASHED_SYMLINK */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +#define MAJOR_IN_SYSMACROS 1 + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T 4 + +/* Define to 1 if strerror_r returns char *. */ +/* #undef STRERROR_R_CHAR_P */ + +/* Define to 1 if you can safely include both and . */ +/* #undef TIME_WITH_SYS_TIME */ + +/* + * Some platform requires a macro to use extension functions. + */ +#define SAFE_TO_DEFINE_EXTENSIONS 1 +#ifdef SAFE_TO_DEFINE_EXTENSIONS +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +#define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +#define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +#define __EXTENSIONS__ 1 +#endif +#endif /* SAFE_TO_DEFINE_EXTENSIONS */ + +/* Version number of package */ +#define VERSION "3.7.7" + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to control Windows SDK version */ +#ifndef NTDDI_VERSION +/* #undef NTDDI_VERSION */ +#endif // NTDDI_VERSION + +#ifndef _WIN32_WINNT +/* #undef _WIN32_WINNT */ +#endif // _WIN32_WINNT + +#ifndef WINVER +/* #undef WINVER */ +#endif // WINVER + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Define to `unsigned long' if does not define. */ +/* #undef id_t */ + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long long' if does not define. */ +/* #undef off_t */ + +/* Define to `int' if doesn't define. */ +/* #undef pid_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if does not define. */ +/* #undef ssize_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ + +/* Define to `int' if does not define. */ +/* #undef intptr_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef uintptr_t */ + +/* + * This header starts from the Linux CMake-generated config used by the native + * cc_library example, then overrides platform-sensitive probes for Darwin. It + * intentionally keeps ACL and xattr disabled, matching the example CMake + * configuration and keeping the native test focused on libarchive+zlib linking. + */ +#if !defined(__APPLE__) +#error libarchive_config_darwin.h is only intended for Darwin builds. +#endif + +#undef ARCHIVE_ACL_DARWIN +#undef ARCHIVE_XATTR_DARWIN + +#undef HAVE_ARC4RANDOM_BUF +#define HAVE_ARC4RANDOM_BUF 1 +#undef HAVE_CHFLAGS +#define HAVE_CHFLAGS 1 +#undef HAVE_COPYFILE_H +#define HAVE_COPYFILE_H 1 +#undef HAVE_FCHFLAGS +#define HAVE_FCHFLAGS 1 +#undef HAVE_GETVFSBYNAME +#define HAVE_GETVFSBYNAME 1 +#undef HAVE_LCHFLAGS +#define HAVE_LCHFLAGS 1 +#undef HAVE_MEMBERSHIP_H +#define HAVE_MEMBERSHIP_H 1 +#undef HAVE_READPASSPHRASE +#define HAVE_READPASSPHRASE 1 +#undef HAVE_READPASSPHRASE_H +#define HAVE_READPASSPHRASE_H 1 +#undef HAVE_FUTIMESAT +#undef HAVE_STRUCT_STATFS_F_IOSIZE +#define HAVE_STRUCT_STATFS_F_IOSIZE 1 +#undef HAVE_STRUCT_STAT_ST_BIRTHTIME +#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 +#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC +#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 +#undef HAVE_STRUCT_STAT_ST_FLAGS +#define HAVE_STRUCT_STAT_ST_FLAGS 1 +#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC +#undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC +#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 +#undef HAVE_SYS_MOUNT_H +#define HAVE_SYS_MOUNT_H 1 +#undef HAVE_SYS_STATFS_H +#undef HAVE_SYS_SYSMACROS_H +#undef HAVE_SYS_XATTR_H +#define HAVE_SYS_XATTR_H 1 +#undef MAJOR_IN_SYSMACROS + +#undef HAVE_DECL_XATTR_NOFOLLOW +#undef HAVE_EXT2FS_EXT2_FS_H +#undef HAVE_LINUX_FIEMAP_H +#undef HAVE_LINUX_FS_H +#undef HAVE_LINUX_MAGIC_H +#undef HAVE_LINUX_TYPES_H +#undef HAVE_SYS_EXTATTR_H +#undef HAVE_SYS_VFS_H +#undef HAVE_WORKING_FS_IOC_GETFLAGS diff --git a/examples/third_party/libarchive/libarchive_config_linux.h b/examples/third_party/libarchive/libarchive_config_linux.h new file mode 100644 index 000000000..c27926055 --- /dev/null +++ b/examples/third_party/libarchive/libarchive_config_linux.h @@ -0,0 +1,1407 @@ +/* config.h. Generated from libarchive 3.7.7 build/cmake/config.h.in by cmake + * configure for Linux native cc_library examples. */ +#define __LIBARCHIVE_CONFIG_H_INCLUDED 1 + +/* + * Ensure we have C99-style int64_t, etc, all defined. + */ + +/* First, we need to know if the system has already defined them. */ +#define HAVE_INT16_T +#define HAVE_INT32_T +#define HAVE_INT64_T +#define HAVE_INTMAX_T + +#define HAVE_UINT8_T +#define HAVE_UINT16_T +#define HAVE_UINT32_T +#define HAVE_UINT64_T +#define HAVE_UINTMAX_T + +/* We might have the types we want under other spellings. */ +/* #undef HAVE___INT64 */ +/* #undef HAVE_U_INT64_T */ +/* #undef HAVE_UNSIGNED___INT64 */ + +/* The sizes of various standard integer types. */ +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#define SIZEOF_LONG 8 +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_UNSIGNED_SHORT 2 +#define SIZEOF_UNSIGNED 4 +#define SIZEOF_UNSIGNED_LONG 8 +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +/* + * If we lack int64_t, define it to the first of __int64, int, long, and long + * long that exists and is the right size. + */ +#if !defined(HAVE_INT64_T) && defined(HAVE___INT64) +typedef __int64 int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZEOF_INT == 8 +typedef int int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZEOF_LONG == 8 +typedef long int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZEOF_LONG_LONG == 8 +typedef long long int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) +#error No 64-bit integer type was found. +#endif + +/* + * Similarly for int32_t + */ +#if !defined(HAVE_INT32_T) && SIZEOF_INT == 4 +typedef int int32_t; +#define HAVE_INT32_T +#endif + +#if !defined(HAVE_INT32_T) && SIZEOF_LONG == 4 +typedef long int32_t; +#define HAVE_INT32_T +#endif + +#if !defined(HAVE_INT32_T) +#error No 32-bit integer type was found. +#endif + +/* + * Similarly for int16_t + */ +#if !defined(HAVE_INT16_T) && SIZEOF_INT == 2 +typedef int int16_t; +#define HAVE_INT16_T +#endif + +#if !defined(HAVE_INT16_T) && SIZEOF_SHORT == 2 +typedef short int16_t; +#define HAVE_INT16_T +#endif + +#if !defined(HAVE_INT16_T) +#error No 16-bit integer type was found. +#endif + +/* + * Similarly for uint64_t + */ +#if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64) +typedef unsigned __int64 uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED == 8 +typedef unsigned uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED_LONG == 8 +typedef unsigned long uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED_LONG_LONG == 8 +typedef unsigned long long uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) +#error No 64-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint32_t + */ +#if !defined(HAVE_UINT32_T) && SIZEOF_UNSIGNED == 4 +typedef unsigned uint32_t; +#define HAVE_UINT32_T +#endif + +#if !defined(HAVE_UINT32_T) && SIZEOF_UNSIGNED_LONG == 4 +typedef unsigned long uint32_t; +#define HAVE_UINT32_T +#endif + +#if !defined(HAVE_UINT32_T) +#error No 32-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint16_t + */ +#if !defined(HAVE_UINT16_T) && SIZEOF_UNSIGNED == 2 +typedef unsigned uint16_t; +#define HAVE_UINT16_T +#endif + +#if !defined(HAVE_UINT16_T) && SIZEOF_UNSIGNED_SHORT == 2 +typedef unsigned short uint16_t; +#define HAVE_UINT16_T +#endif + +#if !defined(HAVE_UINT16_T) +#error No 16-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint8_t + */ +#if !defined(HAVE_UINT8_T) +typedef unsigned char uint8_t; +#define HAVE_UINT8_T +#endif + +#if !defined(HAVE_UINT8_T) +#error No 8-bit unsigned integer type was found. +#endif + +/* Define intmax_t and uintmax_t if they are not already defined. */ +#if !defined(HAVE_INTMAX_T) +typedef int64_t intmax_t; +#endif + +#if !defined(HAVE_UINTMAX_T) +typedef uint64_t uintmax_t; +#endif + +/* Define ZLIB_WINAPI if zlib was built on Visual Studio. */ +/* #undef ZLIB_WINAPI */ + +/* Darwin ACL support */ +/* #undef ARCHIVE_ACL_DARWIN */ + +/* FreeBSD ACL support */ +/* #undef ARCHIVE_ACL_FREEBSD */ + +/* FreeBSD NFSv4 ACL support */ +/* #undef ARCHIVE_ACL_FREEBSD_NFS4 */ + +/* Linux POSIX.1e ACL support via libacl */ +/* #undef ARCHIVE_ACL_LIBACL */ + +/* Linux NFSv4 ACL support via librichacl */ +/* #undef ARCHIVE_ACL_LIBRICHACL */ + +/* Solaris ACL support */ +/* #undef ARCHIVE_ACL_SUNOS */ + +/* Solaris NFSv4 ACL support */ +/* #undef ARCHIVE_ACL_SUNOS_NFS4 */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_LIBC */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_LIBSYSTEM */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_MBEDTLS */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_NETTLE */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_OPENSSL */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_WIN */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_LIBC */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_NETTLE */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_MBEDTLS */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_OPENSSL */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_LIBC */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_LIBSYSTEM */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_MBEDTLS */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_NETTLE */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_OPENSSL */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_WIN */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBC */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC2 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBC2 */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC3 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBC3 */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBSYSTEM */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_MBEDTLS */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_NETTLE */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_OPENSSL */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_WIN */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBC */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC2 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBC2 */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC3 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBC3 */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBSYSTEM */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_MBEDTLS */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_NETTLE */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_OPENSSL */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_WIN */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBC */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC2 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBC2 */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC3 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBC3 */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBSYSTEM */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_MBEDTLS supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_MBEDTLS */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_NETTLE */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_OPENSSL */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_WIN supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_WIN */ + +/* AIX xattr support */ +/* #undef ARCHIVE_XATTR_AIX */ + +/* Darwin xattr support */ +/* #undef ARCHIVE_XATTR_DARWIN */ + +/* FreeBSD xattr support */ +/* #undef ARCHIVE_XATTR_FREEBSD */ + +/* Linux xattr support */ +/* #undef ARCHIVE_XATTR_LINUX */ + +/* Version number of bsdcpio */ +#define BSDCPIO_VERSION_STRING "3.7.7" + +/* Version number of bsdtar */ +#define BSDTAR_VERSION_STRING "3.7.7" + +/* Version number of bsdcat */ +#define BSDCAT_VERSION_STRING "3.7.7" + +/* Version number of bsdunzip */ +#define BSDUNZIP_VERSION_STRING "3.7.7" + +/* Define to 1 if you have the `acl_create_entry' function. */ +/* #undef HAVE_ACL_CREATE_ENTRY */ + +/* Define to 1 if you have the `acl_get_fd_np' function. */ +/* #undef HAVE_ACL_GET_FD_NP */ + +/* Define to 1 if you have the `acl_get_link' function. */ +/* #undef HAVE_ACL_GET_LINK */ + +/* Define to 1 if you have the `acl_get_link_np' function. */ +/* #undef HAVE_ACL_GET_LINK_NP */ + +/* Define to 1 if you have the `acl_get_perm' function. */ +/* #undef HAVE_ACL_GET_PERM */ + +/* Define to 1 if you have the `acl_get_perm_np' function. */ +/* #undef HAVE_ACL_GET_PERM_NP */ + +/* Define to 1 if you have the `acl_init' function. */ +/* #undef HAVE_ACL_INIT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ACL_LIBACL_H */ + +/* Define to 1 if the system has the type `acl_permset_t'. */ +/* #undef HAVE_ACL_PERMSET_T */ + +/* Define to 1 if you have the `acl_set_fd' function. */ +/* #undef HAVE_ACL_SET_FD */ + +/* Define to 1 if you have the `acl_set_fd_np' function. */ +/* #undef HAVE_ACL_SET_FD_NP */ + +/* Define to 1 if you have the `acl_set_file' function. */ +/* #undef HAVE_ACL_SET_FILE */ + +/* Define to 1 if you have the `arc4random_buf' function. */ +/* #undef HAVE_ARC4RANDOM_BUF */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ATTR_XATTR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BCRYPT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BSDXML_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BZLIB_H */ + +/* Define to 1 if you have the `chflags' function. */ +/* #undef HAVE_CHFLAGS */ + +/* Define to 1 if you have the `chown' function. */ +#define HAVE_CHOWN 1 + +/* Define to 1 if you have the `chroot' function. */ +#define HAVE_CHROOT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_COPYFILE_H */ + +/* Define to 1 if you have the `ctime_r' function. */ +#define HAVE_CTIME_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the `cygwin_conv_path' function. */ +/* #undef HAVE_CYGWIN_CONV_PATH */ + +/* Define to 1 if you have the declaration of `ACE_GETACL', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACE_GETACL */ + +/* Define to 1 if you have the declaration of `ACE_GETACLCNT', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACE_GETACLCNT */ + +/* Define to 1 if you have the declaration of `ACE_SETACL', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACE_SETACL */ + +/* Define to 1 if you have the declaration of `ACL_SYNCHRONIZE', and to 0 if + you don't. */ +/* #undef HAVE_DECL_ACL_SYNCHRONIZE */ + +/* Define to 1 if you have the declaration of `ACL_TYPE_EXTENDED', and to 0 if + you don't. */ +/* #undef HAVE_DECL_ACL_TYPE_EXTENDED */ + +/* Define to 1 if you have the declaration of `ACL_TYPE_NFS4', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACL_TYPE_NFS4 */ + +/* Define to 1 if you have the declaration of `ACL_USER', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ACL_USER */ + +/* Define to 1 if you have the declaration of `INT32_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_INT32_MAX 1 + +/* Define to 1 if you have the declaration of `INT32_MIN', and to 0 if you + don't. */ +#define HAVE_DECL_INT32_MIN 1 + +/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_INT64_MAX 1 + +/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you + don't. */ +#define HAVE_DECL_INT64_MIN 1 + +/* Define to 1 if you have the declaration of `INTMAX_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_INTMAX_MAX 1 + +/* Define to 1 if you have the declaration of `INTMAX_MIN', and to 0 if you + don't. */ +#define HAVE_DECL_INTMAX_MIN 1 + +/* Define to 1 if you have the declaration of `SETACL', and to 0 if you don't. + */ +/* #undef HAVE_DECL_SETACL */ + +/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_SIZE_MAX 1 + +/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_SSIZE_MAX 1 + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_R 1 + +/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_UINT32_MAX 1 + +/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_UINT64_MAX 1 + +/* Define to 1 if you have the declaration of `UINTMAX_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_UINTMAX_MAX 1 + +/* Define to 1 if you have the declaration of `XATTR_NOFOLLOW', and to 0 if + you don't. */ +/* #undef HAVE_DECL_XATTR_NOFOLLOW */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DIRECT_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the `dirfd' function. */ +#define HAVE_DIRFD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if nl_langinfo supports D_MD_ORDER */ +/* #undef HAVE_D_MD_ORDER */ + +/* A possible errno value for invalid file format errors */ +/* #undef HAVE_EFTYPE */ + +/* A possible errno value for invalid file format errors */ +#define HAVE_EILSEQ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_EXPAT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_EXT2FS_EXT2_FS_H */ + +/* Define to 1 if you have the `extattr_get_file' function. */ +/* #undef HAVE_EXTATTR_GET_FILE */ + +/* Define to 1 if you have the `extattr_list_file' function. */ +/* #undef HAVE_EXTATTR_LIST_FILE */ + +/* Define to 1 if you have the `extattr_set_fd' function. */ +/* #undef HAVE_EXTATTR_SET_FD */ + +/* Define to 1 if you have the `extattr_set_file' function. */ +/* #undef HAVE_EXTATTR_SET_FILE */ + +/* Define to 1 if EXTATTR_NAMESPACE_USER is defined in sys/extattr.h. */ +/* #undef HAVE_DECL_EXTATTR_NAMESPACE_USER */ + +/* Define to 1 if you have the declaration of `GETACL', and to 0 if you don't. + */ +/* #undef HAVE_DECL_GETACL */ + +/* Define to 1 if you have the declaration of `GETACLCNT', and to 0 if you + don't. */ +/* #undef HAVE_DECL_GETACLCNT */ + +/* Define to 1 if you have the `fchdir' function. */ +#define HAVE_FCHDIR 1 + +/* Define to 1 if you have the `fchflags' function. */ +/* #undef HAVE_FCHFLAGS */ + +/* Define to 1 if you have the `fchmod' function. */ +#define HAVE_FCHMOD 1 + +/* Define to 1 if you have the `fchown' function. */ +#define HAVE_FCHOWN 1 + +/* Define to 1 if you have the `fcntl' function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fdopendir' function. */ +#define HAVE_FDOPENDIR 1 + +/* Define to 1 if you have the `fgetea' function. */ +/* #undef HAVE_FGETEA */ + +/* Define to 1 if you have the `fgetxattr' function. */ +/* #undef HAVE_FGETXATTR */ + +/* Define to 1 if you have the `flistea' function. */ +/* #undef HAVE_FLISTEA */ + +/* Define to 1 if you have the `flistxattr' function. */ +/* #undef HAVE_FLISTXATTR */ + +/* Define to 1 if you have the `fnmatch' function. */ +#define HAVE_FNMATCH 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FNMATCH_H 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the `fsetea' function. */ +/* #undef HAVE_FSETEA */ + +/* Define to 1 if you have the `fsetxattr' function. */ +/* #undef HAVE_FSETXATTR */ + +/* Define to 1 if you have the `fstat' function. */ +#define HAVE_FSTAT 1 + +/* Define to 1 if you have the `fstatat' function. */ +#define HAVE_FSTATAT 1 + +/* Define to 1 if you have the `fstatfs' function. */ +#define HAVE_FSTATFS 1 + +/* Define to 1 if you have the `fstatvfs' function. */ +#define HAVE_FSTATVFS 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `futimens' function. */ +#define HAVE_FUTIMENS 1 + +/* Define to 1 if you have the `futimes' function. */ +#define HAVE_FUTIMES 1 + +/* Define to 1 if you have the `futimesat' function. */ +#define HAVE_FUTIMESAT 1 + +/* Define to 1 if you have the `getea' function. */ +/* #undef HAVE_GETEA */ + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `getgrgid_r' function. */ +#define HAVE_GETGRGID_R 1 + +/* Define to 1 if you have the `getgrnam_r' function. */ +#define HAVE_GETGRNAM_R 1 + +/* Define to 1 if you have the `getline' function. */ +#define HAVE_GETLINE 1 + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 + +/* Define to 1 if you have the `getpwnam_r' function. */ +#define HAVE_GETPWNAM_R 1 + +/* Define to 1 if you have the `getpwuid_r' function. */ +#define HAVE_GETPWUID_R 1 + +/* Define to 1 if you have the `getvfsbyname' function. */ +/* #undef HAVE_GETVFSBYNAME */ + +/* Define to 1 if you have the `getxattr' function. */ +/* #undef HAVE_GETXATTR */ + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GRP_H 1 + +/* Define to 1 if you have the `iconv' function. */ +/* #undef HAVE_ICONV */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ICONV_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LANGINFO_H 1 + +/* Define to 1 if you have the `lchflags' function. */ +/* #undef HAVE_LCHFLAGS */ + +/* Define to 1 if you have the `lchmod' function. */ +#define HAVE_LCHMOD 1 + +/* Define to 1 if you have the `lchown' function. */ +#define HAVE_LCHOWN 1 + +/* Define to 1 if you have the `lgetea' function. */ +/* #undef HAVE_LGETEA */ + +/* Define to 1 if you have the `lgetxattr' function. */ +/* #undef HAVE_LGETXATTR */ + +/* Define to 1 if you have the `acl' library (-lacl). */ +/* #undef HAVE_LIBACL */ + +/* Define to 1 if you have the `attr' library (-lattr). */ +/* #undef HAVE_LIBATTR */ + +/* Define to 1 if you have the `bsdxml' library (-lbsdxml). */ +/* #undef HAVE_LIBBSDXML */ + +/* Define to 1 if you have the `bz2' library (-lbz2). */ +/* #undef HAVE_LIBBZ2 */ + +/* Define to 1 if you have the `b2' library (-lb2). */ +/* #undef HAVE_LIBB2 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BLAKE2_H */ + +/* Define to 1 if you have the `charset' library (-lcharset). */ +/* #undef HAVE_LIBCHARSET */ + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +/* #undef HAVE_LIBCRYPTO */ + +/* Define to 1 if you have the `expat' library (-lexpat). */ +/* #undef HAVE_LIBEXPAT */ + +/* Define to 1 if you have the `gcc' library (-lgcc). */ +/* #undef HAVE_LIBGCC */ + +/* Define to 1 if you have the `lz4' library (-llz4). */ +/* #undef HAVE_LIBLZ4 */ + +/* Define to 1 if you have the `lzma' library (-llzma). */ +/* #undef HAVE_LIBLZMA */ + +/* Define to 1 if you have the `lzmadec' library (-llzmadec). */ +/* #undef HAVE_LIBLZMADEC */ + +/* Define to 1 if you have the `lzo2' library (-llzo2). */ +/* #undef HAVE_LIBLZO2 */ + +/* Define to 1 if you have the `mbedcrypto' library (-lmbedcrypto). */ +/* #undef HAVE_LIBMBEDCRYPTO */ + +/* Define to 1 if you have the `nettle' library (-lnettle). */ +/* #undef HAVE_LIBNETTLE */ + +/* Define to 1 if you have the `pcre' library (-lpcre). */ +/* #undef HAVE_LIBPCRE */ + +/* Define to 1 if you have the `pcreposix' library (-lpcreposix). */ +/* #undef HAVE_LIBPCREPOSIX */ + +/* Define to 1 if you have the `pcre2-8' library (-lpcre2-8). */ +/* #undef HAVE_LIBPCRE2 */ + +/* Define to 1 if you have the `pcreposix' library (-lpcre2posix). */ +/* #undef HAVE_LIBPCRE2POSIX */ + +/* Define to 1 if you have the `xml2' library (-lxml2). */ +/* #undef HAVE_LIBXML2 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBXML_XMLREADER_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBXML_XMLWRITER_H */ + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the `zstd' library (-lzstd). */ +/* #undef HAVE_LIBZSTD */ + +/* Define to 1 if you have the ZSTD_compressStream function. */ +/* #undef HAVE_ZSTD_compressStream */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `link' function. */ +#define HAVE_LINK 1 + +/* Define to 1 if you have the `linkat' function. */ +#define HAVE_LINKAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_FIEMAP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_FS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_MAGIC_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_TYPES_H 1 + +/* Define to 1 if you have the `listea' function. */ +/* #undef HAVE_LISTEA */ + +/* Define to 1 if you have the `listxattr' function. */ +/* #undef HAVE_LISTXATTR */ + +/* Define to 1 if you have the `llistea' function. */ +/* #undef HAVE_LLISTEA */ + +/* Define to 1 if you have the `llistxattr' function. */ +/* #undef HAVE_LLISTXATTR */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LOCALCHARSET_H */ + +/* Define to 1 if you have the `locale_charset' function. */ +/* #undef HAVE_LOCALE_CHARSET */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if the system has the type `long long int'. */ +/* #undef HAVE_LONG_LONG_INT */ + +/* Define to 1 if you have the `lsetea' function. */ +/* #undef HAVE_LSETEA */ + +/* Define to 1 if you have the `lsetxattr' function. */ +/* #undef HAVE_LSETXATTR */ + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if `lstat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the `lutimes' function. */ +#define HAVE_LUTIMES 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZ4HC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZ4_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZMADEC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZMA_H */ + +/* Define to 1 if you have a working `lzma_stream_encoder_mt' function. */ +/* #undef HAVE_LZMA_STREAM_ENCODER_MT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZO_LZO1X_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZO_LZOCONF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MBEDTLS_AES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MBEDTLS_MD_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MBEDTLS_PKCS5_H */ + +/* Define to 1 if you have the `mbrtowc' function. */ +#define HAVE_MBRTOWC 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MEMBERSHIP_H */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkdir' function. */ +#define HAVE_MKDIR 1 + +/* Define to 1 if you have the `mkfifo' function. */ +#define HAVE_MKFIFO 1 + +/* Define to 1 if you have the `mknod' function. */ +#define HAVE_MKNOD 1 + +/* Define to 1 if you have the `mkstemp' function. */ +#define HAVE_MKSTEMP 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_AES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_HMAC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_MD5_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_PBKDF2_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_RIPEMD160_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_SHA_H */ + +/* Define to 1 if you have the `nl_langinfo' function. */ +#define HAVE_NL_LANGINFO 1 + +/* Define to 1 if you have the `openat' function. */ +#define HAVE_OPENAT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_EVP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PATHS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PCREPOSIX_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PCRE2POSIX_H */ + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* Define to 1 if you have the `PKCS5_PBKDF2_HMAC_SHA1' function. */ +/* #undef HAVE_PKCS5_PBKDF2_HMAC_SHA1 */ + +/* Define to 1 if you have the `poll' function. */ +#define HAVE_POLL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_POLL_H 1 + +/* Define to 1 if you have the `posix_spawnp' function. */ +#define HAVE_POSIX_SPAWNP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PROCESS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `readdir_r' function. */ +#define HAVE_READDIR_R 1 + +/* Define to 1 if you have the `readlink' function. */ +#define HAVE_READLINK 1 + +/* Define to 1 if you have the `readlinkat' function. */ +#define HAVE_READLINKAT 1 + +/* Define to 1 if you have the `readpassphrase' function. */ +/* #undef HAVE_READPASSPHRASE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_READPASSPHRASE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_REGEX_H 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SPAWN_H 1 + +/* Define to 1 if you have the `statfs' function. */ +#define HAVE_STATFS 1 + +/* Define to 1 if you have the `statvfs' function. */ +#define HAVE_STATVFS 1 + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_STAT_EMPTY_STRING_BUG */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strnlen' function. */ +#define HAVE_STRNLEN 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if the system has the type `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS */ + +/* Define to 1 if `f_iosize' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_IOSIZE */ + +/* Define to 1 if `f_namemax' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_NAMEMAX */ + +/* Define to 1 if `f_iosize' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_IOSIZE */ + +/* Define to 1 if `st_birthtime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */ + +/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if `st_flags' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_FLAGS */ + +/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_mtime_n' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIME_N */ + +/* Define to 1 if `st_mtime_usec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIME_USEC */ + +/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 + +/* Define to 1 if `st_umtime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_UMTIME */ + +/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */ +#define HAVE_STRUCT_TM_TM_GMTOFF 1 + +/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM___TM_GMTOFF */ + +/* Define to 1 if you have `struct vfsconf'. */ +/* #undef HAVE_STRUCT_VFSCONF */ + +/* Define to 1 if you have `struct xvfsconf'. */ +/* #undef HAVE_STRUCT_XVFSCONF */ + +/* Define to 1 if you have the `symlink' function. */ +#define HAVE_SYMLINK 1 + +/* Define to 1 if you have the `sysconf' function. */ +#define HAVE_SYSCONF 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ACL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_CDEFS_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EA_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EXTATTR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MOUNT_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_RICHACL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSMACROS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UTIME_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTSNAME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_VFS_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_XATTR_H 1 + +/* Define to 1 if you have the `timegm' function. */ +#define HAVE_TIMEGM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the `tzset' function. */ +#define HAVE_TZSET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unlinkat' function. */ +#define HAVE_UNLINKAT 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#define HAVE_UNSETENV 1 + +/* Define to 1 if the system has the type `unsigned long long'. */ +/* #undef HAVE_UNSIGNED_LONG_LONG */ + +/* Define to 1 if the system has the type `unsigned long long int'. */ +/* #undef HAVE_UNSIGNED_LONG_LONG_INT */ + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the `utimensat' function. */ +#define HAVE_UTIMENSAT 1 + +/* Define to 1 if you have the `utimes' function. */ +#define HAVE_UTIMES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if you have the `vfork' function. */ +#define HAVE_VFORK 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if the system has the type `wchar_t'. */ +#define HAVE_WCHAR_T 1 + +/* Define to 1 if you have the `wcrtomb' function. */ +#define HAVE_WCRTOMB 1 + +/* Define to 1 if you have the `wcscmp' function. */ +#define HAVE_WCSCMP 1 + +/* Define to 1 if you have the `wcscpy' function. */ +#define HAVE_WCSCPY 1 + +/* Define to 1 if you have the `wcslen' function. */ +#define HAVE_WCSLEN 1 + +/* Define to 1 if you have the `wctomb' function. */ +#define HAVE_WCTOMB 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCTYPE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINCRYPT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINIOCTL_H */ + +/* Define to 1 if you have _CrtSetReportMode in */ +/* #undef HAVE__CrtSetReportMode */ + +/* Define to 1 if you have the `wmemcmp' function. */ +#define HAVE_WMEMCMP 1 + +/* Define to 1 if you have the `wmemcpy' function. */ +#define HAVE_WMEMCPY 1 + +/* Define to 1 if you have the `wmemmove' function. */ +#define HAVE_WMEMMOVE 1 + +/* Define to 1 if you have a working EXT2_IOC_GETFLAGS */ +/* #undef HAVE_WORKING_EXT2_IOC_GETFLAGS */ + +/* Define to 1 if you have a working FS_IOC_GETFLAGS */ +#define HAVE_WORKING_FS_IOC_GETFLAGS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ZLIB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ZSTD_H */ + +/* Define to 1 if you have the `ctime_s' function. */ +/* #undef HAVE_CTIME_S */ + +/* Define to 1 if you have the `_fseeki64' function. */ +/* #undef HAVE__FSEEKI64 */ + +/* Define to 1 if you have the `_get_timezone' function. */ +/* #undef HAVE__GET_TIMEZONE */ + +/* Define to 1 if you have the `gmtime_s' function. */ +/* #undef HAVE_GMTIME_S */ + +/* Define to 1 if you have the `localtime_s' function. */ +/* #undef HAVE_LOCALTIME_S */ + +/* Define to 1 if you have the `_mkgmtime' function. */ +/* #undef HAVE__MKGMTIME */ + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST + +/* Version number of libarchive as a single integer */ +#define LIBARCHIVE_VERSION_NUMBER "3007007" + +/* Version number of libarchive */ +#define LIBARCHIVE_VERSION_STRING "3.7.7" + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +/* #undef LSTAT_FOLLOWS_SLASHED_SYMLINK */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +#define MAJOR_IN_SYSMACROS 1 + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T 4 + +/* Define to 1 if strerror_r returns char *. */ +/* #undef STRERROR_R_CHAR_P */ + +/* Define to 1 if you can safely include both and . */ +/* #undef TIME_WITH_SYS_TIME */ + +/* + * Some platform requires a macro to use extension functions. + */ +#define SAFE_TO_DEFINE_EXTENSIONS 1 +#ifdef SAFE_TO_DEFINE_EXTENSIONS +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +#define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +#define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +#define __EXTENSIONS__ 1 +#endif +#endif /* SAFE_TO_DEFINE_EXTENSIONS */ + +/* Version number of package */ +#define VERSION "3.7.7" + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to control Windows SDK version */ +#ifndef NTDDI_VERSION +/* #undef NTDDI_VERSION */ +#endif // NTDDI_VERSION + +#ifndef _WIN32_WINNT +/* #undef _WIN32_WINNT */ +#endif // _WIN32_WINNT + +#ifndef WINVER +/* #undef WINVER */ +#endif // WINVER + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Define to `unsigned long' if does not define. */ +/* #undef id_t */ + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long long' if does not define. */ +/* #undef off_t */ + +/* Define to `int' if doesn't define. */ +/* #undef pid_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if does not define. */ +/* #undef ssize_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ + +/* Define to `int' if does not define. */ +/* #undef intptr_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef uintptr_t */ diff --git a/examples/third_party/libarchive/libarchive_config_windows.h b/examples/third_party/libarchive/libarchive_config_windows.h new file mode 100644 index 000000000..cb3bdd882 --- /dev/null +++ b/examples/third_party/libarchive/libarchive_config_windows.h @@ -0,0 +1,123 @@ +/* config.h for Windows native cc_library examples. */ +#define __LIBARCHIVE_CONFIG_H_INCLUDED 1 + +#define HAVE_INT16_T 1 +#define HAVE_INT32_T 1 +#define HAVE_INT64_T 1 +#define HAVE_INTMAX_T 1 +#define HAVE_UINT8_T 1 +#define HAVE_UINT16_T 1 +#define HAVE_UINT32_T 1 +#define HAVE_UINT64_T 1 +#define HAVE_UINTMAX_T 1 + +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_UNSIGNED_SHORT 2 +#define SIZEOF_UNSIGNED 4 +#define SIZEOF_UNSIGNED_LONG 4 +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +#define HAVE_BCRYPT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_DIRECT_H 1 +#define HAVE_ERRNO_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_IO_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_PROCESS_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TIME_H 1 +#define HAVE_WCHAR_H 1 +#define HAVE_WINCRYPT_H 1 +#define HAVE_WINDOWS_H 1 +#define HAVE_ZLIB_H 1 + +#define HAVE_BCRYPT 1 +#define HAVE_LIBZ 1 + +#define HAVE_CHMOD 1 +#define HAVE_DECL_EXTATTR_NAMESPACE_USER 0 +#define HAVE_DECL_INT64_MAX 1 +#define HAVE_DECL_INT64_MIN 1 +#define HAVE_DECL_SIZE_MAX 1 +#define HAVE_DECL_SSIZE_MAX 0 +#define HAVE_DECL_STRERROR_R 0 +#define HAVE_DECL_UINT32_MAX 1 +#define HAVE_DECL_UINT64_MAX 1 +#define HAVE_DECL_UINTMAX_MAX 1 +#define HAVE_DECL_XATTR_NOFOLLOW 0 +#define HAVE_FSTAT 1 +#define HAVE_FTRUNCATE 1 +#define HAVE_GETPID 1 +#define HAVE_LOCALTIME_S 1 +#define HAVE_LSTAT 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMSET 1 +#define HAVE_MKDIR 1 +#define HAVE_READ 1 +#define HAVE_SELECT 1 +#define HAVE_STAT 1 +#define HAVE_STRCHR 1 +#define HAVE_STRDUP 1 +#define HAVE_STRERROR 1 +#define HAVE_STRRCHR 1 +#define HAVE_TIME 1 +#define HAVE_UMASK 1 +#define HAVE_WCSCPY 1 +#define HAVE_WCSLEN 1 +#define HAVE_WMEMCMP 1 +#define HAVE_WMEMCPY 1 +#define HAVE_WRITE 1 +#define HAVE__GET_TIMEZONE 1 + +#define HAVE_STRUCT_STAT_ST_MTIME 1 +#define HAVE_STRUCT_STAT_ST_SIZE 1 + +#define ICONV_CONST + +#ifndef _SSIZE_T_DEFINED +typedef __int64 ssize_t; +#define _SSIZE_T_DEFINED +#endif + +#ifndef _PID_T_ +typedef int pid_t; +#define _PID_T_ +#endif + +#ifndef _MODE_T_DEFINED +typedef int mode_t; +#define _MODE_T_DEFINED +#endif + +#ifndef _UID_T_DEFINED +typedef int uid_t; +#define _UID_T_DEFINED +#endif + +#ifndef _GID_T_DEFINED +typedef int gid_t; +#define _GID_T_DEFINED +#endif + +#ifndef _ID_T_DEFINED +typedef int id_t; +#define _ID_T_DEFINED +#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0601 +#endif + +#ifndef _WIN32 +#error libarchive_config_windows.h is only intended for Windows builds. +#endif diff --git a/examples/third_party/libarchive/libarchive_repositories.bzl b/examples/third_party/libarchive/libarchive_repositories.bzl new file mode 100644 index 000000000..a3d530aa2 --- /dev/null +++ b/examples/third_party/libarchive/libarchive_repositories.bzl @@ -0,0 +1,16 @@ +"""A module defining the third party dependency libarchive.""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +def libarchive_repositories(): + maybe( + http_archive, + name = "examples_libarchive", + build_file = Label("//libarchive:BUILD.libarchive.bazel"), + sha256 = "879acd83c3399c7caaee73fe5f7418e06087ab2aaf40af3e99b9e29beb29faee", + strip_prefix = "libarchive-3.7.7", + urls = [ + "https://github.com/libarchive/libarchive/releases/download/v3.7.7/libarchive-3.7.7.tar.xz", + ], + ) diff --git a/examples/third_party/repositories.bzl b/examples/third_party/repositories.bzl index 82ced0bd8..fa4da3df0 100644 --- a/examples/third_party/repositories.bzl +++ b/examples/third_party/repositories.bzl @@ -10,6 +10,7 @@ load("//glib:glib_repositories.bzl", "glib_repositories") load("//gn:gn_repositories.bzl", "gn_repositories") load("//gperftools:gperftools_repositories.bzl", "gperftools_repositories") load("//iconv:iconv_repositories.bzl", "iconv_repositories") +load("//libarchive:libarchive_repositories.bzl", "libarchive_repositories") load("//libgit2:libgit2_repositories.bzl", "libgit2_repositories") load("//libjpeg_turbo:libjpeg_turbo_repositories.bzl", "libjpeg_turbo_repositories") load("//libpng:libpng_repositories.bzl", "libpng_repositories") @@ -36,6 +37,7 @@ def repositories(): gn_repositories() gperftools_repositories() iconv_repositories() + libarchive_repositories() libgit2_repositories() libjpeg_turbo_repositories() libpng_repositories() diff --git a/examples/third_party/zlib/BUILD.zlib.bazel b/examples/third_party/zlib/BUILD.zlib.bazel index cefa6e58b..384be4890 100644 --- a/examples/third_party/zlib/BUILD.zlib.bazel +++ b/examples/third_party/zlib/BUILD.zlib.bazel @@ -1,4 +1,4 @@ -load("@rules_cc//cc:defs.bzl", "cc_library", "cc_shared_library") +load("@rules_cc//cc:defs.bzl", "cc_import", "cc_library", "cc_shared_library") load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake") package(default_visibility = ["//visibility:public"]) @@ -11,8 +11,50 @@ filegroup( ), ) +ZLIB_PUBLIC_HDRS = [ + "zconf.h", + "zlib.h", +] + +ZLIB_PRIVATE_HDRS = [ + "crc32.h", + "deflate.h", + "gzguts.h", + "inffast.h", + "inffixed.h", + "inflate.h", + "inftrees.h", + "trees.h", + "zutil.h", +] + +ZLIB_SRCS = [ + "adler32.c", + "compress.c", + "crc32.c", + "deflate.c", + "gzclose.c", + "gzlib.c", + "gzread.c", + "gzwrite.c", + "infback.c", + "inffast.c", + "inflate.c", + "inftrees.c", + "trees.c", + "uncompr.c", + "zutil.c", +] + +cc_library( + name = "zlib_headers", + hdrs = ZLIB_PUBLIC_HDRS, + includes = ["."], + linkstatic = True, +) + cmake( - name = "zlib", + name = "zlib_foreign_static", cache_entries = select({ "@platforms//os:linux": { "CMAKE_C_FLAGS": "$${CMAKE_C_FLAGS:-} -fPIC", @@ -31,37 +73,62 @@ cmake( }), ) +alias( + name = "zlib", + actual = ":zlib_foreign_static", +) + +cmake( + name = "zlib_foreign_shared", + cache_entries = select({ + "@platforms//os:linux": { + "BUILD_SHARED_LIBS": "ON", + "CMAKE_C_FLAGS": "$${CMAKE_C_FLAGS:-} -fPIC", + }, + "//conditions:default": { + "BUILD_SHARED_LIBS": "ON", + }, + }), + defines = select({ + "@platforms//os:windows": ["ZLIB_DLL"], + "//conditions:default": [], + }), + generate_args = select({ + "@platforms//os:windows": ["-GNinja"], + "//conditions:default": [], + }), + lib_source = ":all_srcs", + out_include_dir = "include", + out_interface_libs = select({ + "@platforms//os:windows": ["zlib1.lib"], + "//conditions:default": [], + }), + out_shared_libs = select({ + "@platforms//os:macos": [ + "libz.dylib", + "libz.1.dylib", + "libz.1.3.1.dylib", + ], + "@platforms//os:windows": ["zlib1.dll"], + "//conditions:default": [ + "libz.so", + "libz.so.1", + "libz.so.1.3.1", + ], + }), + postfix_script = select({ + # rfcc pairs DLLs and import libs by basename when it builds CcInfo. + # zlib installs zlib1.dll with zdll.lib, so add the Windows alias that + # Bazel consumers expect. + "@platforms//os:windows": "cp -p $$INSTALLDIR/lib/zdll.lib $$INSTALLDIR/lib/zlib1.lib", + "//conditions:default": "", + }), +) + cc_library( - name = "zlib_static", - srcs = [ - "adler32.c", - "compress.c", - "crc32.c", - "deflate.c", - "gzclose.c", - "gzlib.c", - "gzread.c", - "gzwrite.c", - "infback.c", - "inffast.c", - "inflate.c", - "inftrees.c", - "trees.c", - "uncompr.c", - "zutil.c", - ], - hdrs = [ - "crc32.h", - "deflate.h", - "gzguts.h", - "inffast.h", - "inffixed.h", - "inflate.h", - "inftrees.h", - "trees.h", - "zlib.h", - "zutil.h", - ], + name = "z", + srcs = ZLIB_SRCS + ZLIB_PRIVATE_HDRS, + hdrs = ZLIB_PUBLIC_HDRS, copts = select({ "@platforms//os:windows": [], "//conditions:default": [ @@ -72,11 +139,102 @@ cc_library( }), includes = ["."], linkstatic = True, - deps = [":zlib"], + visibility = ["//visibility:private"], +) + +cc_library( + name = "zlib_static", + deps = [":z"], +) + +cc_library( + name = "zlib_dynamic_headers", + hdrs = ZLIB_PUBLIC_HDRS, + defines = select({ + "@platforms//os:windows": ["ZLIB_DLL"], + "//conditions:default": [], + }), + includes = ["."], + linkstatic = True, +) + +cc_library( + name = "zlib_shared_impl", + srcs = ZLIB_SRCS + ZLIB_PRIVATE_HDRS, + hdrs = ZLIB_PUBLIC_HDRS, + copts = select({ + "@platforms//os:windows": [], + "//conditions:default": [ + "-Wno-deprecated-non-prototype", + "-Wno-unused-variable", + "-Wno-implicit-function-declaration", + ], + }), + local_defines = select({ + "@platforms//os:windows": [ + "ZLIB_DLL", + "ZLIB_INTERNAL", + ], + "//conditions:default": [], + }), + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + deps = [":zlib_dynamic_headers"], ) cc_shared_library( name = "zlib_shared", - shared_lib_name = "libz.so", - deps = ["zlib_static"], + features = select({ + "@platforms//os:macos": ["set_install_name"], + "@platforms//os:windows": [], + "//conditions:default": ["set_soname"], + }), + shared_lib_name = select({ + "@platforms//os:macos": "libz.dylib", + "@platforms//os:windows": "zlib1.dll", + "//conditions:default": "libz.so", + }), + deps = select({ + "@platforms//os:windows": [":zlib_shared_impl"], + "//conditions:default": [":zlib_static"], + }), +) + +filegroup( + name = "zlib_shared_interface_library", + srcs = [":zlib_shared"], + output_group = "interface_library", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_import( + name = "zlib_shared_import", + interface_library = ":zlib_shared_interface_library", + shared_library = ":zlib_shared", + target_compatible_with = select({ + "@platforms//os:windows": [], + "//conditions:default": ["@platforms//:incompatible"], + }), +) + +cc_library( + name = "zlib_dynamic", + srcs = select({ + "@platforms//os:windows": [], + "//conditions:default": [":zlib_shared"], + }), + deps = [":zlib_dynamic_headers"] + select({ + "@platforms//os:windows": [":zlib_shared_import"], + "//conditions:default": [], + }), +) + +alias( + name = "zlib_shared_provider_parity", + actual = ":zlib_dynamic", ) diff --git a/foreign_cc/private/framework.bzl b/foreign_cc/private/framework.bzl index 0abad8a7e..ca1a263ad 100644 --- a/foreign_cc/private/framework.bzl +++ b/foreign_cc/private/framework.bzl @@ -2,11 +2,11 @@ with CMake, configure/make, autotools) """ -load("@bazel_features//:features.bzl", "bazel_features") load("@bazel_skylib//lib:collections.bzl", "collections") load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") +load("@cc_compatibility_proxy//:symbols.bzl", "CcSharedLibraryInfo") load("@rules_cc//cc:defs.bzl", "CcInfo", "cc_common") load("//foreign_cc:providers.bzl", "ForeignCcArtifactInfo", "ForeignCcDepsInfo") load("//foreign_cc/private:detect_root.bzl", "filter_containing_dirs_from_inputs") @@ -32,8 +32,6 @@ load( "copy_directory", ) -CcSharedLibraryInfo = bazel_features.globals.CcSharedLibraryInfo - # Dict with definitions of the context attributes, that customize cc_external_rule_impl function. # Many of the attributes have default values. # diff --git a/toolchains/built_toolchains.bzl b/toolchains/built_toolchains.bzl index c4287e894..dfc13e12e 100644 --- a/toolchains/built_toolchains.bzl +++ b/toolchains/built_toolchains.bzl @@ -281,6 +281,8 @@ def _pkgconfig_toolchain(version, register_toolchains): http_archive, name = "glib_dev", build_file_content = ''' +load("@rules_cc//cc:defs.bzl", "cc_import") + cc_import( name = "glib_dev", hdrs = glob(["include/**"]), @@ -299,6 +301,8 @@ cc_import( http_archive, name = "glib_src", build_file_content = ''' +load("@rules_cc//cc:defs.bzl", "cc_import") + cc_import( name = "msvc_hdr", hdrs = ["msvc_recommended_pragmas.h"], @@ -339,6 +343,8 @@ exports_files( http_archive, name = "gettext_runtime", build_file_content = ''' +load("@rules_cc//cc:defs.bzl", "cc_import") + cc_import( name = "gettext_runtime", shared_library = "bin/libintl-8.dll",