first commit

This commit is contained in:
Andy 2019-01-01 17:01:19 +01:00
commit cce8f06fa9
Signed by: arno
GPG Key ID: 9076D5E6B31AE99C
6 changed files with 266 additions and 0 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
data/
data.1/

58
Dockerfile Normal file
View File

@ -0,0 +1,58 @@
FROM ubuntu:bionic
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
# Install 64-bit headers
RUN apt-get -y install libx11-dev libv4l-dev libvulkan-dev libmpg123-dev libgsm1-dev libgphoto2-dev libsane-dev libosmesa6-dev libpcap-dev libfontconfig1-dev libfreetype6-dev libxcursor-dev libxi-dev libxxf86vm-dev libxrandr-dev libxfixes-dev libxinerama-dev libxcomposite-dev libglu1-mesa-dev ocl-icd-opencl-dev libdbus-1-dev liblcms2-dev libpulse-dev libudev-dev libkrb5-dev libopenal-dev libldap2-dev libgettextpo-dev libjpeg-dev libcapi20-dev libtiff5-dev \
libcups2-dev libgnutls28-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsdl2-dev libxml2-dev libxslt1-dev oss4-dev
# Install 32-bit headers
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get -y install libx11-dev:i386 libv4l-dev:i386 libvulkan-dev:i386 libmpg123-dev:i386 libgsm1-dev:i386 libgphoto2-dev:i386 libsane-dev:i386 libosmesa6-dev:i386 libpcap-dev:i386 libfontconfig1-dev:i386 libfreetype6-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libxxf86vm-dev:i386 libxrandr-dev:i386 libxfixes-dev:i386 libxinerama-dev:i386 libxcomposite-dev:i386 libglu1-mesa-dev:i386 ocl-icd-opencl-dev:i386 libdbus-1-dev:i386 liblcms2-dev:i386 libpulse-dev:i386 libudev-dev:i386 libkrb5-dev:i386 libopenal-dev:i386 libldap2-dev:i386 libgettextpo-dev:i386 libjpeg-dev:i386 libcapi20-dev:i386 libtiff5-dev:i386
# Ubuntu Bionic has conflicts when installing these 32-bit dev headers along with the 64-bit ones:
# # apt-get -y install libcups2-dev:i386 libgnutls28-dev:i386 libgstreamer1.0-dev:i386 libgstreamer-plugins-base1.0-dev:i386 libsdl2-dev:i386 libxml2-dev:i386 libxslt1-dev:i386
# As a remedy, just extract the conflicting 32-bit dev headers to i386 directory (it won't do any harm).
RUN mkdir /tmp/sub; cd /tmp/sub && \
apt-get download libcups2-dev:i386 libgnutls28-dev:i386 libgstreamer-plugins-base1.0-dev:i386 libgstreamer1.0-dev:i386 libsdl2-dev:i386 libxml2-dev:i386 libxslt1-dev:i386 && \
for i in $(ls *deb); do echo "Extracting $i ..."; dpkg -x $i . ; done && \
cp -rv usr/lib/i386-linux-gnu /usr/lib/ && \
cp -rv usr/include/i386-linux-gnu /usr/include/ && \
rm -rf -- /tmp/sub
# Install common build deps
RUN apt-get install -y \
gcc-8 g++-8 g++-8-multilib flex bison nasm yasm fontforge-nox \
meson mingw-w64 ccache \
libxslt1.1 libxslt1.1:i386 \
libcups2 libcups2:i386 \
libsdl2-2.0-0 libsdl2-2.0-0:i386
# Install vkd3d (Direct3D 12 support) build deps
RUN echo 'APT::Default-Release "bionic";' | tee /etc/apt/apt.conf.d/01lock-release && \
echo 'deb http://archive.ubuntu.com/ubuntu/ disco main universe' | tee /etc/apt/sources.list.d/disco.list && \
apt-get update && \
apt-get -y -t disco install libvkd3d-dev libvkd3d-dev:i386
# Install misc
RUN apt-get -y install gosu less vim binutils git
# Configure gcc/g++ and POSIX mingw-w64 alternative for DXVK
RUN update-alternatives --install "$(command -v gcc)" gcc "$(command -v gcc-8)" 50 && \
update-alternatives --set gcc "$(command -v gcc-8)" && \
update-alternatives --install "$(command -v g++)" g++ "$(command -v g++-8)" 50 && \
update-alternatives --set g++ "$(command -v g++-8)" && \
update-alternatives --install "$(command -v cpp)" cpp-bin "$(command -v cpp-8)" 50 && \
update-alternatives --set cpp-bin "$(command -v cpp-8)" && \
sed -i 's/-gcc-7.2-/-gcc-7.3-/g' /var/lib/dpkg/alternatives/x86_64-w64-mingw32-gcc && \
update-alternatives --set x86_64-w64-mingw32-gcc $(command -v x86_64-w64-mingw32-gcc-posix) && \
update-alternatives --set x86_64-w64-mingw32-g++ $(command -v x86_64-w64-mingw32-g++-posix) && \
sed -i 's/-gcc-7.2-/-gcc-7.3-/g' /var/lib/dpkg/alternatives/i686-w64-mingw32-gcc && \
update-alternatives --set i686-w64-mingw32-gcc $(command -v i686-w64-mingw32-gcc-posix) && \
update-alternatives --set i686-w64-mingw32-g++ $(command -v i686-w64-mingw32-g++-posix)
COPY ./launch /launch
ENTRYPOINT [ "/bin/bash", "/launch" ]
LABEL maintainer="Andrey Arapov <andrey.arapov@nixaid.com>"

158
README.md Normal file
View File

@ -0,0 +1,158 @@
## Build Proton in Docker
This image has all necessary dependencies for building the [Proton](https://github.com/ValveSoftware/Proton).
Difference from official way of building Proton:
- does not use VM;
- does not rely on Steam runtime;
- preconfigures ccache (incl. mingw32) to speed up the recompilation time;
## 1. Build this image and spawn in it
```
docker-compose build
docker-compose run --rm proton
```
## 2. Clone the Proton repository
```
git clone -b proton_3.16 https://github.com/ValveSoftware/Proton.git proton
cd proton/
git submodule update --init
```
## 3. Configure your build environment
According to [this](https://github.com/FNA-XNA/FAudio/wiki/FAudio-for-Proton#part-1-building-faudio) FFMPEG is needed only for the WMA support in FAudio.
I will not build ``--with-ffmpeg`` in this example as it requires more changes.
```
./configure.sh --no-steam-runtime --build-name "Proton 3.16 My"
export NO_NESTED_MAKE=1
export SUBMAKE_JOBS=$(getconf _NPROCESSORS_ONLN)
```
## 4. Configure and build the Proton
See what are the default targets should you like to make them one-by-one instead of all at once:
```
$ make help
Default targets (make all): faudio lsteamclient vrclient dxvk dist wine fonts
```
I prefer to build them one-by-one arch-by-arch since ``make all`` is trying to build ``lsteamclient`` and ``vrclient`` targets before building ``wine`` whilst both targets having ``wine`` as a build dependency. You can see it in ``build/makefile_base.mak`` file.
My preferred make order:
```
make -j$(getconf _NPROCESSORS_ONLN) cmake32
make -j$(getconf _NPROCESSORS_ONLN) cmake64
make -j$(getconf _NPROCESSORS_ONLN) faudio32
make -j$(getconf _NPROCESSORS_ONLN) faudio64
make -j$(getconf _NPROCESSORS_ONLN) wine32
make -j$(getconf _NPROCESSORS_ONLN) wine64
make -j$(getconf _NPROCESSORS_ONLN) dxvk
make -j$(getconf _NPROCESSORS_ONLN) lsteamclient32
make -j$(getconf _NPROCESSORS_ONLN) lsteamclient64
make -j$(getconf _NPROCESSORS_ONLN) vrclient32
make -j$(getconf _NPROCESSORS_ONLN) vrclient64
make -j$(getconf _NPROCESSORS_ONLN) dist
make -j$(getconf _NPROCESSORS_ONLN) fonts
```
After this you will get the result under ``./dist`` directory.
This is the Proton you have just built.
> Hints
> You can run ``make obj-wine32/Makefile`` and look in ``obj-wine32/config.log`` to see what is missing.
> ``DISABLED_SUBDIRS`` should be empty, otherwise you are going to miss some DLLs.
>
> If you updated the dev dependencies or ``wine/`` submodule repo and do not want wasting time recompiling the whole wine subrepo again, you can re-create Makefile ``rm obj-wine32/Makefile; make obj-wine32/Makefile``, so next time you run ``make wine32`` it will recompile only what is needed. The same applies to wine64.
## 5. Final steps
(Optional) You can archive your dist directory the same way Valve does:
```
$ tar -C ./dist/dist -c . | gzip -c -1 > ./dist/proton_dist.tar.gz
```
Copy your freshly built Proton to your Steam directory ``~/.local/share/Steam/compatibilitytools.d/``.
> Since I am running [Steam in a docker](https://git.nixaid.com/arno/steam) it has a custom home path ``~/git/steam/data``.
> This repo I have at ``~/git/proton`` directory.
```
$ mkdir -p ~/git/steam/data/.local/share/Steam/compatibilitytools.d
$ rsync -avx --progress ~/git/proton/data/proton/dist/ ~/git/steam/data/.local/share/Steam/compatibilitytools.d/proton-316-my/
```
You are done at this point.
Now you can go ``Steam -> Settings -> Steam Play`` and pick your ``Proton 3.16 My``
from the compatibility tool list.
## Links
- https://github.com/ValveSoftware/Proton/
----
# Extra
## Tested on Proton 3.16
- [proton_3.16 branch](https://github.com/ValveSoftware/Proton/tree/proton_3.16/)
```
$ grep ^ .git/modules/*/HEAD .git/HEAD
.git/modules/FAudio/HEAD:10ee03e10d5abc0aca8661a098b481cb6f746c1d
.git/modules/cmake/HEAD:c4ab098097f4fe1bc85ee29c6de390dff435f63f
.git/modules/dxvk/HEAD:3b3ccc8194733e20ce7e2a54edcf54fe4a2b9785
.git/modules/ffmpeg/HEAD:ace829cb45cff530b8a0aed6adf18f329d7a98f6
.git/modules/openal-soft/HEAD:ce6076091bac3c00cd10803916e8911495580bd0
.git/modules/openvr/HEAD:1fb1030f2ac238456dca7615a4408fb2bb42afb6
.git/modules/wine/HEAD:478f3c4a2cdb181c31af19a9031e5c3c6daad2f2
.git/HEAD:ref: refs/heads/proton_3.16
```
## Ccache
ccache is a compiler cache. It speeds up recompilation by caching previous
compilations and detecting when the same compilation is being done again.
> It is already installed in this docker image.
```
apt-get install ccache
/usr/sbin/update-ccache-symlinks
echo 'export PATH="/usr/lib/ccache:$PATH"' | tee /home/user/.profile
```
No limit to the number of files and size of the cache:
```
ccache -F 0
ccache -M 0
```
Stats:
```
ccache -s
```
Empty the cache and reset the stats:
```
ccache -C -z
```

2
data/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

22
docker-compose.yml Normal file
View File

@ -0,0 +1,22 @@
version: '3.7'
services:
proton:
init: true
# tty: true
# stdin_open: true
hostname: proton
network_mode: bridge
# image: andrey01/wine
build: .
shm_size: 4G
environment:
- UID=1000
volumes:
- /etc/localtime:/etc/localtime:ro
- ./data:/home/user
# security_opt:
# - apparmor=unconfined
# cap_add:
# - SYS_PTRACE
# - ALL

24
launch Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
#set -x
# Make errors visible upon `docker logs -f steam` command
exec 2>&1
id user >/dev/null 2>&1
[ $? -eq 0 ] || useradd -s /bin/bash -d /home/user -u ${USER_ID:-1000} user
/usr/sbin/update-ccache-symlinks
echo 'export PATH="/usr/lib/ccache:$PATH"
LC_ALL=C.UTF-8
LANG=C.UTF-8
export LC_ALL LANG' | tee /home/user/.profile
[ -f /home/user/.gitconfig ] || gosu user sh -c 'git config --global user.name "user in docker"; git config --global user.email "user@docker"'
# Set unlimited number of files and size of the cache:
gosu user sh -c 'ccache -F 0; ccache -M 0'
echo 'WARNING: allowing a user escalate to root'
chmod +s /usr/sbin/gosu
cd /home/user
gosu user bash -l