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.

203 lines
5.6 KiB

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