File: Dockerfile

package info (click to toggle)
libtoxcore 0.2.20-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,124 kB
  • sloc: ansic: 75,034; cpp: 4,933; sh: 1,115; python: 651; makefile: 329; perl: 39
file content (85 lines) | stat: -rw-r--r-- 2,160 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND="noninteractive"

# Install dependencies.
RUN apt-get update && apt-get install --no-install-recommends -y \
 autoconf \
 automake \
 ca-certificates \
 cmake \
 curl \
 git \
 libtool \
 make \
 ninja-build \
 pkg-config \
 python3 \
 unzip \
 wget \
 xz-utils \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

WORKDIR /work/emsdk
RUN git clone --depth=1 https://github.com/emscripten-core/emsdk /work/emsdk \
 && ./emsdk install 3.1.3 \
 && ./emsdk activate 3.1.3

# Build libsodium.
RUN . "/work/emsdk/emsdk_env.sh" \
 && git clone --depth=1 --branch=1.0.18 https://github.com/jedisct1/libsodium /work/libsodium \
 && cd /work/libsodium \
 && autoreconf -fi \
 && emconfigure ./configure --disable-shared \
  --without-pthreads \
  --disable-ssp --disable-asm --disable-pie \
  --host x86_64-linux-gnu \
 && emmake make install -j8

# Build an unused libsodium binding first so emcc caches all the system
# libraries. This makes rebuilds of toxcore below much faster.
RUN . "/work/emsdk/emsdk_env.sh" \
 && mkdir -p /work/wasm \
 && emcc -O3 -flto \
 --closure=1 \
 -s ALLOW_UNIMPLEMENTED_SYSCALLS=1 \
 -s EXPORT_NAME=libtoxcore \
 -s IGNORE_MISSING_MAIN=1 \
 -s MAIN_MODULE=1 \
 -s MALLOC=emmalloc \
 -s MODULARIZE=1 \
 -s STRICT=1 \
 -s WEBSOCKET_URL=wss:// \
 /usr/local/lib/libsodium.a \
 -o /work/wasm/libsodium.js

# Build c-toxcore.
COPY . /work/c-toxcore
RUN . "/work/emsdk/emsdk_env.sh" \
 && cd /work/c-toxcore \
 && emcmake cmake -B_build -H. -GNinja \
 -DCMAKE_INSTALL_PREFIX:PATH="/usr/local" \
 -DCMAKE_C_FLAGS="-O3 -flto -fPIC" \
 -DBUILD_TOXAV=OFF \
 -DENABLE_SHARED=OFF \
 -DBOOTSTRAP_DAEMON=OFF \
 -DMIN_LOGGER_LEVEL=DEBUG \
 && emmake cmake --build _build --parallel 8 --target install

# Build wasm bindings.
RUN . "/work/emsdk/emsdk_env.sh" \
 && mkdir -p /work/wasm \
 && emcc -O3 -flto \
 --closure=1 \
 -s ALLOW_UNIMPLEMENTED_SYSCALLS=1 \
 -s EXPORT_NAME=libtoxcore \
 -s IGNORE_MISSING_MAIN=1 \
 -s MAIN_MODULE=1 \
 -s MALLOC=emmalloc \
 -s MODULARIZE=1 \
 -s STRICT=1 \
 -s WEBSOCKET_URL=wss:// \
 /usr/local/lib/libsodium.a \
 /usr/local/lib/libtoxcore.a \
 -o /work/wasm/libtoxcore.js