2021-03-12 16:54:14 +00:00
|
|
|
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
|
2021-02-26 20:21:13 +00:00
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "all_srcs",
|
2021-12-30 16:37:31 +00:00
|
|
|
srcs = glob(
|
|
|
|
include = ["**"],
|
|
|
|
exclude = ["*.bazel"],
|
|
|
|
),
|
2021-02-26 20:21:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
_CACHE_ENTRIES = {
|
|
|
|
"BUILD_CURL_EXE": "off",
|
|
|
|
"BUILD_SHARED_LIBS": "off",
|
2021-05-06 00:47:25 +00:00
|
|
|
"CMAKE_BUILD_TYPE": "RELEASE",
|
2021-04-23 19:41:42 +00:00
|
|
|
"CMAKE_PREFIX_PATH": "$$EXT_BUILD_DEPS$$/openssl",
|
2021-07-28 15:13:03 +00:00
|
|
|
"CMAKE_USE_OPENSSL": "on",
|
2021-02-26 20:21:13 +00:00
|
|
|
# TODO: ldap should likely be enabled
|
|
|
|
"CURL_DISABLE_LDAP": "on",
|
2021-07-28 15:13:03 +00:00
|
|
|
"OPENSSL_ROOT_DIR": "$$EXT_BUILD_DEPS$$/openssl",
|
2021-02-26 20:21:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_MACOS_CACHE_ENTRIES = dict(_CACHE_ENTRIES.items() + {
|
|
|
|
"CMAKE_AR": "",
|
|
|
|
"CMAKE_C_ARCHIVE_CREATE": "",
|
|
|
|
}.items())
|
|
|
|
|
|
|
|
_LINUX_CACHE_ENTRIES = dict(_CACHE_ENTRIES.items() + {
|
|
|
|
"CMAKE_C_FLAGS": "-fPIC",
|
|
|
|
}.items())
|
|
|
|
|
2021-03-09 18:55:01 +00:00
|
|
|
cmake(
|
2021-02-26 20:21:13 +00:00
|
|
|
name = "curl",
|
|
|
|
cache_entries = select({
|
|
|
|
"@platforms//os:linux": _LINUX_CACHE_ENTRIES,
|
|
|
|
"@platforms//os:macos": _MACOS_CACHE_ENTRIES,
|
|
|
|
"//conditions:default": _CACHE_ENTRIES,
|
|
|
|
}),
|
2021-04-12 15:23:42 +00:00
|
|
|
generate_args = select({
|
2021-02-26 20:21:13 +00:00
|
|
|
"@platforms//os:windows": ["-GNinja"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
|
|
|
generate_crosstool_file = False,
|
|
|
|
lib_source = ":all_srcs",
|
2021-07-28 15:13:03 +00:00
|
|
|
linkopts = select({
|
|
|
|
"@platforms//os:linux": [
|
|
|
|
"-lpthread",
|
|
|
|
],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
2021-03-11 17:14:00 +00:00
|
|
|
out_static_libs = select({
|
2021-02-26 20:21:13 +00:00
|
|
|
"@platforms//os:windows": ["libcurl.lib"],
|
|
|
|
"//conditions:default": ["libcurl.a"],
|
|
|
|
}),
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2021-07-28 15:13:03 +00:00
|
|
|
"@openssl",
|
|
|
|
"@zlib",
|
|
|
|
],
|
2021-02-26 20:21:13 +00:00
|
|
|
)
|