From d68e71bed61c822e2e3ecde481d718b9d0213d52 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 24 Jun 2019 09:32:26 -0500 Subject: [PATCH] Build wine with dxvk cross-compiler WARNING: Do not look directly into the build system without eye protection. --- Makefile | 7 ++++++- build/makefile_base.mak | 9 ++++++--- configure.sh | 10 ++++++++++ steamrt-bootstrap.sh | 3 ++- vagrant-user-setup.sh | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f0017310..eafebc18 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,12 @@ else endif -CONFIGURE_CMD := ../proton/configure.sh --steam-runtime64=docker:steam-proton-dev --steam-runtime32=docker:steam-proton-dev32 --steam-runtime="$$HOME"/steam-runtime/runtime/ --build-name="$(_build_name)" --dxvk-crosscc-prefix=\"schroot\",\"-c\",\"dxvk_crosscc\",\"--\" +CONFIGURE_CMD := ../proton/configure.sh \ + --steam-runtime64=docker:steam-proton-dev --steam-runtime32=docker:steam-proton-dev32 \ + --steam-runtime="$$HOME"/steam-runtime/runtime/ \ + --build-name="$(_build_name)" \ + --dxvk-crosscc-prefix=\"schroot\",\"-c\",\"dxvk_crosscc\",\"--\" \ + --docker-opts=-v\ /srv/chroot:/srv/chroot\ -v\ /etc/schroot/chroot.d/dxvk_crosscc:/etc/schroot/chroot.d/dxvk_crosscc\ -v\ /home/vagrant/rbind_fstab:/etc/schroot/default/fstab # make doesn't handle spaces well... replace them with underscores in paths BUILD_DIR := "build-$(shell echo $(_build_name) | sed -e 's/ /_/g')" diff --git a/build/makefile_base.mak b/build/makefile_base.mak index 88cc5601..f4c68fa1 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -58,9 +58,12 @@ cc-option = $(shell if test -z "`echo 'void*p=1;' | \ then echo "$(2)"; else echo "$(3)"; fi ;) # Selected container mode shell -DOCKER_SHELL_BASE = docker run --rm --init -v $(HOME):$(HOME) -w $(CURDIR) -e HOME=$(HOME) \ - -v /etc/passwd:/etc/passwd:ro -u $(shell id -u):$(shell id -g) -h $(shell hostname) \ - -v /tmp:/tmp $(SELECT_DOCKER_IMAGE) /dev/init -sg -- /bin/bash +DOCKER_SHELL_BASE = docker run --rm --init --privileged --cap-add=SYS_ADMIN --security-opt apparmor:unconfined \ + -v $(HOME):$(HOME) -v /tmp:/tmp \ + -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v /etc/shadow:/etc/shadow:ro \ + -w $(CURDIR) -e HOME=$(HOME) -e PATH=$(PATH) -u $(shell id -u):$(shell id -g) -h $(shell hostname) \ + $(DOCKER_OPTS) \ + $(SELECT_DOCKER_IMAGE) /dev/init -sg -- /bin/bash # If STEAMRT64_MODE/STEAMRT32_MODE is set, set the nested SELECT_DOCKER_IMAGE to the _IMAGE variable and eval # DOCKER_SHELL_BASE with it to create the CONTAINER_SHELL setting. diff --git a/configure.sh b/configure.sh index aa1a8276..ff816f10 100755 --- a/configure.sh +++ b/configure.sh @@ -115,6 +115,10 @@ function configure() { echo "DXVK_CROSSCC_PREFIX := $(escape_for_make "$arg_crosscc_prefix")," #comma is not a typo fi + if [[ -n "$arg_docker_opts" ]]; then + echo "DOCKER_OPTS := $arg_docker_opts" + fi + # Include base echo "" echo "include \$(SRCDIR)/build/makefile_base.mak" @@ -135,6 +139,7 @@ arg_no_steamrt="" arg_ffmpeg="" arg_build_name="" arg_crosscc_prefix="" +arg_docker_opts="" arg_help="" invalid_args="" function parse_args() { @@ -174,6 +179,9 @@ function parse_args() { elif [[ $arg = --dxvk-crosscc-prefix ]]; then arg_crosscc_prefix="$val" val_used=1 + elif [[ $arg = --docker-opts ]]; then + arg_docker_opts="$val" + val_used=1 elif [[ $arg = --with-ffmpeg ]]; then arg_ffmpeg=1 elif [[ $arg = --steam-runtime32 ]]; then @@ -236,6 +244,8 @@ usage() { "$1" " the cross-compiler that builds DXVK. E.g:" "$1" " --dxvk-crosscc-prefix=\"schroot\",\"-c\",\"some_chroot\",\"--\"" "$1" "" + "$1" " --docker-opts='' Extra options to pass to Docker when invoking the runtime." + "$1" "" "$1" " Steam Runtime" "$1" " Proton builds that are to be installed & run under the steam client must be built with" "$1" " the Steam Runtime SDK to ensure compatibility. See README.md for more information." diff --git a/steamrt-bootstrap.sh b/steamrt-bootstrap.sh index 15298547..fd7f61c5 100755 --- a/steamrt-bootstrap.sh +++ b/steamrt-bootstrap.sh @@ -14,7 +14,8 @@ set -xe apt-get install -y gcc-5 g++-5 g++-5-multilib flex libosmesa6-dev libpcap-dev \ libhal-dev libsane-dev libv4l-dev libgphoto2-2-dev libcapi20-dev \ - libgsm1-dev libmpg123-dev libvulkan-dev libxslt1-dev nasm yasm ccache + libgsm1-dev libmpg123-dev libvulkan-dev libxslt1-dev nasm yasm ccache \ + schroot update-alternatives --install "$(command -v gcc)" gcc "$(command -v gcc-5)" 50 update-alternatives --set gcc "$(command -v gcc-5)" update-alternatives --install "$(command -v g++)" g++ "$(command -v g++-5)" 50 diff --git a/vagrant-user-setup.sh b/vagrant-user-setup.sh index b759ab5f..9ebde23d 100755 --- a/vagrant-user-setup.sh +++ b/vagrant-user-setup.sh @@ -7,3 +7,39 @@ if [ ! -e "$HOME/steam-runtime" ]; then ./steam-runtime/setup_docker.sh i386 --extra-bootstrap=/home/vagrant/proton/steamrt-bootstrap.sh steam-proton-dev32 (cd steam-runtime && ./build-runtime.py --output=./runtime/) fi + +if [ ! -e "$HOME/bin/schroot_wrapper" ]; then + #create schroot wrapper scripts, for winebuild and winegcc to find in PATH + mkdir -p $HOME/bin/ + cat > $HOME/bin/schroot_wrapper < /home/vagrant/rbind_fstab << EOF +/proc /proc none rw,bind 0 0 +/sys /sys none rw,bind 0 0 +/dev /dev none rw,bind 0 0 +/dev/pts /dev/pts none rw,bind 0 0 +/home /home none rw,rbind 0 0 +/tmp /tmp none rw,rbind 0 0 +EOF +fi