From 3e187237ef600f642aadc8abdb8427248d083c40 Mon Sep 17 00:00:00 2001 From: Jacob Blankenship <55797848+J-B-Blankenship@users.noreply.github.com> Date: Tue, 27 Jan 2026 11:36:55 -0500 Subject: [PATCH 1/3] Refine srcs glob to include and exclude patterns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Non-ASCII characters cannot be parsed by glob. Resolves the following error when trying to build: ERROR: /root/.cache/bazel/_bazel_root/646bcbb063181c5dac5a581e1c4fefdd/external/_main~_repo_rules~cpr/BUILD.bazel:22:6: Foreign Cc - CMake: Building cpr failed: error reading file '@@_main~_repo_rules~cpr//:test/data/test_file_hello_äüöp_2585_你好.txt': /root/.cache/bazel/_bazel_root/646bcbb063181c5dac5a581e1c4fefdd/external/_main~_repo_rules~cpr/test/data/test_file_hello_äüöp_2585_你好.txt (No such file or directory) --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 31799049f..dd313cb4c 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,13 @@ load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake") filegroup( name = "srcs", - srcs = glob(["**"], ["bazel-*/**"]), + srcs = glob( + include = ["**"], + exclude = [ + "bazel-*/**", + "test/data/**", # Exclude test data. + ], + ), visibility = ["//visibility:public"], ) From abf70236f56ecb50ebe84b23c1b3a8f8ec3747dd Mon Sep 17 00:00:00 2001 From: Jacob Blankenship <55797848+J-B-Blankenship@users.noreply.github.com> Date: Wed, 28 Jan 2026 08:34:54 -0500 Subject: [PATCH 2/3] Refactor Bazel setup for cpr library Updated Bazel dependencies and build configuration for cpr. --- README.md | 67 +++++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index dd313cb4c..66e43f639 100644 --- a/README.md +++ b/README.md @@ -152,48 +152,43 @@ Please refer to [hedronvision/bazel-make-cc-https-easy](https://github.com/hedro `cpr` can be added as an extension by adding the following lines to your bazel MODULE file (tested with Bazel 8). Edit the versions as needed. ```starlark bazel_dep(name = "curl", version = "8.8.0.bcr.3") -bazel_dep(name = "platforms", version = "0.0.11") -bazel_dep(name = "zlib", version = "1.3.1.bcr.5") -bazel_dep(name = "boringssl", version = "0.20250212.0") -bazel_dep(name = "rules_foreign_cc", version = "0.14.0") - -http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( +git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +git_repository( name = "cpr", - url = "https://github.com/libcpr/cpr/archive/refs/tags/1.11.2.tar.gz", - strip_prefix = "cpr-1.11.2", - sha256 = "3795a3581109a9ba5e48fbb50f9efe3399a3ede22f2ab606b71059a615cd6084", - build_file_content = """ -load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake") - -filegroup( - name = "srcs", - srcs = glob( - include = ["**"], - exclude = [ - "bazel-*/**", - "test/data/**", # Exclude test data. - ], - ), - visibility = ["//visibility:public"], + build_file = "//path/to/build:cpr.BUILD", + commit = "516cb3e5f4e38bede088f69fcf122c6089e38f00", + remote = "https://github.com/libcpr/cpr.git", + patches = ["//path/to/patch:cpr.PATCH"] ) +``` -cmake( +```starlark +// cpr.BUILD +cc_library( name = "cpr", - cache_entries = { - }, - tags = ["requires-network"], - includes = ["include/cpr"], - lib_source = ":srcs", - out_shared_libs = select({ - "@platforms//os:macos": ["libcpr.dylib"], - "@platforms//os:windows": ["libcpr.dll"], - "//conditions:default": ["libcpr.so.1"], - }), + hdrs = glob(["include/**/*.h"]), + includes = ["include"], visibility = ["//visibility:public"], + + srcs = glob(["cpr/**/*.cpp"]), + deps = [ + "@curl//:curl" + ], ) -""" -) +``` + +```starlark +// Remove this line: cpr.PATCH +--- include/cpr/cpr.h ++++ include/cpr/cpr.h +@@ -10,7 +10,6 @@ + #include "cpr/connection_pool.h" + #include "cpr/cookies.h" + #include "cpr/cprtypes.h" +-#include "cpr/cprver.h" + #include "cpr/curl_container.h" + #include "cpr/curlholder.h" + #include "cpr/error.h" ``` ### Packages for Linux Distributions From 41de77db708cfa58d0ebd5ea1d7d3f4161b8576d Mon Sep 17 00:00:00 2001 From: Jacob Blankenship <55797848+J-B-Blankenship@users.noreply.github.com> Date: Wed, 28 Jan 2026 08:35:51 -0500 Subject: [PATCH 3/3] Update README to remove Bazel link Removed reference to external Bazel repository due to being years out of date. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 66e43f639..35696fa61 100644 --- a/README.md +++ b/README.md @@ -147,8 +147,6 @@ ctest -VV # -VV is optional since it enables verbose output ``` ### Bazel -Please refer to [hedronvision/bazel-make-cc-https-easy](https://github.com/hedronvision/bazel-make-cc-https-easy) or - `cpr` can be added as an extension by adding the following lines to your bazel MODULE file (tested with Bazel 8). Edit the versions as needed. ```starlark bazel_dep(name = "curl", version = "8.8.0.bcr.3")