-
-
Save Saancreed/25a42fccf8329ff05b66f8c5261ac836 to your computer and use it in GitHub Desktop.
vkd3d-standalone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkgname=vkd3d-standalone | |
pkgver=r2656.1ce14c2e | |
pkgrel=1 | |
pkgdesc='A fork of VKD3D, which aims to implement the full Direct3D 12 API on top of Vulkan in Proton' | |
arch=('x86_64') | |
url='https://github.com/HansKristian-Work/vkd3d-proton' | |
license=('LGPL2.1') | |
makedepends=('git' 'glslang' 'meson' 'mingw-w64-gcc' 'mingw-w64-tools' 'ninja') | |
options=('!buildflags') | |
source=("git+https://github.com/HansKristian-Work/vkd3d-proton.git${_commit:+#commit=${_commit}}" | |
'git+https://github.com/HansKristian-Work/dxil-spirv.git' | |
'git+https://github.com/KhronosGroup/SPIRV-Headers.git' | |
'git+https://github.com/KhronosGroup/Vulkan-Headers.git' | |
'setup_vkd3d.sh') | |
sha512sums=("${source[@]/*/SKIP}") | |
prepare() | |
{ | |
cd "${srcdir}/vkd3d-proton" | |
git submodule init | |
for _submodule in dxil-spirv SPIRV-Headers Vulkan-Headers | |
do | |
git config "submodule.subprojects/${_submodule}.path" "${srcdir}/${_submodule}" | |
done | |
git submodule update --init --recursive | |
} | |
pkgver() | |
{ | |
cd "${srcdir}/vkd3d-proton" | |
printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" | |
} | |
build() | |
{ | |
cd "${srcdir}/vkd3d-proton" | |
meson setup ../build-win64 \ | |
--cross-file ./build-win64.txt \ | |
--buildtype release \ | |
--prefix /usr \ | |
--bindir share/vkd3d/x64 \ | |
--strip \ | |
-D enable_standalone_d3d12=true | |
ninja -C ../build-win64 | |
meson setup ../build-win32 \ | |
--cross-file ./build-win32.txt \ | |
--buildtype release \ | |
--prefix /usr \ | |
--bindir share/vkd3d/x32 \ | |
--strip \ | |
-D enable_standalone_d3d12=true | |
ninja -C ../build-win32 | |
} | |
package() | |
{ | |
depends=('lib32-vulkan-icd-loader' 'vulkan-icd-loader' 'wine') | |
DESTDIR="${pkgdir}" ninja -C "${srcdir}/build-win32" install | |
DESTDIR="${pkgdir}" ninja -C "${srcdir}/build-win64" install | |
rm -rf "${pkgdir}/usr/lib" "${pkgdir}"/usr/share/vkd3d/x{32,64}/libvkd3d-utils.dll | |
install "${srcdir}/setup_vkd3d.sh" "${pkgdir}/usr/share/vkd3d/setup_vkd3d.sh" | |
install -d "${pkgdir}/usr/bin" | |
ln -s /usr/share/vkd3d/setup_vkd3d.sh "${pkgdir}/usr/bin/setup_vkd3d" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# default directories | |
vkd3d_lib32=${vkd3d_lib32:-"x32"} | |
vkd3d_lib64=${vkd3d_lib64:-"x64"} | |
# figure out where we are | |
basedir=$(dirname "$(readlink -f $0)") | |
# figure out which action to perform | |
action="$1" | |
case "$action" in | |
install) | |
;; | |
uninstall) | |
;; | |
*) | |
echo "Unrecognized action: $action" | |
echo "Usage: $0 [install|uninstall] [--symlink]" | |
exit 1 | |
esac | |
# process arguments | |
shift | |
file_cmd="cp -v" | |
while (($# > 0)); do | |
case "$1" in | |
"--symlink") | |
file_cmd="ln -s -v" | |
;; | |
esac | |
shift | |
done | |
# check wine prefix before invoking wine, so that we | |
# don't accidentally create one if the user screws up | |
if [ -n "$WINEPREFIX" ] && ! [ -f "$WINEPREFIX/system.reg" ]; then | |
echo "$WINEPREFIX:"' Not a valid wine prefix.' >&2 | |
exit 1 | |
fi | |
# find wine executable | |
export WINEDEBUG=-all | |
wine="wine" | |
wine64="wine64" | |
wineboot="wineboot" | |
# $PATH is the way for user to control where wine is located (including custom Wine versions). | |
# Pure 64-bit Wine (non Wow64) requries skipping 32-bit steps. | |
# In such case, wine64 and winebooot will be present, but wine binary will be missing, | |
# however it can be present in other PATHs, so it shouldn't be used, to avoid versions mixing. | |
wine_path=$(dirname "$(which $wineboot)") | |
wow64=true | |
if ! [ -f "$wine_path/$wine" ]; then | |
wine=$wine64 | |
wow64=false | |
fi | |
# resolve 32-bit and 64-bit system32 path | |
winever=$($wine --version | grep wine) | |
if [ -z "$winever" ]; then | |
echo "$wine:"' Not a wine executable. Check your $wine.' >&2 | |
exit 1 | |
fi | |
# ensure wine placeholder dlls are recreated | |
# if they are missing | |
$wineboot -u | |
win64_sys_path=$($wine64 winepath -u 'C:\windows\system32' 2> /dev/null) | |
win64_sys_path="${win64_sys_path/$'\r'/}" | |
if $wow64; then | |
win32_sys_path=$($wine winepath -u 'C:\windows\system32' 2> /dev/null) | |
win32_sys_path="${win32_sys_path/$'\r'/}" | |
fi | |
if [ -z "$win32_sys_path" ] && [ -z "$win64_sys_path" ]; then | |
echo 'Failed to resolve C:\windows\system32.' >&2 | |
exit 1 | |
fi | |
# create native dll override | |
overrideDll() { | |
$wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d native /f >/dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
echo -e "Failed to add override for $1" | |
exit 1 | |
fi | |
} | |
# remove dll override | |
restoreDll() { | |
$wine reg delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /f > /dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
echo "Failed to remove override for $1" | |
fi | |
} | |
# copy or link vkd3d dll, back up original file | |
installFile() { | |
dstfile="${1}/${3}.dll" | |
srcfile="${basedir}/${2}/${3}.dll" | |
if [ -f "${srcfile}.so" ]; then | |
srcfile="${srcfile}.so" | |
fi | |
if ! [ -f "${srcfile}" ]; then | |
echo "${srcfile}: File not found. Skipping." >&2 | |
return 1 | |
fi | |
if [ -n "$1" ]; then | |
if [ -f "${dstfile}" ] || [ -h "${dstfile}" ]; then | |
if ! [ -f "${dstfile}.old" ]; then | |
mv -v "${dstfile}" "${dstfile}.old" | |
else | |
rm -v "${dstfile}" | |
fi | |
$file_cmd "${srcfile}" "${dstfile}" | |
else | |
echo "${dstfile}: File not found in wine prefix" >&2 | |
return 1 | |
fi | |
fi | |
return 0 | |
} | |
# remove vkd3d dll, restore original file | |
uninstallFile() { | |
dstfile="${1}/${3}.dll" | |
srcfile="${basedir}/${2}/${3}.dll" | |
if [ -f "${srcfile}.so" ]; then | |
srcfile="${srcfile}.so" | |
fi | |
if ! [ -f "${srcfile}" ]; then | |
echo "${srcfile}: File not found. Skipping." >&2 | |
return 1 | |
fi | |
if ! [ -f "${dstfile}" ] && ! [ -h "${dstfile}" ]; then | |
echo "${dstfile}: File not found. Skipping." >&2 | |
return 1 | |
fi | |
if [ -f "${dstfile}.old" ]; then | |
rm -v "${dstfile}" | |
mv -v "${dstfile}.old" "${dstfile}" | |
return 0 | |
else | |
return 1 | |
fi | |
} | |
install() { | |
installFile "$win64_sys_path" "$vkd3d_lib64" "$1" | |
inst64_ret="$?" | |
inst32_ret=-1 | |
if $wow64; then | |
installFile "$win32_sys_path" "$vkd3d_lib32" "$1" | |
inst32_ret="$?" | |
fi | |
if (( ($inst32_ret == 0) || ($inst64_ret == 0) )); then | |
overrideDll "$1" | |
fi | |
} | |
uninstall() { | |
uninstallFile "$win64_sys_path" "$vkd3d_lib64" "$1" | |
uninst64_ret="$?" | |
uninst32_ret=-1 | |
if $wow64; then | |
uninstallFile "$win32_sys_path" "$vkd3d_lib32" "$1" | |
uninst32_ret="$?" | |
fi | |
if (( ($uninst32_ret == 0) || ($uninst64_ret == 0) )); then | |
restoreDll "$1" | |
fi | |
} | |
$action d3d12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment