forked from irungentoo/toxcore
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Simplify and speed up nacl build using toxchat/nacl.
- Loading branch information
Showing
3 changed files
with
23 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,27 @@ | ||
#!/bin/bash | ||
|
||
ACTION="$1" | ||
|
||
set -eu | ||
|
||
CACHEDIR="$HOME/cache" | ||
NPROC=$(nproc) | ||
|
||
ci_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 | ||
} | ||
} | ||
|
||
ci_script() { | ||
. ".github/scripts/flags-$CC.sh" | ||
|
||
add_ld_flag -Wl,-z,defs | ||
. ".github/scripts/flags-$CC.sh" | ||
|
||
# Make compilation error on a warning | ||
add_flag -Werror | ||
add_ld_flag -Wl,-z,defs | ||
|
||
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 | ||
# Make compilation error on a warning | ||
add_flag -Werror | ||
|
||
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 | ||
} | ||
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 | ||
|
||
if [ "-z" "$ACTION" ]; then | ||
"ci_script" | ||
else | ||
"ci_$ACTION" | ||
fi | ||
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 |
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 |
---|---|---|
@@ -1,33 +1,8 @@ | ||
################################################ | ||
# autotools-linux | ||
FROM ubuntu:20.04 | ||
FROM toxchat/nacl:latest | ||
|
||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
autoconf \ | ||
automake \ | ||
ca-certificates \ | ||
curl \ | ||
libconfig-dev \ | ||
libmsgpack-dev \ | ||
libopus-dev \ | ||
libtool \ | ||
libvpx-dev \ | ||
make \ | ||
pkg-config \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN groupadd -r -g 1000 builder \ | ||
&& useradd -m --no-log-init -r -g builder -u 1000 builder | ||
USER builder | ||
|
||
# Copy minimal files to run "autotools-linux install", so we can avoid | ||
# rebuilding nacl and other things when only source files change. | ||
RUN mkdir -p /home/builder/build/c-toxcore /home/builder/cache | ||
WORKDIR /home/builder/build/c-toxcore | ||
COPY --chown=builder:builder .github/scripts/ /home/builder/build/c-toxcore/.github/scripts/ | ||
RUN .github/scripts/autotools-linux install | ||
|
||
# Now copy the rest of the sources and run the build. | ||
COPY --chown=builder:builder . /home/builder/build/c-toxcore/ | ||
RUN CC=gcc .github/scripts/autotools-linux script | ||
# Copy the sources and run the build. | ||
COPY --chown=builder:builder . /home/builder/c-toxcore/ | ||
WORKDIR /home/builder/c-toxcore | ||
RUN CC=gcc .github/scripts/autotools-linux |