2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-30 16:42:07 +00:00
rules_foreign_cc/examples/third_party/libgit2/BUILD.libgit2.bazel

49 lines
1.3 KiB
Plaintext
Raw Normal View History

load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
filegroup(
name = "all_srcs",
srcs = glob(
["**"],
exclude = ["tests/**"],
),
)
_CACHE_ENTRIES = {
"BUILD_CLAR": "off",
"BUILD_EXAMPLES": "off",
"BUILD_FUZZERS": "off",
"BUILD_SHARED_LIBS": "off",
"CMAKE_PREFIX_PATH": "$EXT_BUILD_DEPS/pcre;$EXT_BUILD_DEPS/openssl;$EXT_BUILD_DEPS/libssh2;$EXT_BUILD_DEPS/zlib;${CMAKE_PREFIX_PATH:-}",
"EMBED_SSH_PATH": "$(location @libssh2//:libssh2)",
"USE_HTTPS": "on",
}
_LINUX_CACHE_ENTRIES = dict(_CACHE_ENTRIES.items() + {
"CMAKE_C_FLAGS": "${CMAKE_C_FLAGS:-} -fPIC",
"REGEX_BACKEND": "pcre",
}.items())
cmake(
name = "libgit2",
cache_entries = select({
"@platforms//os:linux": _LINUX_CACHE_ENTRIES,
"//conditions:default": _CACHE_ENTRIES,
}),
lib_source = ":all_srcs",
out_static_libs = select({
# TODO: I'm guessing at this name. Needs to be checked on windows.
"@platforms//os:windows": ["git2.lib"],
"//conditions:default": ["libgit2.a"],
}),
visibility = ["//visibility:public"],
deps = [
"@libssh2",
"@openssl",
2023-04-12 08:29:29 +00:00
"@zlib",
] + select({
"@platforms//os:linux": ["@pcre"],
"@platforms//os:macos": ["@iconv_macos//:iconv"],
"//conditions:default": [],
}),
)