-
Notifications
You must be signed in to change notification settings - Fork 309
/
Dockerfile
410 lines (365 loc) · 12.8 KB
/
Dockerfile
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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# Create a builder image with the compilers, etc. needed
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0.20240829 AS build-env
# Install all the required packages for building. This list is probably
# longer than necessary.
RUN echo "== Install Git/CA certificates ==" && \
tdnf install -y \
git \
ca-certificates
RUN echo "== Install Core dependencies ==" && \
tdnf install -y \
alsa-lib \
alsa-lib-devel \
autoconf \
automake \
binutils \
bison \
build-essential \
cairo \
cairo-devel \
clang \
clang-devel \
cmake \
dbus \
dbus-devel \
dbus-glib \
dbus-glib-devel \
diffutils \
elfutils-devel \
file-libs \
flex \
fontconfig-devel \
gawk \
gcc \
gettext \
glibc-devel \
glib-schemas \
gobject-introspection \
gobject-introspection-devel \
harfbuzz \
harfbuzz-devel \
kernel-headers \
intltool \
libatomic_ops \
libcap-devel \
libffi \
libffi-devel \
libgudev \
libgudev-devel \
libjpeg-turbo \
libjpeg-turbo-devel \
libltdl \
libltdl-devel \
libpng-devel \
librsvg2-devel \
libtiff \
libtiff-devel \
libusb \
libusb-devel \
libwebp \
libwebp-devel \
libxml2 \
libxml2-devel \
make \
meson \
newt \
nss \
nss-libs \
openldap \
openssl-devel \
pam-devel \
pango \
pango-devel \
patch \
perl-XML-Parser \
polkit-devel \
python3-devel \
python3-mako \
python3-markupsafe \
sed \
sqlite-devel \
systemd-devel \
tar \
unzip \
vala \
vala-devel \
vala-tools
RUN echo "== Install UI dependencies ==" && \
tdnf install -y \
libdrm-devel \
libepoxy-devel \
libevdev \
libevdev-devel \
libinput \
libinput-devel \
libpciaccess-devel \
libSM-devel \
libsndfile \
libsndfile-devel \
libXcursor \
libXcursor-devel \
libXdamage-devel \
libXfont2-devel \
libXi \
libXi-devel \
libxkbcommon-devel \
libxkbfile-devel \
libXrandr-devel \
libxshmfence-devel \
libXtst \
libXtst-devel \
libXxf86vm-devel \
wayland-devel \
wayland-protocols-devel \
xkbcomp \
xkeyboard-config \
xorg-x11-server-devel \
xorg-x11-util-macros
# Create an image with builds of FreeRDP and Weston
FROM build-env AS dev
ARG WSLG_VERSION="<current>"
ARG WSLG_ARCH="x86_64"
ARG SYSTEMDISTRO_DEBUG_BUILD
ARG FREERDP_VERSION=2
WORKDIR /work
RUN echo "WSLg (" ${WSLG_ARCH} "):" ${WSLG_VERSION} > /work/versions.txt
RUN echo "Built at:" `date --utc` >> /work/versions.txt
RUN echo "Mariner:" `cat /etc/os-release | head -2 | tail -1` >> /work/versions.txt
#
# Build runtime dependencies.
#
ENV BUILDTYPE=${SYSTEMDISTRO_DEBUG_BUILD:+debug}
ENV BUILDTYPE=${BUILDTYPE:-debugoptimized}
RUN echo "== System distro build type:" ${BUILDTYPE} " =="
ENV BUILDTYPE_NODEBUGSTRIP=${SYSTEMDISTRO_DEBUG_BUILD:+debug}
ENV BUILDTYPE_NODEBUGSTRIP=${BUILDTYPE_NODEBUGSTRIP:-release}
RUN echo "== System distro build type (no debug strip):" ${BUILDTYPE_NODEBUGSTRIP} " =="
# FreeRDP is always built with RelWithDebInfo
ENV BUILDTYPE_FREERDP=${BUILDTYPE_FREERDP:-RelWithDebInfo}
RUN echo "== System distro build type (FreeRDP):" ${BUILDTYPE_FREERDP} " =="
ENV WITH_DEBUG_FREERDP=${SYSTEMDISTRO_DEBUG_BUILD:+ON}
ENV WITH_DEBUG_FREERDP=${WITH_DEBUG_FREERDP:-OFF}
RUN echo "== System distro build type (FreeRDP Debug Options):" ${WITH_DEBUG_FREERDP} " =="
ENV DESTDIR=/work/build
ENV PREFIX=/usr
ENV PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/lib/pkgconfig:${DESTDIR}${PREFIX}/lib/${WSLG_ARCH}-linux-gnu/pkgconfig:${DESTDIR}${PREFIX}/share/pkgconfig
ENV C_INCLUDE_PATH=${DESTDIR}${PREFIX}/include/freerdp${FREERDP_VERSION}:${DESTDIR}${PREFIX}/include/winpr${FREERDP_VERSION}:${DESTDIR}${PREFIX}/include/wsl/stubs:${DESTDIR}${PREFIX}/include
ENV CPLUS_INCLUDE_PATH=${C_INCLUDE_PATH}
ENV LIBRARY_PATH=${DESTDIR}${PREFIX}/lib
ENV LD_LIBRARY_PATH=${LIBRARY_PATH}
ENV CC=/usr/bin/gcc
ENV CXX=/usr/bin/g++
# Setup DebugInfo folder
COPY debuginfo /work/debuginfo
RUN chmod +x /work/debuginfo/gen_debuginfo.sh
# Build DirectX-Headers
COPY vendor/DirectX-Headers-1.0 /work/vendor/DirectX-Headers-1.0
WORKDIR /work/vendor/DirectX-Headers-1.0
RUN /usr/bin/meson --prefix=${PREFIX} build \
--buildtype=${BUILDTYPE_NODEBUGSTRIP} \
-Dbuild-test=false && \
ninja -C build -j8 install && \
echo 'DirectX-Headers:' `git --git-dir=/work/vendor/DirectX-Headers-1.0/.git rev-parse --verify HEAD` >> /work/versions.txt
# Build mesa with the minimal options we need.
COPY vendor/mesa /work/vendor/mesa
WORKDIR /work/vendor/mesa
RUN /usr/bin/meson --prefix=${PREFIX} build \
--buildtype=${BUILDTYPE_NODEBUGSTRIP} \
-Dgallium-drivers=swrast,d3d12 \
-Dvulkan-drivers= \
-Dllvm=disabled && \
ninja -C build -j8 install && \
echo 'mesa:' `git --git-dir=/work/vendor/mesa/.git rev-parse --verify HEAD` >> /work/versions.txt
# Build PulseAudio
COPY vendor/pulseaudio /work/vendor/pulseaudio
WORKDIR /work/vendor/pulseaudio
RUN /usr/bin/meson --prefix=${PREFIX} build \
--buildtype=${BUILDTYPE_NODEBUGSTRIP} \
-Ddatabase=simple \
-Ddoxygen=false \
-Dgsettings=disabled \
-Dtests=false && \
ninja -C build -j8 install && \
echo 'pulseaudio:' `git --git-dir=/work/vendor/pulseaudio/.git rev-parse --verify HEAD` >> /work/versions.txt
# Build FreeRDP
COPY vendor/FreeRDP /work/vendor/FreeRDP
WORKDIR /work/vendor/FreeRDP
RUN cmake -G Ninja \
-B build \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_INSTALL_LIBDIR=${PREFIX}/lib \
-DCMAKE_BUILD_TYPE=${BUILDTYPE_FREERDP} \
-DWITH_DEBUG_ALL=${WITH_DEBUG_FREERDP} \
-DWITH_ICU=ON \
-DWITH_SERVER=ON \
-DWITH_CHANNEL_GFXREDIR=ON \
-DWITH_CHANNEL_RDPAPPLIST=ON \
-DWITH_CLIENT=OFF \
-DWITH_CLIENT_COMMON=OFF \
-DWITH_CLIENT_CHANNELS=OFF \
-DWITH_CLIENT_INTERFACE=OFF \
-DWITH_PROXY=OFF \
-DWITH_SHADOW=OFF \
-DWITH_SAMPLE=OFF && \
ninja -C build -j8 install && \
echo 'FreeRDP:' `git --git-dir=/work/vendor/FreeRDP/.git rev-parse --verify HEAD` >> /work/versions.txt
WORKDIR /work/debuginfo
RUN if [ -z "$SYSTEMDISTRO_DEBUG_BUILD" ] ; then \
echo "== Strip debug info: FreeRDP ==" && \
/work/debuginfo/gen_debuginfo.sh /work/debuginfo/FreeRDP${FREERDP_VERSION}.list /work/build; \
fi
# Build rdpapplist RDP virtual channel plugin
COPY rdpapplist /work/rdpapplist
WORKDIR /work/rdpapplist
RUN /usr/bin/meson --prefix=${PREFIX} build \
--buildtype=${BUILDTYPE} && \
ninja -C build -j8 install
WORKDIR /work/debuginfo
RUN if [ -z "$SYSTEMDISTRO_DEBUG_BUILD" ] ; then \
echo "== Strip debug info: rdpapplist ==" && \
/work/debuginfo/gen_debuginfo.sh /work/debuginfo/rdpapplist.list /work/build; \
fi
# Build Weston
COPY vendor/weston /work/vendor/weston
WORKDIR /work/vendor/weston
RUN /usr/bin/meson --prefix=${PREFIX} build \
--buildtype=${BUILDTYPE} \
-Dbackend-default=rdp \
-Dbackend-drm=false \
-Dbackend-drm-screencast-vaapi=false \
-Dbackend-headless=false \
-Dbackend-wayland=false \
-Dbackend-x11=false \
-Dbackend-fbdev=false \
-Dcolor-management-colord=false \
-Dscreenshare=false \
-Dsystemd=false \
-Dwslgd=true \
-Dremoting=false \
-Dpipewire=false \
-Dshell-fullscreen=false \
-Dcolor-management-lcms=false \
-Dshell-ivi=false \
-Dshell-kiosk=false \
-Ddemo-clients=false \
-Dsimple-clients=[] \
-Dtools=[] \
-Dresize-pool=false \
-Dwcap-decode=false \
-Dtest-junit-xml=false && \
ninja -C build -j8 install && \
echo 'weston:' `git --git-dir=/work/vendor/weston/.git rev-parse --verify HEAD` >> /work/versions.txt
WORKDIR /work/debuginfo
RUN if [ -z "$SYSTEMDISTRO_DEBUG_BUILD" ] ; then \
echo "== Strip debug info: weston ==" && \
/work/debuginfo/gen_debuginfo.sh /work/debuginfo/weston.list /work/build; \
fi
# Build WSLGd Daemon
ENV CC=/usr/bin/clang
ENV CXX=/usr/bin/clang++
COPY WSLGd /work/WSLGd
WORKDIR /work/WSLGd
RUN /usr/bin/meson --prefix=${PREFIX} build \
--buildtype=${BUILDTYPE} && \
ninja -C build -j8 install
WORKDIR /work/debuginfo
RUN if [ -z "$SYSTEMDISTRO_DEBUG_BUILD" ] ; then \
echo "== Strip debug info: WSLGd ==" && \
/work/debuginfo/gen_debuginfo.sh /work/debuginfo/WSLGd.list /work/build; \
fi
# Gather debuginfo to a tar file
WORKDIR /work/debuginfo
RUN if [ -z "$SYSTEMDISTRO_DEBUG_BUILD" ] ; then \
echo "== Compress debug info: /work/debuginfo/system-debuginfo.tar.gz ==" && \
tar -C /work/build/debuginfo -czf system-debuginfo.tar.gz ./ ; \
fi
########################################################################
########################################################################
## Create the distro image with just what's needed at runtime
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0.20240829 AS runtime
RUN echo "== Install Core/UI Runtime Dependencies ==" && \
tdnf install -y \
cairo \
chrony \
dbus \
dbus-glib \
dhcp-client \
e2fsprogs \
freefont \
libinput \
libjpeg-turbo \
libltdl \
libpng \
librsvg2 \
libsndfile \
libwayland-client \
libwayland-server \
libwayland-cursor \
libwebp \
libXcursor \
libxkbcommon \
libXrandr \
iproute \
nftables \
pango \
procps-ng \
rpm \
sed \
tzdata \
wayland-protocols-devel \
xcursor-themes \
xorg-x11-server-Xwayland \
xorg-x11-server-utils \
xorg-x11-xtrans-devel
# Install packages to aid in development, if not remove some packages.
ARG SYSTEMDISTRO_DEBUG_BUILD
RUN if [ -z "$SYSTEMDISTRO_DEBUG_BUILD" ] ; then \
rpm -e --nodeps curl \
rpm -e --nodeps python3 \
rpm -e --nodeps python3-libs; \
else \
echo "== Install development aid packages ==" && \
tdnf install -y \
gdb \
mariner-repos-debug \
nano \
vim && \
tdnf install -y \
wayland-debuginfo \
xorg-x11-server-debuginfo; \
fi
# Clear the tdnf cache to make the image smaller
RUN tdnf clean all
# Remove extra doc
RUN rm -rf /usr/lib/python3.7 /usr/share/gtk-doc
# Create wslg user.
RUN useradd -u 1000 --create-home wslg && \
mkdir /home/wslg/.config && \
chown wslg /home/wslg/.config
# Copy config files.
COPY config/wsl.conf /etc/wsl.conf
COPY config/weston.ini /home/wslg/.config/weston.ini
COPY config/local.conf /etc/fonts/local.conf
# Copy default icon file.
COPY resources/linux.png /usr/share/icons/wsl/linux.png
# Copy the built artifacts from the build stage.
COPY --from=dev /work/build/usr/ /usr/
COPY --from=dev /work/build/etc/ /etc/
# Append WSLg setttings to pulseaudio.
COPY config/default_wslg.pa /etc/pulse/default_wslg.pa
RUN cat /etc/pulse/default_wslg.pa >> /etc/pulse/default.pa
RUN rm /etc/pulse/default_wslg.pa
# Copy the licensing information for PulseAudio
COPY --from=dev /work/vendor/pulseaudio/GPL \
/work/vendor/pulseaudio/LGPL \
/work/vendor/pulseaudio/LICENSE \
/work/vendor/pulseaudio/NEWS \
/work/vendor/pulseaudio/README /usr/share/doc/pulseaudio/
# Copy the licensing information for Weston
COPY --from=dev /work/vendor/weston/COPYING /usr/share/doc/weston/COPYING
# Copy the licensing information for FreeRDP
COPY --from=dev /work/vendor/FreeRDP/LICENSE /usr/share/doc/FreeRDP/LICENSE
# copy the documentation and licensing information for mesa
COPY --from=dev /work/vendor/mesa/docs /usr/share/doc/mesa/
COPY --from=dev /work/versions.txt /etc/versions.txt
CMD /usr/bin/WSLGd