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.

725 lines
21 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[@]: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. local pkg_archive
  367. local arch_pkg_validsuffixes
  368. pkgname=${1}
  369. pkgname_friendly=${2}
  370. pkgdir=${3}
  371. cleanlist=${4}
  372. arch_pkg_validsuffixes=(
  373. 'tar.gz'
  374. 'tar.xz'
  375. 'tar.lz'
  376. 'tar.zst'
  377. )
  378. # Fetch extra files if any defined
  379. fetch_extra_pkg_files ${pkgname} ${pkgdir}
  380. # Create package and install it to the system
  381. # We need to download git sources beforehand in order
  382. # to determine git commit hashes
  383. cd "${ARCH_BUILDROOT}"/${pkgdir}
  384. pkgbuild_file="${ARCH_BUILDROOT}/${pkgdir}/PKGBUILD"
  385. # Check git commit hashes
  386. if [[ $? -eq 0 ]] && \
  387. [[ ${5} == gitcheck ]]; then
  388. if [[ ${pkgname} == wine ]]; then
  389. check_gitOverride_wine
  390. git_source_wine=$(echo ${git_source_wine} | sed 's/\//\\\//g; s/\./\\\./g')
  391. sed -i "s/\(^_wine_gitsrc=\).*/\1\"${git_source_wine}\"/" ${pkgbuild_file}
  392. sed -i "s/\(^_wine_commit=\).*/\1${git_commithash_wine}/" ${pkgbuild_file}
  393. sed -i "s/\(^_git_branch_wine=\).*/\1${git_branch_wine}/" ${pkgbuild_file}
  394. if [[ ! -v NO_STAGING ]]; then
  395. git_source_winestaging=$(echo ${git_source_winestaging} | sed 's/\//\\\//g; s/\./\\\./g;')
  396. sed -i "s/\(^_staging_gitsrc=\).*/\1\"${git_source_winestaging}\"/" ${pkgbuild_file}
  397. sed -i "s/\(^_staging_commit=\).*/\1${git_commithash_winestaging}/" ${pkgbuild_file}
  398. fi
  399. elif [[ ${pkgname} == dxvk ]]; then
  400. git_source_dxvk=$(echo ${git_source_dxvk} | sed 's/\//\\\//g; s/\./\\\./g;')
  401. sed -i "s/\(^_dxvk_gitsrc=\).*/\1\"${git_source_dxvk}\"/" ${pkgbuild_file}
  402. sed -i "s/\(^_git_branch_dxvk=\).*/\1${git_branch_dxvk}/" ${pkgbuild_file}
  403. sed -i "s/\(^_dxvk_commit=\).*/\1${git_commithash_dxvk}/" ${pkgbuild_file}
  404. elif [[ ${pkgname} == vkd3d-proton ]]; then
  405. git_source_vkd3dproton=$(echo ${git_source_vkd3dproton} | sed 's/\//\\\//g; s/\./\\\./g;')
  406. sed -i "s/\(^_vkd3d_gitsrc=\).*/\1\"${git_source_vkd3dproton}\"/" ${pkgbuild_file}
  407. sed -i "s/\(^_git_branch_vkd3d=\).*/\1${git_branch_vkd3dproton}/" ${pkgbuild_file}
  408. sed -i "s/\(^_vkd3d_commit=\).*/\1${git_commithash_vkd3dproton}/" ${pkgbuild_file}
  409. elif [[ ${pkgname} == dxvk-nvapi ]]; then
  410. git_source_dxvknvapi=$(echo ${git_source_dxvknvapi} | sed 's/\//\\\//g; s/\./\\\./g;')
  411. sed -i "s/\(^_dxvknvapi_gitsrc=\).*/\1\"${git_source_dxvknvapi}\"/" ${pkgbuild_file}
  412. sed -i "s/\(^_git_branch_dxvknvapi=\).*/\1${git_branch_dxvknvapi}/" ${pkgbuild_file}
  413. sed -i "s/\(^_dxvknvapi_commit=\).*/\1${git_commithash_dxvknvapi}/" ${pkgbuild_file}
  414. fi
  415. fi
  416. if [[ $? -eq 0 ]]; then
  417. bash -c "updpkgsums && makepkg -Cf"
  418. else
  419. cleanUp "_exit"
  420. fi
  421. # After successful compilation...
  422. pkg_archive=
  423. for pkg_suffix in "${arch_pkg_validsuffixes[@]}"; do
  424. find_suffix=$(find . -mindepth 1 -maxdepth 1 -iname "${pkgname}-*${pkg_suffix}")
  425. if [[ ${find_suffix} ]]; then
  426. pkg_archive=${find_suffix}
  427. break 1
  428. fi
  429. done
  430. if [[ -f ${pkg_archive} ]]; then
  431. if [[ ! -v NO_INSTALL ]]; then
  432. yes | sudo pacman -U ${pkg_archive}
  433. fi
  434. mv ${pkg_archive} ${ARCH_BUILDROOT}/compiled_pkg/${datedir}/ && \
  435. echo -e "\nCompiled ${pkgname_friendly} is stored at '$(readlink -f ${ARCH_BUILDROOT}/compiled_pkg/${datedir}/)/'\n"
  436. for rml in ${cleanlist[*]}; do
  437. rm -rf "${ARCH_BUILDROOT}/${pkgdir}/${rml}"
  438. done
  439. else
  440. echo -e "\e[1mERROR:\e[0m Error occured during ${pkgname} compilation.\n"
  441. for rml in ${cleanlist[*]}; do
  442. rm -rf "${ARCH_BUILDROOT}/${pkgdir}/${rml}"
  443. done
  444. exit 1
  445. fi
  446. cd "${ARCH_BUILDROOT}"
  447. }
  448. ##########################################################
  449. # Update user's PlayOnLinux Wine prefixes if present
  450. function updatePOL() {
  451. # Check whether we will update user's PoL wine prefixes
  452. if [[ ! -v NO_POL ]]; then
  453. # Check existence of PoL default folder in user's homedir
  454. if [[ ! -d "$HOME/.PlayOnLinux" ]]; then
  455. echo -e "\e[1mWARNING:\e[0m Couldn't find PoL directories in $USER's homedir.\n"
  456. return 0
  457. fi
  458. fi
  459. if [[ ! -v NO_WINE ]]; then
  460. # If a new Wine Staging version was installed and 'System' version of Wine has been used in
  461. # PoL wineprefix configurations, update those existing PoL wineprefixes
  462. for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do
  463. if [[ -d ${wineprefix}/dosdevices ]]; then
  464. # If VERSION string exists, skip updating that prefix.
  465. if [[ $(printf $(grep -ril "VERSION" ${wineprefix}/playonlinux.cfg &> /dev/null)$?) -ne 0 ]]; then
  466. WINEPREFIX=${wineprefix} wineboot -u
  467. fi
  468. fi
  469. done
  470. fi
  471. # TODO remove duplicate functionality
  472. if [[ ! -v NO_DXVK ]]; 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 install --symlink
  476. fi
  477. done
  478. fi
  479. # TODO remove duplicate functionality
  480. if [[ ! -v NO_VKD3D ]]; then
  481. for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do
  482. if [[ -d ${wineprefix}/dosdevices ]]; then
  483. WINEPREFIX=${wineprefix} setup_vkd3d_proton install --symlink
  484. fi
  485. done
  486. fi
  487. # TODO remove duplicate functionality
  488. if [[ ! -v NO_NVAPI ]]; then
  489. for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do
  490. if [[ -d ${wineprefix}/dosdevices ]]; then
  491. WINEPREFIX=${wineprefix} setup_dxvk_nvapi install --symlink
  492. fi
  493. done
  494. fi
  495. }
  496. ##########################################################
  497. # Validate all buildtime files
  498. checkFiles
  499. # Check whether we build Wine or Wine Staging
  500. checkStaging
  501. # Check whether we have ccache installed
  502. ccacheCheck
  503. # Clean all previous trash we may have
  504. cleanUp
  505. # Prepare building environment: copy patches and create timestamped folder for compiled packages
  506. prepare_env
  507. #########################
  508. # Check Wine & DXVK dependencies, depending on whether these packages
  509. # are to be built
  510. echo -e "\e[1mINFO:\e[0m Checking dependencies for packages.\n"
  511. if [[ ! -v NO_WINE ]]; then
  512. checkDepends "0-wine-staging-git" "${wine_name}" _depends makedepends
  513. fi
  514. if [[ ! -v NO_DXVK ]]; then
  515. checkDepends "0-dxvk-git" "dxvk-git" depends makedepends
  516. fi
  517. if [[ ! -v NO_VKD3D ]]; then
  518. checkDepends "0-vkd3d-proton-git" "vkd3d-proton-git" depends makedepends
  519. fi
  520. if [[ ! -v NO_NVAPI ]]; then
  521. checkDepends "0-dxvk-nvapi-git" "dxvk-nvapi-git" depends makedepends
  522. fi
  523. check_alldeps
  524. #########################
  525. # Compile Wine & DXVK, depending on whether these packages
  526. # are to be built
  527. # Although the folder name is '0-wine-staging-git', we can still build vanilla Wine
  528. if [[ ! -v NO_WINE ]]; then
  529. build_pkg wine "${wine_name}" "0-wine-staging-git" "${dxvk_wine_cleanlist[*]}" gitcheck
  530. fi
  531. if [[ ! -v NO_DXVK ]]; then
  532. build_pkg dxvk DXVK "0-dxvk-git" "${dxvk_wine_cleanlist[*]}" gitcheck
  533. fi
  534. if [[ ! -v NO_VKD3D ]]; then
  535. build_pkg vkd3d-proton "VKD3D Proton" "0-vkd3d-proton-git" "${dxvk_wine_cleanlist[*]}" gitcheck
  536. fi
  537. if [[ ! -v NO_NVAPI ]]; then
  538. build_pkg dxvk-nvapi "DXVK NVAPI" "0-dxvk-nvapi-git" "${dxvk_wine_cleanlist[*]}" gitcheck
  539. fi
  540. #########################
  541. # Update user's PlayonLinux wine prefixes if needed
  542. if [[ ! -v NO_POL ]]; then
  543. echo -e "\e[1mINFO:\e[0m Updating your PlayOnLinux Wine prefixes.\n"
  544. updatePOL
  545. fi