Squashed 'external/toxcore/c-toxcore/' content from commit 67badf69
git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: 67badf69416a74e74f6d7eb51dd96f37282b8455
This commit is contained in:
27
.github/scripts/autotools-linux
vendored
Executable file
27
.github/scripts/autotools-linux
vendored
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
NPROC=$(nproc)
|
||||
|
||||
. ".github/scripts/flags-$CC.sh"
|
||||
|
||||
add_ld_flag -Wl,-z,defs
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
add_config_flag --with-nacl-libs="$CACHEDIR/lib/amd64"
|
||||
add_config_flag --with-nacl-headers="$CACHEDIR/include/amd64"
|
||||
add_config_flag --disable-ipv6
|
||||
add_config_flag --enable-nacl
|
||||
add_config_flag --enable-daemon
|
||||
add_config_flag --with-log-level=TRACE
|
||||
|
||||
autoreconf -fi
|
||||
mkdir -p _build
|
||||
cd _build # pushd
|
||||
../configure "${CONFIG_FLAGS[@]}" || (cat config.log && false)
|
||||
make "-j$NPROC" -k CFLAGS="$C_FLAGS" LDFLAGS="$LD_FLAGS"
|
||||
make -j50 -k distcheck DISTCHECK_CONFIGURE_FLAGS="${CONFIG_FLAGS[*]}" || (cat tox-*/_build/build/test-suite.log && false)
|
||||
cd - # popd
|
65
.github/scripts/cmake-android
vendored
Executable file
65
.github/scripts/cmake-android
vendored
Executable file
@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
# Set up environment
|
||||
NDK=$ANDROID_NDK_HOME
|
||||
|
||||
ABI=${1:-"armeabi-v7a"}
|
||||
|
||||
case $ABI in
|
||||
armeabi-v7a)
|
||||
TARGET=armv7a-linux-androideabi
|
||||
NDK_API=16
|
||||
;;
|
||||
arm64-v8a)
|
||||
TARGET=aarch64-linux-android
|
||||
NDK_API=21
|
||||
;;
|
||||
x86)
|
||||
TARGET=i686-linux-android
|
||||
NDK_API=16
|
||||
;;
|
||||
x86_64)
|
||||
TARGET=x86_64-linux-android
|
||||
NDK_API=21
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
rm -rf _android_prefix
|
||||
mkdir -p _android_prefix
|
||||
PREFIX=$PWD/_android_prefix
|
||||
|
||||
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
|
||||
SYSROOT=$TOOLCHAIN/sysroot
|
||||
|
||||
export CC="$TOOLCHAIN/bin/$TARGET$NDK_API"-clang
|
||||
export LDFLAGS=-static-libstdc++
|
||||
export PKG_CONFIG_PATH="$PREFIX"/lib/pkgconfig
|
||||
|
||||
# Build libsodium
|
||||
if [ ! -d libsodium ]; then
|
||||
git clone --branch=1.0.18 https://github.com/jedisct1/libsodium.git
|
||||
fi
|
||||
cd libsodium
|
||||
git clean -ffdx
|
||||
autoreconf -fi
|
||||
./configure --prefix="$PREFIX" --host="$TARGET" --with-sysroot="$SYSROOT" --disable-shared
|
||||
make -j"$(nproc)" install
|
||||
cd ..
|
||||
|
||||
# Build c-toxcore
|
||||
rm -rf _build
|
||||
mkdir -p _build
|
||||
cd _build
|
||||
cmake .. \
|
||||
-DBUILD_TOXAV=OFF \
|
||||
-DBOOTSTRAP_DAEMON=OFF \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$NDK/build/cmake/android.toolchain.cmake" \
|
||||
-DANDROID_ABI="$ABI" \
|
||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX"
|
||||
cmake --build .
|
52
.github/scripts/cmake-freebsd-stage2
vendored
Executable file
52
.github/scripts/cmake-freebsd-stage2
vendored
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2018-2021 nurupo
|
||||
|
||||
# Toxcore building
|
||||
|
||||
set -eux
|
||||
|
||||
if [ "$PWD" != "/work" ]; then
|
||||
cd ..
|
||||
mv c-toxcore /
|
||||
mkdir c-toxcore
|
||||
cd /work
|
||||
fi
|
||||
|
||||
. cmake-freebsd-run.sh
|
||||
|
||||
# === Get VM ready to build the code ===
|
||||
|
||||
gunzip "$IMAGE_NAME.gz"
|
||||
|
||||
start_vm
|
||||
|
||||
# Copy over toxcore code from host to qemu
|
||||
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -P "$SSH_PORT" -r /c-toxcore root@localhost:~
|
||||
|
||||
RUN ls -lh
|
||||
|
||||
cd /c-toxcore
|
||||
. ".github/scripts/flags-clang.sh"
|
||||
|
||||
add_ld_flag -Wl,-z,defs
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
RUN 'cmake -B_build -Hc-toxcore \
|
||||
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="_install" \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DNON_HERMETIC_TESTS=ON \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DTEST_TIMEOUT_SECONDS=90 \
|
||||
-DUSE_IPV6=OFF \
|
||||
-DAUTOTEST=ON'
|
||||
|
||||
# We created the VM with the same number of cores as the host, so the host-ran `nproc` here is fine
|
||||
RUN 'gmake "-j$NPROC" -k install -C_build'
|
||||
RUN 'gmake "-j$NPROC" test ARGS="-j50" -C_build || true'
|
45
.github/scripts/cmake-osx
vendored
Executable file
45
.github/scripts/cmake-osx
vendored
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
NPROC=$(sysctl -n hw.physicalcpu)
|
||||
|
||||
# Workaround for bug in Homebrew where it only finds an old Ruby version.
|
||||
brew update
|
||||
|
||||
brew install \
|
||||
libconfig \
|
||||
libsodium \
|
||||
libvpx \
|
||||
opus
|
||||
|
||||
. ".github/scripts/flags-clang.sh"
|
||||
|
||||
add_ld_flag -undefined error
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
# Allow _Static_assert. Supported C11 extensions are fine, since we have several
|
||||
# C99-only compilers we test against anyway. Anything that passes all the
|
||||
# compilers we use is fine.
|
||||
add_c_flag -Wno-c11-extensions
|
||||
|
||||
cmake -B_build -H. \
|
||||
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DNON_HERMETIC_TESTS=ON \
|
||||
-DTEST_TIMEOUT_SECONDS=120 \
|
||||
-DUSE_IPV6=OFF \
|
||||
-DAUTOTEST=ON
|
||||
|
||||
cd _build # pushd
|
||||
make "-j$NPROC" -k install
|
||||
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 ||
|
||||
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6
|
||||
cd - # popd
|
7
.github/scripts/cmake-win32
vendored
Executable file
7
.github/scripts/cmake-win32
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
i686=true
|
||||
x86_64=false
|
||||
WINDOWS_ARCH=win32
|
||||
|
||||
. .github/scripts/cmake-windows.sh
|
7
.github/scripts/cmake-win64
vendored
Executable file
7
.github/scripts/cmake-win64
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
i686=false
|
||||
x86_64=true
|
||||
WINDOWS_ARCH=win64
|
||||
|
||||
. .github/scripts/cmake-windows.sh
|
29
.github/scripts/cmake-windows.sh
vendored
Normal file
29
.github/scripts/cmake-windows.sh
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
NPROC=$(nproc)
|
||||
|
||||
. ".github/scripts/flags-gcc.sh"
|
||||
|
||||
# Allows wine to display source code file names and line numbers on crash in
|
||||
# its backtrace.
|
||||
add_flag -gdwarf-2
|
||||
|
||||
# Fix invalid register for .seh_savexmm error
|
||||
add_flag -fno-asynchronous-unwind-tables
|
||||
|
||||
docker run \
|
||||
-e ALLOW_TEST_FAILURE=true \
|
||||
-e ENABLE_ARCH_i686="$i686" \
|
||||
-e ENABLE_ARCH_x86_64="$x86_64" \
|
||||
-e ENABLE_TEST=true \
|
||||
-e EXTRA_CMAKE_FLAGS="-DBOOTSTRAP_DAEMON=OFF -DMIN_LOGGER_LEVEL=DEBUG -DTEST_TIMEOUT_SECONDS=90 -DAUTOTEST=ON" \
|
||||
-e CMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-e CMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-e CMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-e CMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-v "$PWD:/toxcore" \
|
||||
-v "$PWD/result:/prefix" \
|
||||
--rm \
|
||||
"toxchat/windows:$WINDOWS_ARCH"
|
61
.github/scripts/coverage-linux
vendored
Executable file
61
.github/scripts/coverage-linux
vendored
Executable file
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
NPROC=$(nproc)
|
||||
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libgtest-dev \
|
||||
libopus-dev \
|
||||
libsodium-dev \
|
||||
libvpx-dev \
|
||||
llvm-11 \
|
||||
ninja-build
|
||||
git clone --depth=1 https://github.com/ralight/mallocfail /tmp/mallocfail
|
||||
cd /tmp/mallocfail # pushd
|
||||
make
|
||||
sudo make install
|
||||
cd - # popd
|
||||
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
|
||||
sudo install other/docker/coverage/run_mallocfail /usr/local/bin/run_mallocfail
|
||||
(cd other/proxy && go build)
|
||||
other/proxy/proxy &
|
||||
|
||||
. ".github/scripts/flags-coverage.sh"
|
||||
|
||||
cmake -B_build -H. -GNinja \
|
||||
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
|
||||
-DENABLE_SHARED=OFF \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DNON_HERMETIC_TESTS=OFF \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DTEST_TIMEOUT_SECONDS=120 \
|
||||
-DUSE_IPV6=OFF \
|
||||
-DAUTOTEST=ON \
|
||||
-DPROXY_TEST=ON
|
||||
|
||||
cmake --build _build --parallel "$NPROC" --target install -- -k 0
|
||||
|
||||
cd _build # pushd
|
||||
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 ||
|
||||
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
run_mallocfail --ctest=2 --jobs=8
|
||||
cd - # popd
|
||||
|
||||
#coveralls \
|
||||
# --exclude auto_tests \
|
||||
# --exclude other \
|
||||
# --exclude testing \
|
||||
# --gcov-options '\-lp'
|
||||
|
||||
bash <(curl -s https://codecov.io/bash) -x "llvm-cov-11 gcov"
|
71
.github/scripts/flags-clang.sh
vendored
Normal file
71
.github/scripts/flags-clang.sh
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
. .github/scripts/flags.sh
|
||||
|
||||
# Add all warning flags we can.
|
||||
add_flag -Wall
|
||||
add_flag -Wextra
|
||||
add_flag -Weverything
|
||||
|
||||
# Disable specific warning flags for both C and C++.
|
||||
|
||||
# Very verbose, not very useful. This warns about things like int -> uint
|
||||
# conversions that change sign without a cast and narrowing conversions.
|
||||
add_flag -Wno-conversion
|
||||
# TODO(iphydf): Check enum values when received from the user, then assume
|
||||
# correctness and remove this suppression.
|
||||
add_flag -Wno-covered-switch-default
|
||||
# We use C99, so declarations can come after statements.
|
||||
add_flag -Wno-declaration-after-statement
|
||||
# Due to clang's tolower() macro being recursive
|
||||
# https://github.com/TokTok/c-toxcore/pull/481
|
||||
add_flag -Wno-disabled-macro-expansion
|
||||
# We don't put __attribute__ on the public API.
|
||||
add_flag -Wno-documentation-deprecated-sync
|
||||
# Bootstrap daemon does this.
|
||||
add_flag -Wno-format-nonliteral
|
||||
# struct Foo foo = {0}; is a common idiom. Missing braces means we'd need to
|
||||
# write {{{0}}} in some cases, which is ugly and a maintenance burden.
|
||||
add_flag -Wno-missing-braces
|
||||
add_flag -Wno-missing-field-initializers
|
||||
# We don't use this attribute. It appears in the non-NDEBUG stderr logger.
|
||||
add_flag -Wno-missing-noreturn
|
||||
# Useful sometimes, but we accept padding in structs for clarity.
|
||||
# Reordering fields to avoid padding will reduce readability.
|
||||
add_flag -Wno-padded
|
||||
# This warns on things like _XOPEN_SOURCE, which we currently need (we
|
||||
# probably won't need these in the future).
|
||||
add_flag -Wno-reserved-id-macro
|
||||
# TODO(iphydf): Clean these up. They are likely not bugs, but still
|
||||
# potential issues and probably confusing.
|
||||
add_flag -Wno-sign-compare
|
||||
# __attribute__((nonnull)) causes this warning on defensive null checks.
|
||||
add_flag -Wno-tautological-pointer-compare
|
||||
# Our use of mutexes results in a false positive, see 1bbe446.
|
||||
add_flag -Wno-thread-safety-analysis
|
||||
# File transfer code has this.
|
||||
add_flag -Wno-type-limits
|
||||
# Callbacks often don't use all their parameters.
|
||||
add_flag -Wno-unused-parameter
|
||||
# cimple does this better
|
||||
add_flag -Wno-unused-function
|
||||
# libvpx uses __attribute__((unused)) for "potentially unused" static
|
||||
# functions to avoid unused static function warnings.
|
||||
add_flag -Wno-used-but-marked-unused
|
||||
# We use variable length arrays a lot.
|
||||
add_flag -Wno-vla
|
||||
# Disable warnings about unknown Doxygen commands
|
||||
add_flag -Wno-documentation-unknown-command
|
||||
|
||||
# Disable specific warning flags for C++.
|
||||
|
||||
# Comma at end of enum is supported everywhere we run.
|
||||
add_cxx_flag -Wno-c++98-compat-pedantic
|
||||
# TODO(iphydf): Stop using flexible array members.
|
||||
add_cxx_flag -Wno-c99-extensions
|
||||
# We're C-compatible, so use C style casts.
|
||||
add_cxx_flag -Wno-old-style-cast
|
||||
|
||||
# Downgrade to warning so we still see it.
|
||||
add_flag -Wno-error=unreachable-code
|
||||
add_flag -Wno-error=unused-variable
|
27
.github/scripts/flags-coverage.sh
vendored
Normal file
27
.github/scripts/flags-coverage.sh
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
. .github/scripts/flags-clang.sh
|
||||
|
||||
add_ld_flag -Wl,-z,defs
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
# Coverage flags.
|
||||
add_flag --coverage
|
||||
|
||||
# Optimisation, but keep stack traces useful.
|
||||
add_c_flag -fno-inline -fno-omit-frame-pointer
|
||||
|
||||
# Show useful stack traces on crash.
|
||||
add_flag -fsanitize=undefined -fno-sanitize-recover=all
|
||||
|
||||
# In test code (_test.cc and libgtest), throw away all debug information.
|
||||
# We only care about stack frames inside toxcore (which is C). Without this,
|
||||
# mallocfail will spend a lot of time finding all the ways in which gtest can
|
||||
# fail to allocate memory, which is not interesting to us.
|
||||
add_cxx_flag -g0
|
||||
|
||||
# Continue executing code in error paths so we can see it cleanly exit (and the
|
||||
# test code itself may abort).
|
||||
add_flag -DABORT_ON_LOG_ERROR=false
|
63
.github/scripts/flags-gcc.sh
vendored
Normal file
63
.github/scripts/flags-gcc.sh
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
. .github/scripts/flags.sh
|
||||
|
||||
# Add all warning flags we can.
|
||||
add_flag -Wall
|
||||
add_flag -Wextra
|
||||
|
||||
# Some additional warning flags not enabled by any of the above.
|
||||
add_flag -Wbool-compare
|
||||
add_flag -Wcast-align
|
||||
add_flag -Wcast-qual
|
||||
add_flag -Wchar-subscripts
|
||||
add_flag -Wdouble-promotion
|
||||
add_flag -Wduplicated-cond
|
||||
add_flag -Wempty-body
|
||||
add_flag -Wenum-compare
|
||||
add_flag -Wfloat-equal
|
||||
add_flag -Wformat=2
|
||||
add_flag -Wframe-address
|
||||
add_flag -Wframe-larger-than=9000
|
||||
add_flag -Wignored-attributes
|
||||
add_flag -Wignored-qualifiers
|
||||
add_flag -Winit-self
|
||||
add_flag -Winline
|
||||
add_flag -Wlarger-than=530000
|
||||
add_flag -Wmaybe-uninitialized
|
||||
add_flag -Wmemset-transposed-args
|
||||
add_flag -Wmisleading-indentation
|
||||
add_flag -Wmissing-declarations
|
||||
add_flag -Wnonnull
|
||||
add_flag -Wnull-dereference
|
||||
add_flag -Wodr
|
||||
add_flag -Wredundant-decls
|
||||
add_flag -Wreturn-type
|
||||
add_flag -Wshadow
|
||||
add_flag -Wsuggest-attribute=format
|
||||
add_flag -Wundef
|
||||
add_flag -Wunsafe-loop-optimizations
|
||||
add_flag -Wunused-but-set-parameter
|
||||
add_flag -Wunused-but-set-variable
|
||||
add_flag -Wunused-label
|
||||
add_flag -Wunused-local-typedefs
|
||||
add_flag -Wunused-value
|
||||
|
||||
# Disable specific warning flags for both C and C++.
|
||||
|
||||
# struct Foo foo = {0}; is a common idiom.
|
||||
add_flag -Wno-missing-field-initializers
|
||||
# TODO(iphydf): Clean these up. They are likely not bugs, but still
|
||||
# potential issues and probably confusing.
|
||||
add_flag -Wno-sign-compare
|
||||
# File transfer code has this.
|
||||
add_flag -Wno-type-limits
|
||||
# Callbacks often don't use all their parameters.
|
||||
add_flag -Wno-unused-parameter
|
||||
# cimple does this better
|
||||
add_flag -Wno-unused-function
|
||||
# struct Foo foo = {0}; is a common idiom. Missing braces means we'd need to
|
||||
# write {{{0}}} in some cases, which is ugly and a maintenance burden.
|
||||
add_flag -Wno-missing-braces
|
||||
# __attribute__((nonnull)) causes this warning on defensive null checks.
|
||||
add_flag -Wno-nonnull-compare
|
35
.github/scripts/flags.sh
vendored
Normal file
35
.github/scripts/flags.sh
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
add_config_flag() { CONFIG_FLAGS+=("$@"); }
|
||||
add_c_flag() { C_FLAGS="$C_FLAGS $@"; }
|
||||
add_cxx_flag() { CXX_FLAGS="$CXX_FLAGS $@"; }
|
||||
add_ld_flag() { LD_FLAGS="$LD_FLAGS $@"; }
|
||||
add_flag() {
|
||||
add_c_flag "$@"
|
||||
add_cxx_flag "$@"
|
||||
}
|
||||
|
||||
# Our own flags which we can insert in the correct place. We don't use CFLAGS
|
||||
# and friends here (we unset them below), because they influence config tests
|
||||
# such as ./configure and cmake tests. Our warning flags break those tests, so
|
||||
# we can't add them globally here.
|
||||
CONFIG_FLAGS=()
|
||||
C_FLAGS=""
|
||||
CXX_FLAGS=""
|
||||
LD_FLAGS=""
|
||||
|
||||
unset CFLAGS
|
||||
unset CXXFLAGS
|
||||
unset CPPFLAGS
|
||||
unset LDFLAGS
|
||||
|
||||
# Optimisation flags.
|
||||
add_flag -O3 -march=native
|
||||
|
||||
# Warn on non-ISO C.
|
||||
add_c_flag -pedantic
|
||||
add_c_flag -std=c99
|
||||
add_cxx_flag -std=c++11
|
||||
|
||||
add_flag -g3
|
||||
add_flag -ftrapv
|
7
.github/scripts/sonar-build
vendored
Executable file
7
.github/scripts/sonar-build
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
. ".github/scripts/flags-gcc.sh"
|
||||
|
||||
cmake --build _build --parallel "$(nproc)" --target install -- -k 0
|
32
.github/scripts/sonar-prepare
vendored
Executable file
32
.github/scripts/sonar-prepare
vendored
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libconfig-dev \
|
||||
libopus-dev \
|
||||
libsodium-dev \
|
||||
libvpx-dev \
|
||||
ninja-build
|
||||
|
||||
. ".github/scripts/flags-gcc.sh"
|
||||
|
||||
add_ld_flag -Wl,-z,defs
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
cmake -B_build -H. -GNinja \
|
||||
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DNON_HERMETIC_TESTS=OFF \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DTEST_TIMEOUT_SECONDS=120 \
|
||||
-DUSE_IPV6=OFF \
|
||||
-DAUTOTEST=ON \
|
||||
-DENABLE_SHARED=OFF
|
77
.github/scripts/tox-bootstrapd-docker
vendored
Executable file
77
.github/scripts/tox-bootstrapd-docker
vendored
Executable file
@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -exu
|
||||
|
||||
LOCAL="${1:-}"
|
||||
|
||||
readarray -t FILES <<<"$(git ls-files)"
|
||||
|
||||
tar c "${FILES[@]}" | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node -
|
||||
docker tag toxchat/bootstrap-node:latest toxchat/bootstrap-node:"$(other/print-version)"
|
||||
|
||||
sudo useradd \
|
||||
--home-dir /var/lib/tox-bootstrapd \
|
||||
--create-home \
|
||||
--system \
|
||||
--shell /sbin/nologin \
|
||||
--comment "Account to run Tox's DHT bootstrap daemon" \
|
||||
--user-group tox-bootstrapd
|
||||
sudo chmod 700 /var/lib/tox-bootstrapd
|
||||
docker run -d --name tox-bootstrapd \
|
||||
--user "$(id -u tox-bootstrapd):$(id -g tox-bootstrapd)" \
|
||||
-v /var/lib/tox-bootstrapd/:/var/lib/tox-bootstrapd/ \
|
||||
--ulimit nofile=32768:32768 \
|
||||
-p 443:443 \
|
||||
-p 3389:3389 \
|
||||
-p 33445:33445 \
|
||||
-p 33445:33445/udp \
|
||||
toxchat/bootstrap-node
|
||||
|
||||
sudo ls -lbh /var/lib/tox-bootstrapd
|
||||
|
||||
if sudo [ ! -f /var/lib/tox-bootstrapd/keys ]; then
|
||||
echo "Error: File /var/lib/tox-bootstrapd/keys doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$LOCAL" != "local" ]; then
|
||||
COUNTER=0
|
||||
COUNTER_END=120
|
||||
while [ "$COUNTER" -lt "$COUNTER_END" ]; do
|
||||
if docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully"; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
COUNTER=$(($COUNTER + 1))
|
||||
done
|
||||
|
||||
docker logs tox-bootstrapd
|
||||
|
||||
if [ "$COUNTER" = "$COUNTER_END" ]; then
|
||||
echo "Error: Didn't connect to any nodes"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
docker logs tox-bootstrapd
|
||||
fi
|
||||
|
||||
# Wait a bit before testing if the container is still running
|
||||
sleep 30
|
||||
|
||||
docker ps -a
|
||||
|
||||
if [ "$(docker inspect -f {{.State.Running}} tox-bootstrapd)" != "true" ]; then
|
||||
echo "Error: Container is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat /proc/"$(pidof tox-bootstrapd)"/limits
|
||||
if ! grep -P '^Max open files(\s+)32768(\s+)32768(\s+)files' /proc/"$(pidof tox-bootstrapd)"/limits; then
|
||||
echo "Error: ulimit is not set to the expected value"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! other/fun/bootstrap_node_info.py ipv4 localhost 33445; then
|
||||
echo "Error: Unable to get bootstrap node info"
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user