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.

319 lines
9.9 KiB

  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.19.r9.g566cd55d+wine.wine.3.19.r220.g5e0d1c89ed
  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=(
  107. wine-git::'git://source.winehq.org/git/wine.git'
  108. '30-win32-aliases.conf'
  109. )
  110. if [[ $(find ./wine-patches -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$") ]]; then
  111. cp -r ./wine-patches/*.{patch,diff} ./
  112. p=0
  113. for patch in $(find . -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$"); do
  114. patches[$p]="$(basename ${patch})"
  115. let p++
  116. done
  117. unset p
  118. source+=(${source[@]} ${patches[@]})
  119. fi
  120. if [[ enable_staging -eq 1 ]]; then
  121. stagingsrc=wine-staging-git::'git://github.com/wine-staging/wine-staging.git'
  122. source+=($stagingsrc)
  123. fi
  124. if [[ "$CARCH" == "i686" ]]; then
  125. # Strip lib32 etc. on i686
  126. _depends=(${_depends[@]/*32-*/})
  127. makedepends=(${makedepends[@]/*32-*/} ${_depends[@]})
  128. makedepends=(${makedepends[@]/*-multilib*/})
  129. optdepends=(${optdepends[@]/*32-*/})
  130. else
  131. makedepends=(${makedepends[@]} ${_depends[@]})
  132. fi
  133. pkgver() {
  134. msg2 "Setting Wine versions..."
  135. if [[ enable_staging -eq 1 ]]; then
  136. cd "${srcdir}/wine-staging-git"
  137. _staging_tag="$(git tag | sort -Vr | head -n1 | sed 's/-/./g;s/^v//')"
  138. _staging_version="stg.$(git describe --long \
  139. | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//' \
  140. | sed "s/^latest.release/${_staging_tag}/")"
  141. fi
  142. cd "${srcdir}/wine-git"
  143. _wine_version="wine.$(git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g')"
  144. if [[ enable_staging -eq 1 ]]; then
  145. printf "%s+%s" "$_staging_version" "$_wine_version"
  146. else
  147. printf "%s" "$_wine_version"
  148. fi
  149. }
  150. prepare() {
  151. if [[ enable_staging -eq 1 ]]; then
  152. cd "$srcdir"/wine-git
  153. msg2 "Cleaning the wine source code tree..."
  154. # Restore the wine tree to its git origin state, without wine-staging patches
  155. #+(necessary for reapllying wine-staging patches in succedent builds,
  156. #+otherwise the patches will fail to be reapplied)
  157. git reset --hard HEAD # Restore tracked files
  158. git clean -d -x -f # Delete untracked files
  159. # Change back to the wine upstream commit that this version of wine-staging is based on
  160. git checkout $(../"$pkgname"/patches/patchinstall.sh --upstream-commit)
  161. fi
  162. }
  163. build() {
  164. cd "${srcdir}"
  165. # Delete old build dirs (from previous builds) and make new ones
  166. rm -rf "$pkgname"-{32,64}-build
  167. mkdir --parents "$pkgname"-32-build
  168. if [[ enable_staging -eq 1 ]]; then
  169. # Apply all wine-staging patches
  170. msg2 "Applying wine-staging patches..."
  171. ./wine-staging-git/patches/patchinstall.sh DESTDIR="${srcdir}/wine-git" \
  172. ${staging_patchsets[*]}
  173. fi
  174. if [[ $(ls "${srcdir}"/*.patch | wc -w) -ne 0 ]]; then
  175. cd "${srcdir}"/wine-git
  176. # Apply all custom patches
  177. msg2 "Applying custom patches..."
  178. for i in "${srcdir}"/*{.patch,diff}; do
  179. patch -Np1 < ${i}
  180. done
  181. fi
  182. cd "${srcdir}"
  183. # Build wine 64-bit
  184. #+(according to the wine wiki this 64-bit/32-bit building order is mandatory)
  185. if [[ "$CARCH" = "x86_64" ]] && [[ enable_64 -eq 1 ]]; then
  186. msg2 "Building Wine-64..."
  187. mkdir --parents "$pkgname"-64-build
  188. cd "$pkgname"-64-build
  189. ../wine-git/configure \
  190. --with-x \
  191. --with-gstreamer \
  192. --enable-win64 \
  193. --with-xattr \
  194. --disable-mscoree \
  195. --with-vulkan \
  196. --prefix=/usr \
  197. --libdir=/usr/lib
  198. make
  199. _wine32opts=(
  200. --libdir=/usr/lib32
  201. --with-wine64="${srcdir}/${pkgname}-64-build"
  202. )
  203. export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
  204. fi
  205. # Build wine 32-bit
  206. if [[ enable_32 -eq 1 ]]; then
  207. msg2 "Building Wine-32..."
  208. cd "$srcdir"/"$pkgname"-32-build
  209. ../wine-git/configure \
  210. --with-x \
  211. --with-gstreamer \
  212. --with-xattr \
  213. --disable-mscoree \
  214. --with-vulkan \
  215. "${_wine32opts[@]}" \
  216. --prefix=/usr
  217. make
  218. fi
  219. if [[ ! enable_32 -eq 1 ]] && [[ ! enable_64 -eq 1 ]]; then
  220. msg2 "You must define at least one architecture in PKGBUILD! Aborting"
  221. exit 1
  222. fi
  223. }
  224. package() {
  225. depends=(${_depends[@]})
  226. # Package wine 32-bit
  227. #+(according to the wine wiki this reverse 32-bit/64-bit packaging order is important)
  228. if [[ $enable_32 -eq 1 ]]; then
  229. msg2 "Packaging Wine-32..."
  230. cd "$srcdir"/"$pkgname"-32-build
  231. if [ "$CARCH" = "i686" ]; then
  232. make prefix="$pkgdir/usr" install
  233. else
  234. make prefix="${pkgdir}/usr" \
  235. libdir="${pkgdir}/usr/lib32" \
  236. dlldir="${pkgdir}/usr/lib32/wine" install
  237. fi
  238. fi
  239. # Package wine 64-bit
  240. if [[ "$CARCH" == "x86_64" ]] && [[ enable_64 -eq 1 ]]; then
  241. msg2 "Packaging Wine-64..."
  242. cd "$srcdir"/"$pkgname"-64-build
  243. make prefix="${pkgdir}/usr" \
  244. libdir="${pkgdir}/usr/lib" \
  245. dlldir="${pkgdir}/usr/lib/wine" install
  246. if [[ enable_dxvk -eq 1 ]]; then
  247. mv "$srcdir"/dxvk-compiled/x64/{d3d11.dll,dxgi.dll} "${pkgdir}/usr/lib/wine/fakedlls/"
  248. chmod 644 "${pkgdir}/usr/lib/wine/fakedlls/"{d3d11.dll,dxgi.dll}
  249. mv "$srcdir"/dxvk-compiled/x32/{d3d11.dll,dxgi.dll} "${pkgdir}/usr/lib32/wine/fakedlls/"
  250. chmod 644 "${pkgdir}/usr/lib32/wine/fakedlls/"{d3d11.dll,dxgi.dll}
  251. fi
  252. fi
  253. # Font aliasing settings for Win32 applications
  254. install -d "$pkgdir"/etc/fonts/conf.{avail,d}
  255. install -m644 "${srcdir}/30-win32-aliases.conf" "${pkgdir}/etc/fonts/conf.avail"
  256. ln -s ../conf.avail/30-win32-aliases.conf "${pkgdir}/etc/fonts/conf.d/30-win32-aliases.conf"
  257. }
  258. md5sums=('SKIP'
  259. '1ff4e467f59409272088d92173a0f801'
  260. 'SKIP'
  261. '1ff4e467f59409272088d92173a0f801'
  262. 'd41d8cd98f00b204e9800998ecf8427e'
  263. 'd41d8cd98f00b204e9800998ecf8427e'
  264. 'SKIP')