2021-03-09 18:55:01 +00:00
|
|
|
load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake")
|
2021-02-26 20:21:13 +00:00
|
|
|
|
|
|
|
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())
|
|
|
|
|
2021-03-09 18:55:01 +00:00
|
|
|
cmake(
|
2021-02-26 20:21:13 +00:00
|
|
|
name = "libgit2",
|
|
|
|
cache_entries = select({
|
|
|
|
"@platforms//os:linux": _LINUX_CACHE_ENTRIES,
|
|
|
|
"//conditions:default": _CACHE_ENTRIES,
|
|
|
|
}),
|
|
|
|
lib_source = ":all_srcs",
|
2021-03-11 17:14:00 +00:00
|
|
|
out_static_libs = select({
|
2021-02-26 20:21:13 +00:00
|
|
|
# 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",
|
|
|
|
"@zlib",
|
|
|
|
"@openssl",
|
|
|
|
] + select({
|
|
|
|
"@platforms//os:linux": ["@pcre"],
|
|
|
|
"@platforms//os:macos": ["@iconv"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
|
|
|
)
|