Browse Source

[Arch] Add DXVK NVAPI package (Nvidia NVAPI)

master
Pekka Helenius 2 years ago
parent
commit
b7d61a2e0c
5 changed files with 348 additions and 18 deletions
  1. +112
    -0
      arch/0-dxvk-nvapi-git/PKGBUILD
  2. +201
    -0
      arch/0-dxvk-nvapi-git/setup_dxvk_nvapi.sh
  3. +4
    -0
      dxvk-nvapi_custom_patches/put_your_dxvk-nvapi_patches_here
  4. +5
    -0
      options.conf
  5. +26
    -18
      updatewine.sh

+ 112
- 0
arch/0-dxvk-nvapi-git/PKGBUILD View File

@ -0,0 +1,112 @@
# Maintainer: Pekka Helenius (~Fincer) <fincer89 at hotmail dot com>
# Override /etc/makepkg.conf PKGDEST variable if it's enabled
PKGDEST="${PWD}"
pkgname=dxvk-nvapi-git
_pkgname=dxvk-nvapi
pkgver=580.6268
pkgrel=1
pkgdesc="Alternative NVAPI implementation on top of DXVK."
url="https://github.com/jp7677/dxvk-nvapi"
license=('MIT')
arch=('x86_64')
conflicts=(
'dxvk-nvapi'
)
depends=('dxvk' 'wine' 'vulkan-icd-loader' 'lib32-vulkan-icd-loader')
makedepends=(
'ninja'
'meson>=0.49'
'glslang'
'mingw-w64-gcc'
'git'
'wine'
'python'
)
_dxvknvapi_gitsrc=
_git_branch_dxvknvapi=master
_dxvknvapi_commit=HEAD
provides=('dxvk-nvapi')
options=(!strip !buildflags staticlibs)
source=(
${pkgname}::"${_dxvknvapi_gitsrc}#commit=${_dxvknvapi_commit}"
'setup_dxvk_nvapi.sh'
)
sha256sums=(
'SKIP'
'e2ff99af4ecb739629e0f873077f986cffcc9418c8ecb7e6040744f05110afbb'
)
##############################
# Copy custom patches to correct location
if [[ $(find "${startdir}/dxvk-nvapi-patches" -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$") ]]; then
cp -r "${startdir}/dxvk-nvapi-patches/"*.{patch,diff} "${startdir}"/
p=0
for patch in $(find . -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$"); do
patches[$p]="$(basename ${patch})"
let p++
done
unset p
source+=(${source[@]} ${patches[@]})
fi
# Reset git tree and apply custom patches
prepare() {
cd "${srcdir}/dxvk-nvapi-git"
git checkout ${_git_branch_dxvknvapi}
git reset --hard ${_dxvknvapi_commit} # Restore tracked files
git clean -d -x -f # Delete untracked files
git submodule update --init --recursive
# Apply patches, if present
if [[ $(ls "${srcdir}"/*.{patch,diff} 2>/dev/null | wc -w) -ne 0 ]]; then
# Apply all custom patches
msg2 "Applying custom patches..."
for i in "${srcdir}"/*.{patch,diff}; do
if [[ -f ${i} ]]; then
patch -Np1 < ${i}
fi
done
fi
}
##############################
# Retrieve DXVK NVAPI version tag
pkgver() {
cd "${pkgname}"
printf '%s.%s' $(git rev-list --count HEAD) $(git rev-parse --short HEAD | sed 's/\-[a-z].*//; s/\-/\./g; s/[a-z]//g')
}
# Launch DXVK NVAPI build script
build() {
cd "${pkgname}"
./package-release.sh ${pkgver} "${srcdir}"/build
}
# Bundle the compiled files
package() {
mkdir -p "${pkgdir}"/usr/{bin,share/dxvk_nvapi}
cp -r "${srcdir}"/build/${_pkgname}-${pkgver}/* "${pkgdir}/usr/share/dxvk_nvapi/"
cp "${srcdir}"/setup_dxvk_nvapi.sh "${pkgdir}/usr/share/dxvk_nvapi/"
echo -e "#!/bin/sh" > "${pkgdir}/usr/bin/setup_dxvk_nvapi"
echo -e "
cd /usr/share/dxvk_nvapi/
./setup_dxvk_nvapi.sh \${@}
" >> "${pkgdir}/usr/bin/setup_dxvk_nvapi"
chmod +x "${pkgdir}/usr/share/dxvk_nvapi/setup_dxvk_nvapi.sh"
chmod +x "${pkgdir}/usr/bin/setup_dxvk_nvapi"
}

+ 201
- 0
arch/0-dxvk-nvapi-git/setup_dxvk_nvapi.sh View File

@ -0,0 +1,201 @@
#!/usr/bin/env bash
# NOTE: This is a modified version of script file
# https://github.com/HansKristian-Work/vkd3d-proton/blob/master/setup_vkd3d_proton.sh
#
# default directories
dxvk_nvapi_lib32=${dxvk_nvapi_lib32:-"x32"}
dxvk_nvapi_lib64=${dxvk_nvapi_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
# disable mscoree and mshtml to avoid downloading
# wine gecko and mono
export WINEDLLOVERRIDES="mscoree,mshtml="
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() {
if ! $wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v "$1" /d native /f >/dev/null 2>&1
then
echo -e "Failed to add override for $1"
exit 1
fi
}
# remove dll override
restoreDll() {
if ! $wine reg delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v "$1" /f > /dev/null 2>&1
then
echo "Failed to remove override for $1"
fi
}
# copy or link nvapi dll, back up original file
installFile() {
dstfile="${1}/${3}.dll"
srcfile="${basedir}/${2}/${3}.dll"
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
else
touch "${dstfile}.old_none"
fi
$file_cmd "${srcfile}" "${dstfile}"
fi
return 0
}
# remove nvapi dll, restore original file
uninstallFile() {
dstfile="${1}/${3}.dll"
srcfile="${basedir}/${2}/${3}.dll"
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
elif [ -f "${dstfile}.old_none" ]; then
rm -v "${dstfile}.old_none"
rm -v "${dstfile}"
return 0
else
return 1
fi
}
install() {
installFile "$win64_sys_path" "$dxvk_nvapi_lib64" "${1}64"
inst64_ret="$?"
inst32_ret=-1
if $wow64; then
installFile "$win32_sys_path" "$dxvk_nvapi_lib32" "$1"
inst32_ret="$?"
fi
if (( (inst32_ret == 0) )); then
overrideDll "$1"
fi
if (( (inst64_ret == 0) )); then
overrideDll "${1}64"
fi
}
uninstall() {
uninstallFile "$win64_sys_path" "$dxvk_nvapi_lib64" "${1}64"
uninst64_ret="$?"
uninst32_ret=-1
if $wow64; then
uninstallFile "$win32_sys_path" "$dxvk_nvapi_lib32" "$1"
uninst32_ret="$?"
fi
if (( (uninst32_ret == 0) )); then
restoreDll "$1"
fi
if (( (uninst64_ret == 0) )); then
restoreDll "${1}64"
fi
}
$action nvapi

+ 4
- 0
dxvk-nvapi_custom_patches/put_your_dxvk-nvapi_patches_here View File

@ -0,0 +1,4 @@
Put your custom DXVK patches here.
Valid file suffix formats are: .diff and .patch
These patches are applied during DXVK compilation

+ 5
- 0
options.conf View File

@ -15,6 +15,7 @@
######### #########
git_source_dxvknvapi="git://github.com/jp7677/dxvk-nvapi.git"
git_source_vkd3dproton="git://github.com/HansKristian-Work/vkd3d-proton.git" git_source_vkd3dproton="git://github.com/HansKristian-Work/vkd3d-proton.git"
git_source_dxvk="git://github.com/doitsujin/dxvk.git" git_source_dxvk="git://github.com/doitsujin/dxvk.git"
git_source_wine="git://source.winehq.org/git/wine.git" git_source_wine="git://source.winehq.org/git/wine.git"
@ -24,6 +25,10 @@ git_source_winestaging="git://github.com/wine-staging/wine-staging.git"
git_commithash_dxvk=HEAD git_commithash_dxvk=HEAD
git_branch_dxvk=master git_branch_dxvk=master
# DXVK NVAPI commits & branches
git_commithash_dxvknvapi=HEAD
git_branch_dxvknvapi=master
# VKD3D commits & branches # VKD3D commits & branches
git_commithash_vkd3dproton=HEAD git_commithash_vkd3dproton=HEAD
git_branch_vkd3dproton=master git_branch_vkd3dproton=master


+ 26
- 18
updatewine.sh View File

@ -149,6 +149,10 @@ for arg in ${@}; do
# Skip VKD3D Proton build & installation process all together # Skip VKD3D Proton build & installation process all together
NO_VKD3D= NO_VKD3D=
;; ;;
--no-nvapi)
# Skip DXVK NVAPI build & installation process all together
NO_NVAPI=
;;
--no-pol) --no-pol)
# Skip PlayOnLinux Wine prefixes update process # Skip PlayOnLinux Wine prefixes update process
;; ;;
@ -160,6 +164,7 @@ Usage:\n\nbash updatewine.sh\n\nArguments:\n\n\
--no-install\tDo not install Wine or DXVK. Just compile them. Wine, meson & glslang must be installed for DXVK compilation.\n\ --no-install\tDo not install Wine or DXVK. Just compile them. Wine, meson & glslang must be installed for DXVK compilation.\n\
--no-dxvk\tDo not compile or install DXVK\n\ --no-dxvk\tDo not compile or install DXVK\n\
--no-vkd3d\tDo not compile or install VKD3D Proton\n\ --no-vkd3d\tDo not compile or install VKD3D Proton\n\
--no-nvapi\tDo not compile or install DXVK NVAPI\n\
--no-pol\tDo not update PlayOnLinux Wine prefixes\n\n\ --no-pol\tDo not update PlayOnLinux Wine prefixes\n\n\
--no-staging\tCompile Wine instead of Wine Staging\n\ --no-staging\tCompile Wine instead of Wine Staging\n\
--no-wine\tDo not compile or install Wine/Wine Staging\n\n\ --no-wine\tDo not compile or install Wine/Wine Staging\n\n\
@ -187,34 +192,37 @@ datesuffix=$(echo $(date '+%Y-%m-%d-%H%M%S'))
# Pass them to subscripts, as well. # Pass them to subscripts, as well.
githash_overrides=( githash_overrides=(
"${git_commithash_vkd3dproton}" # 0
"${git_commithash_dxvk}" # 1
"${git_commithash_glslang}" # 2
"${git_commithash_meson}" # 3
"${git_commithash_wine}" # 4
"${git_commithash_dxvknvapi}" # 0
"${git_commithash_vkd3dproton}" # 1
"${git_commithash_dxvk}" # 2
"${git_commithash_glslang}" # 3
"${git_commithash_meson}" # 4
"${git_commithash_wine}" # 5
) )
# Add git branches to argument list # Add git branches to argument list
# Pass them to subscripts, as well. # Pass them to subscripts, as well.
gitbranch_overrides=( gitbranch_overrides=(
"${git_branch_vkd3dproton}" # 5
"${git_branch_dxvk}" # 6
"${git_branch_glslang}" # 7
"${git_branch_meson}" # 8
"${git_branch_wine}" # 9
"${git_branch_dxvknvapi}" # 6
"${git_branch_vkd3dproton}" # 7
"${git_branch_dxvk}" # 8
"${git_branch_glslang}" # 9
"${git_branch_meson}" # 10
"${git_branch_wine}" # 11
) )
# Add git sources to argument list # Add git sources to argument list
# Pass them to subscripts, as well. # Pass them to subscripts, as well.
gitsources=( gitsources=(
"${git_source_vkd3dproton}" # 10
"${git_source_dxvk}" # 11
"${git_source_glslang}" # 12
"${git_source_meson}" # 13
"${git_source_wine}" # 14
"${git_source_winestaging}" # 15
"${git_source_dxvknvapi}" # 12
"${git_source_vkd3dproton}" # 13
"${git_source_dxvk}" # 14
"${git_source_glslang}" # 15
"${git_source_meson}" # 16
"${git_source_wine}" # 17
"${git_source_winestaging}" # 18
) )
############################# #############################
@ -386,7 +394,7 @@ function determineDistroFamily() {
esac esac
} }
if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]] || [[ ! -v NO_VKD3D ]]; then
if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]] || [[ ! -v NO_VKD3D ]] || [[ ! -v NO_NVAPI ]]; then
echo -e "\n${SCRIPT_TITLE}\n\nBuild identifier:\t${datesuffix}\n" echo -e "\n${SCRIPT_TITLE}\n\nBuild identifier:\t${datesuffix}\n"
else else
echo "" echo ""
@ -403,7 +411,7 @@ echo -e "\e[1mNOTE: \e[0mDXVK requires very latest Nvidia/AMD drivers to work.\n
This script comes with GPU driver installation scripts for Debian-based Linux distributions.\n" This script comes with GPU driver installation scripts for Debian-based Linux distributions.\n"
INFO_SEP INFO_SEP
if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]|| [[ ! -v NO_VKD3D ]]; then
if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]] || [[ ! -v NO_VKD3D ]] || [[ ! -v NO_NVAPI ]]; then
reqsCheck reqsCheck
sudoQuestion sudoQuestion
echo "" echo ""


Loading…
Cancel
Save