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.

350 lines
10 KiB

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