Automate installation of DXVK, D9VK + Wine/Wine Staging & update GPU drivers + PlayonLinux wineprefixes (Debian/Ubuntu/Mint/Arch Linux/Manjaro)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

690 lines
20 KiB

5 years ago
  1. #!/bin/env bash
  2. # Set up Wine Staging + DXVK on Arch Linux & Variants
  3. # Copyright (C) 2019 Pekka Helenius
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. ########################################################
  18. # DO NOT RUN INDIVIDUALLY, ONLY VIA ../updatewine.sh PARENT SCRIPT!
  19. ########################################################
  20. # Root directory of this script file
  21. ARCH_BUILDROOT="${PWD}"
  22. # datedir variable supplied by ../updatewine.sh script file
  23. datedir="${1}"
  24. ########################################################
  25. # Divide input args into array indexes
  26. i=0
  27. for p in ${@:2}; do
  28. params[$i]=${p}
  29. let i++
  30. done
  31. ########################################################
  32. # Parse input git override hashes
  33. # This order is mandatory!
  34. # If you change the order or contents of 'githash_overrides'
  35. # array in ../updatewine.sh, make sure to update these
  36. # variables!
  37. #
  38. git_commithash_dxvknvapi=${params[0]}
  39. git_commithash_vkd3dproton=${params[1]}
  40. git_commithash_dxvk=${params[2]}
  41. git_commithash_wine=${params[5]}
  42. git_branch_dxvknvapi=${params[6]}
  43. git_branch_vkd3dproton=${params[7]}
  44. git_branch_dxvk=${params[8]}
  45. git_branch_wine=${params[11]}
  46. git_source_dxvknvapi=${params[12]}
  47. git_source_vkd3dproton=${params[13]}
  48. git_source_dxvk=${params[14]}
  49. git_source_wine=${params[17]}
  50. git_source_winestaging=${params[18]}
  51. ########################################################
  52. # Parse input arguments, filter user parameters
  53. # The range is defined in ../updatewine.sh
  54. # All input arguments are:
  55. # <datedir> 4*<githash_override> <args>
  56. # 0 1 2 3 4 5 ...
  57. # Filter all but <args>, i.e. the first 0-4 arguments
  58. i=0
  59. for arg in ${params[@]:8}; do
  60. args[$i]="${arg}"
  61. let i++
  62. done
  63. for check in ${args[@]}; do
  64. case ${check} in
  65. --no-staging)
  66. NO_STAGING=
  67. ;;
  68. --no-install)
  69. NO_INSTALL=
  70. # Do not check for PlayOnLinux wine prefixes
  71. NO_POL=
  72. ;;
  73. --no-wine)
  74. NO_WINE=
  75. ;;
  76. --no-dxvk)
  77. NO_DXVK=
  78. ;;
  79. --no-vkd3d)
  80. NO_VKD3D=
  81. ;;
  82. --no-nvapi)
  83. NO_NVAPI=
  84. ;;
  85. --no-pol)
  86. NO_POL=
  87. ;;
  88. esac
  89. done
  90. ########################################################
  91. # http://wiki.bash-hackers.org/snipplets/print_horizontal_line#a_line_across_the_entire_width_of_the_terminal
  92. function INFO_SEP() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - ; }
  93. ###########################################################
  94. # TODO Shall we remove git folders or keep them?
  95. dxvk_wine_cleanlist=('*.patch' '*.diff' 'pkg' 'src' '*-patches' '*.tar.xz' '*.sig')
  96. function cleanUp() {
  97. rm -rf ${ARCH_BUILDROOT}/*/{$(echo "${dxvk_wine_cleanlist[@]}" | tr ' ' ',')}
  98. }
  99. # Allow interruption of the script at any time (Ctrl + C)
  100. trap "cleanUp" SIGINT SIGTERM SIGQUIT
  101. ###########################################################
  102. # Check existence of ccache package
  103. function ccacheCheck() {
  104. if [[ $(pacman -Q | awk '{print $1}' | grep -wE "ccache" | wc -l) -eq 0 ]]; then
  105. echo -e "\e[1mNOTE:\e[0m Please consider using 'ccache' for faster compilation times.\nInstall it by typing 'sudo pacman -S ccache'\n"
  106. fi
  107. }
  108. ###########################################################
  109. # Validate all core build files for Wine and/or DXVK exist
  110. function checkFiles() {
  111. local wine_files
  112. local dxvk_files
  113. local vkd3dproton_files
  114. local dxvknvapi_files
  115. wine_files=('30-win32-aliases.conf' 'PKGBUILD')
  116. dxvk_files=('PKGBUILD')
  117. vkd3dproton_files=('PKGBUILD')
  118. dxvknvapi_files=('PKGBUILD' 'setup_dxvk_nvapi.sh')
  119. function validatefiles() {
  120. local list
  121. local name
  122. local path
  123. list=${1}
  124. name=${2}
  125. path=${3}
  126. for file in ${list[@]}; do
  127. if [[ ! -f "${path}/${file}" ]]; then
  128. echo -e "\e[1mERROR:\e[0m Could not locate file ${} for ${name}. Aborting\n"
  129. exit 1
  130. fi
  131. done
  132. }
  133. if [[ ! -v NO_WINE ]]; then
  134. validatefiles "${wine_files[*]}" Wine "${ARCH_BUILDROOT}/0-wine-staging-git"
  135. fi
  136. if [[ ! -v NO_DXVK ]]; then
  137. validatefiles "${dxvk_files[*]}" DXVK "${ARCH_BUILDROOT}/0-dxvk-git"
  138. fi
  139. if [[ ! -v NO_VKD3D ]]; then
  140. validatefiles "${vkd3dproton_files[*]}" "VKD3D Proton" "${ARCH_BUILDROOT}/0-vkd3d-proton-git"
  141. fi
  142. if [[ ! -v NO_NVAPI ]]; then
  143. validatefiles "${dxvknvapi_files[*]}" "DXVK NVAPI" "${ARCH_BUILDROOT}/0-dxvk-nvapi-git"
  144. fi
  145. }
  146. ###########################################################
  147. # Disable or enable Wine Staging, depending on user's
  148. # choice
  149. function checkStaging() {
  150. # Enable Wine Staging
  151. if [[ ! -v NO_STAGING ]]; then
  152. sed -i 's/enable_staging=[0-9]/enable_staging=1/' "${ARCH_BUILDROOT}/0-wine-staging-git/PKGBUILD"
  153. wine_name="wine-staging-git"
  154. # Enable Wine, disable Staging
  155. else
  156. sed -i 's/enable_staging=[0-9]/enable_staging=0/' "${ARCH_BUILDROOT}/0-wine-staging-git/PKGBUILD"
  157. wine_name="wine"
  158. fi
  159. }
  160. ###########################################################
  161. # Check package dependencies beforehand, just to avoid
  162. # annoying situations which could occur later while the script
  163. # is already running.
  164. # Just for "packages which are not found" array <=> errpkgs
  165. # We need to set it outside of checkDepends function
  166. # because it is a global variable for all checked packages
  167. l=0
  168. function checkDepends() {
  169. local packagedir
  170. local package
  171. local file
  172. local file_vars
  173. local field
  174. local i
  175. local pkgs
  176. packagedir=${1}
  177. package=${2}
  178. # We get necessary variables to check from this file
  179. file="./${packagedir}/PKGBUILD"
  180. # All but the (zero), the first and the second argument
  181. # We check the value of these file variables
  182. file_vars=${@:3}
  183. for var in ${file_vars[*]}; do
  184. # Get the variable and set it as a new variable in the current shell
  185. # This is applicable only to variable arrays! Do not use if the variable is not an array.
  186. field=$(awk "/^${var}/,/)/" ${file} | sed -r "s/^${var}=|[)|(|']//g")
  187. i=0
  188. for parse in ${field[*]}; do
  189. if [[ ! $parse =~ ^# ]]; then
  190. pkgs[$i]=$(printf '%s' $parse | sed 's/[=|>|<].*$//')
  191. let i++
  192. fi
  193. done
  194. # Sort list and delete duplicate index values
  195. pkgs=($(sort -u <<< "${pkgs[*]}"))
  196. for pkg in ${pkgs[*]}; do
  197. if [[ $(printf $(pacman -Q ${pkg} &>/dev/null)$?) -ne 0 ]]; then
  198. errpkgs[$l]=${pkg}
  199. echo -e "\e[91mERROR:\e[0m Dependency '${pkg}' not found, required by '${package}' (${file} => ${var})"
  200. let l++
  201. fi
  202. done
  203. done
  204. echo -e "\e[92m==>\e[0m\e[1m Dependency check for ${package} done.\e[0m\n"
  205. }
  206. function check_alldeps() {
  207. if [[ -v errpkgs ]]; then
  208. echo -e "\e[1mERROR:\e[0m The following dependencies are missing:\n\e[91m\
  209. $(for o in ${errpkgs[@]}; do printf '%s\n' ${o}; done)\
  210. \e[0m\n"
  211. echo -e "Please install them and try again.\n"
  212. exit 1
  213. fi
  214. }
  215. ###########################################################
  216. # Prepare building environment for the current runtime
  217. function prepare_env() {
  218. # Remove old Wine & DXVK patch files
  219. rm -rf ${ARCH_BUILDROOT}/0-wine-staging-git/wine-patches
  220. rm -rf ${ARCH_BUILDROOT}/0-dxvk-git/dxvk-patches
  221. rm -rf ${ARCH_BUILDROOT}/0-vkd3d-proton-git/vkd3d-proton-patches
  222. rm -rf ${ARCH_BUILDROOT}/0-dxvk-nvapi-git/dxvk-nvapi-patches
  223. mkdir -p ${ARCH_BUILDROOT}/0-wine-staging-git/wine-patches
  224. mkdir -p ${ARCH_BUILDROOT}/0-dxvk-git/dxvk-patches
  225. mkdir -p ${ARCH_BUILDROOT}/0-vkd3d-proton-git/vkd3d-proton-patches
  226. mkdir -p ${ARCH_BUILDROOT}/0-dxvk-nvapi-git/dxvk-nvapi-patches
  227. # Copy new Wine & DXVK patch files
  228. find ${ARCH_BUILDROOT}/../wine_custom_patches \
  229. -mindepth 1 -maxdepth 1 -type f \( -iname "*.patch" -or -iname "*.diff" \) \
  230. -exec cp {} ${ARCH_BUILDROOT}/0-wine-staging-git/wine-patches/ \;
  231. find ${ARCH_BUILDROOT}/../dxvk_custom_patches \
  232. -mindepth 1 -maxdepth 1 -type f \( -iname "*.patch" -or -iname "*.diff" \) \
  233. -exec cp {} ${ARCH_BUILDROOT}/0-dxvk-git/dxvk-patches/ \;
  234. find ${ARCH_BUILDROOT}/../vkd3d-proton_custom_patches \
  235. -mindepth 1 -maxdepth 1 -type f \( -iname "*.patch" -or -iname "*.diff" \) \
  236. -exec cp {} ${ARCH_BUILDROOT}/0-vkd3d-proton-git/vkd3d-proton-patches/ \;
  237. find ${ARCH_BUILDROOT}/../dxvk-nvapi_custom_patches \
  238. -mindepth 1 -maxdepth 1 -type f \( -iname "*.patch" -or -iname "*.diff" \) \
  239. -exec cp {} ${ARCH_BUILDROOT}/0-dxvk-nvapi-git/dxvk-nvapi-patches/ \;
  240. # Create identifiable directory for this build
  241. mkdir -p ${ARCH_BUILDROOT}/compiled_pkg/"${datedir}"
  242. }
  243. ########################################################
  244. # Parse Wine hash override if Staging is set to be installed
  245. function check_gitOverride_wine() {
  246. # If staging is to be installed and Wine git is frozen to a specific commit
  247. # We need to determine exact commit to use for Wine Staging
  248. # to avoid any mismatches
  249. #
  250. # Basically, when user has defined 'git_commithash_wine' variable (commit), we
  251. # iterate through Wine commits and try to determine previously set
  252. # Wine Staging commit. We use that Wine Staging commit instead of
  253. # the one user has defined in 'git_commithash_wine' variable
  254. #
  255. if [[ ! -v NO_STAGING ]] && [[ "${git_commithash_wine}" != HEAD ]]; then
  256. function form_commit_array() {
  257. local array_name
  258. local commits_raw
  259. local i
  260. cd "${commit_dir}"
  261. if [[ $? -ne 0 ]]; then
  262. echo -e "\e[1mERROR:\e[0m Couldn't access Wine folder ${commit_dir} to check commits. Aborting\n"
  263. exit 1
  264. fi
  265. array_name=${1}
  266. commits_raw=$(eval ${2})
  267. i=0
  268. for commit in ${commits_raw[*]}; do
  269. eval ${array_name}[$i]="${commit}"
  270. let i++
  271. done
  272. if [[ $? -ne 0 ]]; then
  273. echo -e "\e[1mERROR:\e[0m Couldn't parse Wine commits in ${commit_dir}. Aborting\n"
  274. exit 1
  275. fi
  276. cd "${ARCH_BUILDROOT}/0-wine-staging-git/"
  277. }
  278. function staging_change_freeze_commit() {
  279. local wine_commits_raw
  280. local staging_refcommits_raw
  281. local staging_rebasecommits_raw
  282. local i
  283. local k
  284. local wine_dropcommits
  285. wine_commits_raw="git log --pretty=oneline | awk '{print \$1}' | tr '\n' ' '"
  286. # TODO this check may break quite easily
  287. # It depends on the exact comment syntax Wine Staging developers are using (Rebase against ...)
  288. # Length and order of these two "array" variables MUST MATCH!
  289. staging_refcommits_raw="git log --pretty=oneline | awk '{ if ((length(\$NF)==40 || length(\$NF)==41) && \$(NF-1)==\"against\") print \$1; }'"
  290. staging_rebasecommits_raw="git log --pretty=oneline | awk '{ if ((length(\$NF)==40 || length(\$NF)==41) && \$(NF-1)==\"against\") print substr(\$NF,1,40); }' | tr '\n' ' '"
  291. # Syntax: <function> <array_name> <raw_commit_list>
  292. commit_dir="${ARCH_BUILDROOT}/0-wine-staging-git/wine-git"
  293. form_commit_array wine_commits "${wine_commits_raw}"
  294. commit_dir="${ARCH_BUILDROOT}/0-wine-staging-git/wine-staging-git"
  295. form_commit_array staging_refcommits "${staging_refcommits_raw}"
  296. form_commit_array staging_rebasecommits "${staging_rebasecommits_raw}"
  297. # User has selected vanilla Wine commit to freeze to
  298. # We must get the previous Staging commit from rebase_commits array, and
  299. # change git_commithash_wine value to that
  300. # Get all vanilla Wine commits
  301. # Filter all newer than defined in 'git_commithash_wine'
  302. #
  303. echo -e "Determining valid Wine Staging git commit. This takes a while.\n"
  304. i=0
  305. for dropcommit in ${wine_commits[@]}; do
  306. if [[ "${dropcommit}" == "${git_commithash_wine}" ]]; then
  307. break
  308. else
  309. wine_dropcommits[$i]="${dropcommit}"
  310. let i++
  311. fi
  312. done
  313. wine_commits=("${wine_commits[@]:${#wine_dropcommits[*]}}")
  314. # For the filtered array list, iterate through 'staging_rebasecommits' array list until
  315. # we get a match
  316. for vanilla_commit in ${wine_commits[@]}; do
  317. k=0
  318. for rebase_commit in ${staging_rebasecommits[@]}; do
  319. if [[ "${vanilla_commit}" == "${rebase_commit}" ]]; then
  320. # This is the commit we use for vanilla Wine
  321. git_commithash_wine="${vanilla_commit}"
  322. # This is equal commit we use for Wine Staging
  323. git_commithash_winestaging="${staging_refcommits[$k]}"
  324. break 2
  325. fi
  326. let k++
  327. done
  328. done
  329. }
  330. git_branch_wine=master
  331. staging_change_freeze_commit
  332. elif [[ ! -v NO_STAGING ]] && [[ "${git_commithash_wine}" == HEAD ]]; then
  333. git_branch_wine=master
  334. git_commithash_winestaging=HEAD
  335. fi
  336. }
  337. ###########################################################
  338. # Fetch extra package files
  339. function fetch_extra_pkg_files() {
  340. local pkgname
  341. local pkgdir
  342. local extra_files_dir
  343. pkgname=${1}
  344. pkgdir=${2}
  345. extra_files_dir="../extra_files/${pkgname}"
  346. if [[ -d ${extra_files_dir} ]]; then
  347. cp -r ${extra_files_dir}/ "${ARCH_BUILDROOT}"/${pkgdir}/
  348. fi
  349. }
  350. ###########################################################
  351. # Build & install package
  352. function build_pkg() {
  353. local pkgname
  354. local pkgname_friendly
  355. local pkgdir
  356. local cleanlist
  357. local pkgbuild_file
  358. pkgname=${1}
  359. pkgname_friendly=${2}
  360. pkgdir=${3}
  361. cleanlist=${4}
  362. # Fetch extra files if any defined
  363. fetch_extra_pkg_files ${pkgname} ${pkgdir}
  364. # Create package and install it to the system
  365. # We need to download git sources beforehand in order
  366. # to determine git commit hashes
  367. cd "${ARCH_BUILDROOT}"/${pkgdir}
  368. bash -c "updpkgsums && makepkg -o"
  369. pkgbuild_file="${ARCH_BUILDROOT}/${pkgdir}/PKGBUILD"
  370. # Check git commit hashes
  371. if [[ $? -eq 0 ]] && \
  372. [[ ${5} == gitcheck ]]; then
  373. if [[ ${pkgname} == wine ]]; then
  374. check_gitOverride_wine
  375. git_source_wine=$(echo ${git_source_wine} | sed 's/\//\\\//g; s/\./\\\./g; s/^git:/git+https:/')
  376. sed -i "s/\(^_wine_gitsrc=\).*/\1\"${git_source_wine}\"/" ${pkgbuild_file}
  377. sed -i "s/\(^_wine_commit=\).*/\1${git_commithash_wine}/" ${pkgbuild_file}
  378. sed -i "s/\(^_git_branch_wine=\).*/\1${git_branch_wine}/" ${pkgbuild_file}
  379. if [[ ! -v NO_STAGING ]]; then
  380. git_source_winestaging=$(echo ${git_source_winestaging} | sed 's/\//\\\//g; s/\./\\\./g; s/^git:/git+https:/')
  381. sed -i "s/\(^_staging_gitsrc=\).*/\1\"${git_source_winestaging}\"/" ${pkgbuild_file}
  382. sed -i "s/\(^_staging_commit=\).*/\1${git_commithash_winestaging}/" ${pkgbuild_file}
  383. fi
  384. elif [[ ${pkgname} == dxvk ]]; then
  385. git_source_dxvk=$(echo ${git_source_dxvk} | sed 's/\//\\\//g; s/\./\\\./g; s/^git:/git+https:/')
  386. sed -i "s/\(^_dxvk_gitsrc=\).*/\1\"${git_source_dxvk}\"/" ${pkgbuild_file}
  387. sed -i "s/\(^_git_branch_dxvk=\).*/\1${git_branch_dxvk}/" ${pkgbuild_file}
  388. sed -i "s/\(^_dxvk_commit=\).*/\1${git_commithash_dxvk}/" ${pkgbuild_file}
  389. elif [[ ${pkgname} == vkd3d-proton ]]; then
  390. git_source_vkd3dproton=$(echo ${git_source_vkd3dproton} | sed 's/\//\\\//g; s/\./\\\./g; s/^git:/git+https:/')
  391. sed -i "s/\(^_vkd3d_gitsrc=\).*/\1\"${git_source_vkd3dproton}\"/" ${pkgbuild_file}
  392. sed -i "s/\(^_git_branch_vkd3d=\).*/\1${git_branch_vkd3dproton}/" ${pkgbuild_file}
  393. sed -i "s/\(^_vkd3d_commit=\).*/\1${git_commithash_vkd3dproton}/" ${pkgbuild_file}
  394. elif [[ ${pkgname} == dxvk-nvapi ]]; then
  395. git_source_dxvknvapi=$(echo ${git_source_dxvknvapi} | sed 's/\//\\\//g; s/\./\\\./g; s/^git:/git+https:/')
  396. sed -i "s/\(^_dxvknvapi_gitsrc=\).*/\1\"${git_source_dxvknvapi}\"/" ${pkgbuild_file}
  397. sed -i "s/\(^_git_branch_dxvknvapi=\).*/\1${git_branch_dxvknvapi}/" ${pkgbuild_file}
  398. sed -i "s/\(^_dxvknvapi_commit=\).*/\1${git_commithash_dxvknvapi}/" ${pkgbuild_file}
  399. fi
  400. fi
  401. if [[ $? -eq 0 ]]; then bash -c "updpkgsums && makepkg -Cf"; else exit 1; fi
  402. # After successful compilation...
  403. if [[ $(ls ./${pkgname}-*tar.xz 2>/dev/null | wc -l) -ne 0 ]]; then
  404. if [[ ! -v NO_INSTALL ]]; then
  405. yes | sudo pacman -U ${pkgname}-*.tar.xz
  406. fi
  407. mv ${pkgname}-*.tar.xz ${ARCH_BUILDROOT}/compiled_pkg/${datedir}/ && \
  408. echo -e "\nCompiled ${pkgname_friendly} is stored at '$(readlink -f ${ARCH_BUILDROOT}/compiled_pkg/${datedir}/)/'\n"
  409. for rml in ${cleanlist[*]}; do
  410. rm -rf "${ARCH_BUILDROOT}/${pkgdir}/${rml}"
  411. done
  412. else
  413. echo -e "\e[1mERROR:\e[0m Error occured during ${pkgname} compilation.\n"
  414. for rml in ${cleanlist[*]}; do
  415. rm -rf "${ARCH_BUILDROOT}/${pkgdir}/${rml}"
  416. done
  417. exit 1
  418. fi
  419. cd "${ARCH_BUILDROOT}"
  420. }
  421. ##########################################################
  422. # Update user's PlayOnLinux Wine prefixes if present
  423. function updatePOL() {
  424. # Check whether we will update user's PoL wine prefixes
  425. if [[ ! -v NO_POL ]]; then
  426. # Check existence of PoL default folder in user's homedir
  427. if [[ ! -d "$HOME/.PlayOnLinux" ]]; then
  428. echo -e "\e[1mWARNING:\e[0m Couldn't find PoL directories in $USER's homedir.\n"
  429. return 0
  430. fi
  431. fi
  432. if [[ ! -v NO_WINE ]]; then
  433. # If a new Wine Staging version was installed and 'System' version of Wine has been used in
  434. # PoL wineprefix configurations, update those existing PoL wineprefixes
  435. for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do
  436. if [[ -d ${wineprefix}/dosdevices ]]; then
  437. # If VERSION string exists, skip updating that prefix.
  438. if [[ $(printf $(grep -ril "VERSION" ${wineprefix}/playonlinux.cfg &> /dev/null)$?) -ne 0 ]]; then
  439. WINEPREFIX=${wineprefix} wineboot -u
  440. fi
  441. fi
  442. done
  443. fi
  444. # TODO remove duplicate functionality
  445. if [[ ! -v NO_DXVK ]]; then
  446. for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do
  447. if [[ -d ${wineprefix}/dosdevices ]]; then
  448. WINEPREFIX=${wineprefix} setup_dxvk
  449. fi
  450. done
  451. fi
  452. # TODO remove duplicate functionality
  453. if [[ ! -v NO_VKD3D ]]; then
  454. for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do
  455. if [[ -d ${wineprefix}/dosdevices ]]; then
  456. WINEPREFIX=${wineprefix} setup_vkd3d_proton
  457. fi
  458. done
  459. fi
  460. # TODO remove duplicate functionality
  461. if [[ ! -v NO_NVAPI ]]; then
  462. for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do
  463. if [[ -d ${wineprefix}/dosdevices ]]; then
  464. WINEPREFIX=${wineprefix} setup_dxvk_nvapi
  465. fi
  466. done
  467. fi
  468. }
  469. ##########################################################
  470. # Validate all buildtime files
  471. checkFiles
  472. # Check whether we build Wine or Wine Staging
  473. checkStaging
  474. # Check whether we have ccache installed
  475. ccacheCheck
  476. # Clean all previous trash we may have
  477. cleanUp
  478. # Prepare building environment: copy patches and create timestamped folder for compiled packages
  479. prepare_env
  480. #########################
  481. # Check Wine & DXVK dependencies, depending on whether these packages
  482. # are to be built
  483. echo -e "\e[1mINFO:\e[0m Checking dependencies for packages.\n"
  484. if [[ ! -v NO_WINE ]]; then
  485. checkDepends "0-wine-staging-git" "${wine_name}" _depends makedepends
  486. fi
  487. if [[ ! -v NO_DXVK ]]; then
  488. checkDepends "0-dxvk-git" "dxvk-git" depends makedepends
  489. fi
  490. if [[ ! -v NO_VKD3D ]]; then
  491. checkDepends "0-vkd3d-proton-git" "vkd3d-proton-git" depends makedepends
  492. fi
  493. if [[ ! -v NO_NVAPI ]]; then
  494. checkDepends "0-dxvk-nvapi-git" "dxvk-nvapi-git" depends makedepends
  495. fi
  496. check_alldeps
  497. #########################
  498. # Compile Wine & DXVK, depending on whether these packages
  499. # are to be built
  500. # Although the folder name is '0-wine-staging-git', we can still build vanilla Wine
  501. if [[ ! -v NO_WINE ]]; then
  502. build_pkg wine "${wine_name}" "0-wine-staging-git" "${dxvk_wine_cleanlist[*]}" gitcheck
  503. fi
  504. if [[ ! -v NO_DXVK ]]; then
  505. build_pkg dxvk DXVK "0-dxvk-git" "${dxvk_wine_cleanlist[*]}" gitcheck
  506. fi
  507. if [[ ! -v NO_VKD3D ]]; then
  508. build_pkg vkd3d-proton "VKD3D Proton" "0-vkd3d-proton-git" "${dxvk_wine_cleanlist[*]}" gitcheck
  509. fi
  510. if [[ ! -v NO_NVAPI ]]; then
  511. build_pkg dxvk-nvapi "DXVK NVAPI" "0-dxvk-nvapi-git" "${dxvk_wine_cleanlist[*]}" gitcheck
  512. fi
  513. #########################
  514. # Update user's PlayonLinux wine prefixes if needed
  515. if [[ ! -v NO_POL ]]; then
  516. echo -e "\e[1mINFO:\e[0m Updating your PlayOnLinux Wine prefixes.\n"
  517. updatePOL
  518. fi