-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.emscripten
106 lines (88 loc) · 3.25 KB
/
Dockerfile.emscripten
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
## base image
FROM abeimler/simple-cppbuilder:base AS base
ARG extra_libraries
ARG vcpkg_host_triplet="x64-linux"
ARG processor="x86_64"
ARG vcpkg_target_triplet="wasm32-emscripten"
ARG cc="emcc"
ARG cxx="em++"
ARG cross_cmake="emcmake cmake"
ARG cross_make="emmake make"
ARG cmake="cmake"
ARG make="make"
ARG cmake_toolchain_file="/usr/lib/emscripten/cmake/Modules/Platform/Emscripten.cmake"
ARG cmake_generator="Ninja Multi-Config"
# Install packages available from standard repos
RUN pacman-db-upgrade && \
pacman -S --noconfirm \
clang llvm \
mesa glu glfw libx11 libxrender libxext libxcursor libxrandr libxinerama xorg-server-devel \
${extra_libraries} \
cmake make ninja && \
pacman -Scc --noconfirm
# install extra packages from AUR (emscripten)
USER yay
RUN yay -Syu --noconfirm && yay -S --noconfirm \
nodejs emscripten emsdk && \
yay -Scc --noconfirm && \
rm -rf /home/yay/.cache/*
USER root
RUN /usr/lib/emsdk/emsdk install latest && /usr/lib/emsdk/emsdk activate latest
# compiler env settings
ENV EMSDK "/usr/lib/emsdk"
ENV EM_CONFIG "/usr/lib/emsdk/.emscripten"
ENV EM_CACHE "/usr/lib/emsdk/upstream/emscripten/cache"
ENV EMSDK_PATH "/usr/lib/emsdk"
ENV EMSCRIPTEN_PATH "/usr/lib/emscripten"
ENV CLANG_PATH "/opt/emscripten-llvm/bin"
ENV PYTHON_PATH "/usr/bin"
ENV NODE_PATH "/usr/bin"
ENV PATH="${EMSDK_PATH}:${EMSCRIPTEN_PATH}:${CLANG_PATH}:${NODE_PATH}:${PYTHON_PATH}:${PATH}"
ARG setup_env_script="/usr/lib/emsdk/emsdk_env.sh"
ARG setup_env_script_args=""
ENV SETUP_ENV_SCRIPT $setup_env_script
ENV SETUP_ENV_SCRIPT_ARGS $setup_env_script_args
RUN echo "source \"$SETUP_ENV_SCRIPT $SETUP_ENV_SCRIPT_ARGS\"" >> /root/.bash_profile
RUN /usr/lib/emsdk/emsdk construct_env \
&& . $setup_env_script $setup_env_script_args
# FIXME: https://github.com/emscripten-core/emsdk/issues/430
RUN mkdir -p /home/cross && touch /home/cross/.bashrc
ENV SETUP_ENV_SCRIPT "/home/cross/.bashrc"
ENV SETUP_ENV_SCRIPT_ARGS ""
# cross compiler settings
ENV CC $cc
ENV CXX $cxx
ENV CMAKE $cmake
ENV MAKE $make
ENV PROCESSOR $processor
ENV TARGET_TRIPLET $vcpkg_target_triplet
ENV CROSS_CMAKE $cross_cmake
ENV CROSS_MAKE $cross_make
ENV CROSS_TOOLCHAIN $cmake_toolchain_file
# install vcpkg
ENV VCPKG_DEFAULT_HOST_TRIPLET $vcpkg_host_triplet
ENV VCPKG_DEFAULT_TRIPLET $vcpkg_target_triplet
ENV VCPKG_DISABLE_METRICS 1
RUN git clone --depth 1 https://github.com/Microsoft/vcpkg.git /home/project/vcpkg && \
/home/project/vcpkg/bootstrap-vcpkg.sh -disableMetrics
ENV VCPKG_ROOT "/home/project/vcpkg"
ENV CHAINLOAD_TOOLCHAIN_FILE $cmake_toolchain_file
ENV VCPKG_CHAINLOAD_TOOLCHAIN_FILE $CHAINLOAD_TOOLCHAIN_FILE
ENV VCPKG_TOOLCHAIN_FILE "$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
ENV TOOLCHAIN_FILE "$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
# build script settings
ENV TARGET "all"
ENV BUILD_TYPE "Release"
ENV CMAKE_GENERATOR $cmake_generator
ENV CMAKE_ARGS ""
# setup project env
ENV PROJECT_DIR /home/project
WORKDIR /home/project
COPY ./cmake ./cmake
COPY ./scripts/docker-build.setup-env.sh ./docker-build.sh
COPY ./scripts/docker-test.setup-env.sh ./docker-test.sh
COPY ./taskfiles/*.yml /home/taskfiles/
COPY ./taskfiles/TaskfileCross.yml /home/taskfiles/Taskfile.yml
ENV PROJECT_DIR /home/project
WORKDIR /home/project
RUN mkdir build