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.

324 lines
10 KiB

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. # Apply all custom patches
  174. msg2 "Applying custom patches..."
  175. cd "${srcdir}"/wine-git
  176. for i in $srcdir/*.patch
  177. do
  178. patch -Np1 < $i
  179. done
  180. cd "${srcdir}"
  181. # Build wine 64-bit
  182. #+(according to the wine wiki this 64-bit/32-bit building order is mandatory)
  183. if [[ "$CARCH" = "x86_64" ]] && [[ enable_64 -eq 1 ]]; then
  184. msg2 "Building Wine-64..."
  185. mkdir --parents "$pkgname"-64-build
  186. cd "$pkgname"-64-build
  187. ../wine-git/configure \
  188. --with-x \
  189. --with-gstreamer \
  190. --enable-win64 \
  191. --with-xattr \
  192. --disable-mscoree \
  193. --with-vulkan \
  194. --prefix=/usr \
  195. --libdir=/usr/lib
  196. make
  197. _wine32opts=(
  198. --libdir=/usr/lib32
  199. --with-wine64="${srcdir}/${pkgname}-64-build"
  200. )
  201. export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
  202. fi
  203. # Build wine 32-bit
  204. if [[ enable_32 -eq 1 ]]; then
  205. msg2 "Building Wine-32..."
  206. cd "$srcdir"/"$pkgname"-32-build
  207. ../wine-git/configure \
  208. --with-x \
  209. --with-gstreamer \
  210. --with-xattr \
  211. --disable-mscoree \
  212. --with-vulkan \
  213. "${_wine32opts[@]}" \
  214. --prefix=/usr
  215. make
  216. fi
  217. if [[ ! enable_32 -eq 1 ]] && [[ ! enable_64 -eq 1 ]]; then
  218. msg2 "You must define at least one architecture in PKGBUILD! Aborting"
  219. exit 1
  220. fi
  221. }
  222. package() {
  223. depends=(${_depends[@]})
  224. # Package wine 32-bit
  225. #+(according to the wine wiki this reverse 32-bit/64-bit packaging order is important)
  226. if [[ $enable_32 -eq 1 ]]; then
  227. msg2 "Packaging Wine-32..."
  228. cd "$srcdir"/"$pkgname"-32-build
  229. if [ "$CARCH" = "i686" ]; then
  230. make prefix="$pkgdir/usr" install
  231. else
  232. make prefix="${pkgdir}/usr" \
  233. libdir="${pkgdir}/usr/lib32" \
  234. dlldir="${pkgdir}/usr/lib32/wine" install
  235. fi
  236. fi
  237. # Package wine 64-bit
  238. if [[ "$CARCH" == "x86_64" ]] && [[ enable_64 -eq 1 ]]; then
  239. msg2 "Packaging Wine-64..."
  240. cd "$srcdir"/"$pkgname"-64-build
  241. make prefix="${pkgdir}/usr" \
  242. libdir="${pkgdir}/usr/lib" \
  243. dlldir="${pkgdir}/usr/lib/wine" install
  244. if [[ enable_dxvk -eq 1 ]]; then
  245. mv "$srcdir"/dxvk-compiled/x64/{d3d11.dll,dxgi.dll} "${pkgdir}/usr/lib/wine/fakedlls/"
  246. chmod 644 "${pkgdir}/usr/lib/wine/fakedlls/"{d3d11.dll,dxgi.dll}
  247. mv "$srcdir"/dxvk-compiled/x32/{d3d11.dll,dxgi.dll} "${pkgdir}/usr/lib32/wine/fakedlls/"
  248. chmod 644 "${pkgdir}/usr/lib32/wine/fakedlls/"{d3d11.dll,dxgi.dll}
  249. fi
  250. fi
  251. # Font aliasing settings for Win32 applications
  252. install -d "$pkgdir"/etc/fonts/conf.{avail,d}
  253. install -m644 "${srcdir}/30-win32-aliases.conf" "${pkgdir}/etc/fonts/conf.avail"
  254. ln -s ../conf.avail/30-win32-aliases.conf "${pkgdir}/etc/fonts/conf.d/30-win32-aliases.conf"
  255. }
  256. md5sums=('SKIP'
  257. '1ff4e467f59409272088d92173a0f801'
  258. 'SKIP'
  259. '1ff4e467f59409272088d92173a0f801'
  260. '4228291253f5e94b793e5b0e6acab6a1'
  261. '16f24605c2f46404e4db1c89dbf307a6'
  262. '69169c9d32f51ec7af98570061261a2d'
  263. 'c11dfdfda50dc4c05d2f7ef8eef01e70'
  264. '958fcdea1a455786a22e09a6afc0adaf'
  265. '711c39eeb131ff30e2bfb68ea27d4040'
  266. '3474c0d9e65cefc223c0a43cd5b21ce1'
  267. 'f58a4e17b33bd96ce0d6e8325cad7f76'
  268. '18e99ddef0c5ae3bd1b03781ffb1d614'
  269. 'e833694fa978a26ad3254d43ca6127e1'
  270. 'SKIP')