Skip to content

Commit d408c98

Browse files
committed
refactor: Move Tox_Options to tox_options.h.
For backwards compatibility, we also `#include "tox_options.h"` in `tox.h`, but in 0.3.0 we can break that so most toxcore client code doesn't need the options, only the part that creates the instance.
1 parent 5ab42d4 commit d408c98

25 files changed

+1041
-859
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ jobs:
126126
steps:
127127
- checkout
128128
- run: git submodule update --init --recursive
129+
- run: /src/workspace/tools/inject-repo c-toxcore
129130
- run: cd /src/workspace &&
130131
bazel test
131132
-k

BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,29 @@ genrule(
1010
"//c-toxcore/toxcore:tox.h",
1111
"//c-toxcore/toxcore:tox_dispatch.h",
1212
"//c-toxcore/toxcore:tox_events.h",
13+
"//c-toxcore/toxcore:tox_options.h",
1314
"//c-toxcore/toxcore:tox_private.h",
15+
"//c-toxcore/toxcore:tox_types.h",
1416
"//c-toxcore/toxencryptsave:toxencryptsave.h",
1517
],
1618
outs = [
1719
"tox/toxav.h",
1820
"tox/tox.h",
1921
"tox/tox_dispatch.h",
2022
"tox/tox_events.h",
23+
"tox/tox_options.h",
2124
"tox/tox_private.h",
25+
"tox/tox_types.h",
2226
"tox/toxencryptsave.h",
2327
],
2428
cmd = """
2529
cp $(location //c-toxcore/toxav:toxav.h) $(GENDIR)/c-toxcore/tox/toxav.h
2630
cp $(location //c-toxcore/toxcore:tox.h) $(GENDIR)/c-toxcore/tox/tox.h
2731
cp $(location //c-toxcore/toxcore:tox_dispatch.h) $(GENDIR)/c-toxcore/tox/tox_dispatch.h
2832
cp $(location //c-toxcore/toxcore:tox_events.h) $(GENDIR)/c-toxcore/tox/tox_events.h
33+
cp $(location //c-toxcore/toxcore:tox_options.h) $(GENDIR)/c-toxcore/tox/tox_options.h
2934
cp $(location //c-toxcore/toxcore:tox_private.h) $(GENDIR)/c-toxcore/tox/tox_private.h
35+
cp $(location //c-toxcore/toxcore:tox_types.h) $(GENDIR)/c-toxcore/tox/tox_types.h
3036
cp $(location //c-toxcore/toxencryptsave:toxencryptsave.h) $(GENDIR)/c-toxcore/tox/toxencryptsave.h
3137
""",
3238
visibility = ["//visibility:public"],

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,14 @@ set(toxcore_SOURCES
348348
toxcore/tox_events.c
349349
toxcore/tox_events.h
350350
toxcore/tox.h
351+
toxcore/tox_options.c
352+
toxcore/tox_options.h
351353
toxcore/tox_private.c
352354
toxcore/tox_private.h
353355
toxcore/tox_pack.c
354356
toxcore/tox_pack.h
357+
toxcore/tox_types.c
358+
toxcore/tox_types.h
355359
toxcore/tox_unpack.c
356360
toxcore/tox_unpack.h
357361
toxcore/util.c
@@ -369,8 +373,10 @@ endif()
369373
set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} libsodium)
370374
set(toxcore_API_HEADERS
371375
${toxcore_SOURCE_DIR}/toxcore/tox.h^tox
376+
${toxcore_SOURCE_DIR}/toxcore/tox_dispatch.h^tox
372377
${toxcore_SOURCE_DIR}/toxcore/tox_events.h^tox
373-
${toxcore_SOURCE_DIR}/toxcore/tox_dispatch.h^tox)
378+
${toxcore_SOURCE_DIR}/toxcore/tox_options.h^tox
379+
${toxcore_SOURCE_DIR}/toxcore/tox_types.h^tox)
374380
if(EXPERIMENTAL_API)
375381
set(toxcore_API_HEADERS ${toxcore_API_HEADERS}
376382
${toxcore_SOURCE_DIR}/toxcore/tox_private.h^tox)

cmake/StrictAbi.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ function(_make_version_script target)
3232
COMMAND ${SHELL} -c "egrep '^\\w' ${header} | grep '${ns}_[a-z0-9_]*(' | grep -v '^typedef' | grep -o '${ns}_[a-z0-9_]*(' | egrep -o '[a-z0-9_]+' | sort -u"
3333
OUTPUT_VARIABLE sublib_SYMS
3434
OUTPUT_STRIP_TRAILING_WHITESPACE)
35+
if("${sublib_SYMS}" STREQUAL "")
36+
continue()
37+
endif()
3538
string(REPLACE "\n" ";" sublib_SYMS ${sublib_SYMS})
3639

3740
foreach(sym ${sublib_SYMS})

other/docker/modules/check

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ MODS = {}
1212
STD_MODULE = """module std [system] {
1313
textual header "/usr/include/alloca.h"
1414
textual header "/usr/include/assert.h"
15-
textual header "/usr/include/c++/13.2.1/algorithm"
16-
textual header "/usr/include/c++/13.2.1/array"
17-
textual header "/usr/include/c++/13.2.1/chrono"
18-
textual header "/usr/include/c++/13.2.1/cstddef"
19-
textual header "/usr/include/c++/13.2.1/cstdint"
20-
textual header "/usr/include/c++/13.2.1/cstdio"
21-
textual header "/usr/include/c++/13.2.1/cstdlib"
22-
textual header "/usr/include/c++/13.2.1/cstring"
23-
textual header "/usr/include/c++/13.2.1/iomanip"
24-
textual header "/usr/include/c++/13.2.1/iosfwd"
25-
textual header "/usr/include/c++/13.2.1/limits"
26-
textual header "/usr/include/c++/13.2.1/memory"
27-
textual header "/usr/include/c++/13.2.1/ostream"
28-
textual header "/usr/include/c++/13.2.1/random"
29-
textual header "/usr/include/c++/13.2.1/stdlib.h"
30-
textual header "/usr/include/c++/13.2.1/thread"
31-
textual header "/usr/include/c++/13.2.1/type_traits"
32-
textual header "/usr/include/c++/13.2.1/vector"
15+
textual header "/usr/include/c++/14.2.0/algorithm"
16+
textual header "/usr/include/c++/14.2.0/array"
17+
textual header "/usr/include/c++/14.2.0/chrono"
18+
textual header "/usr/include/c++/14.2.0/cstddef"
19+
textual header "/usr/include/c++/14.2.0/cstdint"
20+
textual header "/usr/include/c++/14.2.0/cstdio"
21+
textual header "/usr/include/c++/14.2.0/cstdlib"
22+
textual header "/usr/include/c++/14.2.0/cstring"
23+
textual header "/usr/include/c++/14.2.0/iomanip"
24+
textual header "/usr/include/c++/14.2.0/iosfwd"
25+
textual header "/usr/include/c++/14.2.0/limits"
26+
textual header "/usr/include/c++/14.2.0/memory"
27+
textual header "/usr/include/c++/14.2.0/ostream"
28+
textual header "/usr/include/c++/14.2.0/random"
29+
textual header "/usr/include/c++/14.2.0/stdlib.h"
30+
textual header "/usr/include/c++/14.2.0/thread"
31+
textual header "/usr/include/c++/14.2.0/type_traits"
32+
textual header "/usr/include/c++/14.2.0/vector"
3333
textual header "/usr/include/errno.h"
3434
textual header "/usr/include/fortify/stdio.h"
3535
textual header "/usr/include/fortify/string.h"

other/docker/modules/dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!other/docker/modules/check
2+
!**/BUILD.bazel

other/docker/modules/modules.Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM toxchat/c-toxcore:sources AS sources
2-
FROM alpine:3.19.0
1+
FROM alpine:3.21.0
32

43
RUN ["apk", "add", "--no-cache", \
54
"bash", \
@@ -15,7 +14,7 @@ RUN ["apk", "add", "--no-cache", \
1514
"python3"]
1615

1716
WORKDIR /work
18-
COPY --from=sources /src/ /work/
17+
COPY . /work/
1918

2019
COPY toxcore/BUILD.bazel /work/toxcore/
2120
COPY other/docker/modules/check /work/other/docker/modules/
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# ===== common =====
2+
# Ignore everything ...
3+
**/*
4+
# ... except sources
5+
!**/*.[ch]
6+
!**/*.cc
7+
!**/*.hh
8+
!CHANGELOG.md
9+
!LICENSE
10+
!README.md
11+
!auto_tests/data/*
12+
!other/bootstrap_daemon/bash-completion/**
13+
!other/bootstrap_daemon/tox-bootstrapd.*
14+
!other/proxy/*.mod
15+
!other/proxy/*.sum
16+
!other/proxy/*.go
17+
# ... and CMake build files (used by most builds).
18+
!**/CMakeLists.txt
19+
!.github/scripts/flags*.sh
20+
!cmake/*.cmake
21+
!other/pkgconfig/*
22+
!other/rpm/*
23+
!so.version
24+
!other/docker/modules/check
25+
!**/BUILD.bazel

other/docker/modules/run

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

3-
set -eux
4-
BUILD=modules
5-
other/docker/sources/build
6-
docker build -t "toxchat/c-toxcore:$BUILD" -f "other/docker/$BUILD/$BUILD.Dockerfile" .
3+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")/../sources" && pwd)/run.sh"

other/docker/pkgsrc/dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!other/docker/pkgsrc/pkgsrc.patch

0 commit comments

Comments
 (0)