summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.circleci/config.yml32
-rw-r--r--.travis.yml73
-rwxr-xr-x.travis/autotools-linux52
-rwxr-xr-x.travis/cmake-freebsd-stage123
-rwxr-xr-x.travis/cmake-freebsd-stage223
-rwxr-xr-x.travis/cmake-linux75
-rwxr-xr-x.travis/cmake-osx46
-rwxr-xr-x.travis/cmake-win327
-rwxr-xr-x.travis/cmake-win647
-rw-r--r--.travis/cmake-windows.sh48
-rw-r--r--.travis/flags-clang.sh62
-rw-r--r--.travis/flags-gcc.sh19
-rw-r--r--.travis/flags.sh33
-rwxr-xr-x.travis/tox-bootstrapd-docker (renamed from other/travis/tox-bootstrapd-docker-linux-script)1
-rwxr-xr-x.travis/upload-coverage (renamed from other/travis/toxcore-linux-after_script)0
-rw-r--r--CMakeLists.txt126
-rw-r--r--cmake/AddCompilerFlag.cmake47
-rw-r--r--cmake/CompileGTest.cmake3
-rw-r--r--configure.ac2
-rw-r--r--other/bootstrap_daemon/src/Makefile.inc1
-rw-r--r--other/docker/windows/build_toxcore.sh10
-rw-r--r--other/travis/autotools-linux-install14
-rwxr-xr-xother/travis/autotools-script35
-rw-r--r--other/travis/env-linux.sh27
-rw-r--r--other/travis/env-osx.sh21
-rw-r--r--other/travis/env-windows.sh36
-rwxr-xr-xother/travis/freebsd-script-stage14
-rwxr-xr-xother/travis/installmd-windows-install12
-rwxr-xr-xother/travis/installmd-windows-script12
-rwxr-xr-xother/travis/phase32
-rwxr-xr-xother/travis/toxcore-after_failure7
-rwxr-xr-xother/travis/toxcore-linux-install26
-rwxr-xr-xother/travis/toxcore-osx-install6
-rwxr-xr-xother/travis/toxcore-windows-install7
-rw-r--r--toxcore/crypto_core.c12
35 files changed, 486 insertions, 455 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 3e6f293e..f85e9548 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -10,13 +10,33 @@ jobs:
10 x86_64: 10 x86_64:
11 working_directory: ~/work 11 working_directory: ~/work
12 docker: 12 docker:
13 - image: circleci/builder-base:latest 13 - image: ubuntu
14 14
15 steps: 15 steps:
16 - checkout 16 - checkout
17 - run: add-apt-repository ppa:chris-lea/libsodium
18 - run: apt update 17 - run: apt update
19 - run: apt install -y clang cmake libgtest-dev libopus-dev libsodium-dev libvpx-dev pkg-config 18 - run: apt install -y --no-install-recommends
20 - run: cmake -H. -B_build -DDEBUG=ON -DTRACE=ON -DERROR_ON_WARNING=ON -DASAN=ON -DMUST_BUILD_TOXAV=ON -DSTRICT_ABI=ON -DTEST_TIMEOUT_SECONDS=90 -DUSE_IPV6=OFF 19 clang
21 - run: make -C _build -j$(nproc) 20 cmake
22 - run: make -C _build test ARGS="-j50 --rerun-failed" CTEST_OUTPUT_ON_FAILURE=1 || make -C _build test ARGS="-j50 --rerun-failed" CTEST_OUTPUT_ON_FAILURE=1 21 libconfig-dev
22 libgtest-dev
23 libopus-dev
24 libsodium-dev
25 libvpx-dev
26 ninja-build
27 pkg-config
28 - run: . .travis/flags-clang.sh;
29 add_flag -fsanitize=address;
30 cmake -H. -B_build -GNinja
31 -DCMAKE_C_FLAGS="$C_FLAGS"
32 -DCMAKE_CXX_FLAGS="$CXX_FLAGS"
33 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS"
34 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS"
35 -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install"
36 -DTRACE=ON
37 -DMUST_BUILD_TOXAV=ON
38 -DSTRICT_ABI=ON
39 -DTEST_TIMEOUT_SECONDS=120
40 -DUSE_IPV6=OFF
41 - run: cd _build && ninja install -j$(nproc)
42 - run: cd _build && ctest -j50 --output-on-failure
diff --git a/.travis.yml b/.travis.yml
index 5bb5a87d..416aecc7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,10 +9,10 @@ language: c
9matrix: 9matrix:
10 include: 10 include:
11 - stage: "Stage 1" 11 - stage: "Stage 1"
12 env: JOB=toxcore ENV=linux 12 env: JOB=cmake-linux
13 compiler: gcc 13 compiler: gcc
14 addons: 14 addons:
15 apt: &apt-dependencies 15 apt:
16 packages: 16 packages:
17 - libconfig-dev # For tox-bootstrapd. 17 - libconfig-dev # For tox-bootstrapd.
18 - libcv-dev # For av_test. 18 - libcv-dev # For av_test.
@@ -23,57 +23,55 @@ matrix:
23 - libgtest-dev # For unit tests. 23 - libgtest-dev # For unit tests.
24 - libvpx-dev # For toxav. 24 - libvpx-dev # For toxav.
25 - portaudio19-dev # For av_test. 25 - portaudio19-dev # For av_test.
26 install: .travis/$JOB install
27 script: .travis/$JOB script
28 after_script: .travis/upload-coverage
26 - stage: "Stage 1" 29 - stage: "Stage 1"
27 if: type IN (push, api, cron) 30 env: JOB=autotools-linux
28 env: JOB=autotools ENV=linux
29 compiler: clang 31 compiler: clang
30 addons: 32 addons:
31 apt: *apt-dependencies 33 apt:
32 - stage: "Stage 1" 34 packages:
33 if: type IN (push, api, cron) 35 - libconfig-dev # For tox-bootstrapd.
34 env: JOB=toxcore ENV=windows ARCH=i686 36 - libopus-dev # For toxav.
35 group: deprecated-2017Q4 37 - libvpx-dev # For toxav.
36 services: 38 install: .travis/$JOB install
37 - docker 39 script: .travis/$JOB script
38 - stage: "Stage 1"
39 if: type IN (push, api, cron)
40 env: JOB=toxcore ENV=windows ARCH=x86_64
41 group: deprecated-2017Q4
42 services:
43 - docker
44 - stage: "Stage 1" 40 - stage: "Stage 1"
45 if: type IN (push, api, cron) 41 if: type IN (push, api, cron)
46 env: JOB=installmd ENV=windows SUPPORT_ARCH_i686=true SUPPORT_ARCH_x86_64=false SUPPORT_TEST=true ENABLE_ARCH_i686=true ENABLE_ARCH_x86_64=false ENABLE_TEST=true ALLOW_TEST_FAILURE=true 42 env: JOB=cmake-win32
47 services: 43 services: [docker]
48 - docker 44 install: .travis/$JOB install
45 script: .travis/$JOB script
49 - stage: "Stage 1" 46 - stage: "Stage 1"
50 if: type IN (push, api, cron) 47 if: type IN (push, api, cron)
51 env: JOB=installmd ENV=windows SUPPORT_ARCH_i686=false SUPPORT_ARCH_x86_64=true SUPPORT_TEST=true ENABLE_ARCH_i686=false ENABLE_ARCH_x86_64=true ENABLE_TEST=true ALLOW_TEST_FAILURE=true 48 env: JOB=cmake-win64
52 services: 49 services: [docker]
53 - docker 50 install: .travis/$JOB install
51 script: .travis/$JOB script
54 - stage: "Stage 1" 52 - stage: "Stage 1"
55 if: type IN (push, api, cron) 53 if: type IN (push, api, cron)
56 env: JOB=toxcore ENV=freebsd 54 env: JOB=cmake-freebsd
57 dist: trusty
58 sudo: required 55 sudo: required
59 install: other/travis/phase $JOB $ENV install stage1 56 install: .travis/$JOB-stage1 install
60 script: other/travis/phase $JOB $ENV script stage1 57 script: .travis/$JOB-stage1 script
61 - stage: "Stage 1" 58 - stage: "Stage 1"
62 if: type IN (push, api, cron) 59 if: type IN (push, api, cron)
63 env: JOB=tox-bootstrapd-docker ENV=linux 60 env: JOB=tox-bootstrapd-docker
64 services: 61 services: [docker]
65 - docker 62 script: .travis/$JOB
66 sudo: required
67 - stage: "Stage 2" 63 - stage: "Stage 2"
68 if: type IN (push, api, cron) 64 if: type IN (push, api, cron)
69 env: JOB=toxcore ENV=freebsd 65 env: JOB=cmake-freebsd
70 dist: trusty
71 sudo: required 66 sudo: required
72 install: other/travis/phase $JOB $ENV install stage2 67 install: .travis/$JOB-stage2 install
68 script: .travis/$JOB-stage2 script
73 - stage: "Stage 2" 69 - stage: "Stage 2"
74 if: type IN (push, api, cron) 70 if: type IN (push, api, cron)
75 env: JOB=toxcore ENV=osx RUN_TESTS=true 71 env: JOB=cmake-osx
76 os: osx 72 os: osx
73 install: .travis/$JOB install
74 script: .travis/$JOB script
77 fast_finish: true 75 fast_finish: true
78 76
79cache: 77cache:
@@ -81,11 +79,6 @@ cache:
81 - $HOME/cache 79 - $HOME/cache
82 - /opt/freebsd/cache 80 - /opt/freebsd/cache
83 81
84install: other/travis/phase $JOB $ENV install
85script: other/travis/phase $JOB $ENV script
86after_script: other/travis/phase $JOB $ENV after_script
87after_failure: other/travis/phase $JOB $ENV after_failure
88
89notifications: 82notifications:
90 irc: 83 irc:
91 channels: 84 channels:
diff --git a/.travis/autotools-linux b/.travis/autotools-linux
new file mode 100755
index 00000000..6d38e34e
--- /dev/null
+++ b/.travis/autotools-linux
@@ -0,0 +1,52 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7CACHEDIR="$HOME/cache"
8NPROC=`nproc`
9
10travis_install() {
11 # Install vanilla NaCl only.
12 [ -f "$CACHEDIR/lib/amd64/libnacl.a" ] || {
13 curl https://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | tar jx
14 cd nacl-20110221 # pushd
15 "./do"
16 # "make install"
17 mkdir -p "$CACHEDIR/include"; mv build/*/include/* "$CACHEDIR/include"
18 mkdir -p "$CACHEDIR/lib" ; mv build/*/lib/* "$CACHEDIR/lib"
19 cd - # popd
20 }
21}
22
23travis_script() {
24 . ".travis/flags-$CC.sh"
25
26 add_ld_flag -Wl,-z,defs
27
28 # Make compilation error on a warning
29 add_flag -Werror
30
31 add_config_flag --with-nacl-libs="$CACHEDIR/lib/amd64"
32 add_config_flag --with-nacl-headers="$CACHEDIR/include/amd64"
33 add_config_flag --disable-ipv6
34 add_config_flag --enable-nacl
35 add_config_flag --enable-daemon
36 add_config_flag --enable-logging
37 add_config_flag --with-log-level=TRACE
38
39 autoreconf -fi
40 mkdir -p _build
41 cd _build # pushd
42 ../configure $CONFIG_FLAGS || (cat config.log && false)
43 make "-j$NPROC" -k CFLAGS="$C_FLAGS" LDFLAGS="$LD_FLAGS"
44 make "-j$NPROC" -k distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIG_FLAGS"
45 cd - # popd
46}
47
48if [ "-z" "$ACTION" ]; then
49 "travis_script"
50else
51 "travis_$ACTION"
52fi
diff --git a/.travis/cmake-freebsd-stage1 b/.travis/cmake-freebsd-stage1
new file mode 100755
index 00000000..3954e2af
--- /dev/null
+++ b/.travis/cmake-freebsd-stage1
@@ -0,0 +1,23 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7. other/travis/env.sh
8. other/travis/env-freebsd.sh
9
10travis_install() {
11 . other/travis/freebsd-install
12 . other/travis/freebsd-install-stage1
13}
14
15travis_script() {
16 echo "Nothing to do here. Building happens in stage 2."
17}
18
19if [ "-z" "$ACTION" ]; then
20 "travis_script"
21else
22 "travis_$ACTION"
23fi
diff --git a/.travis/cmake-freebsd-stage2 b/.travis/cmake-freebsd-stage2
new file mode 100755
index 00000000..57b8a0f8
--- /dev/null
+++ b/.travis/cmake-freebsd-stage2
@@ -0,0 +1,23 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7. other/travis/env.sh
8. other/travis/env-freebsd.sh
9
10travis_install() {
11 . other/travis/freebsd-install
12 . other/travis/freebsd-install-stage2
13}
14
15travis_script() {
16 . other/travis/toxcore-script
17}
18
19if [ "-z" "$ACTION" ]; then
20 "travis_script"
21else
22 "travis_$ACTION"
23fi
diff --git a/.travis/cmake-linux b/.travis/cmake-linux
new file mode 100755
index 00000000..e3517a09
--- /dev/null
+++ b/.travis/cmake-linux
@@ -0,0 +1,75 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7CACHEDIR="$HOME/cache"
8NPROC=`nproc`
9ASTYLE="$CACHEDIR/astyle/build/gcc/bin/astyle"
10
11travis_install() {
12 which coveralls || {
13 # Install cpp-coveralls to upload test coverage results.
14 pip install --user ndg-httpsclient urllib3[secure] cpp-coveralls
15
16 # Work around https://github.com/eddyxu/cpp-coveralls/issues/108 by manually
17 # installing the pyOpenSSL module and injecting it into urllib3 as per
18 # https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
19 sed -i -e '/^import sys$/a import urllib3.contrib.pyopenssl\nurllib3.contrib.pyopenssl.inject_into_urllib3()' `which coveralls`
20 }
21
22 # Install astyle (version in ubuntu-precise too old).
23 [ -f "$ASTYLE" ] || {
24 wget -O ../astyle.tar.gz https://deb.debian.org/debian/pool/main/a/astyle/astyle_2.06.orig.tar.gz
25 tar -xf ../astyle.tar.gz -C "$CACHEDIR"
26 make -C "$CACHEDIR/astyle/build/gcc" "-j$NPROC"
27 }
28
29 # Install libsodium (not in ubuntu-precise).
30 [ -f "$CACHEDIR/lib/libsodium.a" ] || {
31 git clone --depth=1 --branch=stable https://github.com/jedisct1/libsodium ../libsodium
32 cd ../libsodium # pushd
33 ./autogen.sh
34 ./configure --prefix="$CACHEDIR"
35 make install "-j$NPROC"
36 cd - # popd
37 }
38}
39
40travis_script() {
41 . ".travis/flags-$CC.sh"
42
43 add_ld_flag -Wl,-z,defs
44
45 # Make compilation error on a warning
46 add_flag -Werror
47
48 # Coverage flags.
49 add_flag -fprofile-arcs -ftest-coverage
50
51 cmake -B_build -H. \
52 -DCMAKE_C_FLAGS="$C_FLAGS" \
53 -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
54 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
55 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
56 -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
57 -DTRACE=ON \
58 -DMUST_BUILD_TOXAV=ON \
59 -DSTRICT_ABI=ON \
60 -DTEST_TIMEOUT_SECONDS=120 \
61 -DUSE_IPV6=OFF
62
63 cd _build # pushd
64 make "-j$NPROC" -k install
65 make "-j$NPROC" test ARGS="-j50" CTEST_OUTPUT_ON_FAILURE=1
66 cd - # popd
67
68 other/astyle/format-source . "$ASTYLE"
69}
70
71if [ "-z" "$ACTION" ]; then
72 "travis_script"
73else
74 "travis_$ACTION"
75fi
diff --git a/.travis/cmake-osx b/.travis/cmake-osx
new file mode 100755
index 00000000..529a2309
--- /dev/null
+++ b/.travis/cmake-osx
@@ -0,0 +1,46 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7CACHEDIR="$HOME/cache"
8NPROC=`sysctl -n hw.physicalcpu`
9
10travis_install() {
11 # Workaround for bug in Homebrew where it only finds an old Ruby version.
12 brew update
13
14 brew install libsodium libvpx opus libconfig
15}
16
17travis_script() {
18 . ".travis/flags-$CC.sh"
19
20 add_ld_flag -undefined error
21
22 # Make compilation error on a warning
23 add_flag -Werror
24
25 cmake -B_build -H. \
26 -DCMAKE_C_FLAGS="$C_FLAGS" \
27 -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
28 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
29 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
30 -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
31 -DTRACE=ON \
32 -DMUST_BUILD_TOXAV=ON \
33 -DTEST_TIMEOUT_SECONDS=120 \
34 -DUSE_IPV6=OFF
35
36 cd _build # pushd
37 make "-j$NPROC" -k install
38 make "-j$NPROC" test ARGS="-j50" CTEST_OUTPUT_ON_FAILURE=1
39 cd - # popd
40}
41
42if [ "-z" "$ACTION" ]; then
43 "travis_script"
44else
45 "travis_$ACTION"
46fi
diff --git a/.travis/cmake-win32 b/.travis/cmake-win32
new file mode 100755
index 00000000..e4be36f0
--- /dev/null
+++ b/.travis/cmake-win32
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3i686=true
4x86_64=false
5WINDOWS_ARCH=win32
6
7. .travis/cmake-windows.sh
diff --git a/.travis/cmake-win64 b/.travis/cmake-win64
new file mode 100755
index 00000000..f961a00b
--- /dev/null
+++ b/.travis/cmake-win64
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3i686=false
4x86_64=true
5WINDOWS_ARCH=win64
6
7. .travis/cmake-windows.sh
diff --git a/.travis/cmake-windows.sh b/.travis/cmake-windows.sh
new file mode 100644
index 00000000..a7d1f7e1
--- /dev/null
+++ b/.travis/cmake-windows.sh
@@ -0,0 +1,48 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7CACHEDIR="$HOME/cache"
8NPROC=`nproc`
9
10travis_install() {
11 cd other/docker/windows
12
13 docker build \
14 --build-arg SUPPORT_ARCH_i686=$i686 \
15 --build-arg SUPPORT_ARCH_x86_64=$x86_64 \
16 --build-arg SUPPORT_TEST=true \
17 -t toxcore-$WINDOWS_ARCH \
18 .
19}
20
21travis_script() {
22 . ".travis/flags-$CC.sh"
23
24 # Allows wine to display source code file names and line numbers on crash in
25 # its backtrace.
26 add_flag -gdwarf-2
27
28 docker run \
29 -e ALLOW_TEST_FAILURE=true \
30 -e ENABLE_ARCH_i686=$i686 \
31 -e ENABLE_ARCH_x86_64=$x86_64 \
32 -e ENABLE_TEST=true \
33 -e EXTRA_CMAKE_FLAGS="-DBOOTSTRAP_DAEMON=OFF -DDEBUG=ON -DTEST_TIMEOUT_SECONDS=90" \
34 -e DCMAKE_C_FLAGS="$C_FLAGS" \
35 -e CMAKE_CXX_FLAGS="$CXX_FLAGS" \
36 -e CMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
37 -e CMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
38 -v "$PWD:/toxcore" \
39 -v "$PWD/result:/prefix" \
40 --rm \
41 toxcore-$WINDOWS_ARCH
42}
43
44if [ "-z" "$ACTION" ]; then
45 "travis_script"
46else
47 "travis_$ACTION"
48fi
diff --git a/.travis/flags-clang.sh b/.travis/flags-clang.sh
new file mode 100644
index 00000000..1bca35ca
--- /dev/null
+++ b/.travis/flags-clang.sh
@@ -0,0 +1,62 @@
1#!/bin/sh
2
3. .travis/flags.sh
4
5# Add all warning flags we can.
6add_flag -Wall
7add_flag -Wextra
8add_flag -Weverything
9
10# Disable specific warning flags for both C and C++.
11
12# TODO(iphydf): Clean these up. Probably all of these are actual bugs.
13add_flag -Wno-cast-align
14# Very verbose, not very useful. This warns about things like int -> uint
15# conversions that change sign without a cast and narrowing conversions.
16add_flag -Wno-conversion
17# TODO(iphydf): Check enum values when received from the user, then assume
18# correctness and remove this suppression.
19add_flag -Wno-covered-switch-default
20# Due to clang's tolower() macro being recursive
21# https://github.com/TokTok/c-toxcore/pull/481
22add_flag -Wno-disabled-macro-expansion
23# We don't put __attribute__ on the public API.
24add_flag -Wno-documentation-deprecated-sync
25# Bootstrap daemon does this.
26add_flag -Wno-format-nonliteral
27# struct Foo foo = {0}; is a common idiom.
28add_flag -Wno-missing-field-initializers
29# Useful sometimes, but we accept padding in structs for clarity.
30# Reordering fields to avoid padding will reduce readability.
31add_flag -Wno-padded
32# This warns on things like _XOPEN_SOURCE, which we currently need (we
33# probably won't need these in the future).
34add_flag -Wno-reserved-id-macro
35# TODO(iphydf): Clean these up. They are likely not bugs, but still
36# potential issues and probably confusing.
37add_flag -Wno-sign-compare
38# Our use of mutexes results in a false positive, see 1bbe446.
39add_flag -Wno-thread-safety-analysis
40# File transfer code has this.
41add_flag -Wno-type-limits
42# Callbacks often don't use all their parameters.
43add_flag -Wno-unused-parameter
44# libvpx uses __attribute__((unused)) for "potentially unused" static
45# functions to avoid unused static function warnings.
46add_flag -Wno-used-but-marked-unused
47# We use variable length arrays a lot.
48add_flag -Wno-vla
49
50# Disable specific warning flags for C++.
51
52# Comma at end of enum is supported everywhere we run.
53add_cxx_flag -Wno-c++98-compat-pedantic
54# TODO(iphydf): Stop using flexible array members.
55add_cxx_flag -Wno-c99-extensions
56# We're C-compatible, so use C style casts.
57add_cxx_flag -Wno-old-style-cast
58
59# Downgrade to warning so we still see it.
60add_flag -Wno-error=documentation-unknown-command
61add_flag -Wno-error=unreachable-code
62add_flag -Wno-error=unused-variable
diff --git a/.travis/flags-gcc.sh b/.travis/flags-gcc.sh
new file mode 100644
index 00000000..0d262060
--- /dev/null
+++ b/.travis/flags-gcc.sh
@@ -0,0 +1,19 @@
1#!/bin/sh
2
3. .travis/flags.sh
4
5# Add all warning flags we can.
6add_flag -Wall
7add_flag -Wextra
8
9# Disable specific warning flags for both C and C++.
10
11# struct Foo foo = {0}; is a common idiom.
12add_flag -Wno-missing-field-initializers
13# TODO(iphydf): Clean these up. They are likely not bugs, but still
14# potential issues and probably confusing.
15add_flag -Wno-sign-compare
16# File transfer code has this.
17add_flag -Wno-type-limits
18# Callbacks often don't use all their parameters.
19add_flag -Wno-unused-parameter
diff --git a/.travis/flags.sh b/.travis/flags.sh
new file mode 100644
index 00000000..0c80e703
--- /dev/null
+++ b/.travis/flags.sh
@@ -0,0 +1,33 @@
1#!/bin/sh
2
3add_config_flag() { CONFIG_FLAGS="$CONFIG_FLAGS $@"; }
4add_c_flag() { C_FLAGS="$C_FLAGS $@"; }
5add_cxx_flag() { CXX_FLAGS="$CXX_FLAGS $@"; }
6add_ld_flag() { LD_FLAGS="$LD_FLAGS $@"; }
7add_flag() { add_c_flag "$@"; add_cxx_flag "$@"; }
8
9export LD_LIBRARY_PATH="$CACHEDIR/lib"
10export PKG_CONFIG_PATH="$CACHEDIR/lib/pkgconfig"
11
12# Our own flags which we can insert in the correct place. We don't use CFLAGS
13# and friends here (we unset them below), because they influence config tests
14# such as ./configure and cmake tests. Our warning flags break those tests, so
15# we can't add them globally here.
16CONFIG_FLAGS=""
17C_FLAGS=""
18CXX_FLAGS=""
19LD_FLAGS=""
20
21unset CFLAGS
22unset CXXFLAGS
23unset CPPFLAGS
24unset LDFLAGS
25
26# Optimisation flags.
27add_flag -O3 -march=native
28
29# Warn on non-ISO C.
30add_c_flag -pedantic
31
32add_flag -g3
33add_flag -ftrapv
diff --git a/other/travis/tox-bootstrapd-docker-linux-script b/.travis/tox-bootstrapd-docker
index bb3b5422..9e476b5f 100755
--- a/other/travis/tox-bootstrapd-docker-linux-script
+++ b/.travis/tox-bootstrapd-docker
@@ -60,4 +60,3 @@ if ! python3 ../fun/bootstrap_node_info.py ipv4 localhost 33445 ; then
60 echo "Error: Unable to get bootstrap node info" 60 echo "Error: Unable to get bootstrap node info"
61 exit 1 61 exit 1
62fi 62fi
63
diff --git a/other/travis/toxcore-linux-after_script b/.travis/upload-coverage
index 7a388d0d..7a388d0d 100755
--- a/other/travis/toxcore-linux-after_script
+++ b/.travis/upload-coverage
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc55a235..8cd26f43 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,7 +52,6 @@ message("SOVERSION: ${SOVERSION}")
52# 52#
53################################################################################ 53################################################################################
54 54
55include(AddCompilerFlag)
56include(ApiDsl) 55include(ApiDsl)
57include(ModulePackage) 56include(ModulePackage)
58include(StrictAbi) 57include(StrictAbi)
@@ -63,25 +62,22 @@ if(APPLE)
63endif() 62endif()
64 63
65if(UNIX) 64if(UNIX)
66 if(CMAKE_SYSTEM_NAME MATCHES ".*Linux") 65 if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
67 set(LINUX TRUE) 66 set(LINUX TRUE)
68 elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*") 67 elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
69 set(OPENBSD TRUE) 68 set(OPENBSD TRUE)
70 elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*") 69 elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
71 set(NETBSD TRUE) 70 set(NETBSD TRUE)
72 elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*|FreeBSD") 71 elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*|FreeBSD")
73 set(FREEBSD TRUE) 72 set(FREEBSD TRUE)
74 endif() 73 endif()
75endif() 74endif()
76 75
77enable_testing() 76enable_testing()
78 77
79set(CMAKE_MACOSX_RPATH ON) 78set(CMAKE_MACOSX_RPATH ON)
80 79
81if(${CMAKE_VERSION} VERSION_LESS "3.1.0") 80if(NOT ${CMAKE_VERSION} VERSION_LESS "3.1.0")
82 add_cflag("-std=c99")
83 add_cxxflag("-std=c++11")
84else()
85 # Set standard version for compiler. 81 # Set standard version for compiler.
86 set(CMAKE_C_STANDARD 99) 82 set(CMAKE_C_STANDARD 99)
87 set(CMAKE_CXX_STANDARD 11) 83 set(CMAKE_CXX_STANDARD 11)
@@ -92,93 +88,9 @@ else()
92 message(STATUS "Supported C++ compiler features = ${CMAKE_CXX_COMPILE_FEATURES}") 88 message(STATUS "Supported C++ compiler features = ${CMAKE_CXX_COMPILE_FEATURES}")
93endif() 89endif()
94 90
95if(NOT MSVC) 91option(TRACE "Enable DEBUG level logging (default)" ON)
96 # Warn on non-ISO C. 92if(DEBUG)
97 add_cflag("-pedantic") 93 set(MIN_LOGGER_LEVEL DEBUG)
98
99 option(ERROR_ON_WARNING "Make compilation error on a warning" OFF)
100 if(ERROR_ON_WARNING)
101 add_flag("-Werror")
102 endif()
103
104 option(COVERAGE "Track code coverage" OFF)
105 if(COVERAGE)
106 add_flag("-fprofile-instr-generate")
107 add_flag("-fcoverage-mapping")
108 endif()
109
110 option(DEBUG "Enable assertions and other debugging facilities" OFF)
111 if(DEBUG)
112 set(MIN_LOGGER_LEVEL DEBUG)
113 add_cflag("-g3")
114 if(MINGW)
115 # Allows wine to display source code file names and line numbers on crash in its backtrace
116 add_flag("-gdwarf-2")
117 endif()
118 # Crash on signed integer overflow.
119 add_flag("-ftrapv")
120 endif()
121
122 option(WARNINGS "Enable additional compiler warnings" ON)
123 if(WARNINGS)
124 # Add all warning flags we can.
125 add_flag("-Wall")
126 add_flag("-Wextra")
127 add_flag("-Weverything")
128
129 # Disable specific warning flags for both C and C++.
130
131 # TODO(iphydf): Clean these up. Probably all of these are actual bugs.
132 add_flag("-Wno-cast-align")
133 # Very verbose, not very useful. This warns about things like int -> uint
134 # conversions that change sign without a cast and narrowing conversions.
135 add_flag("-Wno-conversion")
136 # TODO(iphydf): Check enum values when received from the user, then assume
137 # correctness and remove this suppression.
138 add_flag("-Wno-covered-switch-default")
139 # Due to clang's tolower() macro being recursive
140 # https://github.com/TokTok/c-toxcore/pull/481
141 add_flag("-Wno-disabled-macro-expansion")
142 # We don't put __attribute__ on the public API.
143 add_flag("-Wno-documentation-deprecated-sync")
144 # Bootstrap daemon does this.
145 add_flag("-Wno-format-nonliteral")
146 # struct Foo foo = {0}; is a common idiom.
147 add_flag("-Wno-missing-field-initializers")
148 # Useful sometimes, but we accept padding in structs for clarity.
149 # Reordering fields to avoid padding will reduce readability.
150 add_flag("-Wno-padded")
151 # This warns on things like _XOPEN_SOURCE, which we currently need (we
152 # probably won't need these in the future).
153 add_flag("-Wno-reserved-id-macro")
154 # TODO(iphydf): Clean these up. They are likely not bugs, but still
155 # potential issues and probably confusing.
156 add_flag("-Wno-sign-compare")
157 # Our use of mutexes results in a false positive, see 1bbe446.
158 add_flag("-Wno-thread-safety-analysis")
159 # File transfer code has this.
160 add_flag("-Wno-type-limits")
161 # Callbacks often don't use all their parameters.
162 add_flag("-Wno-unused-parameter")
163 # libvpx uses __attribute__((unused)) for "potentially unused" static
164 # functions to avoid unused static function warnings.
165 add_flag("-Wno-used-but-marked-unused")
166 # We use variable length arrays a lot.
167 add_flag("-Wno-vla")
168
169 # Disable specific warning flags for C++.
170
171 # Comma at end of enum is supported everywhere we run.
172 add_cxxflag("-Wno-c++98-compat-pedantic")
173 # TODO(iphydf): Stop using flexible array members.
174 add_cxxflag("-Wno-c99-extensions")
175 # We're C-compatible, so use C style casts.
176 add_cxxflag("-Wno-old-style-cast")
177
178 # Downgrade to warning so we still see it.
179 add_flag("-Wno-error=unreachable-code")
180 add_flag("-Wno-error=unused-variable")
181 endif()
182endif() 94endif()
183 95
184option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF) 96option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF)
@@ -190,18 +102,6 @@ if(MIN_LOGGER_LEVEL)
190 add_definitions(-DMIN_LOGGER_LEVEL=LOG_${MIN_LOGGER_LEVEL}) 102 add_definitions(-DMIN_LOGGER_LEVEL=LOG_${MIN_LOGGER_LEVEL})
191endif() 103endif()
192 104
193option(ASAN "Enable address-sanitizer to detect invalid memory accesses" OFF)
194if(ASAN)
195 add_cflag("-fsanitize=address")
196 add_dllflag("-fsanitize=address")
197endif()
198
199if(LINUX)
200 add_dllflag("-Wl,-z,defs")
201else()
202 add_dllflag("-undefined error")
203endif()
204
205option(USE_IPV6 "Use IPv6 in tests" ON) 105option(USE_IPV6 "Use IPv6 in tests" ON)
206if(NOT USE_IPV6) 106if(NOT USE_IPV6)
207 add_definitions(-DUSE_IPV6=0) 107 add_definitions(-DUSE_IPV6=0)
diff --git a/cmake/AddCompilerFlag.cmake b/cmake/AddCompilerFlag.cmake
deleted file mode 100644
index 6a4a3f56..00000000
--- a/cmake/AddCompilerFlag.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
1include(CheckCCompilerFlag)
2include(CheckCXXCompilerFlag)
3
4function(add_cflag flag)
5 string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" var ${flag})
6 if(NOT DEFINED HAVE_C${var})
7 message(STATUS "checking for C compiler flag: ${flag}")
8 endif()
9 set(CMAKE_REQUIRED_QUIET TRUE)
10
11 check_c_compiler_flag("${flag}" HAVE_C${var} QUIET)
12 if(HAVE_C${var})
13 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" PARENT_SCOPE)
14 endif()
15endfunction()
16
17function(add_cxxflag flag)
18 string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" var ${flag})
19 if(NOT DEFINED HAVE_CXX${var})
20 message(STATUS "checking for C++ compiler flag: ${flag}")
21 endif()
22 set(CMAKE_REQUIRED_QUIET TRUE)
23
24 check_cxx_compiler_flag("${flag}" HAVE_CXX${var} QUIET)
25 if(HAVE_CXX${var})
26 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
27 endif()
28endfunction()
29
30function(add_dllflag flag)
31 string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" var ${flag})
32 if(NOT DEFINED HAVE_LD${var})
33 message(STATUS "checking for C++ compiler flag: ${flag}")
34 endif()
35 set(CMAKE_REQUIRED_QUIET TRUE)
36
37 check_c_compiler_flag("${flag}" HAVE_LD${var} QUIET)
38 if(HAVE_LD${var})
39 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${flag}" PARENT_SCOPE)
40 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}" PARENT_SCOPE)
41 endif()
42endfunction()
43
44macro(add_flag flag)
45 add_cflag(${flag})
46 add_cxxflag(${flag})
47endmacro()
diff --git a/cmake/CompileGTest.cmake b/cmake/CompileGTest.cmake
index f9aa4506..9aa4712f 100644
--- a/cmake/CompileGTest.cmake
+++ b/cmake/CompileGTest.cmake
@@ -1,5 +1,8 @@
1# Find and compile the GTest library. 1# Find and compile the GTest library.
2 2
3include(CheckCXXCompilerFlag)
4include(CheckIncludeFileCXX)
5
3message(STATUS "Checking for gtest") 6message(STATUS "Checking for gtest")
4 7
5# Look for the sources. 8# Look for the sources.
diff --git a/configure.ac b/configure.ac
index 450a1d53..d070cd77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -350,7 +350,9 @@ if test "x$WANT_NACL" = "xyes"; then
350 if (test -f "$NACL_SEARCH_LIBS/cpucycles.o") && 350 if (test -f "$NACL_SEARCH_LIBS/cpucycles.o") &&
351 (test -f "$NACL_SEARCH_LIBS/randombytes.o"); then 351 (test -f "$NACL_SEARCH_LIBS/randombytes.o"); then
352 NACL_OBJECTS="$NACL_SEARCH_LIBS/cpucycles.o $NACL_SEARCH_LIBS/randombytes.o" 352 NACL_OBJECTS="$NACL_SEARCH_LIBS/cpucycles.o $NACL_SEARCH_LIBS/randombytes.o"
353 AC_MSG_NOTICE([found extra NaCl objects: $NACL_OBJECTS])
353 if test "x$ADD_NACL_OBJECTS_TO_PKGCONFIG" = "xyes"; then 354 if test "x$ADD_NACL_OBJECTS_TO_PKGCONFIG" = "xyes"; then
355 AC_MSG_NOTICE([adding extra NaCl objects to pkg-config file])
354 NACL_OBJECTS_PKGCONFIG="$NACL_OBJECTS" 356 NACL_OBJECTS_PKGCONFIG="$NACL_OBJECTS"
355 fi 357 fi
356 else 358 else
diff --git a/other/bootstrap_daemon/src/Makefile.inc b/other/bootstrap_daemon/src/Makefile.inc
index 1c313d44..6b820be0 100644
--- a/other/bootstrap_daemon/src/Makefile.inc
+++ b/other/bootstrap_daemon/src/Makefile.inc
@@ -33,6 +33,7 @@ tox_bootstrapd_LDADD = \
33 libtoxcore.la \ 33 libtoxcore.la \
34 $(LIBCONFIG_LIBS) \ 34 $(LIBCONFIG_LIBS) \
35 $(LIBSODIUM_LIBS) \ 35 $(LIBSODIUM_LIBS) \
36 $(NACL_OBJECTS) \
36 $(NACL_LIBS) 37 $(NACL_LIBS)
37 38
38endif 39endif
diff --git a/other/docker/windows/build_toxcore.sh b/other/docker/windows/build_toxcore.sh
index a3830455..da465eb1 100644
--- a/other/docker/windows/build_toxcore.sh
+++ b/other/docker/windows/build_toxcore.sh
@@ -1,4 +1,4 @@
1#!/usr/bin/env sh 1#!/bin/sh
2 2
3set -e -x 3set -e -x
4 4
@@ -57,9 +57,13 @@ build()
57 -DCMAKE_INSTALL_PREFIX="${STATIC_TOXCORE_PREFIX_DIR}" \ 57 -DCMAKE_INSTALL_PREFIX="${STATIC_TOXCORE_PREFIX_DIR}" \
58 -DENABLE_SHARED=OFF \ 58 -DENABLE_SHARED=OFF \
59 -DENABLE_STATIC=ON \ 59 -DENABLE_STATIC=ON \
60 -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" \
61 -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
62 -DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
63 -DCMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS}" \
60 ${EXTRA_CMAKE_FLAGS} \ 64 ${EXTRA_CMAKE_FLAGS} \
61 .. 65 ..
62 cmake --build . --target install 66 cmake --build . --target install -- -j$(nproc)
63 67
64 if [ "${ENABLE_TEST}" = "true" ]; then 68 if [ "${ENABLE_TEST}" = "true" ]; then
65 rm -rf /root/.wine 69 rm -rf /root/.wine
@@ -79,7 +83,7 @@ build()
79 if [ "${ALLOW_TEST_FAILURE}" = "true" ]; then 83 if [ "${ALLOW_TEST_FAILURE}" = "true" ]; then
80 set +e 84 set +e
81 fi 85 fi
82 cmake --build . --target test 86 cmake --build . --target test -- ARGS="-j50"
83 if [ "${ALLOW_TEST_FAILURE}" = "true" ]; then 87 if [ "${ALLOW_TEST_FAILURE}" = "true" ]; then
84 set -e 88 set -e
85 fi 89 fi
diff --git a/other/travis/autotools-linux-install b/other/travis/autotools-linux-install
deleted file mode 100644
index ca0adff7..00000000
--- a/other/travis/autotools-linux-install
+++ /dev/null
@@ -1,14 +0,0 @@
1#!/bin/sh
2
3. other/travis/toxcore-linux-install
4
5# Also install vanilla NaCl
6[ -f $CACHE_DIR/lib/amd64/libnacl.a ] || {
7 curl https://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | tar jx
8 cd nacl-20110221 # pushd
9 "./do"
10 # "make install"
11 mv build/*/include/* $CACHE_DIR/include
12 mv build/*/lib/* $CACHE_DIR/lib
13 cd - # popd
14}
diff --git a/other/travis/autotools-script b/other/travis/autotools-script
deleted file mode 100755
index d72ec2a9..00000000
--- a/other/travis/autotools-script
+++ /dev/null
@@ -1,35 +0,0 @@
1#!/bin/sh
2
3if perl -e '
4 use Socket qw(PF_INET6 SOCK_STREAM pack_sockaddr_in6 IN6ADDR_LOOPBACK);
5
6 socket(S, PF_INET6, SOCK_STREAM, 0) || exit 1;
7 bind(S, pack_sockaddr_in6(0, IN6ADDR_LOOPBACK)) || exit 1;
8'; then
9 IPV6_FLAG="--enable-ipv6"
10else
11 IPV6_FLAG="--disable-ipv6"
12fi
13
14# Build toxcore with some custom flags here. Note that this does *not* run the
15# tests, so any flags passed here are irrelevant to testing. This only checks
16# that we can build toxcore with the specified flags. Tests run with default
17# configure flags.
18./autogen.sh
19./configure \
20 --with-nacl-libs=$CACHE_DIR/lib/amd64 \
21 --with-nacl-headers=$CACHE_DIR/include/amd64 \
22 --enable-nacl \
23 --enable-daemon \
24 --enable-logging \
25 $IPV6_FLAG \
26 --with-log-level=TRACE
27
28# We use make instead of RUN $MAKE here, because the autotools build will only
29# ever run natively on the Linux container, never on a Windows cross compilation
30# docker instance or an OSX machine.
31make -j$NPROC -k
32
33# This runs `make check` with the default configure flags, not with the ones
34# above.
35TESTS $MAX_TEST_RETRIES make distcheck -j$NPROC -k
diff --git a/other/travis/env-linux.sh b/other/travis/env-linux.sh
deleted file mode 100644
index 9f25e911..00000000
--- a/other/travis/env-linux.sh
+++ /dev/null
@@ -1,27 +0,0 @@
1#!/bin/sh
2
3export PATH=/opt/ghc/7.8.4/bin:/opt/cabal/1.18/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:$PATH
4export PATH=$HOME/.cabal/bin:$PATH
5
6CMAKE=cmake
7# Asan is disabled because it's currently broken on Travis.
8# See https://github.com/travis-ci/travis-ci/issues/9033.
9CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DASAN=OFF"
10NPROC=`nproc`
11CURDIR=$PWD
12RUN_TESTS=true
13
14RUN() {
15 "$@"
16}
17
18TESTS() {
19 COUNT="$1"; shift
20 "$@" || {
21 if [ $COUNT -gt 1 ]; then
22 TESTS `expr $COUNT - 1` "$@"
23 else
24 false
25 fi
26 }
27}
diff --git a/other/travis/env-osx.sh b/other/travis/env-osx.sh
deleted file mode 100644
index af1794f4..00000000
--- a/other/travis/env-osx.sh
+++ /dev/null
@@ -1,21 +0,0 @@
1#!/bin/sh
2
3CMAKE=cmake
4CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS"
5NPROC=`sysctl -n hw.ncpu`
6CURDIR=$PWD
7
8RUN() {
9 "$@"
10}
11
12TESTS() {
13 COUNT="$1"; shift
14 "$@" || {
15 if [ $COUNT -gt 1 ]; then
16 TESTS `expr $COUNT - 1` "$@"
17 else
18 false
19 fi
20 }
21}
diff --git a/other/travis/env-windows.sh b/other/travis/env-windows.sh
deleted file mode 100644
index 525630ae..00000000
--- a/other/travis/env-windows.sh
+++ /dev/null
@@ -1,36 +0,0 @@
1#!/bin/sh
2
3CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DBOOTSTRAP_DAEMON=OFF -DERROR_ON_WARNING=OFF"
4
5if [ "$JOB" = "toxcore" ]; then
6 CMAKE=$ARCH-w64-mingw32.shared-cmake
7 NPROC=`nproc`
8 CURDIR=/work
9 RUN_TESTS=true
10
11 RUN() {
12 ./dockcross "$@"
13 }
14
15 TESTS() {
16 shift # Ignore test run count.
17
18 # Download Microsoft DLLs.
19 curl http://www.dlldump.com/dllfiles/I/iphlpapi.dll -o _build/iphlpapi.dll
20 curl http://www.dlldump.com/dllfiles/W/ws2_32.dll -o _build/ws2_32.dll
21
22 # Copy our dependency DLLs.
23 ./dockcross sh -c 'cp $WINEDLLPATH/*.dll _build'
24
25 # Run tests in docker.
26 ./dockcross "$@" || {
27 cat _build/Testing/Temporary/LastTest.log
28 # Ignore test failures on Windows builds for now.
29 #false
30 }
31 }
32elif [ "$JOB" = "installmd" ]; then
33 true
34else
35 echo "Unsupported JOB=$JOB"
36fi
diff --git a/other/travis/freebsd-script-stage1 b/other/travis/freebsd-script-stage1
deleted file mode 100755
index ce16aea1..00000000
--- a/other/travis/freebsd-script-stage1
+++ /dev/null
@@ -1,4 +0,0 @@
1#!/bin/sh
2
3# We don't want toxcore-script to run yet, it should be done during FreeBSD stage 2
4exit 0
diff --git a/other/travis/installmd-windows-install b/other/travis/installmd-windows-install
deleted file mode 100755
index 8a85bbbd..00000000
--- a/other/travis/installmd-windows-install
+++ /dev/null
@@ -1,12 +0,0 @@
1#!/bin/sh
2
3cd other/docker/windows
4
5docker build \
6 --build-arg SUPPORT_ARCH_i686=${SUPPORT_ARCH_i686} \
7 --build-arg SUPPORT_ARCH_x86_64=${SUPPORT_ARCH_x86_64} \
8 --build-arg SUPPORT_TEST=${SUPPORT_TEST} \
9 -t toxcore \
10 .
11
12cd -
diff --git a/other/travis/installmd-windows-script b/other/travis/installmd-windows-script
deleted file mode 100755
index 906a7f1d..00000000
--- a/other/travis/installmd-windows-script
+++ /dev/null
@@ -1,12 +0,0 @@
1#!/bin/sh
2
3docker run \
4 -e ALLOW_TEST_FAILURE=${ALLOW_TEST_FAILURE} \
5 -e ENABLE_ARCH_i686=${ENABLE_ARCH_i686} \
6 -e ENABLE_ARCH_x86_64=${ENABLE_ARCH_x86_64} \
7 -e ENABLE_TEST=${ENABLE_TEST} \
8 -e EXTRA_CMAKE_FLAGS="${CMAKE_EXTRA_FLAGS} -DDEBUG=ON -DTEST_TIMEOUT_SECONDS=90" \
9 -v ${PWD}:/toxcore \
10 -v ${PWD}/result:/prefix \
11 --rm \
12 toxcore
diff --git a/other/travis/phase b/other/travis/phase
deleted file mode 100755
index cb9c2abf..00000000
--- a/other/travis/phase
+++ /dev/null
@@ -1,32 +0,0 @@
1#!/bin/sh
2
3set -e -u -x
4
5JOB="$1"
6ENV="$2"
7PHASE="$3"
8STAGE=""
9
10set +u
11if [ ! -z "$4" ] ; then
12 STAGE="$4"
13fi
14set -u
15
16. "other/travis/env.sh"
17. "other/travis/env-$ENV.sh"
18
19try_source() {
20 SCRIPT="other/travis/$1"
21 if [ -f "$SCRIPT" ]; then
22 . "$SCRIPT"
23 fi
24 if [ ! -z "$STAGE" ] && [ -f "$SCRIPT-$STAGE" ]; then
25 . "$SCRIPT-$STAGE"
26 fi
27}
28
29try_source "$PHASE"
30try_source "$ENV-$PHASE"
31try_source "$JOB-$PHASE"
32try_source "$JOB-$ENV-$PHASE"
diff --git a/other/travis/toxcore-after_failure b/other/travis/toxcore-after_failure
deleted file mode 100755
index e1f5c399..00000000
--- a/other/travis/toxcore-after_failure
+++ /dev/null
@@ -1,7 +0,0 @@
1#!/bin/sh
2
3if [ -d /cores ]; then
4 for core in /cores/*; do
5 lldb --core $core --one-line "bt all" < /dev/null
6 done
7fi
diff --git a/other/travis/toxcore-linux-install b/other/travis/toxcore-linux-install
deleted file mode 100755
index 19dccf64..00000000
--- a/other/travis/toxcore-linux-install
+++ /dev/null
@@ -1,26 +0,0 @@
1#!/bin/sh
2
3# Install cpp-coveralls to upload test coverage results.
4pip install --user ndg-httpsclient urllib3[secure] cpp-coveralls
5
6# Work around https://github.com/eddyxu/cpp-coveralls/issues/108 by manually
7# installing the pyOpenSSL module and injecting it into urllib3 as per
8# https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
9sed -i -e '/^import sys$/a import urllib3.contrib.pyopenssl\nurllib3.contrib.pyopenssl.inject_into_urllib3()' `which coveralls`
10
11# Install astyle (version in ubuntu-precise too old).
12[ -f $ASTYLE ] || {
13 wget -O ../astyle.tar.gz https://deb.debian.org/debian/pool/main/a/astyle/astyle_2.06.orig.tar.gz
14 tar -xf ../astyle.tar.gz -C $CACHE_DIR
15 make -C $CACHE_DIR/astyle/build/gcc -j$NPROC
16}
17
18# Install libsodium (not in ubuntu-precise).
19[ -f $CACHE_DIR/lib/libsodium.a ] || {
20 git clone --depth=1 --branch=stable https://github.com/jedisct1/libsodium ../libsodium
21 cd ../libsodium # pushd
22 ./autogen.sh
23 ./configure --prefix=$CACHE_DIR
24 make install -j$NPROC
25 cd - # popd
26}
diff --git a/other/travis/toxcore-osx-install b/other/travis/toxcore-osx-install
deleted file mode 100755
index 8f13cb5f..00000000
--- a/other/travis/toxcore-osx-install
+++ /dev/null
@@ -1,6 +0,0 @@
1#!/bin/sh
2
3# Workaround for bug in Homebrew where it only finds an old Ruby version.
4brew update
5
6brew install libsodium libvpx opus libconfig astyle
diff --git a/other/travis/toxcore-windows-install b/other/travis/toxcore-windows-install
deleted file mode 100755
index 6160856b..00000000
--- a/other/travis/toxcore-windows-install
+++ /dev/null
@@ -1,7 +0,0 @@
1#!/bin/sh
2
3DOCKER_IMAGE=toktoknet/windows:latest.$ARCH-shared
4
5docker pull $DOCKER_IMAGE
6docker run --rm $DOCKER_IMAGE > dockcross
7chmod +x dockcross
diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c
index b2f0e5f0..027f69c3 100644
--- a/toxcore/crypto_core.c
+++ b/toxcore/crypto_core.c
@@ -89,28 +89,28 @@ int32_t public_key_cmp(const uint8_t *pk1, const uint8_t *pk2)
89uint8_t random_u08(void) 89uint8_t random_u08(void)
90{ 90{
91 uint8_t randnum; 91 uint8_t randnum;
92 randombytes(&randnum, 1); 92 random_bytes(&randnum, 1);
93 return randnum; 93 return randnum;
94} 94}
95 95
96uint16_t random_u16(void) 96uint16_t random_u16(void)
97{ 97{
98 uint16_t randnum; 98 uint16_t randnum;
99 randombytes((uint8_t *)&randnum, sizeof(randnum)); 99 random_bytes((uint8_t *)&randnum, sizeof(randnum));
100 return randnum; 100 return randnum;
101} 101}
102 102
103uint32_t random_u32(void) 103uint32_t random_u32(void)
104{ 104{
105 uint32_t randnum; 105 uint32_t randnum;
106 randombytes((uint8_t *)&randnum, sizeof(randnum)); 106 random_bytes((uint8_t *)&randnum, sizeof(randnum));
107 return randnum; 107 return randnum;
108} 108}
109 109
110uint64_t random_u64(void) 110uint64_t random_u64(void)
111{ 111{
112 uint64_t randnum; 112 uint64_t randnum;
113 randombytes((uint8_t *)&randnum, sizeof(randnum)); 113 random_bytes((uint8_t *)&randnum, sizeof(randnum));
114 return randnum; 114 return randnum;
115} 115}
116 116
@@ -266,13 +266,13 @@ void increment_nonce_number(uint8_t *nonce, uint32_t host_order_num)
266/* Fill the given nonce with random bytes. */ 266/* Fill the given nonce with random bytes. */
267void random_nonce(uint8_t *nonce) 267void random_nonce(uint8_t *nonce)
268{ 268{
269 randombytes(nonce, crypto_box_NONCEBYTES); 269 random_bytes(nonce, crypto_box_NONCEBYTES);
270} 270}
271 271
272/* Fill a key CRYPTO_SYMMETRIC_KEY_SIZE big with random bytes */ 272/* Fill a key CRYPTO_SYMMETRIC_KEY_SIZE big with random bytes */
273void new_symmetric_key(uint8_t *key) 273void new_symmetric_key(uint8_t *key)
274{ 274{
275 randombytes(key, CRYPTO_SYMMETRIC_KEY_SIZE); 275 random_bytes(key, CRYPTO_SYMMETRIC_KEY_SIZE);
276} 276}
277 277
278int32_t crypto_new_keypair(uint8_t *public_key, uint8_t *secret_key) 278int32_t crypto_new_keypair(uint8_t *public_key, uint8_t *secret_key)