Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ body:

You can access the wslg logs using explorer at: `\\wsl$\<Distro-Name>\mnt\wslg` (e.g.: `\\wsl$\Ubuntu-20.04\mnt\wslg`)

* `pulseaudio.log`
* `pipewire-pulse.log`
* `weston.log`
* `stderr.log`
label: "WSL logs:"
Expand Down
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any addi

# Building the WSLg System Distro

The heart of WSLg is what we call the WSL system distro. This is where the Weston compositor, XWayland and the PulseAudio server are running. The system distro runs these components and projects their communication sockets into the user distro. Every user distro is paired with a unique instance of the system distro. There is a single version of the system distro on disk which is instantiated in memory when a user distro is launched.
The heart of WSLg is what we call the WSL system distro. This is where the Weston compositor, XWayland and the PipeWire audio stack (with pipewire-pulse) are running. The system distro runs these components and projects their communication sockets into the user distro. Every user distro is paired with a unique instance of the system distro. There is a single version of the system distro on disk which is instantiated in memory when a user distro is launched.

The system distro is essentially a Linux container packaged and distributed as a vhd. The system distro is accessible to the user, but is mounted read-only. Any changes made by the user to the system distro while it is running are discarded when WSL is restarted. Although a user can log into the system distro, it is not meant to be used as a general purpose user distro. The reason behind this choice is due to the way we service WSLg. When updating WSLg we simply replace the existing system distro with a new one. If the user had data embedded into the system distro vhd, this data would be lost.

For folks who want to tinker with or customize their system distro, we give the ability to run a private version of the system distro. When running a private version of WSLg, Windows will load and run your private and ignore the Microsoft published one. If you update your WSL setup (`wsl --update`), the Microsoft published WSLg vhd will be updated, but you will continue to be running your private. You can switch between the Microsoft pulished WSLg system distro and a private one at any time although it does require restarting WSL (`wsl --shutdown`).

The WSLg system distro is built using docker build. We essentially start from a [Azure Linux 3.0](https://github.com/microsoft/azurelinux) base image, install various packages, then build and install version of Weston, FreeRDP and PulseAudio from our mirror repo. This repository contains a Dockerfile and supporting tools to build the WSLg container and convert the container into an ext4 vhd that Windows will load as the system distro.
The WSLg system distro is built using docker build. We essentially start from a [Azure Linux 3.0](https://github.com/microsoft/azurelinux) base image, install various packages, then build and install version of Weston, FreeRDP, PipeWire, and WirePlumber. This repository contains a Dockerfile and supporting tools to build the WSLg container and convert the container into an ext4 vhd that Windows will load as the system distro.

## Build instructions

Expand All @@ -39,12 +39,13 @@ The WSLg system distro is built using docker build. We essentially start from a
git clone https://github.com/microsoft/wslg wslg
```

2. Clone the FreeRDP, Weston and PulseAudio mirror. These need to be located in a **vendor** sub-directory where you clone the wslg project (e.g. wslg/vendor), this is where our docker build script expects to find the source code. Make sure to checkout the **working** branch from each of these projects, the **main** branch references the upstream code.
2. Clone the FreeRDP, Weston, PipeWire, and WirePlumber repositories. These need to be located in a **vendor** sub-directory where you clone the wslg project (e.g. wslg/vendor), this is where our docker build script expects to find the source code.

```bash
git clone https://github.com/microsoft/FreeRDP-mirror wslg/vendor/FreeRDP -b working
git clone https://github.com/microsoft/weston-mirror wslg/vendor/weston -b working
git clone https://github.com/microsoft/PulseAudio-mirror wslg/vendor/pulseaudio -b working
git clone https://github.com/PipeWire/pipewire wslg/vendor/pipewire -b 1.4.10
git clone https://github.com/PipeWire/wireplumber wslg/vendor/wireplumber -b 0.5.13
git clone https://github.com/microsoft/DirectX-Headers.git wslg/vendor/DirectX-Headers-1.0 -b v1.608.0
git clone https://gitlab.freedesktop.org/mesa/mesa.git wslg/vendor/mesa -b mesa-23.1.0
```
Expand Down
115 changes: 96 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ RUN echo "== Install UI dependencies ==" && \
libSM-devel \
libsndfile \
libsndfile-devel \
lua \
lua-devel \
libXcursor \
libXcursor-devel \
libXdamage-devel \
Expand Down Expand Up @@ -188,17 +190,88 @@ RUN /usr/bin/meson --prefix=${PREFIX} build \
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 \
# Build PipeWire
COPY vendor/pipewire /work/vendor/pipewire
RUN /usr/bin/meson setup /work/vendor/pipewire/build /work/vendor/pipewire \
--prefix=${PREFIX} \
--buildtype=${BUILDTYPE_NODEBUGSTRIP} \
-Ddocs=disabled \
-Dman=disabled \
-Dexamples=disabled \
-Dtests=disabled \
-Dsystemd-system-service=disabled \
-Dsystemd-user-service=disabled \
-Dx11=disabled \
-Dx11-xfixes=disabled \
-Dsession-managers=[] \
-Dpipewire-jack=enabled \
-Dpipewire-v4l2=enabled \
-Dlibpulse=disabled \
-Dbluez5=disabled \
-Dffmpeg=disabled \
-Dgsettings=disabled \
-Davahi=disabled \
-Dsnap=disabled \
-Drlimits-install=false \
-Dgstreamer=disabled \
-Dgstreamer-device-provider=disabled \
-Dlv2=disabled \
-Droc=disabled \
-Dspa-plugins=enabled && \
ninja -C /work/vendor/pipewire/build -j8 install && \
echo 'pipewire:' `git --git-dir=/work/vendor/pipewire/.git rev-parse --verify HEAD` >> /work/versions.txt

# Build WSLg PipeWire RDP modules
COPY config/pipewire-rdp-module.c /work/vendor/pipewire/src/modules/module-wslg-rdp.c
COPY config/pipewire-wslg-rdp.patch /work/vendor/pipewire/pipewire-wslg-rdp.patch
RUN cd /work/vendor/pipewire && \
git apply pipewire-wslg-rdp.patch && \
/usr/bin/meson setup /work/vendor/pipewire/build-wslg /work/vendor/pipewire \
--prefix=${PREFIX} \
--buildtype=${BUILDTYPE_NODEBUGSTRIP} \
-Ddatabase=simple \
-Ddoxygen=false \
-Ddocs=disabled \
-Dman=disabled \
-Dexamples=disabled \
-Dtests=disabled \
-Dsystemd-system-service=disabled \
-Dsystemd-user-service=disabled \
-Dsession-managers=[] \
-Dpipewire-jack=enabled \
-Dpipewire-v4l2=enabled \
-Dpipewire-alsa=enabled \
-Dlibpulse=disabled \
-Dbluez5=disabled \
-Dffmpeg=disabled \
-Dgsettings=disabled \
-Dtests=false && \
-Davahi=disabled \
-Dsnap=disabled \
-Drlimits-install=false \
-Dgstreamer=disabled \
-Dgstreamer-device-provider=disabled \
-Dlv2=disabled \
-Droc=disabled \
-Dspa-plugins=enabled && \
ninja -C /work/vendor/pipewire/build-wslg -j8 pipewire-module-wslg-rdp-sink pipewire-module-wslg-rdp-source && \
install -m 0755 /work/vendor/pipewire/build-wslg/src/modules/pipewire-module-wslg-rdp-sink.so ${DESTDIR}${PREFIX}/lib/pipewire-0.3/pipewire-module-wslg-rdp-sink.so && \
install -m 0755 /work/vendor/pipewire/build-wslg/src/modules/pipewire-module-wslg-rdp-source.so ${DESTDIR}${PREFIX}/lib/pipewire-0.3/pipewire-module-wslg-rdp-source.so


# Build WirePlumber
COPY vendor/wireplumber /work/vendor/wireplumber
WORKDIR /work/vendor/wireplumber
RUN /usr/bin/meson --prefix=${PREFIX} build \
--buildtype=${BUILDTYPE_NODEBUGSTRIP} \
-Ddoc=disabled \
-Dtests=false \
-Dsystemd=disabled \
-Dsystemd-user-service=false \
-Dsystemd-system-service=false \
-Dintrospection=disabled \
-Ddaemon=true \
-Dtools=false \
-Dmodules=true && \
ninja -C build -j8 install && \
echo 'pulseaudio:' `git --git-dir=/work/vendor/pulseaudio/.git rev-parse --verify HEAD` >> /work/versions.txt
echo 'wireplumber:' `git --git-dir=/work/vendor/wireplumber/.git rev-parse --verify HEAD` >> /work/versions.txt

# Build FreeRDP
COPY vendor/FreeRDP /work/vendor/FreeRDP
Expand Down Expand Up @@ -337,6 +410,7 @@ RUN echo "== Install Core/UI Runtime Dependencies ==" && \
libpng \
librsvg2 \
libsndfile \
lua \
libwayland-client \
libwayland-server \
libwayland-cursor \
Expand Down Expand Up @@ -428,17 +502,20 @@ COPY resources/linux.png /usr/share/icons/wsl/linux.png
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/
# Append WSLg settings to PipeWire.
COPY config/pipewire.conf /etc/pipewire/pipewire.conf
COPY config/pipewire-pulse.conf /etc/pipewire/pipewire-pulse.conf

# Copy the licensing information for PipeWire
COPY --from=dev /work/vendor/pipewire/COPYING \
/work/vendor/pipewire/LICENSE \
/work/vendor/pipewire/NEWS \
/work/vendor/pipewire/README.md /usr/share/doc/pipewire/

# Copy the licensing information for WirePlumber
COPY --from=dev /work/vendor/wireplumber/LICENSE \
/work/vendor/wireplumber/NEWS.rst \
/work/vendor/wireplumber/README.rst /usr/share/doc/wireplumber/

# Copy the licensing information for Weston
COPY --from=dev /work/vendor/weston/COPYING /usr/share/doc/weston/COPYING
Expand Down
Loading