From 5c5bfcc81e6d515b545043766d20ec634a09d5c5 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 3 Jun 2019 12:47:31 -0500 Subject: [PATCH] Build dxvk with a special cross-compiler This mingw-w64 build is a more recent compiler and has dwarf2 exceptions enabled. --- Makefile | 4 ++-- Vagrantfile | 25 ++++++++++++++++++------- build/makefile_base.mak | 18 +++++++----------- configure.sh | 12 ++++++++++++ dxvk | 2 +- 5 files changed, 40 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 8b25bc99..afcc58bb 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ 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)" +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\",\"--\" # make doesn't handle spaces well... replace them with underscores in paths BUILD_DIR := "build-$(shell echo $(_build_name) | sed -e 's/ /_/g')" @@ -78,7 +78,7 @@ clean: vagrant vagrant ssh -c 'rm -rf $(BUILD_DIR)/' configure: vagrant - vagrant ssh -c 'if [ ! -e $(BUILD_DIR)/Makefile ]; then mkdir $(BUILD_DIR); (cd $(BUILD_DIR) && $(CONFIGURE_CMD)); fi' + vagrant ssh -c 'if [ ! -e $(BUILD_DIR)/Makefile ]; then mkdir -p $(BUILD_DIR); (cd $(BUILD_DIR) && $(CONFIGURE_CMD)); fi' proton: configure vagrant ssh -c 'make -C $(BUILD_DIR)/ dist' diff --git a/Vagrantfile b/Vagrantfile index 5b183d4e..92f73cdd 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -78,7 +78,7 @@ Vagrant.configure(2) do |config| #install host build-time dependencies apt-get update - apt-get install -y gpgv2 gnupg2 g++ g++-6-multilib mingw-w64 git docker-ce fontforge-nox python-debian + apt-get install -y gpgv2 gnupg2 g++ g++-6-multilib git docker-ce fontforge-nox python-debian schroot apt-get -y -t stretch-backports install meson #winehq-devel is installed to pull in dependencies to run Wine @@ -87,14 +87,25 @@ Vagrant.configure(2) do |config| #remove system Wine installation to ensure no accidental leakage apt-get remove -y winehq-devel - #configure posix mingw-w64 alternative for DXVK - update-alternatives --set x86_64-w64-mingw32-gcc `which x86_64-w64-mingw32-gcc-posix` - update-alternatives --set x86_64-w64-mingw32-g++ `which x86_64-w64-mingw32-g++-posix` - update-alternatives --set i686-w64-mingw32-gcc `which i686-w64-mingw32-gcc-posix` - update-alternatives --set i686-w64-mingw32-g++ `which i686-w64-mingw32-g++-posix` - #allow vagrant user to run docker adduser vagrant docker + + #download build of recent mingw-w64 with dwarf2 exceptions enabled + wget -O /root/dxvk_crosscc.tar.xz 'http://repo.steampowered.com/proton_mingw/proton_mingw-9.1-1.tar.xz' + unxz -T0 /root/dxvk_crosscc.tar.xz + mkdir -p /srv/chroot/dxvk_crosscc/ + tar -xf /root/dxvk_crosscc.tar -C /srv/chroot/dxvk_crosscc/ + + #install dxvk_crosscc schroot + cat > /etc/schroot/chroot.d/dxvk_crosscc < "$(abspath $(DXVK_OBJ64))/proton-build-win64.txt" && \ + sed -e "s|@PROTON_DXVK_CROSSCC_PREFIX@|$(subst ",\\\",$(DXVK_CROSSCC_PREFIX))|" < build-win64.txt > "$(abspath $(DXVK_OBJ64))/proton-build-win64.txt" && \ PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" \ meson --prefix="$(abspath $(DXVK_OBJ64))" --cross-file "$(abspath $(DXVK_OBJ64))/proton-build-win64.txt" --strip --buildtype=release "$(abspath $(DXVK_OBJ64))" # 32-bit configure. Remove coredata file if already configured (due to e.g. makefile changing) -# the sed junk is to work around meson not supporting command line args for --cross-file builds -# we need to pass in wine's header files since the debian9 mingw-w64 is too old for dxvk. +# sed is used to sub in our special cross compiler $(DXVK_CONFIGURE_FILES32): $(MAKEFILE_DEP) $(DXVK)/build-win32.txt | $(DXVK_OBJ32) if [ -e "$(abspath $(DXVK_OBJ32))"/build.ninja ]; then \ rm -f "$(abspath $(DXVK_OBJ32))"/meson-private/coredata.dat; \ fi cd "$(abspath $(DXVK))" && \ - mkdir -p "$(abspath $(DXVK_OBJ32))/new_includes" && \ - cp $(abspath $(TOOLS_DIR32))/include/wine/windows/dxgi*.h "$(abspath $(DXVK_OBJ32))/new_includes" && \ - cd "$(abspath $(DXVK))" && \ - sed -e "s|@PROTON_C_ARGS@|'-I$(abspath $(DXVK_OBJ32))/new_includes'|" < build-win32.txt > "$(abspath $(DXVK_OBJ32))/proton-build-win32.txt" && \ + sed -e "s|@PROTON_DXVK_CROSSCC_PREFIX@|$(subst ",\\\",$(DXVK_CROSSCC_PREFIX))|" < build-win32.txt > "$(abspath $(DXVK_OBJ32))/proton-build-win32.txt" && \ PATH="$(abspath $(SRCDIR))/glslang/bin/:$(PATH)" \ meson --prefix="$(abspath $(DXVK_OBJ32))" --cross-file "$(abspath $(DXVK_OBJ32))/proton-build-win32.txt" --strip --buildtype=release "$(abspath $(DXVK_OBJ32))" diff --git a/configure.sh b/configure.sh index 467cbc81..aa1a8276 100755 --- a/configure.sh +++ b/configure.sh @@ -111,6 +111,10 @@ function configure() { echo "STEAMRT32_IMAGE := $(escape_for_make "$steamrt32_name")" echo "STEAMRT_PATH := $(escape_for_make "$steamrt_path")" + if [[ -n "$arg_crosscc_prefix" ]]; then + echo "DXVK_CROSSCC_PREFIX := $(escape_for_make "$arg_crosscc_prefix")," #comma is not a typo + fi + # Include base echo "" echo "include \$(SRCDIR)/build/makefile_base.mak" @@ -130,6 +134,7 @@ arg_steamrt="" arg_no_steamrt="" arg_ffmpeg="" arg_build_name="" +arg_crosscc_prefix="" arg_help="" invalid_args="" function parse_args() { @@ -166,6 +171,9 @@ function parse_args() { elif [[ $arg = --build-name ]]; then arg_build_name="$val" val_used=1 + elif [[ $arg = --dxvk-crosscc-prefix ]]; then + arg_crosscc_prefix="$val" + val_used=1 elif [[ $arg = --with-ffmpeg ]]; then arg_ffmpeg=1 elif [[ $arg = --steam-runtime32 ]]; then @@ -224,6 +232,10 @@ usage() { "$1" "" "$1" " --with-ffmpeg Build ffmpeg for WMA audio support" "$1" "" + "$1" " --dxvk-crosscc-prefix='' Quoted and comma-separated list of arguments to prefix before" + "$1" " the cross-compiler that builds DXVK. E.g:" + "$1" " --dxvk-crosscc-prefix=\"schroot\",\"-c\",\"some_chroot\",\"--\"" + "$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/dxvk b/dxvk index 9e9f1e79..8ba89c94 160000 --- a/dxvk +++ b/dxvk @@ -1 +1 @@ -Subproject commit 9e9f1e79ba05831ecf14fce1f6ce8ab1cf745018 +Subproject commit 8ba89c94cd3fbc9788e4345aea7d4d69f632cc59