-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile.base
291 lines (253 loc) · 9.17 KB
/
Dockerfile.base
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
ARG EMSCRIPTEN_SDK_TAG=emscripten/emsdk
FROM ${EMSCRIPTEN_SDK_TAG} AS builder
ARG CMAKE_BUILD_TYPE=Release
ARG MESON_BUILD_TYPE=release
ARG EMSCRIPTEN_FLAGS="-fexceptions"
# -sUSE_PTHREADS=1 -lpthread -sWASM_WORKERS -sSHARED_MEMORY
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
--mount=type=cache,target=/root/.cache/pip \
apt update && \
apt install -qqy \
autoconf \
automake \
autopoint \
bison \
build-essential \
ccache \
cmake \
flex \
gettext \
git \
gperf \
gpg \
libtool \
ninja-build \
pkg-config \
prelink \
python-is-python3 \
python3 \
python3-pip \
texinfo \
unzip \
wget && \
pip3 install \
meson \
packaging
ENV CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
ENV MESON_BUILD_TYPE=${MESON_BUILD_TYPE}
ENV CFLAGS="${EMSCRIPTEN_FLAGS}"
ENV CXXFLAGS="${EMSCRIPTEN_FLAGS}"
ENV LDFLAGS="${EMSCRIPTEN_FLAGS}"
FROM builder AS boost
COPY boost .
RUN ./bootstrap.sh && \
./b2 \
--disable-icu \
--prefix=/emsdk/upstream/emscripten/cache/sysroot \
--with-filesystem \
--with-program_options \
--with-regex \
--with-system \
address-model=32 \
cxxflags="-std=c++17 -stdlib=libc++ -fexceptions" \
install \
link=static \
linkflags="-stdlib=libc++ -fexceptions" \
release \
runtime-link=static \
toolset=emscripten
FROM builder AS libexpat
COPY libexpat .
RUN cd expat && \
./buildconf.sh && \
emconfigure ./configure \
--without-docbook \
--host wasm32-unknown-linux \
--prefix=/emsdk/upstream/emscripten/cache/sysroot \
--enable-shared=no \
--disable-dependency-tracking && \
emmake make && \
emmake make install
FROM builder AS zlib
COPY zlib .
RUN emcmake cmake \
-DINSTALL_PKGCONFIG_DIR="/emsdk/upstream/emscripten/cache/sysroot/lib/pkgconfig/" \
-B ../build && \
cmake --build ../build && \
cmake --install ../build
FROM builder AS libzip
COPY --from=zlib /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY libzip .
RUN emcmake cmake \
-B ../build \
-G Ninja && \
cmake --build ../build --parallel && \
cmake --install ../build
FROM builder AS libffi
COPY libffi .
RUN ./autogen.sh && \
emconfigure ./configure \
--host wasm32-unknown-linux \
--prefix=/emsdk/upstream/emscripten/cache/sysroot \
--enable-static \
--disable-shared \
--disable-dependency-tracking \
--disable-builddir \
--disable-multi-os-directory \
--disable-raw-api \
--disable-docs && \
emmake make && \
emmake make install SUBDIRS='include'
FROM builder AS glib
COPY --from=zlib /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=libffi /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY glib .
COPY emscripten-crossfile.meson .
RUN meson \
setup \
../build \
--prefix=/emsdk/upstream/emscripten/cache/sysroot \
--cross-file=emscripten-crossfile.meson \
--default-library=static \
--buildtype=${MESON_BUILD_TYPE} \
--force-fallback-for=pcre2,gvdb \
-Dselinux=disabled \
-Dxattr=false \
-Dlibmount=disabled \
-Dnls=disabled \
-Dtests=false \
-Dglib_assert=false \
-Dglib_checks=false && \
meson install -C ../build
FROM builder AS freetype
COPY --from=zlib /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY freetype .
RUN emcmake cmake \
-B ../build \
-DFT_REQUIRE_ZLIB=TRUE && \
cmake --build ../build && \
cmake --install ../build
FROM builder AS libxml2
COPY libxml2 .
RUN emcmake cmake \
-B ../build \
-G Ninja \
-DLIBXML2_WITH_PYTHON=OFF \
-DLIBXML2_WITH_LZMA=OFF \
-DLIBXML2_WITH_ZLIB=OFF && \
cmake --build ../build --parallel && \
cmake --install ../build
FROM builder AS fontconfig
COPY --from=zlib /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=freetype /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=libxml2 /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY fontconfig .
ENV FREETYPE_CFLAGS="-I/emsdk/upstream/emscripten/cache/sysroot/include/freetype2"
ENV FREETYPE_LIBS="-lfreetype -lz"
RUN emconfigure ./autogen.sh \
--host none \
--disable-docs \
--disable-shared \
--enable-static \
--sysconfdir=/ \
--localstatedir=/ \
--with-default-fonts=/fonts \
--enable-libxml2 \
--prefix=/emsdk/upstream/emscripten/cache/sysroot && \
emmake make && \
emmake make install
FROM builder AS cairo
COPY --from=glib /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=fontconfig /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=freetype /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=libexpat /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY cairo .
COPY emscripten-crossfile.meson .
RUN meson \
setup \
../build \
--prefix=/emsdk/upstream/emscripten/cache/sysroot \
--cross-file=emscripten-crossfile.meson \
--default-library=static \
--buildtype=${MESON_BUILD_TYPE} \
-Dtests=disabled && \
meson install -C ../build
FROM builder AS harfbuzz
COPY --from=freetype /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY harfbuzz .
RUN emcmake cmake \
-B ../build \
-G Ninja \
-DHB_HAVE_FREETYPE=ON && \
cmake --build ../build --parallel && \
cmake --install ../build
FROM builder AS eigen
COPY eigen .
RUN emcmake cmake \
-B ../build \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=/emsdk/upstream/emscripten/cache/sysroot && \
cmake --build ../build --parallel && \
cmake --install ../build && \
ln -s /emsdk/upstream/emscripten/cache/sysroot/include/eigen3/Eigen /emsdk/upstream/emscripten/cache/sysroot/include/Eigen
FROM builder AS cgal
COPY cgal .
RUN emcmake cmake \
-B ../build \
-G Ninja && \
cmake --build ../build --parallel && \
cmake --install ../build
FROM builder AS gmp
COPY gmp .
RUN emconfigure ./configure \
--disable-assembly \
--host none \
--enable-cxx --prefix=/emsdk/upstream/emscripten/cache/sysroot \
HOST_CC=gcc && \
make && \
make install
FROM builder AS mpfr
COPY --from=gmp /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY mpfr .
RUN emconfigure ./configure \
--host none \
--with-gmp=/emsdk/upstream/emscripten/cache/sysroot \
--prefix=/emsdk/upstream/emscripten/cache/sysroot && \
make && \
make install
FROM builder AS doubleconversion
COPY doubleconversion .
RUN emcmake cmake \
-B ../build \
-G Ninja && \
cmake --build ../build --parallel && \
cmake --install ../build
FROM builder AS lib3mf
COPY --from=zlib /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=libzip /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY lib3mf .
RUN emcmake cmake \
-B ../build \
-DLIB3MF_TESTS=OFF \
-DUSE_INCLUDED_ZLIB=OFF \
-DUSE_INCLUDED_LIBZIP=OFF \
-G Ninja && \
cmake --build ../build --parallel && \
cmake --install ../build
FROM builder AS wasm-base
COPY --from=boost /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=gmp /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=mpfr /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=cgal /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=eigen /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=harfbuzz /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=fontconfig /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=glib /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=libzip /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=libffi /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=doubleconversion /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
COPY --from=lib3mf /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
# COPY --from=freetype /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
# COPY --from=cairo /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot
# COPY --from=libexpat /emsdk/upstream/emscripten/cache/sysroot /emsdk/upstream/emscripten/cache/sysroot