forked from irungentoo/toxcore
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have one script per build. This means more duplication between the scripts, but it's much easier to understand and to run locally.
- Loading branch information
Showing
9 changed files
with
296 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/sh | ||
|
||
ACTION="$1" | ||
|
||
set -eu | ||
|
||
CACHEDIR="$HOME/cache" | ||
|
||
add_config_flag() { export CONFIG_FLAGS="$CONFIG_FLAGS $1"; } | ||
add_c_flag() { export C_FLAGS="$C_FLAGS $1"; } | ||
add_cxx_flag() { export CXX_FLAGS="$CXX_FLAGS $1"; } | ||
add_flag() { add_c_flag "$@"; add_cxx_flag "$@"; } | ||
|
||
travis_install() { | ||
# Install vanilla NaCl only. | ||
[ -f "$CACHEDIR/lib/amd64/libnacl.a" ] || { | ||
curl https://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | tar jx | ||
cd nacl-20110221 # pushd | ||
"./do" | ||
# "make install" | ||
mkdir -p "$CACHEDIR/include"; mv build/*/include/* "$CACHEDIR/include" | ||
mkdir -p "$CACHEDIR/lib" ; mv build/*/lib/* "$CACHEDIR/lib" | ||
cd - # popd | ||
} | ||
} | ||
|
||
travis_script() { | ||
. ".travis/flags-$CC.sh" | ||
|
||
# Optimisation flags. | ||
add_flag -O3 -march=native | ||
|
||
# Warn on non-ISO C. | ||
add_c_flag -pedantic | ||
|
||
# Make compilation error on a warning | ||
add_flag -Werror | ||
add_flag -g3 | ||
add_flag -ftrapv | ||
|
||
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 --enable-logging | ||
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 -j`nproc` -k distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIG_FLAGS" | ||
cd - # popd | ||
} | ||
|
||
if [ "-z" "$ACTION" ]; then | ||
"travis_script" | ||
else | ||
"travis_$ACTION" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/sh | ||
|
||
ACTION="$1" | ||
|
||
set -eu | ||
|
||
CACHEDIR="$HOME/cache" | ||
|
||
ASTYLE="$CACHEDIR/astyle/build/gcc/bin/astyle" | ||
|
||
add_config_flag() { export CONFIG_FLAGS="$CONFIG_FLAGS $1"; } | ||
add_c_flag() { export C_FLAGS="$C_FLAGS $1"; } | ||
add_cxx_flag() { export CXX_FLAGS="$CXX_FLAGS $1"; } | ||
add_flag() { add_c_flag "$@"; add_cxx_flag "$@"; } | ||
|
||
travis_install() { | ||
which coveralls || { | ||
# Install cpp-coveralls to upload test coverage results. | ||
pip install --user ndg-httpsclient urllib3[secure] cpp-coveralls | ||
|
||
# Work around https://github.com/eddyxu/cpp-coveralls/issues/108 by manually | ||
# installing the pyOpenSSL module and injecting it into urllib3 as per | ||
# https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2 | ||
sed -i -e '/^import sys$/a import urllib3.contrib.pyopenssl\nurllib3.contrib.pyopenssl.inject_into_urllib3()' `which coveralls` | ||
} | ||
|
||
# Install astyle (version in ubuntu-precise too old). | ||
[ -f "$ASTYLE" ] || { | ||
wget -O ../astyle.tar.gz https://deb.debian.org/debian/pool/main/a/astyle/astyle_2.06.orig.tar.gz | ||
tar -xf ../astyle.tar.gz -C "$CACHEDIR" | ||
make -C "$CACHEDIR/astyle/build/gcc" -j`nproc` | ||
} | ||
|
||
# Install libsodium (not in ubuntu-precise). | ||
[ -f "$CACHEDIR/lib/libsodium.a" ] || { | ||
git clone --depth=1 --branch=stable https://github.com/jedisct1/libsodium ../libsodium | ||
cd ../libsodium # pushd | ||
./autogen.sh | ||
./configure --prefix="$CACHEDIR" | ||
make install -j`nproc` | ||
cd - # popd | ||
} | ||
} | ||
|
||
travis_script() { | ||
. ".travis/flags-$CC.sh" | ||
|
||
# Coverage flags. | ||
add_flag -fprofile-arcs -ftest-coverage | ||
|
||
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" \ | ||
-DTRACE=ON \ | ||
-DMUST_BUILD_TOXAV=ON \ | ||
-DSTRICT_ABI=ON \ | ||
-DTEST_TIMEOUT_SECONDS=120 \ | ||
-DUSE_IPV6=OFF | ||
|
||
cd _build # pushd | ||
make -j`nproc` -k install | ||
make -j`nproc` test ARGS="-j50" CTEST_OUTPUT_ON_FAILURE=1 | ||
cd - # popd | ||
} | ||
|
||
if [ "-z" "$ACTION" ]; then | ||
"travis_script" | ||
else | ||
"travis_$ACTION" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
. .travis/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++. | ||
|
||
# TODO(iphydf): Clean these up. Probably all of these are actual bugs. | ||
add_flag -Wno-cast-align | ||
# 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 | ||
# 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. | ||
add_flag -Wno-missing-field-initializers | ||
# 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 | ||
# 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 | ||
# 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 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=documentation-unknown-command | ||
add_flag -Wno-error=unreachable-code | ||
add_flag -Wno-error=unused-variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
. .travis/flags.sh | ||
|
||
# Add all warning flags we can. | ||
add_flag -Wall | ||
add_flag -Wextra | ||
|
||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export LD_LIBRARY_PATH="$CACHEDIR/lib" | ||
export PKG_CONFIG_PATH="$CACHEDIR/lib/pkgconfig" | ||
|
||
export CONFIG_FLAGS="" | ||
export C_FLAGS="" | ||
export CXX_FLAGS="" | ||
export LD_FLAGS="-Wl,-z,defs" | ||
|
||
unset CFLAGS | ||
unset CXXFLAGS | ||
unset CPPFLAGS | ||
unset LDFLAGS | ||
|
||
# Optimisation flags. | ||
add_flag -O3 -march=native | ||
|
||
# Warn on non-ISO C. | ||
add_c_flag -pedantic | ||
|
||
# Make compilation error on a warning | ||
add_flag -Werror | ||
add_flag -g3 | ||
add_flag -ftrapv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# We only submit coverage from the Linux build. | ||
coveralls \ | ||
--exclude auto_tests \ | ||
--exclude other \ | ||
--exclude testing \ | ||
--gcov-options '\-lp' |
Oops, something went wrong.