update toxcore, includes ngc mem savings
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled

Merge commit '261d2e53b7a513de7eb35e022fe3b2ae4efa835f'
This commit is contained in:
Green Sky
2024-12-19 16:27:40 +01:00
101 changed files with 1942 additions and 887 deletions

View File

@ -21,10 +21,15 @@ cc_binary(
"//c-toxcore/toxcore:Messenger",
"//c-toxcore/toxcore:TCP_server",
"//c-toxcore/toxcore:ccompat",
"//c-toxcore/toxcore:crypto_core",
"//c-toxcore/toxcore:forwarding",
"//c-toxcore/toxcore:group_announce",
"//c-toxcore/toxcore:group_onion_announce",
"//c-toxcore/toxcore:logger",
"//c-toxcore/toxcore:mem",
"//c-toxcore/toxcore:mono_time",
"//c-toxcore/toxcore:network",
"//c-toxcore/toxcore:onion",
"//c-toxcore/toxcore:onion_announce",
"//c-toxcore/toxcore:tox",
],

View File

@ -144,16 +144,16 @@ int main(int argc, char *argv[])
IP ip;
ip_init(&ip, ipv6enabled);
Logger *logger = logger_new();
const Random *rng = os_random();
const Network *ns = os_network();
const Memory *mem = os_memory();
Logger *logger = logger_new(mem);
if (MIN_LOGGER_LEVEL <= LOGGER_LEVEL_DEBUG) {
logger_callback_log(logger, print_log, nullptr, nullptr);
}
const Random *rng = os_random();
const Network *ns = os_network();
const Memory *mem = os_memory();
Mono_Time *mono_time = mono_time_new(mem, nullptr, nullptr);
const uint16_t start_port = PORT;
const uint16_t end_port = start_port + (TOX_PORTRANGE_TO - TOX_PORTRANGE_FROM);
@ -228,9 +228,12 @@ int main(int argc, char *argv[])
const uint16_t port = net_htons((uint16_t)port_conv);
// TODO(iphydf): Maybe disable and only use IP addresses?
const bool dns_enabled = true;
uint8_t *bootstrap_key = hex_string_to_bin(argv[argvoffset + 3]);
const bool res = dht_bootstrap_from_address(dht, argv[argvoffset + 1],
ipv6enabled, port, bootstrap_key);
ipv6enabled, dns_enabled, port, bootstrap_key);
free(bootstrap_key);
if (!res) {

View File

@ -15,7 +15,7 @@ CPPFLAGS+=("-Itoxav")
CPPFLAGS+=("-Itoxencryptsave")
CPPFLAGS+=("-Ithird_party/cmp")
LDFLAGS=("-lopus" "-lsodium" "-lvpx" "-lpthread" "-lconfig" "-lgmock" "-lgtest")
LDFLAGS=("-lopus" "-lsodium" "-lvpx" "-lpthread" "-lconfig" "-lgmock" "-lgtest" "-lbenchmark")
LDFLAGS+=("-fuse-ld=gold")
LDFLAGS+=("-Wl,--detect-odr-violations")
LDFLAGS+=("-Wl,--warn-common")
@ -27,7 +27,7 @@ put() {
if [ "$SKIP_LINES" = "" ]; then
echo "#line 1 \"$1\"" >>amalgamation.cc
fi
cat "$1" >>amalgamation.cc
grep -v '^BENCHMARK_MAIN' "$1" >>amalgamation.cc
}
putmain() {

View File

@ -6,16 +6,24 @@ cc_binary(
"src/*.c",
"src/*.h",
]),
tags = ["no-windows"],
deps = [
"//c-toxcore/other:bootstrap_node_packets",
"//c-toxcore/toxcore:DHT",
"//c-toxcore/toxcore:LAN_discovery",
"//c-toxcore/toxcore:TCP_server",
"//c-toxcore/toxcore:announce",
"//c-toxcore/toxcore:attributes",
"//c-toxcore/toxcore:ccompat",
"//c-toxcore/toxcore:crypto_core",
"//c-toxcore/toxcore:forwarding",
"//c-toxcore/toxcore:group_announce",
"//c-toxcore/toxcore:group_onion_announce",
"//c-toxcore/toxcore:logger",
"//c-toxcore/toxcore:mem",
"//c-toxcore/toxcore:mono_time",
"//c-toxcore/toxcore:network",
"//c-toxcore/toxcore:onion",
"//c-toxcore/toxcore:onion_announce",
"//c-toxcore/toxcore:tox",
"@libconfig",

View File

@ -1 +1 @@
e96f03a89051c5df12c28d0d6941184da2b92742d248bd4c57d31189a0052844 /usr/local/bin/tox-bootstrapd
9ec2993a28988bd147bf8f4f21a824c2fc5dbf7255e391b3ce517d337ebce5c1 /usr/local/bin/tox-bootstrapd

View File

@ -390,6 +390,9 @@ bool bootstrap_from_config(const char *cfg_file_path, DHT *dht, bool enable_ipv6
bool address_resolved;
uint8_t *bs_public_key_bin;
// TODO(iphydf): Maybe disable it and only use IP addresses?
const bool dns_enabled = true;
node = config_setting_get_elem(node_list, 0);
if (node == nullptr) {
@ -429,7 +432,7 @@ bool bootstrap_from_config(const char *cfg_file_path, DHT *dht, bool enable_ipv6
}
bs_public_key_bin = bootstrap_hex_string_to_bin(bs_public_key);
address_resolved = dht_bootstrap_from_address(dht, bs_address, enable_ipv6, net_htons(bs_port),
address_resolved = dht_bootstrap_from_address(dht, bs_address, enable_ipv6, dns_enabled, net_htons(bs_port),
bs_public_key_bin);
free(bs_public_key_bin);

View File

@ -283,16 +283,17 @@ int main(int argc, char *argv[])
IP ip;
ip_init(&ip, enable_ipv6);
Logger *logger = logger_new();
const Memory *mem = os_memory();
const Random *rng = os_random();
const Network *ns = os_network();
Logger *logger = logger_new(mem);
if (MIN_LOGGER_LEVEL <= LOGGER_LEVEL_DEBUG) {
logger_callback_log(logger, toxcore_logger_callback, nullptr, nullptr);
}
const uint16_t end_port = start_port + (TOX_PORTRANGE_TO - TOX_PORTRANGE_FROM);
const Memory *mem = os_memory();
const Random *rng = os_random();
const Network *ns = os_network();
Networking_Core *net = new_networking_ex(logger, mem, ns, &ip, start_port, end_port, nullptr);
if (net == nullptr) {

View File

@ -1,18 +1,18 @@
################################################
# cmake-asan
FROM ubuntu:20.04
FROM ubuntu:24.04
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
clang \
cmake \
libclang-rt-dev \
libconfig-dev \
libgmock-dev \
libgtest-dev \
libopus-dev \
libsodium-dev \
libvpx-dev \
llvm-dev \
ninja-build \
pkg-config \
&& apt-get clean \
@ -22,8 +22,8 @@ COPY entrypoint.sh /
RUN ["chmod", "755", "/entrypoint.sh"]
WORKDIR /home/builder
RUN groupadd -r -g 1000 builder \
&& useradd --no-log-init -r -g builder -u 1000 builder \
RUN groupadd -r -g 987 builder \
&& useradd --no-log-init -r -g builder -u 987 builder \
&& chown builder:builder /home/builder
USER builder

View File

@ -1,9 +1,9 @@
#!/bin/sh
set -eu
set -eux
SANITIZER="${1:-asan}"
cp -a /c-toxcore .
cd c-toxcore
.circleci/cmake-"$SANITIZER"
.circleci/cmake-"$SANITIZER" || (cat /home/builder/c-toxcore/_build/CMakeFiles/CMakeError.log && false)

View File

@ -1,6 +1,14 @@
#!/bin/sh
set -eux
SANITIZER="${1:-asan}"
if [ -t 0 ]; then
TTY=true
else
TTY=false
fi
docker build -t toxchat/c-toxcore:circleci other/docker/circleci
docker run --name toxcore-circleci --rm -it -v "$PWD:/c-toxcore" toxchat/c-toxcore:circleci "$SANITIZER"
docker run --name toxcore-circleci --rm --interactive="$TTY" --tty="$TTY" --volume "$PWD:/c-toxcore" toxchat/c-toxcore:circleci "$SANITIZER"

View File

@ -9,6 +9,7 @@ cc_binary(
"main/tox_main.h",
],
deps = [
"//c-toxcore/toxcore:ccompat",
"//c-toxcore/toxcore:tox",
"//c-toxcore/toxcore:tox_events",
],

View File

@ -50,6 +50,10 @@ module "//c-toxcore/third_party:cmp" {
module "//c-toxcore/toxencryptsave:defines" {
header "toxencryptsave/defines.h"
}
module "@benchmark" {
textual header "/usr/include/benchmark/benchmark.h"
use std
}
module "@com_google_googletest//:gtest" {
textual header "/usr/include/gmock/gmock.h"
textual header "/usr/include/gtest/gtest.h"
@ -83,9 +87,9 @@ class Context:
pass
def bzl_exports_files(
self,
srcs: list[str],
visibility: Optional[list[str]] = None,
self,
srcs: list[str],
visibility: Optional[list[str]] = None,
) -> None:
pass
@ -110,7 +114,7 @@ class Context:
hdrs,
}
def bzl_cc_test(
def bzl_cc_binary(
self,
name: str,
srcs: Iterable[str] = tuple(),
@ -161,7 +165,8 @@ def main() -> None:
"load": ctx.bzl_load,
"exports_files": ctx.bzl_exports_files,
"cc_library": ctx.bzl_cc_library,
"cc_test": ctx.bzl_cc_test,
"cc_binary": ctx.bzl_cc_binary,
"cc_test": ctx.bzl_cc_binary,
"cc_fuzz_test": ctx.bzl_cc_fuzz_test,
"select": ctx.bzl_select,
"glob": ctx.bzl_glob,

View File

@ -3,6 +3,7 @@ FROM alpine:3.19.0
RUN ["apk", "add", "--no-cache", \
"bash", \
"benchmark-dev", \
"clang", \
"gtest-dev", \
"libconfig-dev", \

View File

@ -5,7 +5,7 @@ COPY . /work/c-toxcore-0.2.18
RUN ["tar", "zcf", "c-toxcore.tar.gz", "c-toxcore-0.2.18"]
WORKDIR /work/pkgsrc/chat/toxcore
RUN ["sed", "-i", "-e", "s/libtoxcore.so.2.18.0/libtoxcore.so.2.19.0/g", "PLIST"]
RUN ["sed", "-i", "-e", "s/libtoxcore.so.2.18.0/libtoxcore.so.2.20.0/g", "PLIST"]
RUN ["bmake", "clean"]
RUN ["bmake", "DISTFILES=c-toxcore.tar.gz", "DISTDIR=/work", "NO_CHECKSUM=yes"]
RUN ["bmake", "install"]