## 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/ ``` At this point you are done building Proton from source code. Now restart Steam, then go to ``Steam -> Settings -> Steam Play`` and pick your ``Proton 3.16 My`` from the compatibility tool list. This will restart Steam once more. ## 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 ``` ## Sanity checks - check there are no 64-bit libs under ``dist/dist/lib/`` nor 32-bit libs under ``dist/dist/lib64/``. This can happen when having issues with the Makefiles, e.g. unset ``FFMPEG_CROSS_LDFLAGS := -m32`` in ``build/makefile_base.mak`` if building ``--with-ffmpeg``: ``` find dist/dist/lib/ -xdev -type f -exec sh -c "file '{}' | grep -vE 'ASCII|MS-DOS executable|PE32 executable|ELF 32-bit'" \; find dist/dist/lib64/ -xdev -type f -exec sh -c "file '{}' | grep -vE 'ASCII|MS-DOS executable|PE32\+ executable|ELF 64-bit'" \; ``` - check ffmpeg (if built with ``--with-ffmpeg``) ``` ls -la dist/dist/lib{,64}/lib{avcodec,avutil,swresample}* ``` - check xaudio2 (FAudio) ``` ls -la dist/dist/lib{,64}/libFAudio.so ls -la dist/dist/lib{,64}/wine/x3daudio1_{0..7}.dll.so ls -la dist/dist/lib{,64}/wine/xactengine3_{0..7}.dll.so ls -la dist/dist/lib{,64}/wine/xapofx1_{1..5}.dll.so ls -la dist/dist/lib{,64}/wine/xaudio2_{0..9}.dll.so ``` > If ``xactengine3`` is missing then apply https://github.com/ValveSoftware/wine/commit/e0e3165c15, https://github.com/ValveSoftware/wine/commit/967f095438 - check DXVK ``` ls -la dist/dist/lib{,64}/wine/dxvk/*dll ``` - check lsteamclient ``` ls -la dist/dist/lib{,64}/wine/lsteamclient.dll.so ``` - check vrclient ``` ls -la dist/dist/{lib/wine/vrclient.dll.so,lib64/wine/vrclient_x64.dll.so} ls -la dist/dist/{lib/wine/fakedlls/vrclient.dll,lib64/wine/fakedlls/vrclient_x64.dll} ``` ## 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 so no action is required from your side. ``` 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 ```