Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
For dxvk building on Debian
#!/bin/bash
# Notes:
#
# For Debian build of dxvk. Only builds dll.
#
# Example of building 64-bit and 32-bit variatns:
#
# for bitness in 64 32; do dxvk_bitness=$bitness dxvk_build.sh; done
#
base="${HOME}/build"
dxvk_src="${base}/dxvk/source"
dxvk_bitness=${dxvk_bitness:-64}
dxvk_build="${base}/dxvk/build_${dxvk_bitness}"
dxvk_branch=${dxvk_branch:-"master"}
dest_dir="${HOME}/mnt/vmshare/dxvk-${dxvk_bitness}"
lib_dir="lib${dxvk_bitness}"
cpuarch=${cpuarch:-"znver2"} # Zen 2 by default. Change to your arch or "native" accordingly.
cross_file="build-win${dxvk_bitness}.txt"
function prepare() {
sudo apt install meson mingw-w64 glslang-tools
if (($? != 0)); then
echo "Installation of build tools failed! Aborting."
exit 2
fi
}
function update_sources() {
mkdir -p $(dirname "$dxvk_src")
cd $(dirname "$dxvk_src")
git clone git://github.com/doitsujin/dxvk.git $(basename "$dxvk_src")
cd "$dxvk_src"
git reset --hard HEAD
git clean -df
git checkout master
git pull --rebase --prune
git checkout ${dxvk_branch}
if (($? != 0)); then
echo "Invalid branch or tag ${dxvk_branch}! Aborting"
exit 4
fi
}
function build() {
mkdir -p "$dxvk_build"
rm -rfv ${dxvk_build}/*
cd "$dxvk_src"
export CFLAGS="-march=${cpuarch}"
export CXXFLAGS="-march=${cpuarch}"
meson --cross-file "$cross_file" --buildtype release --prefix "$dest_dir" --libdir "$lib_dir" --bindir "$lib_dir" "$dxvk_build"
cd "$dxvk_build"
ninja
if (($? != 0)); then
echo "Build failed!"
exit 5
fi
}
function publish() {
cd "$dxvk_build"
rm -rfv ${dest_dir}/*
ninja install
}
###################################################
update_sources
prepare
build
publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment