Build wine with dxvk cross-compiler

WARNING: Do not look directly into the build system without eye
protection.
This commit is contained in:
Andrew Eikum 2019-06-24 09:32:26 -05:00
parent ab453aaf11
commit d68e71bed6
5 changed files with 60 additions and 5 deletions

View File

@ -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')"

View File

@ -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.

View File

@ -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='<options>' 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."

View File

@ -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

View File

@ -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 <<EOF
#!/bin/bash
schroot -c dxvk_crosscc -- /usr/bin/\$(basename \$0) \$@
EOF
chmod 755 $HOME/bin/schroot_wrapper
for a in x86_64 i686
do
for f in \
w64-mingw32-ar \
w64-mingw32-as \
w64-mingw32-dlltool \
w64-mingw32-gcc \
w64-mingw32-ld \
w64-mingw32-nm \
w64-mingw32-ranlib \
w64-mingw32-windres
do
ln -s schroot_wrapper $HOME/bin/$a-$f
done
done
# docker mounts /home/vagrant, not /home, so we need rbind instead of bind
# for $HOME to get mounted in the schroot when called from within the docker
cat > /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