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.

326 lines
10 KiB

6 years ago
6 years ago
6 years ago
  1. # Maintainer: Daniel Bermond < yahoo-com: danielbermond >
  2. # Contributor: Pekka Helenius (~ Fincer) <fincer89@hotmail.com>
  3. # Enable Wine Staging? 1 = yes
  4. enable_staging=1
  5. # Staging patchsets. Default: all patchsets. Please see Wine Staging patchinstall.sh file for individual patchset names.
  6. staging_patchsets=(--all) # In order to disable all patchsets, use #(--all) and add desired patchsets individually here
  7. # Enable 32-bit compilation? 1 = yes
  8. enable_32=1
  9. # Enable 64-bit compilation? 1 = yes
  10. enable_64=1
  11. provides=('wine' 'wine-git' 'wine-staging' 'wine-staging-git' 'wine-staging-dxvk-git')
  12. if [[ enable_staging -eq 1 ]]; then
  13. pkgname=wine-staging-git
  14. pkgdesc="A compatibility layer for running Windows programs (staging branch, Git version)"
  15. url="https://github.com/wine-staging/wine-staging/"
  16. conflicts=('wine' 'wine-git' 'wine-staging')
  17. else
  18. pkgname=wine-git
  19. pkgdesc="A compatibility layer for running Windows programs (Git version)"
  20. url="https://source.winehq.org/git/wine.git/"
  21. conflicts=('wine' 'wine-staging' 'wine-staging-git')
  22. fi
  23. pkgver=stg.3.13.1.r11.g39cafb1d+wine.wine.3.13.r0.g25cc380b8e
  24. pkgrel=1
  25. arch=('i686' 'x86_64')
  26. license=('LGPL')
  27. _depends=(
  28. 'attr' 'lib32-attr'
  29. 'fontconfig' 'lib32-fontconfig'
  30. 'lcms2' 'lib32-lcms2'
  31. 'libxml2' 'lib32-libxml2'
  32. 'libxcursor' 'lib32-libxcursor'
  33. 'libxrandr' 'lib32-libxrandr'
  34. 'libxdamage' 'lib32-libxdamage'
  35. 'libxi' 'lib32-libxi'
  36. 'gettext' 'lib32-gettext'
  37. 'freetype2' 'lib32-freetype2'
  38. 'glu' 'lib32-glu'
  39. 'libsm' 'lib32-libsm'
  40. 'gcc-libs' 'lib32-gcc-libs'
  41. 'libpcap' 'lib32-libpcap'
  42. 'desktop-file-utils'
  43. 'vulkan-icd-loader' 'lib32-vulkan-icd-loader'
  44. )
  45. makedepends=(
  46. 'git'
  47. 'autoconf'
  48. 'ncurses'
  49. 'bison'
  50. 'perl'
  51. #'fontforge'
  52. 'flex'
  53. 'gcc>=4.5.0-2'
  54. 'giflib' 'lib32-giflib'
  55. 'libpng' 'lib32-libpng'
  56. 'gnutls' 'lib32-gnutls'
  57. 'libxinerama' 'lib32-libxinerama'
  58. 'libxcomposite' 'lib32-libxcomposite'
  59. 'libxmu' 'lib32-libxmu'
  60. 'libxxf86vm' 'lib32-libxxf86vm'
  61. 'libldap' 'lib32-libldap'
  62. 'mpg123' 'lib32-mpg123'
  63. 'openal' 'lib32-openal'
  64. 'v4l-utils' 'lib32-v4l-utils'
  65. 'alsa-lib' 'lib32-alsa-lib'
  66. 'libxcomposite' 'lib32-libxcomposite'
  67. 'mesa' 'lib32-mesa'
  68. 'libgl' 'lib32-libgl'
  69. 'opencl-icd-loader' 'lib32-opencl-icd-loader'
  70. 'libxslt' 'lib32-libxslt'
  71. 'libpulse' 'lib32-libpulse'
  72. 'libva' 'lib32-libva'
  73. 'gst-plugins-base-libs' 'lib32-gst-plugins-base-libs'
  74. 'samba'
  75. #'opencl-headers'
  76. #'gcc-multilib>=4.5.0-2'
  77. )
  78. optdepends=(
  79. 'giflib' 'lib32-giflib'
  80. 'libpng' 'lib32-libpng'
  81. 'libldap' 'lib32-libldap'
  82. 'gnutls' 'lib32-gnutls'
  83. 'mpg123' 'lib32-mpg123'
  84. 'openal' 'lib32-openal'
  85. 'v4l-utils' 'lib32-v4l-utils'
  86. 'libpulse' 'lib32-libpulse'
  87. 'alsa-plugins' 'lib32-alsa-plugins'
  88. 'alsa-lib' 'lib32-alsa-lib'
  89. 'libjpeg-turbo' 'lib32-libjpeg-turbo'
  90. 'libxcomposite' 'lib32-libxcomposite'
  91. 'libxinerama' 'lib32-libxinerama'
  92. 'ncurses' 'lib32-ncurses'
  93. 'opencl-icd-loader' 'lib32-opencl-icd-loader'
  94. 'libxslt' 'lib32-libxslt'
  95. 'libtxc_dxtn' 'lib32-libtxc_dxtn'
  96. 'libva' 'lib32-libva'
  97. 'gst-plugins-base-libs' 'lib32-gst-plugins-base-libs'
  98. 'vulkan-icd-loader' 'lib32-vulkan-icd-loader'
  99. 'cups'
  100. 'samba'
  101. 'dosbox'
  102. )
  103. # lib32-libtxc_dxtn
  104. # 'gtk3' 'lib32-gtk3'
  105. options=('staticlibs')
  106. source=(wine-git::'git://source.winehq.org/git/wine.git'
  107. '30-win32-aliases.conf'
  108. )
  109. if [[ $(find ./custom_patches -mindepth 1 -maxdepth 1 -name "*.patch") ]]; then
  110. cp ./custom_patches/*.patch ./
  111. let p=0
  112. for patch in $(find . -mindepth 1 -maxdepth 1 -name "*.patch"); do
  113. patches[$p]="$(basename ${patch})"
  114. let p++
  115. done
  116. unset p
  117. source+=(${source[@]} ${patches[@]})
  118. fi
  119. if [[ enable_staging -eq 1 ]]; then
  120. stagingsrc=wine-staging-git::'git://github.com/wine-staging/wine-staging.git'
  121. source+=($stagingsrc)
  122. fi
  123. if [[ "$CARCH" == "i686" ]]; then
  124. # Strip lib32 etc. on i686
  125. _depends=(${_depends[@]/*32-*/})
  126. makedepends=(${makedepends[@]/*32-*/} ${_depends[@]})
  127. makedepends=(${makedepends[@]/*-multilib*/})
  128. optdepends=(${optdepends[@]/*32-*/})
  129. else
  130. makedepends=(${makedepends[@]} ${_depends[@]})
  131. fi
  132. pkgver() {
  133. msg2 "Setting Wine versions..."
  134. if [[ enable_staging -eq 1 ]]; then
  135. cd "${srcdir}/wine-staging-git"
  136. _staging_tag="$(git tag | sort -Vr | head -n1 | sed 's/-/./g;s/^v//')"
  137. _staging_version="stg.$(git describe --long \
  138. | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//' \
  139. | sed "s/^latest.release/${_staging_tag}/")"
  140. fi
  141. cd "${srcdir}/wine-git"
  142. _wine_version="wine.$(git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g')"
  143. if [[ enable_staging -eq 1 ]]; then
  144. printf "%s+%s" "$_staging_version" "$_wine_version"
  145. else
  146. printf "%s" "$_wine_version"
  147. fi
  148. }
  149. prepare() {
  150. if [[ enable_staging -eq 1 ]]; then
  151. cd "$srcdir"/wine-git
  152. msg2 "Cleaning the wine source code tree..."
  153. # Restore the wine tree to its git origin state, without wine-staging patches
  154. #+(necessary for reapllying wine-staging patches in succedent builds,
  155. #+otherwise the patches will fail to be reapplied)
  156. git reset --hard HEAD # Restore tracked files
  157. git clean -d -x -f # Delete untracked files
  158. # Change back to the wine upstream commit that this version of wine-staging is based in
  159. git checkout $(../"$pkgname"/patches/patchinstall.sh --upstream-commit)
  160. fi
  161. }
  162. build() {
  163. cd "${srcdir}"
  164. # Delete old build dirs (from previous builds) and make new ones
  165. rm -rf "$pkgname"-{32,64}-build
  166. mkdir --parents "$pkgname"-32-build
  167. if [[ enable_staging -eq 1 ]]; then
  168. # Apply all wine-staging patches
  169. msg2 "Applying wine-staging patches..."
  170. ./wine-staging-git/patches/patchinstall.sh DESTDIR="${srcdir}/wine-git" \
  171. ${staging_patchsets[*]}
  172. fi
  173. if [[ $(ls "${srcdir}"/*.patch | wc -w) -ne 0 ]]; then
  174. cd "${srcdir}"/wine-git
  175. # Apply all custom patches
  176. msg2 "Applying custom patches..."
  177. for i in "${srcdir}"/*.patch; do
  178. patch -Np1 < ${i}
  179. done
  180. fi
  181. cd "${srcdir}"
  182. # Build wine 64-bit
  183. #+(according to the wine wiki this 64-bit/32-bit building order is mandatory)
  184. if [[ "$CARCH" = "x86_64" ]] && [[ enable_64 -eq 1 ]]; then
  185. msg2 "Building Wine-64..."
  186. mkdir --parents "$pkgname"-64-build
  187. cd "$pkgname"-64-build
  188. ../wine-git/configure \
  189. --with-x \
  190. --with-gstreamer \
  191. --enable-win64 \
  192. --with-xattr \
  193. --disable-mscoree \
  194. --with-vulkan \
  195. --prefix=/usr \
  196. --libdir=/usr/lib
  197. make
  198. _wine32opts=(
  199. --libdir=/usr/lib32
  200. --with-wine64="${srcdir}/${pkgname}-64-build"
  201. )
  202. export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
  203. fi
  204. # Build wine 32-bit
  205. if [[ enable_32 -eq 1 ]]; then
  206. msg2 "Building Wine-32..."
  207. cd "$srcdir"/"$pkgname"-32-build
  208. ../wine-git/configure \
  209. --with-x \
  210. --with-gstreamer \
  211. --with-xattr \
  212. --disable-mscoree \
  213. --with-vulkan \
  214. "${_wine32opts[@]}" \
  215. --prefix=/usr
  216. make
  217. fi
  218. if [[ ! enable_32 -eq 1 ]] && [[ ! enable_64 -eq 1 ]]; then
  219. msg2 "You must define at least one architecture in PKGBUILD! Aborting"
  220. exit 1
  221. fi
  222. }
  223. package() {
  224. depends=(${_depends[@]})
  225. # Package wine 32-bit
  226. #+(according to the wine wiki this reverse 32-bit/64-bit packaging order is important)
  227. if [[ $enable_32 -eq 1 ]]; then
  228. msg2 "Packaging Wine-32..."
  229. cd "$srcdir"/"$pkgname"-32-build
  230. if [ "$CARCH" = "i686" ]; then
  231. make prefix="$pkgdir/usr" install
  232. else
  233. make prefix="${pkgdir}/usr" \
  234. libdir="${pkgdir}/usr/lib32" \
  235. dlldir="${pkgdir}/usr/lib32/wine" install
  236. fi
  237. fi
  238. # Package wine 64-bit
  239. if [[ "$CARCH" == "x86_64" ]] && [[ enable_64 -eq 1 ]]; then
  240. msg2 "Packaging Wine-64..."
  241. cd "$srcdir"/"$pkgname"-64-build
  242. make prefix="${pkgdir}/usr" \
  243. libdir="${pkgdir}/usr/lib" \
  244. dlldir="${pkgdir}/usr/lib/wine" install
  245. if [[ enable_dxvk -eq 1 ]]; then
  246. mv "$srcdir"/dxvk-compiled/x64/{d3d11.dll,dxgi.dll} "${pkgdir}/usr/lib/wine/fakedlls/"
  247. chmod 644 "${pkgdir}/usr/lib/wine/fakedlls/"{d3d11.dll,dxgi.dll}
  248. mv "$srcdir"/dxvk-compiled/x32/{d3d11.dll,dxgi.dll} "${pkgdir}/usr/lib32/wine/fakedlls/"
  249. chmod 644 "${pkgdir}/usr/lib32/wine/fakedlls/"{d3d11.dll,dxgi.dll}
  250. fi
  251. fi
  252. # Font aliasing settings for Win32 applications
  253. install -d "$pkgdir"/etc/fonts/conf.{avail,d}
  254. install -m644 "${srcdir}/30-win32-aliases.conf" "${pkgdir}/etc/fonts/conf.avail"
  255. ln -s ../conf.avail/30-win32-aliases.conf "${pkgdir}/etc/fonts/conf.d/30-win32-aliases.conf"
  256. }
  257. md5sums=('SKIP'
  258. '1ff4e467f59409272088d92173a0f801'
  259. 'SKIP'
  260. '1ff4e467f59409272088d92173a0f801'
  261. '4228291253f5e94b793e5b0e6acab6a1'
  262. '16f24605c2f46404e4db1c89dbf307a6'
  263. '69169c9d32f51ec7af98570061261a2d'
  264. 'c11dfdfda50dc4c05d2f7ef8eef01e70'
  265. '958fcdea1a455786a22e09a6afc0adaf'
  266. '711c39eeb131ff30e2bfb68ea27d4040'
  267. '3474c0d9e65cefc223c0a43cd5b21ce1'
  268. 'f58a4e17b33bd96ce0d6e8325cad7f76'
  269. '18e99ddef0c5ae3bd1b03781ffb1d614'
  270. 'e833694fa978a26ad3254d43ca6127e1'
  271. 'SKIP')