From dc18887dac5fa1a7f48823dcf9310b14dedbab62 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Sun, 30 Oct 2022 10:53:09 +0200 Subject: [PATCH] [Arch] Add VKD3D Proton package (DX12) --- arch/0-vkd3d-proton-git/PKGBUILD | 98 +++++++++++++++++++ arch/updatewine_arch.sh | 68 ++++++++++--- options.conf | 5 + updatewine.sh | 38 ++++--- .../put_your_vkd3d-proton_patches_here | 4 + 5 files changed, 186 insertions(+), 27 deletions(-) create mode 100755 arch/0-vkd3d-proton-git/PKGBUILD create mode 100644 vkd3d-proton_custom_patches/put_your_vkd3d-proton_patches_here diff --git a/arch/0-vkd3d-proton-git/PKGBUILD b/arch/0-vkd3d-proton-git/PKGBUILD new file mode 100755 index 0000000..ff754ea --- /dev/null +++ b/arch/0-vkd3d-proton-git/PKGBUILD @@ -0,0 +1,98 @@ +# Maintainer: Pekka Helenius (~Fincer) + +# Override /etc/makepkg.conf PKGDEST variable if it's enabled +PKGDEST="${PWD}" + +pkgname=vkd3d-proton-git +_pkgname=vkd3d-proton +pkgver=3.1.1.2967 +pkgrel=1 +pkgdesc="Fork of VKD3D. Development branches for Proton's Direct3D 12 implementation." +url="https://github.com/HansKristian-Work/vkd3d-proton" +license=('LGPL2.1') + +arch=('x86_64') +conflicts=( + 'vkd3d-proton' +) +depends=('wine' 'vulkan-icd-loader' 'lib32-vulkan-icd-loader') +makedepends=( + 'ninja' + 'meson>=0.49' + 'glslang' + 'mingw-w64-gcc' + 'git' + 'wine' +) + +_vkd3d_gitsrc= +_git_branch_vkd3d=master +_vkd3d_commit=HEAD + +provides=('vkd3d-proton') +options=(!strip !buildflags staticlibs) +source=(${pkgname}::"${_vkd3d_gitsrc}#commit=${_vkd3d_commit}") +sha256sums=('SKIP') + +############################## + +# Copy custom patches to correct location +if [[ $(find "${startdir}/vkd3d-proton-patches" -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$") ]]; then + cp -r "${startdir}/vkd3d-proton-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}/vkd3d-proton-git" + git checkout ${_git_branch_vkd3d} + git reset --hard ${_vkd3d_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 VKD3D version tag +pkgver() { + cd "${pkgname}" + printf '%s' $(git describe --long --always | sed 's/\-[a-z].*//; s/\-/\./g; s/[a-z]//g') +} + +# Launch VKD3D build script +build() { + "${srcdir}/${pkgname}"/package-release.sh ${pkgver} "${srcdir}"/build --no-package +} + +# Bundle the compiled files +package() { + mkdir -p "${pkgdir}"/usr/{bin,share/vkd3d} + cp -r "${srcdir}"/build/${_pkgname}-${pkgver}/* "${pkgdir}/usr/share/vkd3d/" + + echo -e "#!/bin/sh\n/usr/share/dxvk/setup_vkd3d_proton.sh \${@}" \ + > "${pkgdir}/usr/bin/setup_vkd3d_proton" + + chmod +x "${pkgdir}/usr/bin/setup_vkd3d_proton" +} diff --git a/arch/updatewine_arch.sh b/arch/updatewine_arch.sh index 49773fb..f35ae54 100755 --- a/arch/updatewine_arch.sh +++ b/arch/updatewine_arch.sh @@ -45,15 +45,18 @@ done # array in ../updatewine.sh, make sure to update these # variables! # -git_commithash_dxvk=${params[0]} -git_commithash_wine=${params[3]} +git_commithash_vkd3dproton=${params[0]} +git_commithash_dxvk=${params[1]} +git_commithash_wine=${params[4]} -git_branch_dxvk=${params[4]} -git_branch_wine=${params[7]} +git_branch_vkd3dproton=${params[5]} +git_branch_dxvk=${params[6]} +git_branch_wine=${params[9]} -git_source_dxvk=${params[8]} -git_source_wine=${params[11]} -git_source_winestaging=${params[12]} +git_source_vkd3dproton=${params[10]} +git_source_dxvk=${params[11]} +git_source_wine=${params[14]} +git_source_winestaging=${params[15]} ######################################################## @@ -87,6 +90,9 @@ for check in ${args[@]}; do --no-dxvk) NO_DXVK= ;; + --no-vkd3d) + NO_VKD3D= + ;; --no-pol) NO_POL= ;; @@ -129,9 +135,11 @@ function checkFiles() { local wine_files local dxvk_files + local vkd3dproton_files wine_files=('30-win32-aliases.conf' 'PKGBUILD') dxvk_files=('PKGBUILD') + vkd3dproton_files=('PKGBUILD') function validatefiles() { @@ -160,6 +168,10 @@ function checkFiles() { validatefiles "${dxvk_files[*]}" DXVK "${ARCH_BUILDROOT}/0-dxvk-git" fi + if [[ ! -v NO_VKD3D ]]; then + validatefiles "${vkd3dproton_files[*]}" "VKD3D Proton" "${ARCH_BUILDROOT}/0-vkd3d-proton-git" + fi + } ########################################################### @@ -266,10 +278,12 @@ function prepare_env() { # Remove old Wine & DXVK patch files rm -rf ${ARCH_BUILDROOT}/0-wine-staging-git/wine-patches rm -rf ${ARCH_BUILDROOT}/0-dxvk-git/dxvk-patches + rm -rf ${ARCH_BUILDROOT}/0-vkd3d-proton-git/vkd3d-proton-patches mkdir -p ${ARCH_BUILDROOT}/0-wine-staging-git/wine-patches mkdir -p ${ARCH_BUILDROOT}/0-dxvk-git/dxvk-patches - + mkdir -p ${ARCH_BUILDROOT}/0-vkd3d-proton-git/vkd3d-proton-patches + # Copy new Wine & DXVK patch files find ${ARCH_BUILDROOT}/../wine_custom_patches \ -mindepth 1 -maxdepth 1 -type f \( -iname "*.patch" -or -iname "*.diff" \) \ @@ -277,7 +291,11 @@ function prepare_env() { find ${ARCH_BUILDROOT}/../dxvk_custom_patches \ -mindepth 1 -maxdepth 1 -type f \( -iname "*.patch" -or -iname "*.diff" \) \ - -exec cp {} ${ARCH_BUILDROOT}/0-dxvk-git/dxvk-patches \; + -exec cp {} ${ARCH_BUILDROOT}/0-dxvk-git/dxvk-patches/ \; + + find ${ARCH_BUILDROOT}/../vkd3d-proton_custom_patches \ + -mindepth 1 -maxdepth 1 -type f \( -iname "*.patch" -or -iname "*.diff" \) \ + -exec cp {} ${ARCH_BUILDROOT}/0-vkd3d-proton-git/vkd3d-proton-patches/ \; # Create identifiable directory for this build mkdir -p ${ARCH_BUILDROOT}/compiled_pkg/"${datedir}" @@ -433,26 +451,34 @@ function build_pkg() { if [[ ${pkgname} == wine ]]; then check_gitOverride_wine - git_source_wine=$(echo ${git_source_wine} | sed 's/\//\\\//g; s/\./\\\./g') + git_source_wine=$(echo ${git_source_wine} | sed 's/\//\\\//g; s/\./\\\./g; s/^git:/git+https:/') sed -i "s/\(^_wine_gitsrc=\).*/\1\"${git_source_wine}\"/" ${pkgbuild_file} sed -i "s/\(^_wine_commit=\).*/\1${git_commithash_wine}/" ${pkgbuild_file} sed -i "s/\(^_git_branch_wine=\).*/\1${git_branch_wine}/" ${pkgbuild_file} if [[ ! -v NO_STAGING ]]; then - git_source_winestaging=$(echo ${git_source_winestaging} | sed 's/\//\\\//g; s/\./\\\./g') + git_source_winestaging=$(echo ${git_source_winestaging} | sed 's/\//\\\//g; s/\./\\\./g; s/^git:/git+https:/') sed -i "s/\(^_staging_gitsrc=\).*/\1\"${git_source_winestaging}\"/" ${pkgbuild_file} sed -i "s/\(^_staging_commit=\).*/\1${git_commithash_winestaging}/" ${pkgbuild_file} fi elif [[ ${pkgname} == dxvk ]]; then - git_source_dxvk=$(echo ${git_source_dxvk} | sed 's/\//\\\//g; s/\./\\\./g') + git_source_dxvk=$(echo ${git_source_dxvk} | sed 's/\//\\\//g; s/\./\\\./g; s/^git:/git+https:/') sed -i "s/\(^_dxvk_gitsrc=\).*/\1\"${git_source_dxvk}\"/" ${pkgbuild_file} sed -i "s/\(^_git_branch_dxvk=\).*/\1${git_branch_dxvk}/" ${pkgbuild_file} sed -i "s/\(^_dxvk_commit=\).*/\1${git_commithash_dxvk}/" ${pkgbuild_file} + + elif [[ ${pkgname} == vkd3d-proton ]]; then + git_source_vkd3dproton=$(echo ${git_source_vkd3dproton} | sed 's/\//\\\//g; s/\./\\\./g; s/^git:/git+https:/') + sed -i "s/\(^_vkd3d_gitsrc=\).*/\1\"${git_source_vkd3dproton}\"/" ${pkgbuild_file} + + sed -i "s/\(^_git_branch_vkd3d=\).*/\1${git_branch_vkd3dproton}/" ${pkgbuild_file} + sed -i "s/\(^_vkd3d_commit=\).*/\1${git_commithash_vkd3dproton}/" ${pkgbuild_file} fi + fi if [[ $? -eq 0 ]]; then bash -c "updpkgsums && makepkg -Cf"; else exit 1; fi @@ -520,6 +546,16 @@ function updatePOL() { fi done fi + + # TODO remove duplicate functionality + if [[ ! -v NO_VKD3D ]]; then + for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do + if [[ -d ${wineprefix}/dosdevices ]]; then + WINEPREFIX=${wineprefix} setup_vkd3d_proton + fi + done + fi + } ########################################################## @@ -554,6 +590,10 @@ if [[ ! -v NO_DXVK ]]; then checkDepends "0-dxvk-git" "dxvk-git" depends makedepends fi +if [[ ! -v NO_VKD3D ]]; then + checkDepends "0-vkd3d-proton-git" "vkd3d-proton-git" depends makedepends +fi + check_alldeps ######################### @@ -570,6 +610,10 @@ if [[ ! -v NO_DXVK ]]; then build_pkg dxvk DXVK "0-dxvk-git" "${dxvk_wine_cleanlist[*]}" gitcheck fi +if [[ ! -v NO_VKD3D ]]; then + build_pkg vkd3d-proton "VKD3D Proton" "0-vkd3d-proton-git" "${dxvk_wine_cleanlist[*]}" gitcheck +fi + ######################### # Update user's PlayonLinux wine prefixes if needed diff --git a/options.conf b/options.conf index be08fa4..19c08ed 100644 --- a/options.conf +++ b/options.conf @@ -15,6 +15,7 @@ ######### +git_source_vkd3dproton="git://github.com/HansKristian-Work/vkd3d-proton.git" git_source_dxvk="git://github.com/doitsujin/dxvk.git" git_source_wine="git://source.winehq.org/git/wine.git" git_source_winestaging="git://github.com/wine-staging/wine-staging.git" @@ -23,6 +24,10 @@ git_source_winestaging="git://github.com/wine-staging/wine-staging.git" git_commithash_dxvk=HEAD git_branch_dxvk=master +# VKD3D commits & branches +git_commithash_vkd3dproton=HEAD +git_branch_vkd3dproton=master + # Wine commits & branches git_commithash_wine=HEAD git_branch_wine=master diff --git a/updatewine.sh b/updatewine.sh index 8202a61..e317674 100755 --- a/updatewine.sh +++ b/updatewine.sh @@ -145,6 +145,10 @@ for arg in ${@}; do # Skip DXVK build & installation process all together NO_DXVK= ;; + --no-vkd3d) + # Skip VKD3D Proton build & installation process all together + NO_VKD3D= + ;; --no-pol) # Skip PlayOnLinux Wine prefixes update process ;; @@ -155,6 +159,7 @@ ${SCRIPT_TITLE} by ${SCRIPT_AUTHOR}\n\n\ 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-dxvk\tDo not compile or install DXVK\n\ +--no-vkd3d\tDo not compile or install VKD3D Proton\n\ --no-pol\tDo not update PlayOnLinux Wine prefixes\n\n\ --no-staging\tCompile Wine instead of Wine Staging\n\ --no-wine\tDo not compile or install Wine/Wine Staging\n\n\ @@ -182,31 +187,34 @@ datesuffix=$(echo $(date '+%Y-%m-%d-%H%M%S')) # Pass them to subscripts, as well. githash_overrides=( - "${git_commithash_dxvk}" # 0 - "${git_commithash_glslang}" # 1 - "${git_commithash_meson}" # 2 - "${git_commithash_wine}" # 3 + "${git_commithash_vkd3dproton}" # 0 + "${git_commithash_dxvk}" # 1 + "${git_commithash_glslang}" # 2 + "${git_commithash_meson}" # 3 + "${git_commithash_wine}" # 4 ) # Add git branches to argument list # Pass them to subscripts, as well. gitbranch_overrides=( - "${git_branch_dxvk}" # 4 - "${git_branch_glslang}" # 5 - "${git_branch_meson}" # 6 - "${git_branch_wine}" # 7 + "${git_branch_vkd3dproton}" # 5 + "${git_branch_dxvk}" # 6 + "${git_branch_glslang}" # 7 + "${git_branch_meson}" # 8 + "${git_branch_wine}" # 9 ) # Add git sources to argument list # Pass them to subscripts, as well. gitsources=( - "${git_source_dxvk}" # 8 - "${git_source_glslang}" # 9 - "${git_source_meson}" # 10 - "${git_source_wine}" # 11 - "${git_source_winestaging}" # 12 + "${git_source_vkd3dproton}" # 10 + "${git_source_dxvk}" # 11 + "${git_source_glslang}" # 12 + "${git_source_meson}" # 13 + "${git_source_wine}" # 14 + "${git_source_winestaging}" # 15 ) ############################# @@ -378,7 +386,7 @@ function determineDistroFamily() { esac } -if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]; then +if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]] || [[ ! -v NO_VKD3D ]]; then echo -e "\n${SCRIPT_TITLE}\n\nBuild identifier:\t${datesuffix}\n" else echo "" @@ -395,7 +403,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" INFO_SEP -if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]; then +if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]|| [[ ! -v NO_VKD3D ]]; then reqsCheck sudoQuestion echo "" diff --git a/vkd3d-proton_custom_patches/put_your_vkd3d-proton_patches_here b/vkd3d-proton_custom_patches/put_your_vkd3d-proton_patches_here new file mode 100644 index 0000000..e5ca62e --- /dev/null +++ b/vkd3d-proton_custom_patches/put_your_vkd3d-proton_patches_here @@ -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