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.

323 lines
10 KiB

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