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.

705 lines
21 KiB

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