2021-12-21 18:43:02 +08:00
|
|
|
#!/bin/bash
|
2023-11-22 19:41:53 +08:00
|
|
|
# Copyright (C) 2018-2023 nurupo
|
2021-12-21 18:43:02 +08:00
|
|
|
|
|
|
|
# Toxcore building
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
2023-11-22 19:41:53 +08:00
|
|
|
cd .. # /work
|
2021-12-22 09:18:43 +08:00
|
|
|
. cmake-freebsd-run.sh
|
2021-12-21 18:43:02 +08:00
|
|
|
|
|
|
|
# === Get VM ready to build the code ===
|
|
|
|
|
2023-11-23 05:12:16 +08:00
|
|
|
# Unpack image only if it's compressed.
|
|
|
|
if [ -f "$IMAGE_NAME.gz" ]; then
|
|
|
|
gunzip "$IMAGE_NAME.gz"
|
|
|
|
fi
|
2021-12-22 09:18:43 +08:00
|
|
|
|
2023-11-22 19:41:53 +08:00
|
|
|
mv c-toxcore /
|
|
|
|
|
2021-12-21 18:43:02 +08:00
|
|
|
start_vm
|
|
|
|
|
2022-01-10 09:17:46 +08:00
|
|
|
# Copy over toxcore code from host to qemu
|
2021-12-21 18:43:02 +08:00
|
|
|
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -P "$SSH_PORT" -r /c-toxcore root@localhost:~
|
|
|
|
|
|
|
|
RUN ls -lh
|
|
|
|
|
|
|
|
cd /c-toxcore
|
2023-11-22 19:41:53 +08:00
|
|
|
. '.github/scripts/flags-clang.sh'
|
2021-12-21 18:43:02 +08:00
|
|
|
|
|
|
|
add_ld_flag -Wl,-z,defs
|
|
|
|
|
2023-11-22 19:41:53 +08:00
|
|
|
# Make compilation error on a warning.
|
2021-12-21 18:43:02 +08:00
|
|
|
add_flag -Werror
|
|
|
|
|
2023-11-22 19:41:53 +08:00
|
|
|
# This triggers on FreeBSD's clang.
|
|
|
|
add_flag -Wno-format
|
|
|
|
add_flag -Wno-unsafe-buffer-usage
|
|
|
|
|
|
|
|
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' \
|
2021-12-21 18:43:02 +08:00
|
|
|
-DMIN_LOGGER_LEVEL=TRACE \
|
|
|
|
-DMUST_BUILD_TOXAV=ON \
|
|
|
|
-DNON_HERMETIC_TESTS=ON \
|
|
|
|
-DSTRICT_ABI=ON \
|
2023-11-23 05:12:16 +08:00
|
|
|
-DTEST_TIMEOUT_SECONDS=120 \
|
2021-12-21 18:43:02 +08:00
|
|
|
-DUSE_IPV6=OFF \
|
2023-11-22 19:41:53 +08:00
|
|
|
-DAUTOTEST=ON"
|
2021-12-21 18:43:02 +08:00
|
|
|
|
2023-11-22 19:41:53 +08:00
|
|
|
# We created the VM with the same number of cores as the host, so the host-ran `nproc` here is fine.
|
2023-11-23 05:12:16 +08:00
|
|
|
RUN 'cmake --build _build --parallel "$NPROC" --target install -- -k'
|
|
|
|
RUN 'cd _build && ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:2 --timeout 120 || true'
|
2023-11-22 19:41:53 +08:00
|
|
|
|
|
|
|
# Gracefully shut down the VM.
|
|
|
|
stop_vm
|