From ef52848be05a9f724f4949f6238b658c54c29bc3 Mon Sep 17 00:00:00 2001 From: Fincer Date: Sun, 11 Nov 2018 22:31:31 +0200 Subject: [PATCH] Rebuild the whole script --- README.md | 247 ++++++- arch/0-dxvk-git/PKGBUILD | 43 ++ arch/0-wine-staging-git/30-win32-aliases.conf | 20 + arch/0-wine-staging-git/PKGBUILD | 319 +++++++++ arch/updatewine_arch.sh | 369 ++++++++++ debian/dxvkroot/dxvkbuild.sh | 474 +++++++++++++ debian/playonlinux_prefixupdate.sh | 48 ++ debian/updatewine_debian.sh | 200 ++++++ debian/wineroot/winebuild.sh | 639 ++++++++++++++++++ debian_devpkgremoval.sh | 182 +++++ updatewine.sh | 518 +++++--------- .../put_your_wine_patches_here | 4 + .../put_disabled_wine_patches_here | 0 13 files changed, 2712 insertions(+), 351 deletions(-) create mode 100755 arch/0-dxvk-git/PKGBUILD create mode 100755 arch/0-wine-staging-git/30-win32-aliases.conf create mode 100755 arch/0-wine-staging-git/PKGBUILD create mode 100755 arch/updatewine_arch.sh create mode 100644 debian/dxvkroot/dxvkbuild.sh create mode 100644 debian/playonlinux_prefixupdate.sh create mode 100644 debian/updatewine_debian.sh create mode 100644 debian/wineroot/winebuild.sh create mode 100644 debian_devpkgremoval.sh mode change 100755 => 100644 updatewine.sh create mode 100644 wine_custom_patches/put_your_wine_patches_here create mode 100644 wine_disabled_patches/put_disabled_wine_patches_here diff --git a/README.md b/README.md index 663d7c6..2978485 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,253 @@ # pol-wine-dxvk -Automate installation of the newest DXVK + Wine Staging into all your PlayonLinux wineprefixes (Arch Linux) +Automate installation of the newest DXVK + Wine Staging, and optionally update all your PlayonLinux wineprefixes (Ubuntu/Mint/Arch Linux/Manjaro) -**IMPORTANT** Set your username correctly to _USER_ variable. This variable is defined at the beginning of `updatewine.sh` shell script. +## About -## Usage +This script bundle offers an easy-way solution to use the bleeding edge Wine Staging & DXVK packages system-wide on Ubuntu/Mint and Arch Linux based Linux distributions. -Run with sudo +## Motivation + +**Accessibility, lower the barrier.** My personal motivation to develop this script bundle was to lower the barried to people to get their hands on the latest bleeding-edge Wine / Wine Staging & DXVK versions on major Linux distribution platforms. + +I have seen that there is not a clear way to install Wine Staging Git & DXVK, especially on Ubuntu/Mint. Therefore, I decided someone has to do something, so this script bundle was born. + +Additionally, the benefits of the bleeding-edge Wine/Wine Staging & DXVK versions are quite limited at the moment. Wine Staging is not easily available on Debian-based Linux distributions, and DXVK is practically bundled to Lutris or Steam gaming platform as a form of Proton. We have to keep in mind that not all Windows programs are run under Steam on Linux but many programs are run via PlayOnLinux or without relying on any other third-party management software. + +The solution I provide here _is not bundled to any commercial or other Wine management platform_. The latest Wine Staging & DXVK bundle is available system-wide, not just Steam, Lutris or PlayOnLinux. + +---------------- + +## Requirements + +- Ubuntu, Mint or any other Linux distribution which uses `dpkg` and `àpt` for package management + + - pure Debian is not supported yet + +- Arch Linux, Manjaro or any other Linux distribution which uses `pacman` for package management + +- **Not listed as a hard dependency, but actually required by DXVK**: The latest Nvidia or AMD GPU drivers. Personally, I've used proprietary Nvidia drivers & AMDGPU (not AMDGPU Pro). + +---------------- + +## Why to compile from source? + +**Advantages:** +- packages are directly adapted to your system +- packages do not rely on PPAs which may be abandoned in time +- using Git sources provide the latest packages available publicly + +**Disadvantages:** +- takes time & CPU processing +- is unreliable in some cases, the script may break easily due to rapid DXVK development or distro changes +- may break working already-working versions of the packages (use `--no-install` parameter to avoid installation of DXVK & Wine) + +---------------- + +## Script usage + +For instructions, run: + +``` +bash updatewine.sh --help +``` + +on the main script folder. + +You can pass arguments like: + +``` +bash updatewine.sh --no-staging --no-install +``` + +All supported arguments are: + +- `--no-staging` = Build Wine instead of Wine Staging + +- `--no-install` = Do not install Wine or DXVK, just compile them. Note that Wine must be installed for DXVK compilation. + +- `--no-wine` = Do not compile or install Wine/Wine Staging + +- `--no-dxvk` = Do not compile or install DXVK + +- `--no-pol` = Do not update current user's PlayOnLinux Wine prefixes + +---------------- + +## Compiled packages are stored for later usage + +Successfully compiled Wine & DXVK packages are stored as follows: + +On Ubuntu/Mint: + +- `main script folder/debian/compiled_deb/` + +On Arch Linux: + +- `main script folder/arch/compiled_pkg/` + +The subfolders there are generated according to buildtime timestamp, known as `build identifier` + +## DXVK usage + +**NOTE:** DXVK must be installed before applying these steps! + +To enable DXVK on existing wineprefixes, just run + +``` +WINEPREFIX=/path/to/my/wineprefix setup_dxvk +``` + +`winetricks` is required for this command. + +## Add DXVK to PlayOnLinux Wine prefixes + +To install DXVK on specific PlayOnLinux wineprefix which uses a different than `system` version of Wine, apply the following command syntax: + +``` +WINEPREFIX="$HOME/.PlayOnLinux/wineprefix/myprefix" WINEPATH=$HOME/.PlayOnLinux/wine/{linux-amd64,linux-x86}/wineversion/bin" setup_dxvk +``` + +where you need to set either `linux-amd64` or `linux-x86` and set `wineversion` to match a real one, obviously. + +system-wide `winetricks` executable (`/usr/bin/winetricks`) is required for this command. + +### Uninstall temporary development packages (Ubuntu/Mint etc. only): + +Development packages can take extra space on your system so you may find useful to uninstall them. +This package comes with `debian_devpkgremoval.sh` script which is targeted for that purpose. +It uninstalls majority of Wine-Staging (Git), meson & glslang buildtime dependencies. + +To use `debian_devpkgremoval.sh`, simply run: + +``` +bash debian_devpkgremoval.sh +``` + +--------------------------- + +### EXAMPLES: + +**NOTE:** If `--no-install` option is given, the script doesn't check for PlayOnLinux Wine prefixes. + +**NOTE:** PlayOnLinux Wine prefixes is checked for current user only. + +**1)** Compile Wine Staging & DXVK, make and installable packages for them and install them : + +`bash updatewine.sh` + +**2)** Compile DXVK and make an installable package for it. Do not install: + +`bash updatewine.sh --no-wine --no-install` + +**3)** Compile Wine Staging and make and installable package for it. Do not install: + +`bash updatewine.sh --no-dxvk --no-install` + +**4)** Compile Wine and make and installable package for it. Do not install: + +`bash updatewine.sh --no-staging --no-dxvk --no-install` + +**5)** Compile Wine & DXVK, and make and installable packages for them. Do not install: + +`bash updatewine.sh --no-staging --no-install` + +**6)** Compile Wine Staging & DXVK, and make and installable packages for them. Do not install: + +`bash updatewine.sh --no-install` + +**7)** Compile Wine & DXVK, make and installable packages for them and install them : + +`bash updatewine.sh --no-staging` + +**8)** Compile Wine, make and installable packages for it. Install it, do not check PlayOnLinux wineprefixes: + +`bash updatewine.sh --no-staging --no-dxvk --no-pol` + +--------------------------- + +### NOTES + +**NOTE: Do not pause a virtual machine**. It is not recommended to run this script in a virtualized environment (Oracle VirtualBox, for instance) if you plan to `Pause` the virtual machine during script runtime. This causes an internal sudo validate loop to get nuts. In normal environments and in normal runtime cases, this doesn't happen. Validate loop is required to keep sudo permissions alive for the script since the execution time exceeds default system-wide sudo timeout limit. + +--------------------------- + +### Test-run validation + +This is validation test done for the script. This test is to ensure it works as expected. It is mandatory due to rapid development of the packages it handles. + +**Latest test-run:** 11th November, 2018 + +**Linux Distributions:** + +- Success: Arch Linux, Linux Mint 19 + +- Failure: Debian 9 (Wine), Ubuntu 18.04 (DXVK) + +#### Failure reasons: + +Debian: + + - conflicting amd64/i386 Wine build time dependency packages, must find workaround for this + + - no winetricks package + +Ubuntu 18.04: + +- during DXVK compilation, the following error appears: ``` -sudo bash ./updatewine.sh +... +[162/192] Compiling C++ object 'src/d3d11/src@d3d11@@d3d11@sha/d3d11_swapchain.cpp.obj'. +FAILED: src/d3d11/src@d3d11@@d3d11@sha/d3d11_swapchain.cpp.obj +x86_64-w64-mingw32-g++ -Isrc/d3d11/src@d3d11@@d3d11@sha -Isrc/d3d11 -I../../../../src/d3d11 -I../../../.././include -fdiagnostics-color=always -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++1z -O3 -DNOMINMAX -MD -MQ 'src/d3d11/src@d3d11@@d3d11@sha/d3d11_swapchain.cpp.obj' -MF 'src/d3d11/src@d3d11@@d3d11@sha/d3d11_swapchain.cpp.obj.d' -o 'src/d3d11/src@d3d11@@d3d11@sha/d3d11_swapchain.cpp.obj' -c ../../../../src/d3d11/d3d11_swapchain.cpp +{standard input}: Assembler messages: +{standard input}:3269: Warning: end of file not at end of a line; newline inserted +{standard input}: Error: open SEH entry at end of file (missing .seh_endproc) +x86_64-w64-mingw32-g++: internal compiler error: Killed (program cc1plus) +... + +``` + +or + +``` +... +[137/192] Compiling C++ object 'src/d3d11/src@d3d11@@d3d11@sha/d3d11_view_uav.cpp.obj'. +FAILED: src/d3d11/src@d3d11@@d3d11@sha/d3d11_view_uav.cpp.obj +x86_64-w64-mingw32-g++ -Isrc/d3d11/src@d3d11@@d3d11@sha -Isrc/d3d11 -I../../../../src/d3d11 -I../../../.././include -fdiagnostics-color=always -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++1z -O3 -DNOMINMAX -MD -MQ 'src/d3d11/src@d3d11@@d3d11@sha/d3d11_view_uav.cpp.obj' -MF 'src/d3d11/src@d3d11@@d3d11@sha/d3d11_view_uav.cpp.obj.d' -o 'src/d3d11/src@d3d11@@d3d11@sha/d3d11_view_uav.cpp.obj' -c ../../../../src/d3d11/d3d11_view_uav.cpp +x86_64-w64-mingw32-g++: internal compiler error: Killed (program cc1plus) +Please submit a full bug report, +with preprocessed source if appropriate. +See for instructions. +[144/192] Compiling C++ object 'src/d3d11/src@d3d11@@d3d11@sha/d3d11_context.cpp.obj'. +ninja: build stopped: subcommand failed. +... ``` -**NOTE:** All commands are executed as user (defined above). Only commands which require root permissions are ones which install packages wine-staging-git and dxvk into your system. +--------------------------- -All regular user commands have prefix 'cmd' in the main script. +### TODO -### Switches: +- Add support for pure Debian. Main issue is conflicting amd64/i386 Wine buildtime packages -**--refresh** + - Workaround must be found, maybe split single Wine deb package into two, with suffixes amd64 & i386? -- Check for new Staging/DXVK releases, update PoL Wine prefixes if needed + - For pure Debian, package 'winetricks' must be compiled, too -- Does a comparison between local & remote git repos +- Add compilation scripts for the latest AMDGPU & Nvidia drivers on Arch Linux/Debian/Ubuntu/Mint -**--check** +- Remove temp folders in case of failure (meson/glslang/dxvk-git/wine... temp build folders) -- Check for new Staging/DXVK releases +- Add support for custom DXVK patches -- Does a comparison between local & remote git repos +- Better handling for sudo validation loop function -**--force** + - may cause the terminal output to get nuts -- Force Wine Staging & DXVK installation + - when interrupting the script, the exit functionality may not be handled correctly? --------------------------- ### LICENSE -This repository uses GPLv3 license. See [LICENSE](https://github.com/Fincer/pol-wine-dxvk/blob/master/LICENSE) for details. +This repository uses GPLv3 license. See [LICENSE](LICENSE) for details. diff --git a/arch/0-dxvk-git/PKGBUILD b/arch/0-dxvk-git/PKGBUILD new file mode 100755 index 0000000..34dae14 --- /dev/null +++ b/arch/0-dxvk-git/PKGBUILD @@ -0,0 +1,43 @@ +# Maintainer: Adrià Cereto i Massagué +# Contributor: Pekka Helenius + +pkgname=dxvk-git +_pkgname=dxvk +pkgver=0.91.21 +pkgrel=1 + +arch=('i686' 'x86_64') +conflicts=("dxvk-win64-bin") +provides=("dxvk" "dxvk64") +depends=('vulkan-icd-loader' 'wine' 'winetricks') +conflicts=("dxvk-git<$pkgver") + +pkgdesc="A Vulkan-based compatibility layer for Direct3D 10/11 which allows running 3D applications on Linux using Wine." +arch=('x86_64' 'i686') + +url="https://github.com/doitsujin/dxvk" +license=('custom:zlib/libpng') +makedepends=('ninja' 'meson>=0.43' 'glslang' 'mingw-w64-gcc' 'git' 'wine') +options=(!strip !buildflags staticlibs) +source=(${pkgname}::"git+https://github.com/doitsujin/dxvk.git") +sha256sums=('SKIP') + +pkgver() { + cd "${pkgname}" + git describe --long | sed 's/\-[a-z].*//; s/\-/\./; s/[a-z]//g' +} + +build() { + "${srcdir}/${pkgname}"/package-release.sh ${pkgver} "${srcdir}"/build --no-package +} + +package() { + mkdir -p "${pkgdir}"/usr/{bin,share/dxvk} + cp -r "${srcdir}"/build/${_pkgname}-${pkgver}/* "${pkgdir}/usr/share/dxvk/" + + echo -e "#!/bin/sh\nwinetricks --force /usr/share/dxvk/setup_dxvk.verb" \ + > "${pkgdir}/usr/bin/setup_dxvk" + + chmod +x "${pkgdir}/usr/bin/setup_dxvk" +} + diff --git a/arch/0-wine-staging-git/30-win32-aliases.conf b/arch/0-wine-staging-git/30-win32-aliases.conf new file mode 100755 index 0000000..99ae1f7 --- /dev/null +++ b/arch/0-wine-staging-git/30-win32-aliases.conf @@ -0,0 +1,20 @@ + + + + + MS Shell Dlg + Microsoft Sans Serif + sans-serif + + + MS Shell Dlg 2 + Tahoma + sans-serif + + + + MS Sans Serif + Microsoft Sans Serif + sans-serif + + diff --git a/arch/0-wine-staging-git/PKGBUILD b/arch/0-wine-staging-git/PKGBUILD new file mode 100755 index 0000000..90f7bde --- /dev/null +++ b/arch/0-wine-staging-git/PKGBUILD @@ -0,0 +1,319 @@ +# Maintainer: Daniel Bermond < yahoo-com: danielbermond > +# Contributor: Pekka Helenius (~ Fincer) + +# Enable Wine Staging? 1 = yes +enable_staging=1 + +# Staging patchsets. Default: all patchsets. Please see Wine Staging patchinstall.sh file for individual patchset names. +staging_patchsets=(--all) # In order to disable all patchsets, use #(--all) and add desired patchsets individually here + +# Enable 32-bit compilation? 1 = yes +enable_32=1 + +# Enable 64-bit compilation? 1 = yes +enable_64=1 + +provides=('wine' 'wine-git' 'wine-staging' 'wine-staging-git' 'wine-staging-dxvk-git') + +if [[ enable_staging -eq 1 ]]; then + pkgname=wine-staging-git + pkgdesc="A compatibility layer for running Windows programs (staging branch, Git version)" + url="https://github.com/wine-staging/wine-staging/" + conflicts=('wine' 'wine-git' 'wine-staging') +else + pkgname=wine-git + pkgdesc="A compatibility layer for running Windows programs (Git version)" + url="https://source.winehq.org/git/wine.git/" + conflicts=('wine' 'wine-staging' 'wine-staging-git') + +fi + +pkgver=stg.3.19.r9.g566cd55d+wine.wine.3.19.r220.g5e0d1c89ed +pkgrel=1 +arch=('i686' 'x86_64') + +license=('LGPL') +_depends=( + 'attr' 'lib32-attr' + 'fontconfig' 'lib32-fontconfig' + 'lcms2' 'lib32-lcms2' + 'libxml2' 'lib32-libxml2' + 'libxcursor' 'lib32-libxcursor' + 'libxrandr' 'lib32-libxrandr' + 'libxdamage' 'lib32-libxdamage' + 'libxi' 'lib32-libxi' + 'gettext' 'lib32-gettext' + 'freetype2' 'lib32-freetype2' + 'glu' 'lib32-glu' + 'libsm' 'lib32-libsm' + 'gcc-libs' 'lib32-gcc-libs' + 'libpcap' 'lib32-libpcap' + 'desktop-file-utils' + 'vulkan-icd-loader' 'lib32-vulkan-icd-loader' +) +makedepends=( + 'git' + 'autoconf' + 'ncurses' + 'bison' + 'perl' + #'fontforge' + 'flex' + 'gcc>=4.5.0-2' + 'giflib' 'lib32-giflib' + 'libpng' 'lib32-libpng' + 'gnutls' 'lib32-gnutls' + 'libxinerama' 'lib32-libxinerama' + 'libxcomposite' 'lib32-libxcomposite' + 'libxmu' 'lib32-libxmu' + 'libxxf86vm' 'lib32-libxxf86vm' + 'libldap' 'lib32-libldap' + 'mpg123' 'lib32-mpg123' + 'openal' 'lib32-openal' + 'v4l-utils' 'lib32-v4l-utils' + 'alsa-lib' 'lib32-alsa-lib' + 'libxcomposite' 'lib32-libxcomposite' + 'mesa' 'lib32-mesa' + 'libgl' 'lib32-libgl' + 'opencl-icd-loader' 'lib32-opencl-icd-loader' + 'libxslt' 'lib32-libxslt' + 'libpulse' 'lib32-libpulse' + 'libva' 'lib32-libva' + 'gst-plugins-base-libs' 'lib32-gst-plugins-base-libs' + 'samba' + #'opencl-headers' + #'gcc-multilib>=4.5.0-2' +) +optdepends=( + 'giflib' 'lib32-giflib' + 'libpng' 'lib32-libpng' + 'libldap' 'lib32-libldap' + 'gnutls' 'lib32-gnutls' + 'mpg123' 'lib32-mpg123' + 'openal' 'lib32-openal' + 'v4l-utils' 'lib32-v4l-utils' + 'libpulse' 'lib32-libpulse' + 'alsa-plugins' 'lib32-alsa-plugins' + 'alsa-lib' 'lib32-alsa-lib' + 'libjpeg-turbo' 'lib32-libjpeg-turbo' + 'libxcomposite' 'lib32-libxcomposite' + 'libxinerama' 'lib32-libxinerama' + 'ncurses' 'lib32-ncurses' + 'opencl-icd-loader' 'lib32-opencl-icd-loader' + 'libxslt' 'lib32-libxslt' + 'libtxc_dxtn' 'lib32-libtxc_dxtn' + 'libva' 'lib32-libva' + 'gst-plugins-base-libs' 'lib32-gst-plugins-base-libs' + 'vulkan-icd-loader' 'lib32-vulkan-icd-loader' + 'cups' + 'samba' + 'dosbox' +) +# lib32-libtxc_dxtn +# 'gtk3' 'lib32-gtk3' +options=('staticlibs') + +source=( + wine-git::'git://source.winehq.org/git/wine.git' + '30-win32-aliases.conf' + ) + +if [[ $(find ./wine-patches -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$") ]]; then + cp -r ./wine-patches/*.{patch,diff} ./ + p=0 + for patch in $(find . -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$"); do + patches[$p]="$(basename ${patch})" + let p++ + done + unset p + source+=(${source[@]} ${patches[@]}) +fi + +if [[ enable_staging -eq 1 ]]; then + stagingsrc=wine-staging-git::'git://github.com/wine-staging/wine-staging.git' + source+=($stagingsrc) +fi + +if [[ "$CARCH" == "i686" ]]; then + # Strip lib32 etc. on i686 + _depends=(${_depends[@]/*32-*/}) + makedepends=(${makedepends[@]/*32-*/} ${_depends[@]}) + makedepends=(${makedepends[@]/*-multilib*/}) + optdepends=(${optdepends[@]/*32-*/}) +else + makedepends=(${makedepends[@]} ${_depends[@]}) +fi + +pkgver() { + + msg2 "Setting Wine versions..." + if [[ enable_staging -eq 1 ]]; then + cd "${srcdir}/wine-staging-git" + _staging_tag="$(git tag | sort -Vr | head -n1 | sed 's/-/./g;s/^v//')" + _staging_version="stg.$(git describe --long \ + | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//' \ + | sed "s/^latest.release/${_staging_tag}/")" + fi + + cd "${srcdir}/wine-git" + _wine_version="wine.$(git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g')" + + if [[ enable_staging -eq 1 ]]; then + printf "%s+%s" "$_staging_version" "$_wine_version" + else + printf "%s" "$_wine_version" + fi +} + +prepare() { + + if [[ enable_staging -eq 1 ]]; then + cd "$srcdir"/wine-git + + msg2 "Cleaning the wine source code tree..." + + # Restore the wine tree to its git origin state, without wine-staging patches + #+(necessary for reapllying wine-staging patches in succedent builds, + #+otherwise the patches will fail to be reapplied) + git reset --hard HEAD # Restore tracked files + git clean -d -x -f # Delete untracked files + + # Change back to the wine upstream commit that this version of wine-staging is based on + git checkout $(../"$pkgname"/patches/patchinstall.sh --upstream-commit) + fi +} + +build() { + cd "${srcdir}" + + # Delete old build dirs (from previous builds) and make new ones + rm -rf "$pkgname"-{32,64}-build + mkdir --parents "$pkgname"-32-build + + if [[ enable_staging -eq 1 ]]; then + # Apply all wine-staging patches + msg2 "Applying wine-staging patches..." + ./wine-staging-git/patches/patchinstall.sh DESTDIR="${srcdir}/wine-git" \ + ${staging_patchsets[*]} + fi + + if [[ $(ls "${srcdir}"/*.patch | wc -w) -ne 0 ]]; then + + cd "${srcdir}"/wine-git + # Apply all custom patches + msg2 "Applying custom patches..." + + for i in "${srcdir}"/*{.patch,diff}; do + patch -Np1 < ${i} + done + fi + + cd "${srcdir}" + + # Build wine 64-bit + #+(according to the wine wiki this 64-bit/32-bit building order is mandatory) + + if [[ "$CARCH" = "x86_64" ]] && [[ enable_64 -eq 1 ]]; then + msg2 "Building Wine-64..." + + mkdir --parents "$pkgname"-64-build + cd "$pkgname"-64-build + + ../wine-git/configure \ + --with-x \ + --with-gstreamer \ + --enable-win64 \ + --with-xattr \ + --disable-mscoree \ + --with-vulkan \ + --prefix=/usr \ + --libdir=/usr/lib + make + + _wine32opts=( + --libdir=/usr/lib32 + --with-wine64="${srcdir}/${pkgname}-64-build" + ) + + export PKG_CONFIG_PATH="/usr/lib32/pkgconfig" + fi + + # Build wine 32-bit + + if [[ enable_32 -eq 1 ]]; then + msg2 "Building Wine-32..." + + cd "$srcdir"/"$pkgname"-32-build + + ../wine-git/configure \ + --with-x \ + --with-gstreamer \ + --with-xattr \ + --disable-mscoree \ + --with-vulkan \ + "${_wine32opts[@]}" \ + --prefix=/usr + make + fi + + if [[ ! enable_32 -eq 1 ]] && [[ ! enable_64 -eq 1 ]]; then + msg2 "You must define at least one architecture in PKGBUILD! Aborting" + exit 1 + fi +} + +package() { + depends=(${_depends[@]}) + + # Package wine 32-bit + #+(according to the wine wiki this reverse 32-bit/64-bit packaging order is important) + + if [[ $enable_32 -eq 1 ]]; then + + msg2 "Packaging Wine-32..." + + cd "$srcdir"/"$pkgname"-32-build + + if [ "$CARCH" = "i686" ]; then + + make prefix="$pkgdir/usr" install + + else + make prefix="${pkgdir}/usr" \ + libdir="${pkgdir}/usr/lib32" \ + dlldir="${pkgdir}/usr/lib32/wine" install + fi + fi + + # Package wine 64-bit + + if [[ "$CARCH" == "x86_64" ]] && [[ enable_64 -eq 1 ]]; then + msg2 "Packaging Wine-64..." + + cd "$srcdir"/"$pkgname"-64-build + + make prefix="${pkgdir}/usr" \ + libdir="${pkgdir}/usr/lib" \ + dlldir="${pkgdir}/usr/lib/wine" install + + if [[ enable_dxvk -eq 1 ]]; then + mv "$srcdir"/dxvk-compiled/x64/{d3d11.dll,dxgi.dll} "${pkgdir}/usr/lib/wine/fakedlls/" + chmod 644 "${pkgdir}/usr/lib/wine/fakedlls/"{d3d11.dll,dxgi.dll} + mv "$srcdir"/dxvk-compiled/x32/{d3d11.dll,dxgi.dll} "${pkgdir}/usr/lib32/wine/fakedlls/" + chmod 644 "${pkgdir}/usr/lib32/wine/fakedlls/"{d3d11.dll,dxgi.dll} + fi + + fi + + # Font aliasing settings for Win32 applications + install -d "$pkgdir"/etc/fonts/conf.{avail,d} + install -m644 "${srcdir}/30-win32-aliases.conf" "${pkgdir}/etc/fonts/conf.avail" + ln -s ../conf.avail/30-win32-aliases.conf "${pkgdir}/etc/fonts/conf.d/30-win32-aliases.conf" +} +md5sums=('SKIP' + '1ff4e467f59409272088d92173a0f801' + 'SKIP' + '1ff4e467f59409272088d92173a0f801' + 'd41d8cd98f00b204e9800998ecf8427e' + 'd41d8cd98f00b204e9800998ecf8427e' + 'SKIP') diff --git a/arch/updatewine_arch.sh b/arch/updatewine_arch.sh new file mode 100755 index 0000000..ba311fc --- /dev/null +++ b/arch/updatewine_arch.sh @@ -0,0 +1,369 @@ +#!/bin/bash + +# Set up Wine Staging + DXVK on Arch Linux & Variants +# Copyright (C) 2018 Pekka Helenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +######################################################## + +# DO NOT RUN INDIVIDUALLY, ONLY VIA ../updatewine.sh PARENT SCRIPT! + +######################################################## + +datedir="${1}" + +######################################################## + +# http://wiki.bash-hackers.org/snipplets/print_horizontal_line#a_line_across_the_entire_width_of_the_terminal +function INFO_SEP() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - ; } + +######################################################## + +# Parse input arguments + +i=0 +for arg in ${@:2}; do + args[$i]="${arg}" + let i++ +done +# Must be a true array as defined above, not a single index list! +#args="${@:2}" + +for check in ${args[@]}; do + + case ${check} in + --no-staging) + NO_STAGING= + ;; + --no-install) + NO_INSTALL= + # Do not check for PlayOnLinux wine prefixes + NO_POL= + ;; + --no-wine) + NO_WINE= + ;; + --no-dxvk) + NO_DXVK= + ;; + --no-pol) + NO_POL= + ;; + esac + +done + +########################################################### + +ARCH_BUILDROOT="${PWD}" + +function Arch_intCleanup() { + rm -rf ${ARCH_BUILDROOT}/{0-wine-staging-git/{wine-patches,*.tar.xz},0-dxvk-git/{dxvk-git,*.tar.xz}} + exit 0 +} + +# Allow interruption of the script at any time (Ctrl + C) +trap "Arch_intCleanup" INT + +########################################################### + +function ccacheCheck() { + if [[ $(pacman -Q | awk '{print $1}' | grep -wE "ccache" | wc -l) -eq 0 ]]; then + echo -e "NOTE: Please consider using 'ccache' for faster compilation times.\nInstall it by typing 'sudo pacman -S ccache'\n" + fi +} + +########################################################### + +# Validate all files exist + +function checkFiles() { + + local wine_files=('30-win32-aliases.conf' 'PKGBUILD') + local dxvk_files=('PKGBUILD') + + function validatefiles() { + + local list=${1} + local name=${2} + local path=${3} + + for file in ${list[@]}; do + if [[ ! -f "${path}/${file}" ]]; then + echo -e "Could not locate file ${} for ${name}. Aborting\n" + exit 1 + fi + done + + } + + if [[ ! -v NO_WINE ]]; then + validatefiles "${wine_files[*]}" Wine "${ARCH_BUILDROOT}/0-wine-staging-git" + fi + + if [[ ! -v NO_DXVK ]]; then + validatefiles "${dxvk_files[*]}" DXVK "${ARCH_BUILDROOT}/0-dxvk-git" + fi + +} + +########################################################### + +# Disable or enable Wine Staging, depending on user's +# choice + +function checkStaging() { + + # Enable Wine Staging + if [[ ! -v NO_STAGING ]]; then + sed -i 's/enable_staging=[0-9]/enable_staging=1/' "${ARCH_BUILDROOT}/0-wine-staging-git/PKGBUILD" + wine_name="wine-staging-git" + + # Enable Wine, disable Staging + else + sed -i 's/enable_staging=[0-9]/enable_staging=0/' "${ARCH_BUILDROOT}/0-wine-staging-git/PKGBUILD" + wine_name="wine" + fi + +} + +########################################################### + +# Check package dependencies beforehand, just to avoid +# annoying situations which could occur later while the script +# is already running. + +# Just for "packages which are not found" array <=> ERRPKGS +# We need to set it outside of checkDepends function +# because it is a global variable for all checked packages +l=0 + +function checkDepends() { + + # The first and the second argument + local packagedir=${1} + local package=${2} + + # We get necessary variables to check from this file + local file="./${packagedir}/PKGBUILD" + + # All but the (zero), the first and the second argument + # We check the value of these file variables + local file_vars=${@:3} + + for var in ${file_vars[*]}; do + # Get the variable and set it as a new variable in the current shell + # This is applicable only to variable arrays! Do not use if the variable is not an array. + local field=$(awk "/^${var}/,/)/" ${file} | sed -r "s/^${var}=|[)|(|']//g") + + local i=0 + for parse in ${field[*]}; do + if [[ ! $parse =~ ^# ]]; then + local PKGS[$i]=$(printf '%s' $parse | sed 's/[=|>|<].*$//') + let i++ + fi + done + + # Sort list and delete duplicate index values + local PKGS=($(sort -u <<< "${PKGS[*]}")) + + for pkg in ${PKGS[*]}; do + + if [[ $(printf $(pacman -Q ${pkg} &>/dev/null)$?) -ne 0 ]]; then + ERRPKGS[$l]=${pkg} + echo -e "\e[91mError:\e[0m Dependency '${pkg}' not found, required by '${package}' (${file} => ${var})" + let l++ + fi + + done + + done + + echo -e "\e[92m==>\e[0m\e[1m Dependency check for ${package} done.\e[0m\n" +} + +function check_alldeps() { + + if [[ -v ERRPKGS ]]; then + echo -e "The following dependencies are missing:\n\e[91m\ +$(for o in ${ERRPKGS[@]}; do printf '%s\n' ${o}; done)\ +\e[0m\n" + exit 1 + fi + +} + +########################################################### + +function prepare_env() { + + # Copy Wine patch files + cp -rf ${ARCH_BUILDROOT}/../wine_custom_patches ${ARCH_BUILDROOT}/0-wine-staging-git/wine-patches + + # Create identifiable directory for this build + mkdir -p ${ARCH_BUILDROOT}/compiled_pkg/"${datedir}" + +} + +########################################################### + +# Remove any existing pkg,src or tar.xz packages left by previous pacman commands + +function cleanUp() { + rm -rf ${ARCH_BUILDROOT}/*/{pkg,src,*.tar.xz} + rm -rf ${ARCH_BUILDROOT}/0-wine-staging-git/{*.patch} +} + +########################################################### + +function build_pkg() { + + local pkgname=${1} + local pkgname_friendly={2} + local pkgdir=${3} + local cleanlist=${4} + + # Create package and install it to the system + cd "${ARCH_BUILDROOT}"/${pkgdir} + bash -c "updpkgsums && makepkg" + + # After successful compilation... + if [[ $(ls ${pkgname}-*tar.xz | wc -l) -ne 0 ]]; then + + if [[ ! -v NO_INSTALL ]]; then + yes | sudo pacman -U ${pkgname}-*.tar.xz + fi + + mv ${pkgname}-*.tar.xz ${ARCH_BUILDROOT}/compiled_pkg/${datedir}/ && \ + echo -e "\nCompiled ${pkgname_friendly} is stored at '$(readlink -f ${ARCH_BUILDROOT}/compiled_pkg/${datedir}/)/'\n" + for rml in ${cleanlist[*]}; do + rm -rf "${ARCH_BUILDROOT}/${pkgdir}/${rml}" + done + + else + echo -e "Error occured while compliling ${pkgname} from source.\n" + for rml in ${cleanlist[*]}; do + rm -rf "${ARCH_BUILDROOT}/${pkgdir}/${rml}" + done + exit 1 + fi + + cd "${ARCH_BUILDROOT}" + +} + +########################################################## + +function updatePOL() { + + # Check whether we will update user's PoL wine prefixes + if [[ ! -v NO_POL ]]; then + # Check existence of PoL default folder in user's homedir + if [[ ! -d "$HOME/PlayOnLinux" ]]; then + echo -e "Warning. Couldn't find PoL directories in the user's $USERNAME homedir.\n" + return 0 + fi + fi + + + if [[ ! -v NO_WINE ]]; then + # If a new Wine Staging version was installed and 'System' version of Wine has been used in + # PoL wineprefix configurations, update those existing PoL wineprefixes + for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do + if [[ -d ${wineprefix}/dosdevices ]]; then + + # If VERSION string exists, skip updating that prefix. + if [[ $(printf $(grep -ril "VERSION" ${wineprefix}/playonlinux.cfg &> /dev/null)$?) -ne 0 ]]; then + WINEPREFIX=${wineprefix} wineboot -u + fi + fi + done + fi + + if [[ ! -v NO_DXVK ]]; then + for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do + if [[ -d ${wineprefix}/dosdevices ]]; then + WINEPREFIX=${wineprefix} setup_dxvk + fi + done + fi + +} + +########################################################## + +# Clean these temporary folders & files files + +# TODO Shall we remove git folders or keep them? + +dxvk_cleanlist=('pkg' 'src' '*.tar.xz') # dxvk-git +wine_cleanlist=('*.patch' '*.diff' 'pkg' 'src' 'wine-patches' '*.tar.xz') # wine-*git + +########################################################## + +# Validate all buildtime files +checkFiles + +# Check whether we build Wine or Wine Staging +checkStaging + +# Check whether we have ccache installed +ccacheCheck + +# Prepare building environment: copy patches and create timestamped folder for compiled packages +prepare_env + +# Clean all previous trash we may have +cleanUp + +######################### + +# Check Wine & DXVK dependencies, depending on whether these packages +# are to be built + +echo -e "\e[1mINFO:\e[0m Checking dependencies for packages.\n" + +if [[ ! -v NO_WINE ]]; then + checkDepends "0-wine-staging-git" "${wine_name}" _depends makedepends +fi + +if [[ ! -v NO_DXVK ]]; then + checkDepends "0-dxvk-git" "dxvk-git" depends makedepends +fi + +check_alldeps + +######################### + +# Compile Wine & DXVK, depending on whether these packages +# are to be built + +if [[ ! -v NO_WINE ]]; then + build_pkg wine "${wine_name}" "0-wine-staging-git" "${wine_cleanlist[*]}" +fi + +if [[ ! -v NO_DXVK ]]; then + build_pkg dxvk DXVK "0-dxvk-git" "${dxvk_cleanlist[*]}" +fi + +######################### + +# Update user's PlayonLinux wine prefixes if needed + +if [[ ! -v NO_POL ]]; then + echo -e "Updating your PlayOnLinux Wine prefixes.\n" + updatePOL +fi + diff --git a/debian/dxvkroot/dxvkbuild.sh b/debian/dxvkroot/dxvkbuild.sh new file mode 100644 index 0000000..e8c5fa2 --- /dev/null +++ b/debian/dxvkroot/dxvkbuild.sh @@ -0,0 +1,474 @@ +#!/bin/env bash + +# Compile DXVK git on Debian/Ubuntu/Mint and variants +# Copyright (C) 2018 Pekka Helenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +########################################################### + +# DO NOT RUN INDIVIDUALLY, ONLY VIA ../../updatewine.sh PARENT SCRIPT! + +######################################################## + +datedir="${1}" +DXVKROOT="${PWD}" + +########################################################### + +# Parse input arguments + +i=0 +for arg in ${@:2}; do + args[$i]="${arg}" + let i++ +done +# Must be a true array as defined above, not a single index list! +#args="${@:2}" + +for check in ${args[@]}; do + + case ${check} in + --no-install) + NO_INSTALL= + ;; + --updateoverride) + updateoverride= + ;; + esac + +done + +########################################################### + +# Some version of Wine must be found in the system +# Warn the user + +function wineCheck() { + if [[ ! $(which wine 2>/dev/null) ]]; then + echo -e "Warning: You must have Wine installed before DXVK can be compiled.\n" + fi +} + +wineCheck + +########################################################### + +function DXVK_intCleanup() { + rm -rf ${DXVKROOT}/{dxvk-git,meson,glslang} + rm -rf ${DXVKROOT}/../compiled_deb/"${datedir}" + exit 0 +} + +# Allow interruption of the script at any time (Ctrl + C) +trap "DXVK_intCleanup" INT + +######################################################## + +# http://wiki.bash-hackers.org/snipplets/print_horizontal_line#a_line_across_the_entire_width_of_the_terminal +function INFO_SEP() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - ; } + +######################################################## + +# Universal core dependencies +_coredeps=('dh-make' 'make' 'gcc' 'build-essential' 'fakeroot') + +################################## + +function customReqs() { + + if [[ -v updateoverride ]]; then + echo -en "Updating package databases." && \ + if [[ $(printf $(sudo -n uptime &>/dev/null)$?) -ne 0 ]]; then printf " Please provide your sudo password.\n"; else printf "\n\n"; fi + sudo apt update + fi + + for cmd in git tar wget; do + if [[ $(printf $(which ${cmd} &> /dev/null)$?) -ne 0 ]]; then + echo -e "Missing ${cmd}. Installing...\n" + sudo apt update && sudo apt install -y ${cmd} + fi + done + + for coredep in ${_coredeps[@]}; do + + local coredep=$(printf ${coredep} | sed 's/\+/\\\+/g') + + if [[ $(apt version ${coredep} | wc -w) -eq 0 ]]; then + echo -e "Installing core dependency $(printf ${coredep} | sed 's/\\//g').\n" + sudo apt install -y ${coredep} + if [[ $? -ne 0 ]]; then + echo -e "Could not install ${coredep}. Aborting.\n" + exit 1 + fi + fi + done + +} + +customReqs + +################################## + +function pkgcompilecheck() { + + local pkg=$(printf ${1} | sed 's/\+/\\\+/g') + + if [[ $(dpkg --get-selections | awk '{print $1}' | grep -wE "^${pkg}$" | wc -l) -eq 0 ]] || [[ -v updateoverride ]]; then + ${2} + fi + +} + +################################################### + +function preparepackage() { + + echo -e "Starting compilation (& installation) of ${1}\n" + + local a=0 + local _pkgname=${1} + local _pkgdeps=${2} + local _pkgurl=${3} + local _pkgver=${4} + if [[ -n ${5} ]]; then local _pkgdeps_runtime=${5}; fi + + function pkgdependencies() { + + for pkgdep in ${@}; do + + if [[ $(apt version ${pkgdep} | wc -w) -eq 0 ]]; then + + echo -e "Installing ${_pkgname} dependency ${pkgdep} ($(($a + 1 )) / $((${#*} + 1)))\n." + sudo apt install -y ${pkgdep} &> /dev/null + if [[ $? -eq 0 ]]; then + let a++ + else + echo -e "\nError occured while installing ${pkgdep}. Aborting.\n" + exit 1 + fi + fi + done + + } + + function pkgversion() { + + if [[ -n "${_pkgver}" ]] && [[ "${_pkgver}" =~ ^git ]]; then + cd ${_pkgname} + _pkgver=$(eval "${_pkgver}") + cd .. + fi + + } + + function pkgfoldername() { + + rm -rf ${_pkgname} + mkdir ${_pkgname} + cd ${_pkgname} + echo -e "Retrieving source code of ${_pkgname} from $(printf ${_pkgurl} | sed 's/^.*\/\///; s/\/.*//')\n" + git clone ${_pkgurl} ${_pkgname} + + pkgversion && \ + mv ${_pkgname} ${_pkgname}-${_pkgver} + cd ${_pkgname}-${_pkgver} + } + + pkgdependencies "${_pkgdeps[*]}" && \ + if [[ -v _pkgdeps_runtime ]]; then pkgdependencies "${_pkgdeps_runtime[*]}"; fi + pkgfoldername + + unset _pkgver + +} + +################################################### + +function meson_install_main() { + + local pkgname="meson" + + local pkgdeps_build=( + 'python3' + 'dh-python' + 'python3-setuptools' + 'ninja-build' + ) + +<= 11)/debhelper (>= 10)/' debian/control + + sed -ir "s/0\.45\.1-2/${sedversion}/" debian/changelog + + sed -ir '/rm \$\$(pwd)\/debian\/meson\/usr\/bin\/mesontest/d' debian/rules + sed -ir '/rm \$\$(pwd)\/debian\/meson\/usr\/bin\/mesonconf/d' debian/rules + sed -ir '/rm \$\$(pwd)\/debian\/meson\/usr\/bin\/mesonintrospect/d' debian/rules + sed -ir '/rm \$\$(pwd)\/debian\/meson\/usr\/bin\/wraptool/d' debian/rules + + sed -ir '/rm \-rf \$\$(pwd)\/debian\/meson\/usr\/lib\/python3/d' debian/rules + + + + #sed -ir "s/0\.45\.1-2/${sedversion}/" debian/files + #sed -ir "s/0\.45\.1-2/${sedversion}/" debian/meson/DEBIAN/control + rm -r debian/patches + + # Compile the package and actually install it. It is required by DXVK + DEB_BUILD_OPTIONS="strip nodocs noddebs" dpkg-buildpackage -rfakeroot -b -us -uc + + if [[ $? -eq 0 ]]; then + rm -rf ../*.{changes,buildinfo,tar.xz} && \ + sudo dpkg -i ../${pkgname}*.deb && \ + mv ../${pkgname}*.deb ../../../compiled_deb/"${datedir}" && \ + echo -e "Compiled ${pkgname} is stored at '$(readlink -f ../../../compiled_deb/"${datedir}")/'\n" + cd ../.. + rm -rf ${pkgname} + else + exit 1 + fi + + } + + preparepackage "${pkgname}" "${pkgdeps_build[*]}" "${pkgurl}" "${pkgver_git}" && \ + meson_debianbuild + +} + +################################################### + +function glslang_install_main() { + + local pkgname="glslang" + local pkgdeps_build=('cmake' 'python2.7') + + local pkgurl="https://github.com/KhronosGroup/glslang" + + local pkgver_git="git describe --long | sed 's/\-[a-z].*//; s/\-/\./; s/[a-z]//g'" + + function glslang_debianbuild() { + + # Compile the package and actually install it. It is required by DXVK + dh_make --createorig -s -y + sed -ie "s/^Build-Depends:.*$/Build-Depends: debhelper (>=10), $(echo ${_coredeps[*]} | sed 's/\s/, /g'), $(echo ${pkgdeps_build[*]} | sed 's/\s/, /g')/g" debian/control + printf 'override_dh_usrlocal:' | tee -a debian/rules + DEB_BUILD_OPTIONS="strip nodocs noddebs" dpkg-buildpackage -rfakeroot -b -us -uc + + if [[ $? -eq 0 ]]; then + rm -rf ../*.{changes,buildinfo,tar.xz} && \ + sudo dpkg -i ../${pkgname}*.deb && \ + mv ../${pkgname}*.deb ../../../compiled_deb/"${datedir}" && \ + echo -e "Compiled ${pkgname} is stored at '$(readlink -f ../../../compiled_deb/"${datedir}")/'\n" + cd ../.. + rm -rf ${pkgname} + else + exit 1 + fi + + } + + preparepackage "${pkgname}" "${pkgdeps_build[*]}" "${pkgurl}" "${pkgver_git}" && \ + glslang_debianbuild + +} + +################################################### + +function dxvk_install_main() { + + local pkgname="dxvk-git" + + local pkgdeps_build=( + 'meson' + 'glslang' + 'gcc-mingw-w64-x86-64' + 'gcc-mingw-w64-i686' + 'g++-mingw-w64-x86-64' + 'g++-mingw-w64-i686' + 'mingw-w64-x86-64-dev' + 'mingw-w64-i686-dev' + ) + + local pkgdeps_runtime=('wine' 'winetricks') + + local pkgver_git="git describe --long | sed 's/\-[a-z].*//; s/\-/\./; s/[a-z]//g'" + + local pkgurl="https://github.com/doitsujin/dxvk" + + function dxvk_posixpkgs() { + + local packages=( + 'i686-w64-mingw32-g++' + 'i686-w64-mingw32-gcc' + 'x86_64-w64-mingw32-g++' + 'x86_64-w64-mingw32-gcc' + ) + + for package in "${packages[@]}"; do + local option=$(echo "" | sudo update-alternatives --config "${package}" | grep posix | sed 's@^[^0-9]*\([0-9]\+\).*@\1@') + echo "${option}" | sudo update-alternatives --config "${package}" &> /dev/null + done + + } + + function dxvk_debianbuild() { + + local dxvx_relative_builddir="debian/source/dxvk-master" + + dh_make --createorig -s -y + sed -ie "s/^Build-Depends:.*$/Build-Depends: debhelper (>=10), $(echo ${_coredeps[*]} | sed 's/\s/, /g'), $(echo ${pkgdeps_build[*]} | sed 's/\s/, /g')/g" debian/control + sed -ie "s/^Depends:.*$/Depends: $(echo ${pkgdeps_runtime} | sed 's/\s/, /g')/g" debian/control + + printf "${dxvx_relative_builddir}/setup_dxvk.verb usr/share/dxvk/" > debian/install + printf "\n${dxvx_relative_builddir}/bin/* usr/bin/" >> debian/install + + rm debian/*.{ex,EX} + +cat << 'DXVK-DEBIANRULES' > debian/rules +#!/usr/bin/make -f +%: + dh $@ + +override_dh_auto_configure: + +override_dh_usrlocal: +DXVK-DEBIANRULES + + bash ./package-release.sh master debian/source/ --no-package + + if [[ $? -ne 0 ]]; then + echo "Error while compiling ${pkgname}. Check messages above. Aborting\n" + exit 1 + fi + + sed -ir '/dxvk64_dir/d' ${dxvx_relative_builddir}/setup_dxvk.verb + + mkdir -p ${dxvx_relative_builddir}/bin + + echo -e "#!/bin/sh\nwinetricks --force /usr/share/dxvk/setup_dxvk.verb" \ + > "${dxvx_relative_builddir}/bin/setup_dxvk" + chmod +x "${dxvx_relative_builddir}/bin/setup_dxvk" + + for arch in 64 32; do + mkdir -p ${dxvx_relative_builddir}/x${arch} + + printf "\n${dxvx_relative_builddir}/x${arch}/* usr/share/dxvk/x${arch}/" >> debian/install + + done + + DEB_BUILD_OPTIONS="strip nodocs noddebs" dpkg-buildpackage -us -uc -b --source-option=--include-binaries + + if [[ $? -eq 0 ]]; then + + if [[ ! -v NO_INSTALL ]]; then + sudo dpkg -i ../${pkgname}*.deb + fi + + rm -rf ../*.{changes,buildinfo,tar.xz} + mv ../${pkgname}*.deb ../../../compiled_deb/"${datedir}" && \ + echo -e "Compiled ${pkgname} is stored at '$(readlink -f ../../../compiled_deb/"${datedir}")/'\n" + cd ../.. + rm -rf ${pkgname} + else + exit 1 + fi + } + + preparepackage "${pkgname}" "${pkgdeps_build[*]}" "${pkgurl}" "${pkgver_git}" "${pkgdeps_runtime[*]}" && \ + dxvk_posixpkgs && \ + dxvk_debianbuild + +} + +#################################################################### + +pkgcompilecheck meson meson_install_main +pkgcompilecheck glslang glslang_install_main +dxvk_install_main + diff --git a/debian/playonlinux_prefixupdate.sh b/debian/playonlinux_prefixupdate.sh new file mode 100644 index 0000000..bb56cfc --- /dev/null +++ b/debian/playonlinux_prefixupdate.sh @@ -0,0 +1,48 @@ +#!/bin/env bash + +# Update PoL Wine prefixes (DXVK & Wine Staging) on Debian/Ubuntu/Mint +# Copyright (C) 2018 Pekka Helenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +############################################################################## + +# Check existence of PoL default folder in user's homedir +if [[ ! -d "$HOME/.PlayOnLinux" ]]; then + echo "Warning. Couldn't find PoL directories in the user $USER homedir." + exit 0 +fi + +# Install dxvk-git to every PlayOnLinux wineprefix +if [[ $? -eq 0 ]] && [[ ! -v NOPOL ]]; then + for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do + if [[ -d ${wineprefix}/dosdevices ]]; then + WINEPREFIX=${wineprefix} setup_dxvk + fi + done +fi + +# If a new Wine Staging version was installed and 'System' version of Wine has been used in +# PoL wineprefix configurations, update those existing PoL wineprefixes +if [[ ! -v NOPOL ]]; then + for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do + if [[ -d ${wineprefix}/dosdevices ]]; then + + # If VERSION string exists, skip updating that prefix. + if [[ $(printf $(grep -ril "VERSION" ${wineprefix}/playonlinux.cfg &> /dev/null)$?) -ne 0 ]]; then + WINEPREFIX=${wineprefix} wineboot -u + fi + fi + done +fi diff --git a/debian/updatewine_debian.sh b/debian/updatewine_debian.sh new file mode 100644 index 0000000..ccae4ac --- /dev/null +++ b/debian/updatewine_debian.sh @@ -0,0 +1,200 @@ +#!/bin/env bash + +# Wrapper for DXVK & Wine compilation scripts +# Copyright (C) 2018 Pekka Helenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +######################################################## + +# DO NOT RUN INDIVIDUALLY, ONLY VIA ../updatewine.sh PARENT SCRIPT! + +######################################################## + +ROOTDIR="${PWD}" +datedir="${1}" + +######################################################## + +# http://wiki.bash-hackers.org/snipplets/print_horizontal_line#a_line_across_the_entire_width_of_the_terminal +function INFO_SEP() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - ; } + +######################################################## + +# Parse input arguments + +i=0 +for arg in ${@:2}; do + args[$i]="${arg}" + let i++ +done +# Must be a true array as defined above, not a single index list! +#args="${@:2}" + +# All valid arguments given in ../updatewine.sh are handled... +# All valid arguments are passed to subscripts... +# ...but these are specifically used in this script +# +for check in ${args[@]}; do + + case ${check} in + --no-wine) + NO_WINE= + ;; + --no-dxvk) + NO_DXVK= + ;; + --no-pol) + NO_POL= + ;; + --no-install) + # If this option is given, do not check PoL wineprefixes + NO_POL= + ;; + esac + +done + +######################################################## + +mkdir -p ${ROOTDIR}/compiled_deb/${datedir} + +######################################################## + +function Deb_intCleanup() { + cd ${ROOTDIR} + rm -rf compiled_deb/${datedir} + exit 0 +} + +# Allow interruption of the script at any time (Ctrl + C) +trap "Deb_intCleanup" INT + +######################################################## + +function ccacheCheck() { + if [[ $(apt version ccache | wc -w) -eq 0 ]]; then + echo -e "NOTE: Please consider using 'ccache' for faster compilation times.\nInstall it by typing 'sudo apt install ccache'\n" + fi +} + +ccacheCheck + +######################################################## + +function wine_install_main() { + + echo -e "Starting compilation & installation of Wine\n\n\ +This can take up to 0.5-2 hours depending on the available CPU cores.\n\n\ +Using $(nproc --ignore 1) of $(nproc) available CPU cores for Wine source code compilation. +" + + bash -c "cd ${ROOTDIR}/wineroot/ && bash ./winebuild.sh \"${datedir}\" \"${args[*]}\"" + +} + +######################################################## + +function questionresponse() { + + local response=${1} + + read -r -p "" response + if [[ $(echo $response | sed 's/ //g') =~ ^([yY][eE][sS]|[yY])$ ]]; then + echo "" + return 0 + else + return 1 + fi + +} + +################################## + +INFO_SEP + +echo -e "\e[1mINFO:\e[0m About installation\n\nThe installation may take long time because many development dependencies may be \ +installed and the following packages will be compiled from source (depending on your choise):\n\n\ +\t- Wine/Wine Staging (latest git version)\n\ +\t- DXVK (latest git version)\n\ +\t- meson & glslang (latest git versions; these are build time dependencies for DXVK)\n\n\ +Do you want to continue? [Y/n]" + +questionresponse + +if [[ $? -ne 0 ]]; then + echo -e "Cancelling.\n" + exit 2 +fi + +#################### + +AVAIL_SPACE=$(df -h -B MB --output=avail . | sed '1d; s/[A-Z]*//g') +REC_SPACE=8000 + +if [[ ${AVAIL_SPACE} -lt ${REC_SPACE} ]]; then + INFO_SEP + +echo -e "\e[1mWARNING:\e[0m Not sufficient storage space\n\nYou will possibly run out of space while compiling software.\n\ +The script strongly recommends ~\e[1m$((${REC_SPACE} / 1000)) GB\e[0m at least to compile software successfully but you have only\n\ +\e[1m${AVAIL_SPACE} MB\e[0m left on the filesystem the script is currently placed at.\n\n\ +Be aware that the script process may fail because of this, especially while compiling Wine Staging.\n\n\ +Do you really want to continue? [Y/n]" + + questionresponse + + if [[ $? -ne 0 ]]; then + echo -e "Cancelling.\n" + exit 2 + fi + + unset AVAIL_SPACE REC_SPACE +fi + +#################### + +INFO_SEP + +echo -e "\e[1mINFO:\e[0m Update existing dependencies?\n\nIn a case you have old build time dependencies on your system, do you want to update them?\n\ +If you answer 'yes', then those dependencies are updated if needed. Otherwise, already installed\n\ +build time dependencies are not updated. If you don't have 'meson' or 'glslang' installed on your system, they will be compiled, anyway.\n\ +Be aware, that updating these packages may increase total run time used by this script.\n\n\ +Update dependency packages & other system packages? [Y/n]" + +questionresponse + +if [[ $? -eq 0 ]]; then + args+=('--updateoverride') +fi + +INFO_SEP + +######################################################## + +if [[ ! -v NO_WINE ]]; then + wine_install_main +else + echo -e "Skipping Wine build & installation process.\n" +fi + +if [[ ! -v NO_DXVK ]]; then + bash -c "cd ${ROOTDIR}/dxvkroot && bash dxvkbuild.sh \"${datedir}\" \"${args[*]}\"" +else + echo -e "Skipping DXVK build & installation process.\n" +fi + +if [[ ! -v NO_POL ]]; then + bash -c "cd ${ROOTDIR} && bash playonlinux_prefixupdate.sh" +fi + diff --git a/debian/wineroot/winebuild.sh b/debian/wineroot/winebuild.sh new file mode 100644 index 0000000..babbbfc --- /dev/null +++ b/debian/wineroot/winebuild.sh @@ -0,0 +1,639 @@ +#!/bin/env bash + +# Wine/Wine Staging build script for Ubuntu & variants (amd64) +# Copyright (C) 2018 Pekka Helenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +######################################################## + +# DO NOT RUN INDIVIDUALLY, ONLY VIA ../../updatewine.sh PARENT SCRIPT! + +######################################################## + +# + +# Staging patchsets. Default: all patchsets. +# Applies only if Wine Staging is set to be compiled +# Please see Wine Staging patchinstall.sh file for individual patchset names. +staging_patchsets=(--all) + +######################################################## + +datedir="${1}" + +######################################################## + +# Parse input arguments + +i=0 +for arg in ${@:2}; do + args[$i]="${arg}" + let i++ +done +# Must be a true array as defined above, not a single index list! +#args="${@:2}" + +for check in ${args[@]}; do + + case ${check} in + --no-staging) + NO_STAGING= + ;; + --no-install) + NO_INSTALL= + ;; + esac + +done + +######################################################## + +function Wine_intCleanup() { + cd .. + rm -rf winebuild_${datedir} + exit 0 +} + +# Allow interruption of the script at any time (Ctrl + C) +trap "Wine_intCleanup" INT + +######################################################## + +# This is specifically for Debian +# Must be done to install Wine buildtime dependencies on amd64 environment +# +if [[ $(dpkg --print-foreign-architectures | grep i386 | wc -l) -eq 0 ]]; then + sudo dpkg --add-architecture i386 + sudo apt update +fi + +######################################################## + +function getWine() { + + function cleanOldBuilds() { + if [[ $(find . -type d -name "winebuild_*" | wc -l) -ne 0 ]]; then + echo -e "Removing old Wine build folders. This can take a while.\n" + rm -rf ./winebuild_* + fi + } + + cleanOldBuilds + + mkdir winebuild_${datedir} + cd winebuild_${datedir} + + WINEROOT="${PWD}" + + echo -e "Retrieving source code of Wine$(if [[ ! -v NO_STAGING ]]; then echo ' & Wine Staging' ; fi)\n" + + git clone git://source.winehq.org/git/wine.git + + if [[ ! -v NO_STAGING ]]; then + git clone git://github.com/wine-staging/wine-staging.git + WINEDIR_STAGING="${WINEROOT}/wine-staging" + PKGNAME="wine-staging-git" + else + PKGNAME="wine-git" + fi + + mkdir wine-{patches,32-build,32-install,64-build,64-install,package} + cp -r ../../../wine_custom_patches/*.{patch,diff} wine-patches/ 2>/dev/null + + WINEDIR="${WINEROOT}/wine" + WINEDIR_PATCHES="${WINEROOT}/wine-patches" + WINEDIR_BUILD_32="${WINEROOT}/wine-32-build" + WINEDIR_BUILD_64="${WINEROOT}/wine-64-build" + WINEDIR_INSTALL_32="${WINEROOT}/wine-32-install" + WINEDIR_INSTALL_64="${WINEROOT}/wine-64-install" + WINEDIR_PACKAGE="${WINEROOT}/wine-package" + +} + +function getDebianFiles() { + + local debian_archive=wine_3.0-1ubuntu1.debian.tar.xz + + cd "${WINEDIR}" + wget http://archive.ubuntu.com/ubuntu/pool/universe/w/wine/${debian_archive} + tar xvf ${debian_archive} + rm ${debian_archive} + +} + +######################################################## + +# Wine build dependency list on Debian + +wine_deps_build=( +'make' +'gcc-multilib' +'g++-multilib' +'libxml-simple-perl' +'libxml-parser-perl' +'libxml-libxml-perl' +'lzma' +'flex' +'bison' +'quilt' +'gettext' +'oss4-dev' +'sharutils' +'pkg-config' +'dctrl-tools' +'khronos-api' +'unicode-data' +'freebsd-glue' +'icoutils' +'librsvg2-bin' +'imagemagick' +'fontforge' +'libxi-dev:amd64' +'libxt-dev:amd64' +'libxmu-dev:amd64' +'libx11-dev:amd64' +'libxext-dev:amd64' +'libxfixes-dev:amd64' +'libxrandr-dev:amd64' +'libxcursor-dev:amd64' +'libxrender-dev:amd64' +'libxkbfile-dev:amd64' +'libxxf86vm-dev:amd64' +'libxxf86dga-dev:amd64' +'libxinerama-dev:amd64' +'libgl1-mesa-dev:amd64' +'libglu1-mesa-dev:amd64' +'libxcomposite-dev:amd64' +'libpng-dev:amd64' +'libssl-dev:amd64' +'libv4l-dev:amd64' +'libxml2-dev:amd64' +'libgsm1-dev:amd64' +'libjpeg-dev:amd64' +'libkrb5-dev:amd64' +'libtiff-dev:amd64' +'libsane-dev:amd64' +'libudev-dev:amd64' +'libpulse-dev:amd64' +'liblcms2-dev:amd64' +'libldap2-dev:amd64' +'libxslt1-dev:amd64' +'unixodbc-dev:amd64' +'libcups2-dev:amd64' +'libcapi20-dev:amd64' +'libopenal-dev:amd64' +'libdbus-1-dev:amd64' +'freeglut3-dev:amd64' +'libmpg123-dev:amd64' +'libasound2-dev:amd64' +'libgphoto2-dev:amd64' +'libosmesa6-dev:amd64' +'libpcap0.8-dev:amd64' +'libgnutls28-dev:amd64' +'libncurses5-dev:amd64' +'libgettextpo-dev:amd64' +'libfreetype6-dev:amd64' +'libfontconfig1-dev:amd64' +'libgstreamer-plugins-base1.0-dev:amd64' +'ocl-icd-opencl-dev:amd64' +'libvulkan-dev:amd64' +'libxi-dev:i386' +'libxt-dev:i386' +'libxmu-dev:i386' +'libx11-dev:i386' +'libxext-dev:i386' +'libxfixes-dev:i386' +'libxrandr-dev:i386' +'libxcursor-dev:i386' +'libxrender-dev:i386' +'libxkbfile-dev:i386' +'libxxf86vm-dev:i386' +'libxxf86dga-dev:i386' +'libxinerama-dev:i386' +'libgl1-mesa-dev:i386' +'libglu1-mesa-dev:i386' +'libxcomposite-dev:i386' +'libpng-dev:i386' +'libssl-dev:i386' +'libv4l-dev:i386' +'libgsm1-dev:i386' +'libjpeg-dev:i386' +'libkrb5-dev:i386' +'libsane-dev:i386' +'libudev-dev:i386' +'libpulse-dev:i386' +'liblcms2-dev:i386' +'libldap2-dev:i386' +'unixodbc-dev:i386' +'libcapi20-dev:i386' +'libopenal-dev:i386' +'libdbus-1-dev:i386' +'freeglut3-dev:i386' +'libmpg123-dev:i386' +'libasound2-dev:i386' +'libgphoto2-dev:i386' +'libosmesa6-dev:i386' +'libpcap0.8-dev:i386' +'libncurses5-dev:i386' +'libgettextpo-dev:i386' +'libfreetype6-dev:i386' +'libfontconfig1-dev:i386' +'ocl-icd-opencl-dev:i386' +'libvulkan-dev:i386' +) + +# Excluded x86 packages since they conflict with their amd64 counterparts: +# +# libxslt1-dev:i386 +# libxml2-dev:i386 +# libicu-dev:i386 +# libtiff-dev:i386 +# libcups2-dev:i386 +# libgnutls28-dev:i386 +# libgstreamer1.0-dev:i386 +# libgstreamer-plugins-base1.0-dev:i386 + +######################################################## + +# Wine runtime dependency list on Debian + +wine_deps_runtime=( +'libxcursor1:i386' +'libxrandr2:i386' +'libxi6:i386' +'libsm6:i386' +'libvulkan1:i386' +'libasound2:i386' +'libc6:i386' +'libfontconfig1:i386' +'libfreetype6:i386' +'libgcc1:i386' +'libglib2.0-0:i386' +'libgphoto2-6:i386' +'libgphoto2-port12:i386' +'liblcms2-2:i386' +'libldap-2.4-2:i386' +'libmpg123-0:i386' +'libncurses5:i386' +'libopenal1:i386' +'libpcap0.8:i386' +'libpulse0:i386' +'libtinfo5:i386' +'libudev1:i386' +'libx11-6:i386' +'libxext6:i386' +'libxml2:i386' +'ocl-icd-libopencl1:i386' +'zlib1g:i386' +'fontconfig:amd64' +'libxcursor1:amd64' +'libxrandr2:amd64' +'libxi6:amd64' +'gettext:amd64' +'libsm6:amd64' +'libvulkan1:amd64' +'libasound2:amd64' +'libc6:amd64' +'libfontconfig1:amd64' +'libfreetype6:amd64' +'libgcc1:amd64' +'libglib2.0-0:amd64' +'libgphoto2-6:amd64' +'libgphoto2-port12:amd64' +'liblcms2-2:amd64' +'libldap-2.4-2:amd64' +'libmpg123-0:amd64' +'libncurses5:amd64' +'libopenal1:amd64' +'libpcap0.8:amd64' +'libpulse0:amd64' +'libtinfo5:amd64' +'libudev1:amd64' +'libx11-6:amd64' +'libxext6:amd64' +'libxml2:amd64' +'ocl-icd-libopencl1:amd64' +'zlib1g:amd64' +'desktop-file-utils' +'libgstreamer-plugins-base1.0-0:amd64' +'libgstreamer1.0-0:amd64' +) + +# Exclude the following i386 runtime dependencies +# because they conflict with their amd64 counterparts: +# gettext:i386 + +######################################################## + +# Wine dependencies: + +function WineDeps() { + + local a=0 + local deps="${1}" + local depsname=${2} + + echo -e "Installing Wine dependencies.\n" # Sudo password may be required.\n" + + # TODO should we install all at once, or go iterating the list, + # giving better output for user. Iterative method is slower, though. + # +# sudo apt install -y ${deps[*]} +# if [[ $? -ne 0 ]]; then +# echo -e "Error while installing Wine dependencies. Aborting\n" +# exit 1 +# fi + + function pkgdependencies() { + + for pkgdep in ${@}; do + + if [[ $(apt version ${pkgdep} | wc -w) -eq 0 ]]; then + + echo -e "Installing ${depsname} dependency ${pkgdep} ($(($a + 1 )) / $((${#*} + 1)))\n." + sudo apt install -y ${pkgdep} &> /dev/null + if [[ $? -eq 0 ]]; then + let a++ + else + echo -e "\nError occured while installing ${pkgdep}. Aborting.\n" + exit 1 + fi + fi + done + + } + + pkgdependencies ${deps[*]} + +} + +######################################################## + +# Wine staging override list +# Wine Staging replaces and conflicts with these packages +# Applies to debian/control file + +wine_over_pkgs=( +'wine' +'wine-development' +'wine64-development' +'wine1.6' +'wine1.6-i386' +'wine1.6-amd64' +'libwine:amd64' +'libwine:i386' +'wine-stable' +'wine32' +'wine64' +) + +############################ + +# Suggest section in debian/control file + +wine_suggest_pkgs=( +'winbind' +'winetricks' +'fonts-wine' +'playonlinux' +'wine-binfmt' +'dosbox' +) + +######################################################## + +# Feed the following data to Wine debian/control file + +function feedControlfile() { + + local MAINTAINER="$USER" + + sed -ie "s/^Build-Depends:.*$/Build-Depends: debhelper (>=11), $(echo ${wine_deps_build[*]} | sed 's/\s/, /g')/g" debian/control + sed -ie "s/^Depends:.*$/Depends: $(echo ${wine_deps_runtime[*]} | sed 's/\s/, /g')/g" debian/control + sed -ie "s/^Suggests:.*$/Suggests: $(echo ${wine_suggest_pkgs[*]} | sed 's/\s/, /g')/g" debian/control + + sed -ie "s/^Maintainer:.*$/Maintainer: ${MAINTAINER}/g" debian/control + sed -ie "s/^Source:.*$/Source: ${PKGNAME}/g" debian/control + sed -ie "s/^Package:.*$/Package: ${PKGNAME}/g" debian/control + + for ctrl_section in Conflicts Breaks Replaces Provides; do + sed -ie "s/^${ctrl_section}:.*$/${ctrl_section}: $(echo ${wine_over_pkgs[*]} | sed 's/\s/, /g')/g" debian/control + done + +} + +######################################################## + +# Refresh Wine GIT + +function refreshWineGIT() { + + # Restore the wine tree to its git origin state, without wine-staging patches + # (necessary for reapllying wine-staging patches in succedent builds, + # otherwise the patches will fail to be reapplied) + cd "${WINEDIR}" + git reset --hard HEAD # Restore tracked files + git clean -d -x -f # Delete untracked files + + if [[ ! -v NO_STAGING ]]; then + # Change back to the wine upstream commit that this version of wine-staging is based on + git checkout $(bash "${WINEDIR_STAGING}"/patches/patchinstall.sh --upstream-commit) + fi +} + +######################################################## + +# Get Wine version tag + +function getWineVersion() { + cd "${WINEDIR}" + wine_version=$(git describe | sed 's/^[a-z]*-//; s/-[0-9]*-[a-z0-9]*$//') +} + +######################################################## + +# Apply patches + +function patchWineSource() { + + if [[ ! -v NO_STAGING ]]; then + cd "${WINEDIR_STAGING}/patches" + bash ./patchinstall.sh DESTDIR="${WINEDIR}" ${staging_patchsets[*]} + fi + + cp -r ${WINEROOT}/../../../wine_custom_patches/* "${WINEDIR_PATCHES}/" + + if [[ $(find "${WINEDIR_PATCHES}" -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$") ]]; then + cd "${WINEDIR}" + for i in "${WINEDIR_PATCHES}"/*.patch; do + patch -Np1 < $i + done + fi + +} + +######################################################## + +# 64-bit build + +function wine64Build() { + + cd "${WINEDIR_BUILD_64}" + "${WINEDIR}"/configure \ + --with-x \ + --with-gstreamer \ + --enable-win64 \ + --with-xattr \ + --disable-mscoree \ + --with-vulkan \ + --prefix=/usr \ + --libdir=/usr/lib/x86_64-linux-gnu/ + make -j$(nproc --ignore 1) + + make -j$(nproc --ignore 1) prefix="${WINEDIR_INSTALL_64}/usr" \ + libdir="${WINEDIR_INSTALL_64}/usr/lib/x86_64-linux-gnu/" \ + dlldir="${WINEDIR_INSTALL_64}/usr/lib/x86_64-linux-gnu/wine" install + +} + +# 32-bit build + +function wine32Build() { + +# Gstreamer amd64 & i386 dev packages conflict on Ubuntu + + cd "${WINEDIR_BUILD_32}" + "${WINEDIR}"/configure \ + --with-x \ + --with-gstreamer \ + --with-xattr \ + --disable-mscoree \ + --with-vulkan \ + --without-gstreamer \ + --libdir=/usr/lib/i386-linux-gnu/ \ + --with-wine64="${WINEDIR_BUILD_64}" \ + --prefix=/usr + make -j$(nproc --ignore 1) + + make -j$(nproc --ignore 1) prefix="${WINEDIR_INSTALL_32}/usr" \ + libdir="${WINEDIR_INSTALL_32}/usr/lib/i386-linux-gnu/" \ + dlldir="${WINEDIR_INSTALL_32}/usr/lib/i386-linux-gnu/wine" install + +} + +######################################################## + +function mergeWineBuilds() { + + cp -r "${WINEDIR_INSTALL_64}"/* "${WINEDIR_PACKAGE}"/ + + cp -r "${WINEDIR_INSTALL_32}"/usr/bin/{wine,wine-preloader} "${WINEDIR_PACKAGE}"/usr/bin/ + cp -r "${WINEDIR_INSTALL_32}"/usr/lib/* "${WINEDIR_PACKAGE}"/usr/lib/ + +} + +function buildDebianArchive() { + cd "${WINEROOT}" + mv "${WINEDIR_PACKAGE}" "${WINEROOT}/${PKGNAME}-${wine_version}" + cd "${WINEROOT}/${PKGNAME}-${wine_version}" + dh_make --createorig -s -y + rm debian/*.{ex,EX} + printf "usr/* /usr" > debian/install + +cat << 'DEBIANCONTROL' > debian/control +Source: +Section: otherosfs +Priority: optional +Maintainer: +Build-Depends: +Standards-Version: 4.1.2 +Homepage: https://www.winehq.org + +Package: +Architecture: any +Depends: +Suggests: +Conflicts: +Breaks: +Replaces: +Provides: +Description: A compatibility layer for running Windows programs. + Wine is an open source Microsoft Windows API implementation for + POSIX-compliant operating systems, including Linux. + Git version includes the latest updates available for Wine. + +DEBIANCONTROL + + feedControlfile + + DEB_BUILD_OPTIONS="strip nodocs noddebs" dpkg-buildpackage -b -us -uc + +} + +function installDebianArchive() { + cd "${WINEROOT}" + # TODO Although the package name ends with 'amd64', this contains both 32 and 64 bit Wine versions + echo -e "\nInstalling Wine.\n" # Please provide your sudo password. + sudo dpkg -i ${PKGNAME}_${wine_version}-1_amd64.deb +} + +function storeDebianArchive() { + cd "${WINEROOT}" + mv ${PKGNAME}_${wine_version}-1_amd64.deb ../../compiled_deb/"${datedir}" && \ + echo -e "Compiled ${PKGNAME} is stored at '$(readlink -f ../../compiled_deb/"${datedir}")/'\n" + rm -rf winebuild_${datedir} +} + +function clearTree() { + rm -rf "${WINEROOT}" +} + +######################################################## + +# Get Wine (& Wine-Staging) sources +getWine + +# Install Wine dependencies +WineDeps "${wine_deps_build[*]}" "Wine build time" +WineDeps "${wine_deps_runtime[*]}" "Wine runtime" + +# Refresh & sync Wine (+ Wine Staging) git sources +refreshWineGIT + +# Update Wine source files +patchWineSource + +# Get Wine/Wine Staging version +getWineVersion + +# Compile 64 & 32 bit Wine/Wine Staging +wine64Build +wine32Build + +# Bundle compiled Wine-Staging files +mergeWineBuilds + +# Bundle and install Debian deb archive +buildDebianArchive + +if [[ ! -v NO_INSTALL ]]; then + installDebianArchive +fi + +storeDebianArchive + +# Clear all temporary files +clearTree + diff --git a/debian_devpkgremoval.sh b/debian_devpkgremoval.sh new file mode 100644 index 0000000..73f1f1d --- /dev/null +++ b/debian_devpkgremoval.sh @@ -0,0 +1,182 @@ +# Uninstall Wine-Staging, DXVK, meson & glslang buildtime deps on Debian +# Copyright (C) 2018 Pekka Helenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +############################################################################## + +meson_deps=( +'dh-python' +'python3-setuptools' +'ninja-build' +) + +#glslang_deps=( +# Nothing to remove actually, just python2.7 which is likely required by other packages +#) + +wine_deps=( +'libxi-dev:amd64' +'libxt-dev:amd64' +'libxmu-dev:amd64' +'libx11-dev:amd64' +'libxext-dev:amd64' +'libxfixes-dev:amd64' +'libxrandr-dev:amd64' +'libxcursor-dev:amd64' +'libxrender-dev:amd64' +'libxkbfile-dev:amd64' +'libxxf86vm-dev:amd64' +'libxxf86dga-dev:amd64' +'libxinerama-dev:amd64' +'libgl1-mesa-dev:amd64' +'libglu1-mesa-dev:amd64' +'libxcomposite-dev:amd64' +'libpng-dev:amd64' +'libssl-dev:amd64' +'libv4l-dev:amd64' +'libxml2-dev:amd64' +'libgsm1-dev:amd64' +'libjpeg-dev:amd64' +'libkrb5-dev:amd64' +'libtiff-dev:amd64' +'libsane-dev:amd64' +'libudev-dev:amd64' +'libpulse-dev:amd64' +'liblcms2-dev:amd64' +'libldap2-dev:amd64' +'libxslt1-dev:amd64' +'unixodbc-dev:amd64' +'libcups2-dev:amd64' +'libcapi20-dev:amd64' +'libopenal-dev:amd64' +'libdbus-1-dev:amd64' +'freeglut3-dev:amd64' +'libmpg123-dev:amd64' +'libasound2-dev:amd64' +'libgphoto2-dev:amd64' +'libosmesa6-dev:amd64' +'libpcap0.8-dev:amd64' +'libgnutls28-dev:amd64' +'libncurses5-dev:amd64' +'libgettextpo-dev:amd64' +'libfreetype6-dev:amd64' +'libfontconfig1-dev:amd64' +'libgstreamer-plugins-base1.0-dev:amd64' +'ocl-icd-opencl-dev:amd64' +'libvulkan-dev:amd64' +'libxi-dev:i386' +'libxt-dev:i386' +'libxmu-dev:i386' +'libx11-dev:i386' +'libxext-dev:i386' +'libxfixes-dev:i386' +'libxrandr-dev:i386' +'libxcursor-dev:i386' +'libxrender-dev:i386' +'libxkbfile-dev:i386' +'libxxf86vm-dev:i386' +'libxxf86dga-dev:i386' +'libxinerama-dev:i386' +'libgl1-mesa-dev:i386' +'libglu1-mesa-dev:i386' +'libxcomposite-dev:i386' +'libpng-dev:i386' +'libssl-dev:i386' +'libv4l-dev:i386' +'libgsm1-dev:i386' +'libjpeg-dev:i386' +'libkrb5-dev:i386' +'libsane-dev:i386' +'libudev-dev:i386' +'libpulse-dev:i386' +'liblcms2-dev:i386' +'libldap2-dev:i386' +'unixodbc-dev:i386' +'libcapi20-dev:i386' +'libopenal-dev:i386' +'libdbus-1-dev:i386' +'freeglut3-dev:i386' +'libmpg123-dev:i386' +'libasound2-dev:i386' +'libgphoto2-dev:i386' +'libosmesa6-dev:i386' +'libpcap0.8-dev:i386' +'libncurses5-dev:i386' +'libgettextpo-dev:i386' +'libfreetype6-dev:i386' +'libfontconfig1-dev:i386' +'ocl-icd-opencl-dev:i386' +'libvulkan-dev:i386' +) + +dxvk_deps=( +'meson' +'glslang' +'gcc-mingw-w64-x86-64' +'gcc-mingw-w64-i686' +'g++-mingw-w64-x86-64' +'g++-mingw-w64-i686' +'mingw-w64-x86-64-dev' +'mingw-w64-i686-dev' +) + +wine_deps_noremove=( +'gcc-multilib' +'g++-multilib' +'libxml-simple-perl' +'libxml-parser-perl' +'libxml-libxml-perl' +'lzma' +'flex' +'bison' +'quilt' +'gettext' +'oss4-dev' +'sharutils' +'pkg-config' +'dctrl-tools' +'khronos-api' +'unicode-data' +'freebsd-glue' +'icoutils' +'librsvg2-bin' +'imagemagick' +'fontforge' +) + +core_deps_noremove=( +'make' 'cmake' 'gcc' 'git' 'build-essential' 'fakeroot' +) + +removals_name=('Meson' 'Wine Staging' 'DXVK') +removals=('${meson_deps[*]}' '${wine_deps[*]}' '${dxvk_deps[*]}') + +i=0 +for k in ${removals[*]}; do + echo -e "\nRemoving ${removals_name[$i]} buildtime dependencies\n" + sudo apt-get purge --remove $(eval echo ${k}) + let i++ +done + +echo -e "\nThe following Wine Staging buildtime dependencies were not removed:\n$(for o in ${wine_deps_noremove[*]}; do echo ${o}; done)\n" + +echo -e "\nThe following core buildtime dependencies were not removed:\n$(for o in ${core_deps_noremove[*]}; do echo ${o}; done)\n" + +read -r -p "Auto remove packages which are no longer needed? [Y/n] " question + +if [[ $(echo $question | sed 's/ //g') =~ ^([yY][eE][sS]|[yY])$ ]]; then + sudo apt-get purge --autoremove +fi + diff --git a/updatewine.sh b/updatewine.sh old mode 100755 new mode 100644 index 8061999..6fea3bd --- a/updatewine.sh +++ b/updatewine.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/env bash -# getsource - Simple script to set up Wine Staging + DXVK for PoL wineprefixes +# DXVK/Wine-Staging scripts dispatcher for various Linux distributions # Copyright (C) 2018 Pekka Helenius # # This program is free software: you can redistribute it and/or modify @@ -16,405 +16,255 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -########################################################### - -# REQUIREMENTS: - -# - Arch Linux or equivalent (uses pacman) -# -# - Existing PlayonLinux package installation and $HOME/.PlayOnLinux folder -# with all relevant subfolders -# -# - git, sudo, pwd...etc. -# -# - dxvk-git and wine-staging-git package dependencies installed -# (see PKGBUILD files ./PKGBUILD and ./0-dxvk-git/PKGBUILD for details) -# -# - Internet connection -# -# - GPU Vulkan support and the most recent Nvidia/AMD drivers - -########################################################### - -# Usage - -# Run with sudo -# -# # sudo bash ./updatewine.sh -# -# NOTE: All commands are executed as user (defined above). -# Only commands which require root permissions are ones -# which install packages wine-staging-git and dxvk into -# your system - -# All regular user commands have prefix 'cmd' below - -# Switches: -# -# --refresh -# -# Check for new Staging/DXVK releases, update PoL Wine prefixes if needed -# Does a comparison between local & remote git repos -# -# --check -# -# Check for new Staging/DXVK releases -# Does a comparison between local & remote git repos -# -# --force -# -# Force Wine Staging & DXVK installation -# - -########################################################### - -# Get current date -CURDATE=$(date "+%d-%m-%Y %H:%M:%S") +############################################################################## -# This variable value is automatically generated. DO NOT CHANGE. -LASTUPDATE= +# Check if we're using bash or sh to run the script. If bash, OK. +# If another one, ask user to run the script with bash. -# This variable value is automatically generated. DO NOT CHANGE. -WINE_VERSION= +BASH_CHECK=$(ps | grep `echo $$` | awk '{ print $4 }') -########################################################### - -if [[ $UID -ne 0 ]]; then - echo "Run as root or sudo. This permission is required only for package installation." +if [ $BASH_CHECK != "bash" ]; then + echo " +Please run this script using bash (/usr/bin/bash). + " exit 1 fi ########################################################### +# Allow interruption of the script at any time (Ctrl + C) +trap "exit" INT -# Your system username (who has PoL profile // existing Wine prefixes) -# Get it by running 'whoami' - -unset USERNAME ERRPKGS - -read -r -p "Who has PoL profiles // existing Wine prefixes on the system? [username] " username - echo "" -function check_username { - - if [[ $(printf '%s' $username | sed 's/[[:blank:]]//g') == "" ]]; then - echo "Empty username is invalid. Aborting." - exit 1 - fi +########################################################### - if [[ $username == "root" ]]; then - echo "Can't use 'root' user. Aborting." - exit 1 - fi +COMMANDS=( + groups + sudo + wget + date + find + grep + uname + readlink +) + +function checkCommands() { + + if [[ $(which --help 2>/dev/null) ]] && [[ $(echo --help 2>/dev/null) ]]; then + + local a=0 + for command in ${@}; do + if [[ ! $(which $command 2>/dev/null) ]]; then + COMMANDS_NOTFOUND[$a]=$command + let a++ + fi + done - local IFS=$'\n' - for validname in $(cat /etc/passwd | awk -F : '{print $1}'); do - if [[ $validname == $username ]]; then - USERNAME=$username + if [[ -n $COMMANDS_NOTFOUND ]]; then + echo -e "\nError! The following commands could not be found: ${COMMANDS_NOTFOUND[*]}\nAborting\n" + exit 1 fi - done - - if [[ ! -n $USERNAME ]]; then - echo "Couldn't find user '$username'. Please check the name and try again." + else exit 1 fi - } -function check_pol { - - # Check existence of PoL default folder in user's homedir - - local USERHOME=$(grep $USERNAME /etc/passwd | awk -F : '{print $(NF-1)}') - - if [[ ! -d "$USERHOME/PlayOnLinux's virtual drives" ]]; then - echo "Warning. Couldn't find PoL directories in the homedir of user $USERNAME." - NOPOL= - fi - -} - -check_username -check_pol +checkCommands "${COMMANDS[*]}" ########################################################### -# Check package dependencies beforehand, just to avoid -# annoying situations which could occur later while the script -# is already running. - -# Just for "packages which are not found" array <=> ERRPKGS -# We need to set it outside of checkDepends function -# because it is a global variable for all checked packages -l=0 - -function checkDepends { - - # The first and the second argument - local packagedir=${1} - local package=${2} - - # We get necessary variables to check from this file - local file="./${packagedir}/PKGBUILD" - - # All but the (zero), the first and the second argument - # We check the value of these file variables - local file_vars=${@:3} - - for var in ${file_vars[*]}; do - # Get the variable and set it as a new variable in the current shell - # This is applicable only to variable arrays! Do not use if the variable is not an array. - local field=$(awk "/^${var}/,/)/" ${file} | sed -r "s/^${var}=|[)|(|']//g") - - local i=0 - for parse in ${field[*]}; do - if [[ ! $parse =~ ^# ]]; then - local PKGS[$i]=$(printf '%s' $parse | sed 's/[=|>|<].*$//') - let i++ - fi - done - - # Sort list and delete duplicate index values - # https://stackoverflow.com/questions/13648410/how-can-i-get-unique-values-from-an-array-in-bash - local PKGS_sort=($(printf "${PKGS[*]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) - - for pkg in ${PKGS_sort[*]}; do - - if [[ $(printf $(pacman -Q ${pkg} &>/dev/null)$?) -ne 0 ]]; then - ERRPKGS[$l]=${pkg} - echo -e "\e[91mError:\e[0m Dependency '${pkg}' not found, required by '${package}' (${file} => ${var})" - let l++ - fi - - done - - unset PKGS PKGS_sort var i - - done - echo -e " \e[92m=>\e[0m Dependency check for ${package} done.\n" -} - -checkDepends "0-wine-staging-git" "wine-staging-git" _depends makedepends -checkDepends "0-dxvk-git" "dxvk-git" depends makedepends - -if [[ -v ERRPKGS ]]; then - echo -e "The following dependencies are missing:\n\e[91m$(for o in ${ERRPKGS[@]}; do printf '%s\n' ${o}; done)\e[0m\n" - exit 1 -fi +# http://wiki.bash-hackers.org/snipplets/print_horizontal_line#a_line_across_the_entire_width_of_the_terminal +function INFO_SEP() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - ; } ########################################################### -# Switches - -if [[ "${1}" == "--refresh" ]]; then - WINE_INSTALL= - CHECK= +if [[ $(uname -a | grep -c x86_64) -eq 0 ]]; then + echo "This script supports 64-bit architectures only." + exit 1 fi -if [[ "${1}" == "--check" ]]; then - CHECK= +if [[ $(groups | grep -c sudo) -eq 0 ]]; then + echo "You must belong to sudo group." + exit 1 fi -if [[ "${1}" == "--force" ]] || [[ $WINE_VERSION == "" ]] || [[ $LASTUPDATE == "" ]]; then - WINE_INSTALL= - FORCE_INSTALL= -fi - -if [[ $LASTUPDATE == "" ]]; then - LASTUPDATE="Unknown" +if [[ $UID -eq 0 ]]; then + echo "Run as regular user." + exit 1 fi ########################################################### -echo -e "\nLast update: $LASTUPDATE\n" +# Prevent running on pure Debian -ORG_CURDIR=$(pwd) +# This is just to prevent this script from running on Debian +# Although the script works quite well on Debian +# we get conflicting issues between amd64 & i386 Wine +# buildtime dependency packages +# These conflicts do not occur on Ubuntu or on Mint -cmd() { - sudo -u $USERNAME bash -c "${*}" -} +# Additionally, package 'winetricks' is not found on Debian. +# This is quite trivial to get fixed, though. -########################################################### -# Check for existing PoL user folder +if [[ -f /usr/lib/os-release ]]; then + distroname=$(grep -oP "(?<=^NAME=\").*(?=\"$)" /usr/lib/os-release) +else + echo -e "\nCould not verify your Linux distribution. Aborting.\n" + exit 1 +fi -#if [[ ! -d /home/$USERNAME/.PlayOnLinux ]]; then -# echo "No existing PlayonLinux profiles in $USERNAME's home folder. Aborting" -# exit 1 -#fi +case "${distroname}" in + *Debian*) + echo -e "\nSorry, pure Debian is not supported yet. See README for details. Aborting.\n" + exit 0 + ;; +esac ########################################################### -# Check internet connection -function netCheck() { - if [[ $(echo $(wget --delete-after -q -T 5 github.com -o -)$?) -ne 0 ]]; then - echo -e "\nInternet connection failed (GitHub). Please check your connection and try again.\n" - exit 1 - fi - cmd "rm -f ./index.html.tmp" -} +# Just a title for this script, used in initialization and help page -########################################################### -# Local/Remote git comparisons +SCRIPT_TITLE="\e[1mWine/Wine Staging & DXVK package builder & auto-installer\e[0m" -function gitCheck() { +########################################################### - netCheck +# User-passed arguments for the script +# We check the values of this array +# and pass them to the subscripts if supported + +unset NO_INSTALL NO_STAGING NO_POL NO_DXVK + +i=0 +for arch_arg in ${@}; do + + case ${arch_arg} in + --no-staging) + # Do not build Wine staging version, just Wine + ;; + --no-install) + # Just build, do not install DXVK or Wine-Staging + # Note that some version of Wine is required for DXVK compilation, though! + ;; + --no-wine) + # Skip Wine build & installation process all together + ;; + --no-dxvk) + # Skip DXVK build & installation process all together + ;; + --no-pol) + # Skip PlayOnLinux Wine prefixes update process + ;; + *) + echo -e "\n\ +\ +${SCRIPT_TITLE} by Pekka Helenius (~Fincer), 2018\n\n\ +Usage:\n\nbash updatewine.sh\n\nArguments:\n\n\ +--no-staging\tCompile Wine instead of Wine Staging\n\ +--no-install\tDo not install Wine or DXVK, just compile them. Wine, meson & glslang must be installed for DXVK compilation.\n\ +--no-wine\tDo not compile or install Wine/Wine Staging\n\ +--no-dxvk\tDo not compile or install DXVK\n\ +--no-pol\tDo not update PlayOnLinux Wine prefixes\n\n\ +Compiled packages are installed by default, unless '--no-install' argument is given.\n\ +If '--no-install' argument is given, the script doesn't check or update your PlayOnLinux Wine prefixes.\n" + exit 0 + ;; + esac + + args[$i]="${arch_arg}" + let i++ +done - if [[ -v FORCE_INSTALL ]]; then - NEEDSBUILD=1 - return 0 - fi +########################################################### - if [[ ! -d "${1}" ]]; then - NEEDSBUILD=1 - return 1 - fi +function sudoQuestion() { + sudo -k + echo -e "\e[1mINFO:\e[0m sudo password required\n\nThis script requires elevated permissions for package updates & installations. Please provide your sudo password for these script commands. Sudo permissions are not used for any other purposes.\n" + sudo echo "" > /dev/null - echo -e "=> Checking ${2} GIT for changes\n" + if [[ $? -ne 0 ]]; then + echo "Invalid sudo password.\n" + exit 1 + fi - local CURDIR="${PWD}" - cd "${1}" - local LOCAL_GIT=$(git rev-parse @) - local REMOTE_GIT=$(git ls-remote origin -h refs/heads/master | awk '{print $1}') + # PID of the current main process + PIDOF=$$ - echo -e "\t${2}:\n\tlocal git: $LOCAL_GIT\n\tremote git: $REMOTE_GIT" + # Run sudo timestamp update on the background and continue the script execution + # Refresh sudo timestamp while the main process is running + function sudo_refresh() { + while [[ $(printf $(ps ax -o pid --no-headers | grep -o ${PIDOF} &> /dev/null)$?) -eq 0 ]]; do + sudo -nv && sleep 2 + done + } - if [[ $LOCAL_GIT != $REMOTE_GIT ]]; then - # true - echo -e "\e[91m\n\t${2} needs to be updated\e[0m\n" - NEEDSBUILD=1 - else - # false - echo -e "\e[92m\n\t${2} is updated\e[0m\n" - NEEDSBUILD=0 - fi + sudo_refresh & - cd "${CURDIR}" } ########################################################### -# Remove any existing pkg,src or tar.xz packages left by previous pacman commands - -cmd "rm -rf ./*/{pkg,src,*.tar.xz}" -cmd "rm -f ./0-wine-staging-git/*.patch" - -if [[ $? -ne 0 ]]; then - echo "Could not remove previous pacman-generated Wine source folders" - exit 1 -fi - -########################################################### - -# Do git check for Wine Staging -gitCheck ./0-wine-staging-git/wine-staging-git Wine - -# If needs build and --check switch is not used -if [[ $NEEDSBUILD -eq 1 ]] && [[ ! -v CHECK ]]; then - - # Create wine-staging-git package and install it to the system - cd "${ORG_CURDIR}"/0-wine-staging-git - cmd "updpkgsums && makepkg ;" - - if [[ $(find . -mindepth 1 -maxdepth 1 -type f -iname "wine-*tar.xz" | wc -l) -ne 0 ]]; then - pacman -U --noconfirm wine-*.tar.xz - else - cmd "rm -rf ./{*.patch,pkg,src}" +function checkInternet() { + if [[ $(echo $(wget --delete-after -q -T 5 github.com -o -)$?) -ne 0 ]]; then + echo -e "\nInternet connection failed (GitHub). Please check your connection and try again.\n" exit 1 fi + rm -f ./index.html.tmp +} - if [[ $? -eq 0 ]]; then - cmd "rm -rf ./{*.patch,pkg,src,*.tar.xz}" - WINE_INSTALL= - WINE_VERSION_UPDATE=$(pacman -Qi wine-staging-git | grep 'Version' | awk '{print $NF}') - else - exit 1 - fi +checkInternet - cd .. +########################################################### -fi +# Date timestamp and random number identifier for compiled +# DXVK & Wine Staging builds +# This variable is known as 'datedir' in other script files -############################# +datesuffix=$(echo $(date '+%Y-%m-%d-%H%M%S')) -# Create dxvk-git package and install it to the system -gitCheck ./0-dxvk-git/dxvk-git DXVK +########################################################### +# Only Debian & Arch based Linux distributions are currently supported -# If needs build and --check switch is not used -if [[ $NEEDSBUILD -eq 1 ]] && [[ ! -v CHECK ]]; then +function determineDistroFamily() { - # Create dxvk-git package and install it to the system - cd "${ORG_CURDIR}"/0-dxvk-git - cmd "updpkgsums && makepkg ;" + # These are default package managers used by the supported Linux distributions + pkgmgrs=('dpkg' 'pacman') - if [[ $(find . -mindepth 1 -maxdepth 1 -type f -iname "dxvk-git-*tar.xz" | wc -l) -ne 0 ]]; then - pacman -U --noconfirm dxvk-git*.tar.xz - else - cmd "rm -rf ./{pkg,src}" - exit 1 + for pkgmgr in ${pkgmgrs[@]}; do + if [[ $(printf $(which ${pkgmgr} &> /dev/null)$?) -eq 0 ]]; then + pkgmgr_valid=${pkgmgr} fi - - if [[ $? -eq 0 ]]; then - cmd "rm -rf ./{pkg,src,dxvk-git*.tar.xz}" - else + done + + case ${pkgmgr_valid} in + + dpkg) + distro="debian" + ;; + pacman) + distro="arch" + ;; + default|*) + echo -e "Your Linux distribution is not supported. Aborting.\n" exit 1 - fi - -fi - -cd .. - -# If a new Wine Staging version was installed and 'System' version of Wine has been used in -# PoL wineprefix configurations, update those existing PoL wineprefixes -if [[ -v WINE_INSTALL ]] && [[ ! -v NOPOL ]]; then - for wineprefix in $(find /home/$USERNAME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do - if [[ -d ${wineprefix}/dosdevices ]]; then + ;; + esac +} - # If VERSION string exists, skip updating that prefix. - if [[ $(printf $(grep -ril "VERSION" ${wineprefix}/playonlinux.cfg &> /dev/null)$?) -ne 0 ]]; then +echo -e "\n${SCRIPT_TITLE}\n\nBuild identifier:\t${datesuffix}\n" - # If currently installed Wine version is not same than we just built. - if [[ -v WINE_VERSION_UPDATE ]]; then - if [[ "${WINE_VERSION}" != "${WINE_VERSION_UPDATE}" ]]; then - cmd "WINEPREFIX=${wineprefix} wineboot -u" - fi - fi - fi - fi - done +if [[ -n ${args[*]} ]]; then + echo -e "Using arguments:\t${args[*]}\n" fi -# Install dxvk-git to every PlayOnLinux wineprefix -if [[ $? -eq 0 ]] && [[ ! -v NOPOL ]]; then - - for wineprefix in $(find /home/$USERNAME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do - - if [[ -d ${wineprefix}/dosdevices ]]; then - - if [[ $(printf $(grep -ril "\"d3d11\"=\"native\"" ${wineprefix}/user.reg &> /dev/null)$?) -ne 0 ]]; then - cmd "WINEPREFIX=${wineprefix} setup_dxvk32" - cmd "WINEPREFIX=${wineprefix} setup_dxvk64" - fi - - # For D3D10 DXVK support - if [[ $(printf $(grep -ril "\"\*d3dcompiler_43\"=\"native\"" ${wineprefix}/user.reg &> /dev/null)$?) -ne 0 ]]; then - cmd "WINEPREFIX=${wineprefix} winetricks d3dcompiler_43" - fi - - fi +determineDistroFamily - done -fi +INFO_SEP +echo -e "\e[1mNOTE: \e[0mDXVK requires very latest Nvidia/AMD drivers to work. Make sure these drivers are available on your Linux distribution.\n\ +This script comes with GPU driver installation scripts for Debian-based Linux distributions.\n" +INFO_SEP -# If a new Wine Staging version was installed, update WINE_VERSION string variable in this script file -if [[ -v WINE_VERSION_UPDATE ]]; then - cmd "sed -i 's/^WINE_VERSION=.*/WINE_VERSION=\"${WINE_VERSION_UPDATE}\"/' $ORG_CURDIR/updatewine.sh" -fi +sudoQuestion +echo "" +INFO_SEP -# Update LASTUPDATE variable string, if --check switch is not used + a new Wine Staging version is used or NEEDSBUILD variable is set to 1 -if [[ ! -v CHECK ]]; then - if [[ -v WINE_INSTALL ]] || [[ $NEEDSBUILD -eq 1 ]]; then - cmd "sed -i 's/^LASTUPDATE=.*/LASTUPDATE=\"$CURDATE\"/' $ORG_CURDIR/updatewine.sh" - fi -fi +bash -c "cd ${distro} && bash ./updatewine_${distro}.sh \"${datesuffix}\" ${args[*]}" -# Unset various env vars -unset CHECK WINE_INSTALL FORCE_INSTALL l diff --git a/wine_custom_patches/put_your_wine_patches_here b/wine_custom_patches/put_your_wine_patches_here new file mode 100644 index 0000000..9fa8438 --- /dev/null +++ b/wine_custom_patches/put_your_wine_patches_here @@ -0,0 +1,4 @@ +Put your custom Wine patches here. +Valid file suffix formats are: .diff and .patch + +These patches are applied during Wine + Wine Staging compilation diff --git a/wine_disabled_patches/put_disabled_wine_patches_here b/wine_disabled_patches/put_disabled_wine_patches_here new file mode 100644 index 0000000..e69de29