Skip to content

Commit c5e3bca

Browse files
committed
chore: Simplify and speed up nacl build using toxchat/nacl.
1 parent 4389c71 commit c5e3bca

File tree

3 files changed

+23
-77
lines changed

3 files changed

+23
-77
lines changed

.github/scripts/autotools-linux

Lines changed: 17 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,27 @@
11
#!/bin/bash
22

3-
ACTION="$1"
4-
53
set -eu
64

7-
CACHEDIR="$HOME/cache"
85
NPROC=$(nproc)
96

10-
ci_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"
18-
mv build/*/include/* "$CACHEDIR/include"
19-
mkdir -p "$CACHEDIR/lib"
20-
mv build/*/lib/* "$CACHEDIR/lib"
21-
cd - # popd
22-
}
23-
}
24-
25-
ci_script() {
26-
. ".github/scripts/flags-$CC.sh"
27-
28-
add_ld_flag -Wl,-z,defs
7+
. ".github/scripts/flags-$CC.sh"
298

30-
# Make compilation error on a warning
31-
add_flag -Werror
9+
add_ld_flag -Wl,-z,defs
3210

33-
add_config_flag --with-nacl-libs="$CACHEDIR/lib/amd64"
34-
add_config_flag --with-nacl-headers="$CACHEDIR/include/amd64"
35-
add_config_flag --disable-ipv6
36-
add_config_flag --enable-nacl
37-
add_config_flag --enable-daemon
38-
add_config_flag --with-log-level=TRACE
11+
# Make compilation error on a warning
12+
add_flag -Werror
3913

40-
autoreconf -fi
41-
mkdir -p _build
42-
cd _build # pushd
43-
../configure "${CONFIG_FLAGS[@]}" || (cat config.log && false)
44-
make "-j$NPROC" -k CFLAGS="$C_FLAGS" LDFLAGS="$LD_FLAGS"
45-
make -j50 -k distcheck DISTCHECK_CONFIGURE_FLAGS="${CONFIG_FLAGS[*]}" || (cat tox-*/_build/build/test-suite.log && false)
46-
cd - # popd
47-
}
14+
add_config_flag --with-nacl-libs="$CACHEDIR/lib/amd64"
15+
add_config_flag --with-nacl-headers="$CACHEDIR/include/amd64"
16+
add_config_flag --disable-ipv6
17+
add_config_flag --enable-nacl
18+
add_config_flag --enable-daemon
19+
add_config_flag --with-log-level=TRACE
4820

49-
if [ "-z" "$ACTION" ]; then
50-
"ci_script"
51-
else
52-
"ci_$ACTION"
53-
fi
21+
autoreconf -fi
22+
mkdir -p _build
23+
cd _build # pushd
24+
../configure "${CONFIG_FLAGS[@]}" || (cat config.log && false)
25+
make "-j$NPROC" -k CFLAGS="$C_FLAGS" LDFLAGS="$LD_FLAGS"
26+
make -j50 -k distcheck DISTCHECK_CONFIGURE_FLAGS="${CONFIG_FLAGS[*]}" || (cat tox-*/_build/build/test-suite.log && false)
27+
cd - # popd

.github/scripts/cmake-freebsd-stage2

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,4 @@ RUN 'cmake -B_build -Hc-toxcore \
4949

5050
# We created the VM with the same number of cores as the host, so the host-ran `nproc` here is fine
5151
RUN 'gmake "-j$NPROC" -k install -C_build'
52-
RUN 'gmake "-j$NPROC" test ARGS="-j50" -C_build || \
53-
gmake -j50 -C_build test ARGS="-j50 --rerun-failed" || \
54-
gmake -j1 -C_build test ARGS="-j1 --rerun-failed" CTEST_OUTPUT_ON_FAILURE=1 || \
55-
true'
52+
RUN 'gmake "-j$NPROC" test ARGS="-j50" -C_build || true'

other/docker/autotools/Dockerfile

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,8 @@
11
################################################
22
# autotools-linux
3-
FROM ubuntu:20.04
3+
FROM toxchat/nacl:latest
44

5-
RUN apt-get update && apt-get install --no-install-recommends -y \
6-
autoconf \
7-
automake \
8-
ca-certificates \
9-
curl \
10-
libconfig-dev \
11-
libmsgpack-dev \
12-
libopus-dev \
13-
libtool \
14-
libvpx-dev \
15-
make \
16-
pkg-config \
17-
&& apt-get clean \
18-
&& rm -rf /var/lib/apt/lists/*
19-
20-
RUN groupadd -r -g 1000 builder \
21-
&& useradd -m --no-log-init -r -g builder -u 1000 builder
22-
USER builder
23-
24-
# Copy minimal files to run "autotools-linux install", so we can avoid
25-
# rebuilding nacl and other things when only source files change.
26-
RUN mkdir -p /home/builder/build/c-toxcore /home/builder/cache
27-
WORKDIR /home/builder/build/c-toxcore
28-
COPY --chown=builder:builder .github/scripts/ /home/builder/build/c-toxcore/.github/scripts/
29-
RUN .github/scripts/autotools-linux install
30-
31-
# Now copy the rest of the sources and run the build.
32-
COPY --chown=builder:builder . /home/builder/build/c-toxcore/
33-
RUN CC=gcc .github/scripts/autotools-linux script
5+
# Copy the sources and run the build.
6+
COPY --chown=builder:builder . /home/builder/c-toxcore/
7+
WORKDIR /home/builder/c-toxcore
8+
RUN CC=gcc .github/scripts/autotools-linux

0 commit comments

Comments
 (0)