From 29d760301179e33cd00f28a3344cbfbbaa23164c Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 10 Feb 2026 21:52:02 +0000 Subject: [PATCH] chore: Statically link tests in bazel. Some curl weirdness. We didn't have this with our own custom curl build, but the bzlmod one has something weird about it. Still, better to use someone else's maintained curl build than our own, even with this slight oddity. --- BUILD.bazel | 17 ++++++++++++++--- src/main.c | 2 +- src/python_api.c | 2 +- src/python_api.h | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index f40202206..4ba9b652f 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -19,10 +19,13 @@ COPTS = [ "//tools/config:linux-x86_64": [ "-DAUDIO", "-DVIDEO", - "-DPYTHON", "-DTOX_EXPERIMENTAL", ], "//conditions:default": [], +}) + select({ + "//tools/config:linux-x86_64": ["-DPYTHON"], + "//tools/config:linux-x86_64-no-python": [], + "//conditions:default": [], }) cc_library( @@ -50,11 +53,14 @@ cc_library( "//tools/config:linux-x86_64": [ "@libvpx", "@openal", - "@python3//:python", "@x11", "@xproto", ], "//conditions:default": [], + }) + select({ + "//tools/config:linux-x86_64": ["@python3//:python"], + "//tools/config:linux-x86_64-no-python": [], + "//conditions:default": [], }), ) @@ -74,10 +80,13 @@ cc_binary( "//tools/config:linux-x86_64": [ "@libvpx", "@openal", - "@python3//:python", "@x11", ], "//conditions:default": [], + }) + select({ + "//tools/config:linux-x86_64": ["@python3//:python"], + "//tools/config:linux-x86_64-no-python": [], + "//conditions:default": [], }), ) @@ -93,6 +102,7 @@ cc_test( name = "line_info_test", size = "small", srcs = ["src/line_info_test.cc"], + linkstatic = True, tags = ["no-windows"], deps = [ ":libtoxic", @@ -105,6 +115,7 @@ cc_test( name = "misc_tools_test", size = "small", srcs = ["src/misc_tools_test.cc"], + linkstatic = True, tags = ["no-windows"], deps = [ ":libtoxic", diff --git a/src/main.c b/src/main.c index 6d52171e8..5d9ec85fc 100644 --- a/src/main.c +++ b/src/main.c @@ -192,7 +192,7 @@ static void load_groups(Toxic *toxic) Tox *tox = toxic->tox; - size_t numgroups = tox_group_get_number_groups(tox); + size_t numgroups = tox_group_get_group_list_size(tox); for (size_t i = 0; i < numgroups; ++i) { if (init_groupchat_win(toxic, i, NULL, 0, Group_Join_Type_Load) != 0) { diff --git a/src/python_api.c b/src/python_api.c index 5cd28b3ee..314931531 100644 --- a/src/python_api.c +++ b/src/python_api.c @@ -291,7 +291,7 @@ void init_python(Toxic *toxic) PyEval_SaveThread(); } -void run_python(FILE *fp, char *path) +void run_python(FILE *fp, const char *path) { PyGILState_STATE gstate = PyGILState_Ensure(); diff --git a/src/python_api.h b/src/python_api.h index b6067411e..7b6227c38 100644 --- a/src/python_api.h +++ b/src/python_api.h @@ -20,7 +20,7 @@ PyMODINIT_FUNC PyInit_toxic_api(void); void terminate_python(void); void init_python(Toxic *toxic); -void run_python(FILE *fp, char *path); +void run_python(FILE *fp, const char *path); int do_python_command(int num_args, char (*args)[MAX_STR_SIZE]); int python_num_registered_handlers(void); int python_help_max_width(void);