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.

200 lines
5.5 KiB

  1. #!/bin/env bash
  2. # Wrapper for DXVK & Wine compilation scripts
  3. # Copyright (C) 2018 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. ROOTDIR="${PWD}"
  21. datedir="${1}"
  22. ########################################################
  23. # http://wiki.bash-hackers.org/snipplets/print_horizontal_line#a_line_across_the_entire_width_of_the_terminal
  24. function INFO_SEP() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - ; }
  25. ########################################################
  26. # Parse input arguments
  27. i=0
  28. for arg in ${@:2}; do
  29. args[$i]="${arg}"
  30. let i++
  31. done
  32. # Must be a true array as defined above, not a single index list!
  33. #args="${@:2}"
  34. # All valid arguments given in ../updatewine.sh are handled...
  35. # All valid arguments are passed to subscripts...
  36. # ...but these are specifically used in this script
  37. #
  38. for check in ${args[@]}; do
  39. case ${check} in
  40. --no-wine)
  41. NO_WINE=
  42. ;;
  43. --no-dxvk)
  44. NO_DXVK=
  45. ;;
  46. --no-pol)
  47. NO_POL=
  48. ;;
  49. --no-install)
  50. # If this option is given, do not check PoL wineprefixes
  51. NO_POL=
  52. ;;
  53. esac
  54. done
  55. ########################################################
  56. mkdir -p ${ROOTDIR}/compiled_deb/${datedir}
  57. ########################################################
  58. function Deb_intCleanup() {
  59. cd ${ROOTDIR}
  60. rm -rf compiled_deb/${datedir}
  61. exit 0
  62. }
  63. # Allow interruption of the script at any time (Ctrl + C)
  64. trap "Deb_intCleanup" INT
  65. ########################################################
  66. function ccacheCheck() {
  67. if [[ $(apt version ccache | wc -w) -eq 0 ]]; then
  68. echo -e "NOTE: Please consider using 'ccache' for faster compilation times.\nInstall it by typing 'sudo apt install ccache'\n"
  69. fi
  70. }
  71. ccacheCheck
  72. ########################################################
  73. function wine_install_main() {
  74. echo -e "Starting compilation & installation of Wine\n\n\
  75. This can take up to 0.5-2 hours depending on the available CPU cores.\n\n\
  76. Using $(nproc --ignore 1) of $(nproc) available CPU cores for Wine source code compilation.
  77. "
  78. bash -c "cd ${ROOTDIR}/wineroot/ && bash ./winebuild.sh \"${datedir}\" \"${args[*]}\""
  79. }
  80. ########################################################
  81. function questionresponse() {
  82. local response=${1}
  83. read -r -p "" response
  84. if [[ $(echo $response | sed 's/ //g') =~ ^([yY][eE][sS]|[yY])$ ]]; then
  85. echo ""
  86. return 0
  87. else
  88. return 1
  89. fi
  90. }
  91. ##################################
  92. INFO_SEP
  93. echo -e "\e[1mINFO:\e[0m About installation\n\nThe installation may take long time because many development dependencies may be \
  94. installed and the following packages will be compiled from source (depending on your choise):\n\n\
  95. \t- Wine/Wine Staging (latest git version)\n\
  96. \t- DXVK (latest git version)\n\
  97. \t- meson & glslang (latest git versions; these are build time dependencies for DXVK)\n\n\
  98. Do you want to continue? [Y/n]"
  99. questionresponse
  100. if [[ $? -ne 0 ]]; then
  101. echo -e "Cancelling.\n"
  102. exit 2
  103. fi
  104. ####################
  105. AVAIL_SPACE=$(df -h -B MB --output=avail . | sed '1d; s/[A-Z]*//g')
  106. REC_SPACE=8000
  107. if [[ ${AVAIL_SPACE} -lt ${REC_SPACE} ]]; then
  108. INFO_SEP
  109. echo -e "\e[1mWARNING:\e[0m Not sufficient storage space\n\nYou will possibly run out of space while compiling software.\n\
  110. The script strongly recommends ~\e[1m$((${REC_SPACE} / 1000)) GB\e[0m at least to compile software successfully but you have only\n\
  111. \e[1m${AVAIL_SPACE} MB\e[0m left on the filesystem the script is currently placed at.\n\n\
  112. Be aware that the script process may fail because of this, especially while compiling Wine Staging.\n\n\
  113. Do you really want to continue? [Y/n]"
  114. questionresponse
  115. if [[ $? -ne 0 ]]; then
  116. echo -e "Cancelling.\n"
  117. exit 2
  118. fi
  119. unset AVAIL_SPACE REC_SPACE
  120. fi
  121. ####################
  122. INFO_SEP
  123. echo -e "\e[1mINFO:\e[0m Update existing dependencies?\n\nIn a case you have old build time dependencies on your system, do you want to update them?\n\
  124. If you answer 'yes', then those dependencies are updated if needed. Otherwise, already installed\n\
  125. build time dependencies are not updated. If you don't have 'meson' or 'glslang' installed on your system, they will be compiled, anyway.\n\
  126. Be aware, that updating these packages may increase total run time used by this script.\n\n\
  127. Update dependency packages & other system packages? [Y/n]"
  128. questionresponse
  129. if [[ $? -eq 0 ]]; then
  130. args+=('--updateoverride')
  131. fi
  132. INFO_SEP
  133. ########################################################
  134. if [[ ! -v NO_WINE ]]; then
  135. wine_install_main
  136. else
  137. echo -e "Skipping Wine build & installation process.\n"
  138. fi
  139. if [[ ! -v NO_DXVK ]]; then
  140. bash -c "cd ${ROOTDIR}/dxvkroot && bash dxvkbuild.sh \"${datedir}\" \"${args[*]}\""
  141. else
  142. echo -e "Skipping DXVK build & installation process.\n"
  143. fi
  144. if [[ ! -v NO_POL ]]; then
  145. bash -c "cd ${ROOTDIR} && bash playonlinux_prefixupdate.sh"
  146. fi