Build dxvk with a special cross-compiler

This mingw-w64 build is a more recent compiler and has dwarf2 exceptions
enabled.
This commit is contained in:
Andrew Eikum 2019-06-03 12:47:31 -05:00
parent 434046797c
commit 5c5bfcc81e
5 changed files with 40 additions and 21 deletions

View File

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

25
Vagrantfile vendored
View File

@ -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 <<EOF
[dxvk_crosscc]
description=Special mingw-w64 for building DXVK
type=directory
directory=/srv/chroot/dxvk_crosscc/
users=vagrant
personality=linux
preserve-environment=true
EOF
SHELL
config.vm.provision "shell", privileged: "true", inline: <<-SHELL

View File

@ -32,6 +32,9 @@ else # (Rest of the file is the else)
# STEAMRT32_MODE - Same as above for 32-bit container (can be different type)
# STEAMRT32_IMAGE - Same as above for 32-bit container
# STEAMRT_PATH - Path to built runtime which contains run.sh
# DXVK_CROSSCC_PREFIX - Quoted and comma-separated list of strings that
# should be prefixed before the cross compiler that builds DXVK, so
# we can execute it when it lives in a chroot, for example.
ifeq ($(SRCDIR),)
foo := $(error SRCDIR not set, do not include makefile_base directly, run ./configure.sh to generate Makefile)
@ -977,31 +980,24 @@ DXVK_CONFIGURE_FILES32 := $(DXVK_OBJ32)/build.ninja
DXVK_CONFIGURE_FILES64 := $(DXVK_OBJ64)/build.ninja
# 64bit-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_FILES64): $(MAKEFILE_DEP) $(DXVK)/build-win64.txt | $(DXVK_OBJ64)
if [ -e "$(abspath $(DXVK_OBJ64))"/build.ninja ]; then \
rm -f "$(abspath $(DXVK_OBJ64))"/meson-private/coredata.dat; \
fi
mkdir -p "$(abspath $(DXVK_OBJ64))/new_includes" && \
cp $(abspath $(TOOLS_DIR64))/include/wine/windows/dxgi*.h "$(abspath $(DXVK_OBJ64))/new_includes" && \
cd "$(abspath $(DXVK))" && \
sed -e "s|@PROTON_C_ARGS@|'-I$(abspath $(DXVK_OBJ64))/new_includes'|" < build-win64.txt > "$(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))"

View File

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

2
dxvk

@ -1 +1 @@
Subproject commit 9e9f1e79ba05831ecf14fce1f6ce8ab1cf745018
Subproject commit 8ba89c94cd3fbc9788e4345aea7d4d69f632cc59