diff --git a/README.md b/README.md index 17e3c62..e9d5aa5 100755 --- a/README.md +++ b/README.md @@ -1,30 +1,30 @@ -# Wine/Wine Staging + DXVK package builder & auto-installer +# Wine/Wine Staging + DXVK & D9VK package builder & auto-installer ![](https://i.imgur.com/5WCPioZ.png) -Boost up your Wine experience with a taste of DXVK and automate installation of [DXVK](https://github.com/doitsujin/dxvk) + [Wine](https://www.winehq.org/)/[Wine Staging](https://github.com/wine-staging/wine-staging/) on Debian/Ubuntu/Mint/Arch Linux/Manjaro. Additionally, update your GPU drivers + PlayonLinux wineprefixes to use the latest Wine & DXVK combination available. +Boost up your Wine experience with a taste of DXVK + D9VK and automate installation of [DXVK](https://github.com/doitsujin/dxvk), [D9VK](https://github.com/Joshua-Ashton/d9vk) + [Wine](https://www.winehq.org/)/[Wine Staging](https://github.com/wine-staging/wine-staging/) on Debian/Ubuntu/Mint/Arch Linux/Manjaro. Additionally, update your GPU drivers + PlayonLinux wineprefixes to use the latest Wine & DXVK + D9VK combination available. ## About -One-click solution for accessing bleeding-edge Wine/Wine Staging & DXVK packages _system-widely_ on Debian/Ubuntu/Mint and on Arch Linux/Manjaro. Alternatively, you can pick any version of Wine/Wine Staging & DXVK to be used. +One-click solution for accessing bleeding-edge Wine/Wine Staging, DXVK & D9VK packages _system-widely_ on Debian/Ubuntu/Mint and on Arch Linux/Manjaro. Alternatively, you can pick any version of Wine/Wine Staging, DXVK & D9VK to be used. ![](https://i.imgur.com/Tqqi7pm.png) -_Wine Staging 3.20, DXVK and winetricks on Debian 9. Normally, winetricks & DXVK are not available, and Wine is set to very old version 1.8.7 on Debian - leaving all the sweet candies out. Not anymore - let's end this misery and give user finally a choice._ +_Wine Staging 3.20, DXVK and winetricks on Debian 9. Normally, no winetricks, DXVK or D9VK are available, and Wine is set to very old version 1.8.7 on Debian - leaving all the sweet candies out. Not anymore - let's end this misery and give user finally a choice._ ## Motivation -**Accessibility, lower the barrier.** Help people to get their hands on the latest (bleeding-edge) Wine/Wine Staging & DXVK software on major Linux distribution platforms without hassle or headaches. +**Accessibility, lower the barrier.** Help people to get their hands on the latest (bleeding-edge) Wine/Wine Staging, DXVK & D9VK software on major Linux distribution platforms without hassle or headaches. -There is not an easy way to auto-install the latest Wine/Wine Staging & DXVK, especially on Debian/Ubuntu/Mint. The newest Wine/Wine Staging is not easily accessible on Debian-based Linux distributions, and DXVK is practically bundled to Lutris or Steam gaming platform as a form of Proton. However, not all Windows programs, like MS Office or Adobe Photoshop, could run under Linux Steam client: Many Windows programs actually rely on system-wide Wine installation which is why system-wide Wine/Wine Staging & DXVK auto-installation this script offers becomes quite handy. +There is not an easy way to auto-install the latest Wine/Wine Staging, DXVK & D9VK, especially on Debian/Ubuntu/Mint. The newest Wine/Wine Staging is not easily accessible on Debian-based Linux distributions, and DXVK/D9VK is practically bundled to Lutris or Steam gaming platform as a form of Proton. However, not all Windows programs, like MS Office or Adobe Photoshop, could run under Linux Steam client: Many Windows programs actually rely on system-wide Wine installation which is why system-wide Wine/Wine Staging, DXVK & D9VK auto-installation this script offers becomes quite handy. -The solution provided here _is independent from Steam client or any other Wine management platform_. The latest Wine/Wine Staging & DXVK bundle will be accessible system-widely, not just via Steam, Lutris or PlayOnLinux. Provided PlayOnLinux prefix update is optional, as well. +The solution provided here _is independent from Steam client or any other Wine management platform_. The latest Wine/Wine Staging, DXVK & D9VK bundle will be accessible system-widely, not just via Steam, Lutris or PlayOnLinux. Provided PlayOnLinux prefix update is optional, as well. ---------------- ## Adapt system-wide Wine/DXVK to your Steam Windows games -If you want to easily use Wine/Wine Staging and DXVK with your Steam Windows games on Linux, you may want to check out my helper script [steam-launchoptions](https://github.com/Fincer/steam-launchoptions). +If you want to easily use Wine/Wine Staging and DXVK + D9VK with your Steam Windows games on Linux, you may want to check out my helper script [steam-launchoptions](https://github.com/Fincer/steam-launchoptions). With the helper script, you can set launch options for a single game/selected group of games/all games you have on your Steam account. You can customize the launch options for both Windows and Linux games and clean all existing launch options, too. @@ -32,13 +32,13 @@ With the helper script, you can set launch options for a single game/selected gr ## Contents -- **Wine/Wine Staging & DXVK:** Installation script for supported Linux distributions +- **Wine/Wine Staging, DXVK & D9VK:** Installation script for supported Linux distributions - **Nvidia drivers:** Installation script for supported Debian-based distributions. Independent script. - **Winetricks install** Installation script for supported Debian-based distributions. Can be run independently. -- **Patches:** Possibility to use your custom patches with Wine & DXVK +- **Patches:** Possibility to use your custom patches with Wine, DXVK & D9VK ---------------- @@ -48,7 +48,7 @@ With the helper script, you can set launch options for a single game/selected gr - **RAM:** 4096 MB (DXVK build process may fail with less RAM available) -- **Not listed as a hard dependency, but recommended for DXVK**: The latest Nvidia or AMD GPU drivers (Nvidia proprietary drivers // AMDGPU) +- **Not listed as a hard dependency, but recommended for DXVK & D9VK**: The latest Nvidia or AMD GPU drivers (Nvidia proprietary drivers // AMDGPU) - **Time:** it can take between 0.5-2 hours for the script to run. Compiling Wine takes _a lot of time_. You have been warned. @@ -56,7 +56,7 @@ With the helper script, you can set launch options for a single game/selected gr ## Why to compile from source? -Latest version of Wine/Wine Staging & DXVK are only available via git as source code which must be compiled before usage. Note that compiling Wine takes a lot of time. Compiling from source has its advantages and disadvantages, some of them listed below. +Latest version of Wine/Wine Staging, DXVK & D9VK are only available via git as source code which must be compiled before usage. Note that compiling Wine takes a lot of time. Compiling from source has its advantages and disadvantages, some of them listed below. **Advantages:** @@ -72,7 +72,7 @@ Latest version of Wine/Wine Staging & DXVK are only available via git as source - 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, just as precaution) +- may break working already-working versions of the packages (use `--no-install` parameter to avoid installation of DXVK/D9VK & Wine, just as precaution) ---------------- @@ -102,11 +102,13 @@ All supported arguments are: - `--no-dxvk` = Do not compile or install DXVK +- `--no-d9vk` = Do not compile or install D9VK + - `--no-pol` = Do not update current user's PlayOnLinux Wine prefixes ### Force/Lock package versions -You can force/lock specific Wine, Wine Staging, DXVK, meson & glslang versions. +You can force/lock specific Wine, Wine Staging, DXVK, D9VK, meson & glslang versions. There are two switches for that: Set a specific **1)** _commit_ **2)** _git branch_ you want to use @@ -114,11 +116,11 @@ This is handy if you encounter issues during package compilation (DXVK/glslang o - Git commit: - - `git_commithash_dxvk`, `git_commithash_wine`, `git_commithash_glslang`, `git_commithash_meson` + - `git_commithash_dxvk`, `git_commithash_d9vk`, `git_commithash_wine`, `git_commithash_glslang`, `git_commithash_meson` - Git branch: - - `git_branch_dxvk`, `git_branch_wine`, `git_branch_glslang`, `git_branch_meson` + - `git_branch_dxvk`, `git_branch_d9vk`, `git_branch_wine`, `git_branch_glslang`, `git_branch_meson` **These settings apply only on Debian/Ubuntu/Mint:** @@ -138,7 +140,7 @@ Each variable applies values which must be match package git commit tree. The va - **A)** 40 characters long commit hash. Use this if you want this commit to be the latest to be used in package compilation, not anything after it. - - defined in git commit tree: [DXVK commit tree](https://github.com/doitsujin/dxvk/commits/master), [Wine commit tree](https://source.winehq.org/git/wine.git/) (or [GitHub mirror](https://github.com/wine-mirror/wine)), [glslang commit tree](https://github.com/KhronosGroup/glslang/commits/master), [meson commit tree](https://github.com/mesonbuild/meson/commits/master) + - defined in git commit tree: [DXVK commit tree](https://github.com/doitsujin/dxvk/commits/master), D9VK commit tree](https://github.com/Joshua-Ashton/d9vk/commits/master), [Wine commit tree](https://source.winehq.org/git/wine.git/) (or [GitHub mirror](https://github.com/wine-mirror/wine)), [glslang commit tree](https://github.com/KhronosGroup/glslang/commits/master), [meson commit tree](https://github.com/mesonbuild/meson/commits/master) - You can obtain proper hash by opening the commit. Hash syntax is: `654544e96bfcd1bbaf4a0fc639ef655299276a39` etc... @@ -168,13 +170,13 @@ Any other vanilla Wine git branch setting than _master_ will be ignored if Wine **NOTE:** This section doesn't concern Ubuntu or Mint users. -Since Debian doesn't provide winetricks package on official repositories, it is strongly recommended that you use provided `debian_install_winetricks.sh` to install Winetricks. +Since Debian doesn't provide winetricks package on official repositories, it is strongly recommended that you use provided `debian_install_winetricks.sh` to install Winetricks if needed. ---------------- -## Custom patches for Wine & DXVK +## Custom patches for Wine, DXVK & D9VK -You can apply your own patches for DXVK & Wine by dropping valid `.patch` or `.diff` files into `dxvk_custom_patches` (DXVK) or `wine_custom_patches` (Wine) folder. +You can apply your own patches for DXVK, D9VK & Wine by dropping valid `.patch` or `.diff` files into `dxvk_custom_patches` (DXVK), `d9vk_custom_patches` (D9VK) or `wine_custom_patches` (Wine) folder. Folders `dxvk_disabled_patches` and `wine_disabled_patches` are just for management purposes, they do not have a role in script logic at all. @@ -188,7 +190,7 @@ By using keywords `_staging` or `_nostaging` in your patch filename, you can qui ## Compiled packages are stored for later usage -Successfully compiled Wine & DXVK packages are stored in separate subfolders. Their locations are as follows. +Successfully compiled Wine, DXVK & D9VK packages are stored in separate subfolders. Their locations are as follows. On Debian/Ubuntu/Mint: @@ -210,12 +212,24 @@ To enable DXVK on existing wineprefixes, just run WINEPREFIX=/path/to/my/wineprefix setup_dxvk ``` -## Add DXVK to PlayOnLinux Wine prefixes +## D9VK usage + +**NOTE:** D9VK must be installed before applying these steps. -To install DXVK on specific PlayOnLinux wineprefix which uses a different than `system` version of Wine, apply the following command syntax: +To enable D9VK on existing wineprefixes, just run + +``` +WINEPREFIX=/path/to/my/wineprefix setup_d9vk +``` + +## Add DXVK/D9VK to PlayOnLinux Wine prefixes + +To install DXVK or D9VK 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 + +WINEPREFIX="$HOME/.PlayOnLinux/wineprefix/myprefix" WINEPATH=$HOME/.PlayOnLinux/wine/{linux-amd64,linux-x86}/wineversion/bin" setup_d9vk ``` where you need to set either `linux-amd64` or `linux-x86`, and `wineversion` + `myprefix` to match real ones, obviously. @@ -270,6 +284,10 @@ bash debian_cleanup_devpkgs.sh `bash updatewine.sh --no-staging --no-dxvk --no-pol` +**8)** Compile D9VK, and make an installable package for it. Install the package, do not check PlayOnLinux wineprefixes: + +`bash updatewine.sh --no-wine --no-dxvk --no-pol` + ---------------- ## GPU drivers @@ -302,7 +320,7 @@ The following section contains important notes about the script usage. ### Script runtime test -Runtime test done for the script to ensure it works as expected. Occasional test-runs are mandatory due to rapid development of the packages (Wine/DXVK) it handles. +Runtime test done for the script to ensure it works as expected. Occasional test-runs are mandatory due to rapid development of the packages (Wine/DXVK/D9VK) it handles. **Latest test-run:** 23th November, 2018 @@ -334,8 +352,6 @@ Git commit freezing used for DXVK & meson. Reasons: - Add compilation/installation script for the latest AMDGPU on Debian/Ubuntu/Mint -- Add compilation/installation script for the latest MinGW on Debian/Ubuntu/Mint - - Add info about selected commits and branches (if they have not been set to default) - Remove temp folders in case of failure (meson/glslang/dxvk-git/wine... temp build folders) diff --git a/arch/0-d9vk-git/PKGBUILD b/arch/0-d9vk-git/PKGBUILD new file mode 100644 index 0000000..f8f1449 --- /dev/null +++ b/arch/0-d9vk-git/PKGBUILD @@ -0,0 +1,90 @@ +# Maintainer: Pekka Helenius +# Contributor: Adrià Cereto i Massagué + +pkgname=d9vk-git +pkgver=6125834 +pkgrel=1 +pkgdesc="A Vulkan-based compatibility layer for Direct3D 9 which allows running 3D applications on Linux using Wine" +arch=('x86_64') +url="https://github.com/Joshua-Ashton/d9vk" +license=('zlib/libpng') +makedepends=('ninja' 'meson>=0.43' 'glslang' 'git' 'wine') +source=( + ${pkgname}::"git+https://github.com/Joshua-Ashton/d9vk.git#commit=HEAD" +) +sha256sums=('SKIP' + 'SKIP' + 'b67f3a88115b1d048fb373ff6df2140c3027fe9edecccf58c1a88efce01fb738') + +_git_branch_d9vk=master +_d9vk_commit=HEAD + +############################## + +# Copy custom patches to correct location +if [[ $(find "${startdir}/d9vk-patches" -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$") ]]; then + cp -r "${startdir}/d9vk-patches/"*.{patch,diff} "${startdir}"/ + 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 + +# Reset git tree and apply custom patches +prepare() { + + cd "${srcdir}/${pkgname}" + git checkout ${_git_branch_d9vk} + git reset --hard ${_d9vk_commit} # Restore tracked files + git clean -d -x -f # Delete untracked files + + # Apply patches, if present + if [[ $(ls "${srcdir}"/*.{patch,diff} 2>/dev/null | wc -w) -ne 0 ]]; then + + # Apply all custom patches + msg2 "Applying custom patches..." + + for i in "${srcdir}"/*.{patch,diff}; do + if [[ -f ${i} ]]; then + patch -Np1 < ${i} + fi + done + + fi + +} + +############################## + +pkgver() { + cd "$srcdir/${pkgname}" + git describe --long --tags --always | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g' +} + +prepare() { + cd "$srcdir/${pkgname}" + patch -Np1 < "$srcdir"/patch_remove_d3d10-11.patch +} + +build() { + cd "$srcdir/${pkgname}" + ./package-release.sh ${pkgver} build --no-package +} + +package_d9vk-git() { + depends=('vulkan-icd-loader' 'wine' 'lib32-vulkan-icd-loader') + + mkdir -p "$pkgdir"/usr/share/dxvk/{x32,x64} + + cd "$srcdir/${pkgname}" + install -m0644 build/dxvk-${pkgver}/x32/d3d9.dll "$pkgdir"/usr/share/dxvk/x32/d3d9.dll + install -m0644 build/dxvk-${pkgver}/x64/d3d9.dll "$pkgdir"/usr/share/dxvk/x64/d3d9.dll + install -m0755 build/dxvk-${pkgver}/setup_dxvk.sh "$pkgdir"/usr/share/dxvk/setup_d9vk.sh + + mkdir "$pkgdir"/usr/bin + cd "$pkgdir"/usr/bin + ln -s /usr/share/dxvk/setup_d9vk.sh setup_d9vk +} diff --git a/arch/updatewine_arch.sh b/arch/updatewine_arch.sh index 49bde56..3475d50 100755 --- a/arch/updatewine_arch.sh +++ b/arch/updatewine_arch.sh @@ -1,6 +1,6 @@ #!/bin/env bash -# Set up Wine Staging + DXVK on Arch Linux & Variants +# Set up Wine Staging + DXVK & D9VK on Arch Linux & Variants # Copyright (C) 2018 Pekka Helenius # # This program is free software: you can redistribute it and/or modify @@ -46,10 +46,12 @@ done # variables! # git_commithash_dxvk=${params[0]} -git_commithash_wine=${params[3]} +git_commithash_d9vk=${params[1]} +git_commithash_wine=${params[4]} -git_branch_dxvk=${params[4]} -git_branch_wine=${params[7]} +git_branch_dxvk=${params[5]} +git_branch_d9vk=${params[6]} +git_branch_wine=${params[9]} ######################################################## @@ -83,6 +85,9 @@ for check in ${args[@]}; do --no-dxvk) NO_DXVK= ;; + --no-d9vk) + NO_D9VK= + ;; --no-pol) NO_POL= ;; @@ -100,7 +105,7 @@ function INFO_SEP() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - ; # If the script is interrupted (Ctrl+C/SIGINT), do the following function Arch_intCleanup() { - rm -rf ${ARCH_BUILDROOT}/{0-wine-staging-git/{wine-patches,*.tar.xz},0-dxvk-git/{dxvk-git,*.tar.xz}} + rm -rf ${ARCH_BUILDROOT}/{0-wine-staging-git/{wine-patches,*.tar.xz},0-dxvk-git/{dxvk-git,*.tar.xz},0-d9vk-git/{d9vk-git,*.tar.xz}} exit 0 } @@ -125,6 +130,7 @@ function checkFiles() { local wine_files=('30-win32-aliases.conf' 'PKGBUILD') local dxvk_files=('PKGBUILD') + local d9vk_files=('PKGBUILD') function validatefiles() { @@ -149,6 +155,10 @@ function checkFiles() { validatefiles "${dxvk_files[*]}" DXVK "${ARCH_BUILDROOT}/0-dxvk-git" fi + if [[ ! -v NO_D9VK ]]; then + validatefiles "${d9vk_files[*]}" D9VK "${ARCH_BUILDROOT}/0-d9vk-git" + fi + } ########################################################### @@ -243,9 +253,10 @@ $(for o in ${ERRPKGS[@]}; do printf '%s\n' ${o}; done)\ function prepare_env() { - # Copy Wine & DXVK patch files + # Copy Wine, DXVK & D9VK patch files cp -rf ${ARCH_BUILDROOT}/../wine_custom_patches ${ARCH_BUILDROOT}/0-wine-staging-git/wine-patches cp -rf ${ARCH_BUILDROOT}/../dxvk_custom_patches ${ARCH_BUILDROOT}/0-dxvk-git/dxvk-patches + cp -rf ${ARCH_BUILDROOT}/../d9vk_custom_patches ${ARCH_BUILDROOT}/0-d9vk-git/d9vk-patches # Create identifiable directory for this build mkdir -p ${ARCH_BUILDROOT}/compiled_pkg/"${datedir}" @@ -420,6 +431,12 @@ function build_pkg() { set_gitOverride "dxvk.git" "${git_commithash_dxvk}" ${pkgbuild_file} sed -i "s/\(^_git_branch_dxvk=\).*/\1${git_branch_dxvk}/" ${pkgbuild_file} sed -i "s/\(^_dxvk_commit=\).*/\1${git_commithash_dxvk}/" ${pkgbuild_file} + + elif [[ ${pkgname} == d9vk ]]; then + local pkgbuild_file="${ARCH_BUILDROOT}/${pkgdir}/PKGBUILD" + set_gitOverride "d9vk.git" "${git_commithash_d9vk}" ${pkgbuild_file} + sed -i "s/\(^_git_branch_d9vk=\).*/\1${git_branch_d9vk}/" ${pkgbuild_file} + sed -i "s/\(^_d9vk_commit=\).*/\1${git_commithash_d9vk}/" ${pkgbuild_file} fi fi @@ -481,6 +498,7 @@ function updatePOL() { done fi + # TODO remove duplicate functionality if [[ ! -v NO_DXVK ]]; then for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do if [[ -d ${wineprefix}/dosdevices ]]; then @@ -488,7 +506,13 @@ function updatePOL() { fi done fi - + if [[ ! -v NO_D9VK ]]; then + for wineprefix in $(find $HOME/.PlayOnLinux/wineprefix -mindepth 1 -maxdepth 1 -type d); do + if [[ -d ${wineprefix}/dosdevices ]]; then + WINEPREFIX=${wineprefix} setup_d9vk + fi + done + fi } ########################################################## @@ -496,7 +520,7 @@ function updatePOL() { # Clean these temporary folders & files # TODO Shall we remove git folders or keep them? -dxvk_wine_cleanlist=('*.patch' '*.diff' 'pkg' 'src' '*-patches' '*.tar.xz') # dxvk-git wine-*git +dxvk_wine_cleanlist=('*.patch' '*.diff' 'pkg' 'src' '*-patches' '*.tar.xz') ########################################################## @@ -530,6 +554,10 @@ if [[ ! -v NO_DXVK ]]; then checkDepends "0-dxvk-git" "dxvk-git" depends makedepends fi +if [[ ! -v NO_D9VK ]]; then + checkDepends "0-d9vk-git" "d9vk-git" depends makedepends +fi + check_alldeps ######################### @@ -546,6 +574,10 @@ if [[ ! -v NO_DXVK ]]; then build_pkg dxvk DXVK "0-dxvk-git" "${dxvk_wine_cleanlist[*]}" gitcheck fi +if [[ ! -v NO_D9VK ]]; then + build_pkg d9vk D9VK "0-d9vk-git" "${dxvk_wine_cleanlist[*]}" gitcheck +fi + ######################### # Update user's PlayonLinux wine prefixes if needed diff --git a/d9vk_custom_patches/patch_remove_d3d10-11.patch b/d9vk_custom_patches/patch_remove_d3d10-11.patch new file mode 100644 index 0000000..b7a5b10 --- /dev/null +++ b/d9vk_custom_patches/patch_remove_d3d10-11.patch @@ -0,0 +1,10 @@ +--- a/setup_dxvk.sh ++++ b/setup_dxvk.sh +@@ -173,7 +173,3 @@ + fi + + $action d3d9 +-$action d3d10 +-$action d3d10_1 +-$action d3d10core +-$action d3d11 diff --git a/d9vk_custom_patches/put_your_d9vk_patches_here b/d9vk_custom_patches/put_your_d9vk_patches_here new file mode 100644 index 0000000..1caca92 --- /dev/null +++ b/d9vk_custom_patches/put_your_d9vk_patches_here @@ -0,0 +1,4 @@ +Put your custom D9VK patches here. +Valid file suffix formats are: .diff and .patch + +These patches are applied during D9VK compilation diff --git a/debian/dxvkroot/d9vk.debdata b/debian/dxvkroot/d9vk.debdata new file mode 100755 index 0000000..b610865 --- /dev/null +++ b/debian/dxvkroot/d9vk.debdata @@ -0,0 +1,175 @@ +######################################################## +# Common properties + +pkg_name="d9vk-git" +pkg_license="custom --copyrightfile ../LICENSE" +pkg_maintainer="${USER} <${USER}@unknown>" +pkg_section="otherosfs" +pkg_priority="optional" +pkg_arch="all" + +d9vk_relative_builddir="debian/source/dxvk-master" + +pkg_commondesc="Vulkan-based D3D9 implementation for Linux / Wine" +pkg_longdesc=" +A Vulkan-based translation layer for Direct3D 9 which +allows running 3D applications on Linux using Wine. +" + +pkg_giturl="https://github.com/Joshua-Ashton/d9vk" +pkg_homeurl="https://github.com/Joshua-Ashton/d9vk" +pkg_gitbranch=${git_branch_d9vk} + +git_commithash=${git_commithash_d9vk} +pkg_gitver="git describe --long --always | sed 's/\-[a-z].*//; s/\-/\./; s/[a-z]//g'" + +pkg_installfile="./debian/install" +pkg_controlfile="./debian/control" +pkg_rulesfile="./debian/rules" + +######################################################## +# Debian rules file section + +pkg_debrules="\ +#!/usr/bin/make -f + +%: + dh \$@ + +override_dh_auto_configure: + +override_dh_usrlocal: + +override_dh_install: + + # Compile D9VK + bash ./package-release.sh master debian/source/ --no-package + + # Tell deb builder to create D9VK x32 & x64 subfolders + for arch in 32 64; do mkdir -p ${d9vk_relative_builddir}/x${arch}; done + + # Make a proper executable script folder for setup_d9vk.sh file + mkdir -p ${d9vk_relative_builddir}/bin + + printf '%s\n%s' \"#!/bin/sh\" \"/usr/share/dxvk/setup_d9vk.sh\" > \"${d9vk_relative_builddir}/bin/setup_d9vk\" + chmod +x "${d9vk_relative_builddir}/bin/setup_d9vk" + mv ${d9vk_relative_builddir}/setup_dxvk.sh ${d9vk_relative_builddir}/setup_d9vk.sh + dh_install +" + +######################################################## +# Debian install file section + +pkg_debinstall="\ +${d9vk_relative_builddir}/setup_d9vk.sh usr/share/dxvk/ +${d9vk_relative_builddir}/bin/* usr/bin/ +$(for arch in 32 64; do echo -e ${d9vk_relative_builddir}/x${arch}/d3d9.dll usr/share/dxvk/x${arch}/; done) +" + +######################################################## +# Debian control file subfields + +# Debian control file Overrides section +pkg_overrides=( +empty +) + +# Debian control file Suggests section +pkg_suggests=( +empty +) + +# Debian control file Conflicts section +pkg_conflicts=( +empty +) + +# Debian control file Breaks section +pkg_breaks=( +empty +) + +# Debian control file Replaces section +pkg_replaces=( +empty +) + +# Debian control file Provides section +pkg_provides=( +empty +) + +############################ + +# Build time dependencies +pkg_deps_build=( +#${_coredeps[*]} +'meson' +'glslang' +'gcc-mingw-w64-base' +#'binutils-common' +'mingw-w64-common' +'binutils-mingw-w64-x86-64' +'binutils-mingw-w64-i686' + +'mingw-w64-x86-64-dev' +'gcc-mingw-w64-x86-64' +'g++-mingw-w64-x86-64' + +'mingw-w64-i686-dev' +'gcc-mingw-w64-i686' +'g++-mingw-w64-i686' +) + +# Runtime dependencies +pkg_deps_runtime=( +'wine' +) + +# Extra fields for Debian control file Source section +pkg_extra_1=( +empty +) + +# Extra fields for Debian control file Package section +pkg_extra_2=( +empty +) + +############################ + +# Deb builder execution field +# Do not build either debug symbols or doc files +pkg_debbuilder="DEB_BUILD_OPTIONS=\"strip nodocs noddebs\" dpkg-buildpackage -us -uc -b -d --source-option=--include-binaries" + +######################################################## +# Contents of Debian control file +# This is a necessary variable setting for array loops below +IFS=$'\n' + +pkg_debcontrol="\ +Source: ${pkg_name} +Section: ${pkg_section} +Priority: ${pkg_priority} +Maintainer: ${pkg_maintainer} +Build-Depends: debhelper (>=9), $(if [[ ${pkg_deps_build[0]} != "empty" ]]; then \ +for w in ${pkg_deps_build[@]}; do printf '%s, ' ${w}; done; fi) +Standards-Version: 4.1.3 +Homepage: ${pkg_homeurl} +$(if [[ ${pkg_extra_1[0]} != "empty" ]]; then for w in ${pkg_extra_1[@]}; do echo ${w}; done ; fi) + +Package: ${pkg_name} +Architecture: ${pkg_arch} +Depends: \${shlibs:Depends}, \${misc:Depends}, $(if [[ ${pkg_deps_runtime[0]} != "empty" ]]; then \ +for w in ${pkg_deps_runtime[@]}; do printf '%s, ' ${w}; done; fi) +Description: ${pkg_commondesc} +$(echo -e ${pkg_longdesc} | sed 's/^/ /g; s/\n/\n /g') +$(if [[ ${pkg_extra_2[0]} != "empty" ]]; then for w in ${pkg_extra_2[@]}; do echo ${w}; done ; fi) +$(if [[ ${pkg_suggests[0]} != "empty" ]]; then echo "Suggests: $(echo ${_kg_suggests[*]} | sed 's/\s/, /g')"; fi) +$(if [[ ${pkg_conflicts[0]} != "empty" ]]; then echo "Conflicts: $(echo ${pkg_overrides[*]} | sed 's/\s/, /g')"; fi) +$(if [[ ${pkg_breaks[0]} != "empty" ]]; then echo "Breaks: $(echo ${pkg_overrides[*]} | sed 's/\s/, /g')"; fi) +$(if [[ ${pkg_replaces[0]} != "empty" ]]; then echo "Replaces: $(echo ${pkg_overrides[*]} | sed 's/\s/, /g')"; fi) +$(if [[ ${pkg_provides[0]} != "empty" ]]; then echo "Provides: $(echo ${pkg_overrides[*]} | sed 's/\s/, /g')"; fi) +" + +unset IFS diff --git a/debian/dxvkroot/dxvk.debdata b/debian/dxvkroot/dxvk.debdata index a6584c7..dbf9ad9 100755 --- a/debian/dxvkroot/dxvk.debdata +++ b/debian/dxvkroot/dxvk.debdata @@ -48,10 +48,10 @@ override_dh_install: # Tell deb builder to create DXVK x32 & x64 subfolders for arch in 32 64; do mkdir -p ${dxvk_relative_builddir}/x${arch}; done - # Make a proper executable script folder for setup_dxvk.verb file + # Make a proper executable script folder for setup_dxvk.sh file mkdir -p ${dxvk_relative_builddir}/bin - echo -e \"#!/bin/sh\n/usr/share/dxvk/setup_dxvk.sh\" > \"${dxvk_relative_builddir}/bin/setup_dxvk\" + printf '%s\n%s' \"#!/bin/sh\" \"/usr/share/dxvk/setup_dxvk.sh\" > \"${dxvk_relative_builddir}/bin/setup_dxvk\" chmod +x "${dxvk_relative_builddir}/bin/setup_dxvk" dh_install " @@ -60,7 +60,7 @@ override_dh_install: # Debian install file section pkg_debinstall="\ -${dxvk_relative_builddir}/setup_dxvk.verb usr/share/dxvk/ +${dxvk_relative_builddir}/setup_dxvk.sh usr/share/dxvk/ ${dxvk_relative_builddir}/bin/* usr/bin/ $(for arch in 32 64; do echo -e ${dxvk_relative_builddir}/x${arch}/* usr/share/dxvk/x${arch}/; done) " @@ -105,12 +105,19 @@ pkg_deps_build=( #${_coredeps[*]} 'meson' 'glslang' +'gcc-mingw-w64-base' +#'binutils-common' +'mingw-w64-common' +'binutils-mingw-w64-x86-64' +'binutils-mingw-w64-i686' + +'mingw-w64-x86-64-dev' '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' +'gcc-mingw-w64-i686' +'g++-mingw-w64-i686' ) # Runtime dependencies @@ -132,7 +139,7 @@ empty # Deb builder execution field # Do not build either debug symbols or doc files -pkg_debbuilder="DEB_BUILD_OPTIONS=\"strip nodocs noddebs\" dpkg-buildpackage -us -uc -b --source-option=--include-binaries" +pkg_debbuilder="DEB_BUILD_OPTIONS=\"strip nodocs noddebs\" dpkg-buildpackage -us -uc -b -d --source-option=--include-binaries" ######################################################## # Contents of Debian control file diff --git a/debian/dxvkroot/dxvkbuild.sh b/debian/dxvkroot/dxvkbuild.sh index e8d3afa..dec4fcb 100755 --- a/debian/dxvkroot/dxvkbuild.sh +++ b/debian/dxvkroot/dxvkbuild.sh @@ -1,6 +1,6 @@ #!/bin/env bash -# Compile DXVK git on Debian/Ubuntu/Mint and variants +# Compile DXVK & D9VK git on Debian/Ubuntu/Mint and variants # Copyright (C) 2018 Pekka Helenius # # This program is free software: you can redistribute it and/or modify @@ -46,12 +46,14 @@ done # variables! # git_commithash_dxvk=${params[0]} -git_commithash_glslang=${params[1]} -git_commithash_meson=${params[2]} +git_commithash_d9vk=${params[1]} +git_commithash_glslang=${params[2]} +git_commithash_meson=${params[3]} -git_branch_dxvk=${params[4]} -git_branch_glslang=${params[5]} -git_branch_meson=${params[6]} +git_branch_dxvk=${params[5]} +git_branch_d9vk=${params[6]} +git_branch_glslang=${params[7]} +git_branch_meson=${params[8]} ######################################################## @@ -80,28 +82,78 @@ for check in ${args[@]}; do --buildpkg-rm) BUILDPKG_RM= ;; + --no-dxvk) + NO_DXVK= + ;; + --no-d9vk) + NO_D9VK= + ;; esac done ######################################################## -# PRESENCE OF WINE - # Check presence of Wine. Some version of Wine should # be found in the system in order to install DXVK. known_wines=( -'wine' -'wine-stable' -'wine32' -'wine64' -'libwine:amd64' -'libwine:i386' -'wine-git' -'wine-staging-git' + 'wine' + 'wine-stable' + 'wine32' + 'wine64' + 'libwine:amd64' + 'libwine:i386' + 'wine-git' + 'wine-staging-git' ) +# Alternative remote dependency packages for Debian distributions which offer too old packages for DXVK/D9VK +# +# Left side: , +# Right side: package alternative source URL +# +# NOTE: Determine these packages in corresponding debdata files as runtime or buildtime dependencies +# +typeset -A remotePackagesAlt +remotePackagesAlt=( + [gcc-mingw-w64-base,830]="http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-mingw-w64/gcc-mingw-w64-base_8.3.0-6ubuntu1+21.1build2_amd64.deb" + [mingw-w64-common,600]="http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-common_6.0.0-3_all.deb" +# [binutils-common,232]="http://mirrors.kernel.org/ubuntu/pool/main/b/binutils/binutils-common_2.32-7ubuntu4_amd64.deb" + [binutils-mingw-w64-x86-64,232]="http://mirrors.kernel.org/ubuntu/pool/universe/b/binutils-mingw-w64/binutils-mingw-w64-x86-64_2.32-7ubuntu4+8.3ubuntu2_amd64.deb" + [binutils-mingw-w64-i686,232]="http://mirrors.kernel.org/ubuntu/pool/universe/b/binutils-mingw-w64/binutils-mingw-w64-i686_2.32-7ubuntu4+8.3ubuntu2_amd64.deb" + + [mingw-w64-x86-64-dev,600]="http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-x86-64-dev_6.0.0-3_all.deb" + [gcc-mingw-w64-x86-64,830]="http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-mingw-w64/gcc-mingw-w64-x86-64_8.3.0-6ubuntu1+21.1build2_amd64.deb" + [g++-mingw-w64-x86-64,830]="http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-mingw-w64/g++-mingw-w64-x86-64_8.3.0-6ubuntu1+21.1build2_amd64.deb" + + [mingw-w64-i686-dev,600]="http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-i686-dev_6.0.0-3_all.deb" + [gcc-mingw-w64-i686,830]="http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-mingw-w64/gcc-mingw-w64-i686_8.3.0-6ubuntu1+21.1build2_amd64.deb" + [g++-mingw-w64-i686,830]="http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-mingw-w64/g++-mingw-w64-i686_8.3.0-6ubuntu1+21.1build2_amd64.deb" +) + +# Posix-compliant MingW alternative executables +# +typeset -A alternatives +alternatives=( + [x86_64-w64-mingw32-gcc]="x86_64-w64-mingw32-gcc-posix" + [x86_64-w64-mingw32-g++]="x86_64-w64-mingw32-g++-posix" + [i686-w64-mingw32-gcc]="i686-w64-mingw32-gcc-posix" + [i686-w64-mingw32-g++]="i686-w64-mingw32-g++-posix" +) + +# Temporary symbolic links for DXVK & D9VK compilation +# +typeset -A tempLinks +tempLinks=( + ['/usr/bin/i686-w64-mingw32-gcc']='/usr/bin/i686-w64-mingw32-gcc-posix' + ['/usr/bin/i686-w64-mingw32-g++']='/usr/bin/i686-w64-mingw32-g++-posix' + ['/usr/bin/x86_64-w64-mingw32-gcc']='x86_64-w64-mingw32-gcc-posix' + ['/usr/bin/x86_64-w64-mingw32-g++']='x86_64-w64-mingw32-g++-posix' +) + +######################################################## + function runtimeCheck() { # Friendly name for this package @@ -119,15 +171,14 @@ function runtimeCheck() { done if [[ -z ${pkglist[*]} ]]; then - echo -e "\e[1mWARNING:\e[0m Not installing DXVK because \e[1m${pkgreq_name}\e[0m is missing on your system.\n\ -${pkgreq_name} should be installed in order to use DXVK. Just compiling DXVK for later use.\n" + echo -e "\e[1mWARNING:\e[0m Not installing DXVK/D9VK because \e[1m${pkgreq_name}\e[0m is missing on your system.\n\ +${pkgreq_name} should be installed in order to use DXVK/D9VK. Just compiling DXVK/D9VK for later use.\n" # Do this check separately so we can warn about all missing runtime dependencies above if [[ ! -v NO_INSTALL ]]; then # Force --no-install switch NO_INSTALL= fi - fi } @@ -137,7 +188,7 @@ ${pkgreq_name} should be installed in order to use DXVK. Just compiling DXVK for # If the script is interrupted (Ctrl+C/SIGINT), do the following function DXVK_intCleanup() { - rm -rf ${DXVKROOT}/{dxvk-git,meson,glslang} + rm -rf ${DXVKROOT}/{dxvk-git,d9vk-git,meson,glslang,*.deb} rm -rf ${DXVKROOT}/../compiled_deb/"${datedir}" exit 0 } @@ -186,27 +237,32 @@ function pkgcompilecheck() { function dxvk_install_custom() { + local PATCHDIR="${1}" + # Use posix alternates for MinGW binaries 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 + for alt in ${!alternatives[@]}; do + echo "Linking MingW executable ${alt} to ${alternatives[$alt]}" + sudo rm -rf /etc/alternatives/"${alt}" 2>/dev/null + sudo ln -sf /usr/bin/"${alternatives[$alt]}" /etc/alternatives/"${alt}" if [[ $? -ne 0 ]]; then - echo -e "\e[1mERROR:\e[0m Error occured while running 'update-alternatives' for '${package}'. Aborting\n" + echo -e "\e[1mERROR:\e[0m Error occured while linking executable ${alt} to ${alternatives[$alt]}. Aborting\n" exit 1 fi - done + for link in ${!tempLinks[@]}; do + if [[ ! -f ${link} ]]; then + echo "Creating temporary links for MingW executable ${link}" + sudo ln -sf ${tempLinks["${link}"]} "${link}" + if [[ $? -ne 0 ]]; then + echo -e "\e[1mERROR:\e[0m Error occured while linking executable ${link}. Aborting\n" + exit 1 + fi + fi + done } ############################ @@ -218,10 +274,10 @@ function dxvk_install_custom() { # Get our current directory, since we will change it during patching process below # We want to go back here after having applied the patches local CURDIR="${PWD}" - + # Check if the following folder exists, and proceed. - if [[ -d "${DXVKROOT}/../../dxvk_custom_patches" ]]; then - cp -r "${DXVKROOT}/../../dxvk_custom_patches/"*.{patch,diff} "${DXVKROOT}/${pkg_name}/" 2>/dev/null + if [[ -d "${DXVKROOT}/../../${PATCHDIR}" ]]; then + cp -r "${DXVKROOT}/../../${PATCHDIR}/"*.{patch,diff} "${DXVKROOT}/${pkg_name}/" 2>/dev/null local dxvk_builddir_name=$(ls -l "${DXVKROOT}/${pkg_name}" | grep ^d | awk '{print $NF}') @@ -258,8 +314,7 @@ function dxvk_install_custom() { # DXVK - CUSTOM HOOKS EXECUTION dxvk_custompatches && \ - dxvk_posixpkgs && \ - dxvk_custom_deb_build + dxvk_posixpkgs } ######################################################## @@ -323,6 +378,13 @@ function compile_and_install_deb() { arrayparser_reverse +############################ + + function pkg_installcheck() { + RETURNVALUE=$(echo $(dpkg -s "${1}" &>/dev/null)$?) + return $RETURNVALUE + } + ############################ echo -e "Starting compilation$(if [[ ! -v NO_INSTALL ]] || [[ ${_pkg_name} =~ ^meson|glslang$ ]]; then printf " & installation"; fi) of ${_pkg_name}\n" @@ -337,6 +399,8 @@ function compile_and_install_deb() { local _pkg_list="${1}" local _pkg_type="${2}" local IFS=$'\n' + _pkg_list=$(echo "${_pkg_list}" | sed 's/([^)]*)//g') + unset IFS case ${_pkg_type} in buildtime) @@ -354,25 +418,76 @@ function compile_and_install_deb() { # Generate a list of missing dependencies local a=0 for p in ${_pkg_list[@]}; do - local p=$(printf '%s' ${p} | awk '{print $1}') - if [[ $(echo $(dpkg -s ${p} &>/dev/null)$?) -ne 0 ]]; then + if [[ $(pkg_installcheck ${p}) -eq 0 ]]; then local _validlist[$a]=${p} let a++ # Global array to track installed build dependencies if [[ ${_pkg_type} == "buildtime" ]]; then - _buildpkglist[$z]=${p} + _buildpkglist[$z]="${p}" let z++ fi - fi done + function pkg_remoteinstall() { + sudo apt install -y ${1} &> /dev/null + } + + function pkg_localinstall() { + wget ${1} -O ${DXVKROOT}/"${2}".deb + sudo dpkg -i --force-all ${DXVKROOT}/"${2}".deb + } + + function pkg_configure() { + if [[ $(sudo dpkg-reconfigure ${1} | grep "is broken or not fully installed") ]]; then + if [[ -v ${2} ]]; then + pkg_localinstall ${2} ${1} + else + pkg_remoteinstall ${1} + fi + fi + } + # Install missing dependencies, be informative local b=0 for _pkg_dep in ${_validlist[@]}; do echo -e "$(( $b + 1 ))/$(( ${#_validlist[*]} )) - Installing ${_pkg_name} ${_pkg_type_str} dependency ${_pkg_dep}" - sudo apt install -y ${_pkg_dep} &> /dev/null + + if [[ ${#remotePackagesAlt[@]} -gt 0 ]]; then + for altRemote in ${!remotePackagesAlt[@]}; do + altRemotepkg=$(echo ${altRemote} | awk -F ',' '{print $1}') + altRemotever=$(echo ${altRemote} | awk -F ',' '{print $2}') + if [[ "${_pkg_dep}" == "${altRemotepkg}" ]]; then + if [[ $(pkg_installcheck ${altRemotepkg}) -ne 0 ]]; then + + # TODO remove duplicate functionality + if [[ $(apt-cache show "${altRemotepkg}" | grep -m1 -oP "(?<=^Version: )[0-9|\.]*" | sed 's/\.//g') < ${altRemotever} ]]; then + pkg_localinstall ${remotePackagesAlt["${altRemote}"]} "${altRemotepkg}" + pkg_configure "${altRemotepkg}" ${remotePackagesAlt["${altRemote}"]} + else + pkg_remoteinstall "${altRemotepkg}" + pkg_configure "${altRemotepkg}" + fi + else + if [[ $(dpkg -s "${altRemotepkg}" | grep -m1 -oP "(?<=^Version: )[0-9|\.]*" | sed 's/\.//g') < ${altRemotever} ]]; then + pkg_localinstall ${remotePackagesAlt["${altRemote}"]} "${altRemotepkg}" + pkg_configure "${altRemotepkg}" ${remotePackagesAlt["${altRemote}"]} + else + pkg_remoteinstall "${altRemotepkg}" + pkg_configure "${altRemotepkg}" + fi + + fi + fi + done + fi + + if [[ $(pkg_installcheck ${_pkg_dep}) -ne 0 ]]; then + pkg_remoteinstall "${_pkg_dep}" + pkg_configure "${_pkg_dep}" + fi + if [[ $? -eq 0 ]]; then let b++ else @@ -483,7 +598,7 @@ function compile_and_install_deb() { mv ../${_pkg_name}*.deb ../../../compiled_deb/"${datedir}" && \ echo -e "Compiled ${_pkg_name} is stored at '$(readlink -f ../../../compiled_deb/"${datedir}")/'\n" cd ../.. - rm -rf ${_pkg_name} + rm -rf {${_pkg_name},*.deb} else buildpkg_removal exit 1 @@ -494,7 +609,7 @@ function compile_and_install_deb() { ############################ # COMMON - EXECUTION HOOKS - pkg_dependencies "${_pkg_deps_build[*]}" buildtime && \ + pkg_dependencies "${_pkg_deps_build[*]}" buildtime if [[ ${_pkg_deps_runtime[0]} != "empty" ]] && [[ ! -v NO_INSTALL ]]; then pkg_dependencies "${_pkg_deps_runtime[*]}" runtime @@ -503,9 +618,13 @@ function compile_and_install_deb() { pkg_folderprepare # TODO use package name or separate override switch here? - if [[ ${_pkg_name} == *"dxvk"* ]]; then - dxvk_install_custom - fi + if [[ "${_pkg_name}" == *"dxvk"* ]]; then + dxvk_install_custom "dxvk_custom_patches" + fi + if [[ "${_pkg_name}" == *"d9vk"* ]]; then + dxvk_install_custom "d9vk_custom_patches" + fi + pkg_debianbuild unset _pkg_gitver @@ -518,6 +637,14 @@ function compile_and_install_deb() { function buildpkg_removal() { + _buildpkglist=($(echo ${_buildpkglist[@]} | tr ' ' '\n' |sort -u | tr '\n' ' ')) + + for link in ${!tempLinks[@]}; do + if [[ $(file ${link}) == *"symbolic link"* ]]; then + sudo rm -f "${link}" + fi + done + # Build time dependencies which were installed but no longer needed if [[ -v _buildpkglist ]]; then if [[ -v BUILDPKG_RM ]]; then @@ -526,9 +653,11 @@ function buildpkg_removal() { # In some cases, glslang or meson may still be present on the system. Remove them for _extrapkg in glslang meson; do if [[ $(echo $(dpkg -s ${_extrapkg} &>/dev/null)$?) -eq 0 ]]; then - sudo apt purge --remove -y ${_extrapkg} + sudo dpkg --remove --force-remove-reinstreq ${_extrapkg} fi done + # Manually obtained deb packages are expected to break system configuration, thus we need to fix it. + sudo apt --fix-broken -y install else echo -e "The following build time dependencies were installed and no longer needed:\n\n$(for l in ${_buildpkglist[*]}; do echo -e ${l}; done)\n" @@ -559,8 +688,8 @@ function pkg_install_main() { function pkg_arrayparser() { local pkg_arrays=( - 'pkg_deps_build' - 'pkg_deps_runtime' + 'pkg_deps_build' + 'pkg_deps_runtime' ) local IFS=$'\n' @@ -609,8 +738,15 @@ pkgcompilecheck pkg_install_main meson "${DXVKROOT}/meson.debdata" # Glslang - compile (& install) pkgcompilecheck pkg_install_main glslang "${DXVKROOT}/glslang.debdata" -# DXVK - compile (& install) -pkg_install_main "${DXVKROOT}/dxvk.debdata" +if [[ ! -v NO_DXVK ]]; then + # DXVK - compile (& install) + pkg_install_main "${DXVKROOT}/dxvk.debdata" +fi + +if [[ ! -v NO_D9VK ]]; then + # D9VK - compile (& install) + pkg_install_main "${DXVKROOT}/d9vk.debdata" +fi # Clean buildtime dependencies buildpkg_removal diff --git a/debian/dxvkroot/glslang.debdata b/debian/dxvkroot/glslang.debdata index 339f61a..2af8b40 100755 --- a/debian/dxvkroot/glslang.debdata +++ b/debian/dxvkroot/glslang.debdata @@ -102,7 +102,7 @@ empty # Deb builder execution field # Do not build either debug symbols -pkg_debbuilder="DEB_BUILD_OPTIONS=\"strip nodocs noddebs\" dpkg-buildpackage -rfakeroot -b -us -uc" +pkg_debbuilder="DEB_BUILD_OPTIONS=\"strip nodocs noddebs\" dpkg-buildpackage -rfakeroot -b -us -uc -d" ######################################################## # Contents of Debian control file diff --git a/debian/dxvkroot/meson.debdata b/debian/dxvkroot/meson.debdata index 3590bf2..4356579 100755 --- a/debian/dxvkroot/meson.debdata +++ b/debian/dxvkroot/meson.debdata @@ -135,7 +135,7 @@ empty # Deb builder execution field # Do not build either debug symbols or doc files -pkg_debbuilder="DEB_BUILD_OPTIONS=\"strip nodocs noddebs nocheck\" dpkg-buildpackage -rfakeroot -b -us -uc" +pkg_debbuilder="DEB_BUILD_OPTIONS=\"strip nodocs noddebs nocheck\" dpkg-buildpackage -rfakeroot -b -us -uc -d" ######################################################## # Contents of Debian control file diff --git a/debian/updatewine_debian.sh b/debian/updatewine_debian.sh index fd49569..16f6091 100755 --- a/debian/updatewine_debian.sh +++ b/debian/updatewine_debian.sh @@ -74,12 +74,12 @@ for check in ${args[@]}; do --no-dxvk) NO_DXVK= ;; + --no-d9vk) + NO_D9VK= + ;; --no-pol) NO_POL= ;; - --no-winetricks) - NO_WINETRICKS= - ;; --no-install) NO_INSTALL= # If this option is given, do not check PoL wineprefixes @@ -137,187 +137,14 @@ Using $(nproc --ignore 1) of $(nproc) available CPU cores for Wine source code c ######################################################## -# Call Winetricks compilation & installation subscript in the following function - -function winetricks_install_main() { - - local pkg="winetricks" - - # Location of expected Winetricks deb archive from - # the point of view of this script file - local pkgdebdir=".." - - # Winetricks availability check - function winetricks_availcheck() { - - local apt_searchcheck=$(apt-cache search ^${pkg}$ | wc -l) - - if [[ $(echo $(dpkg -s ${pkg} &>/dev/null)$?) -ne 0 ]]; then - - # TODO expecting only 1 match from apt-cache output - if [[ ${apt_searchcheck} -eq 1 ]]; then - sudo apt install -y ${pkg} - if [[ $? -eq 0 ]]; then - # Winetricks already installed by the previous command - return 0 - else - echo -e "\e[1mWARNING:\e[0m Can't install Winetricks from repositories. Trying to compile from source.\n" - # TODO Force Winetricks compilation from source. Is this a good practice? - return 1 - fi - else - # Multiple or no entries from apt-cache output. Can't decide which package to use, so force winetricks compilation. - echo -e "\e[1mWARNING:\e[0m Can't install Winetricks from repositories. Trying to compile from source.\n" - # TODO Force Winetricks compilation from source. Is this a good practice? - return 1 - fi - else - # Winetricks already installed on the system - echo -e "Winetricks is installed on your system. Use your package manager or 'debian_install_winetricks.sh' script to update it.\n" - return 0 - fi - } - - # Winetricks installation from local deb package - function winetricks_localdeb() { - - # Check that Wine exists on the system. If yes, then - # install other required winetricks dependencies - # so that Winetricks install script won't complain about - # missing them. - # - local known_wines=( - 'wine' - 'wine-stable' - 'wine32' - 'wine64' - 'libwine:amd64' - 'libwine:i386' - 'wine-git' - 'wine-staging-git' - ) - - # Other winetricks dependencies - local winetricks_deps=('cabextract' 'unzip' 'x11-utils') - - # If known wine is found, then check winetricks_deps and install them if needed. - for winepkg in ${known_wines[@]}; do - if [[ $(echo $(dpkg -s ${winepkg} &>/dev/null)$?) -eq 0 ]]; then - for tricksdep in ${winetricks_deps[@]}; do - if [[ $(echo $(dpkg -s ${tricksdep} &>/dev/null)$?) -ne 0 ]]; then - sudo apt install -y ${tricksdep} - if [[ $? -ne 0 ]]; then - echo -e "\e[1mERROR:\e[0m Couldn't install Winetricks dependency ${tricksdep}. Skipping Winetricks installation.\n" - # TODO revert installation of any installed 'tricksdep' installed on previous loop cycle - if [[ ! -v NO_INSTALL ]];then - echo -e "DXVK won't be installed\n" - # We can set this value because winetricks function is intented to be called - # after Wine compilation & installation BUT before DXVK install function - # DXVK runtime (not build time) depends on Winetricks - params+=('--no-install') - fi - # Special variable only to inform user about errors in Winetricks installation - WINETRICKS_ERROR= - return 1 - fi - fi - done - # If known wine has already been found, do not iterate through other candidates - break - fi - done - - # Check for existing winetricks deb archives in the previous folder - local localdeb=$(find ${pkgdebdir} -type f -name "${pkg}*.deb" | wc -l) - - case ${localdeb} in - 0) - # No old winetricks archives - # Just fall through - ;; - 1) - # One old winetricks archive found - echo -e "Found already compiled Winetricks archive, installing it.\n" - # TODO ask user? Note that asking this limits the automation process of this script - # unless a solution will be implemented (e.g. parameter switch) - sudo dpkg -i ${pkgdebdir}/${pkg}*.deb - return 0 - ;; - *) - # Multiple old winetricks archives found - # Move them and compile a new one - if [[ ! -d ${pkgdebdir}/winetricks_old ]]; then - mkdir -p ${pkgdebdir}/winetricks_old - fi - mv ${pkgdebdir}/${pkg}*.deb ${pkgdebdir}/winetricks_old/ - if [[ $? -ne 0 ]]; then - echo -e "\e[1mWARNING:\e[0m Couldn't move old Winetricks archives. Not installing Winetricks.\n" - if [[ ! -v NO_INSTALL ]];then - echo -e "DXVK won't be installed\n" - # We can set this value because winetricks function is intented to be called - # after Wine compilation & installation BUT before DXVK install function - # DXVK runtime (not build time) depends on Winetricks - params+=('--no-install') - fi - fi - ;; - esac - - echo -e "Starting compilation & installation of Winetricks\n" - bash -c "cd .. && bash ./debian_install_winetricks.sh" - - if [[ $? -eq 0 ]]; then - # The compiled Winetricks deb package is found in the previous folder - sudo dpkg -i ${pkgdebdir}/${pkg}*.deb - - if [[ $? -ne 0 ]]; then - echo -e "\e[1mWARNING:\e[0m Couldn't install Winetricks.\n" - - if [[ ! -v NO_INSTALL ]];then - echo -e "DXVK won't be installed\n" - # We can set this value because winetricks function is intented to be called - # after Wine compilation & installation BUT before DXVK install function - # DXVK runtime (not build time) depends on Winetricks - params+=('--no-install') - fi - # Special variable only to inform user about errors in Winetricks installation - WINETRICKS_ERROR= - return 1 - fi - else - echo -e "\e[1mWARNING:\e[0m Couldn't compile Winetricks.\n" - if [[ ! -v NO_INSTALL ]];then - echo -e "DXVK won't be installed\n" - # We can set this value because winetricks function is intented to be called - # after Wine compilation & installation BUT before DXVK install function - # DXVK runtime (not build time) depends on Winetricks - params+=('--no-install') - fi - # Special variable only to inform user about errors in Winetricks compilation - WINETRICKS_ERROR= - return 1 - fi - - } - - winetricks_availcheck - if [[ $? -ne 0 ]]; then - winetricks_localdeb - fi - -} - -######################################################## - # Call DXVK compilation & installation subscript in the following function function dxvk_install_main() { - echo -e "Starting compilation & installation of DXVK\n\n\ + echo -e "Starting compilation & installation of DXVK/D9VK\n\n\ This can take up to 10-20 minutes depending on how many dependencies we need to build for it.\n" bash -c "cd ${ROOTDIR}/dxvkroot && bash dxvkbuild.sh \"${datedir}\" \"${params[*]}\"" - } ######################################################## @@ -347,6 +174,7 @@ function mainQuestions() { installed and the following packages may be compiled from source (depending on your choises):\n\n\ \t- Wine/Wine Staging (latest git version)\n\ \t- DXVK (latest git version)\n\ +\t- D9VK (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]" @@ -395,8 +223,8 @@ Do you really want to continue? [Y/n]" #################### - # This question is relevant only if DXVK stuff is compiled - if [[ ! -v NO_DXVK ]]; then + # This question is relevant only if DXVK or D9VK stuff is compiled + if [[ ! -v NO_DXVK ]] || [[ ! -v NO_D9VK ]]; then INFO_SEP echo -e "\e[1mQUESTION:\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\ @@ -439,8 +267,8 @@ function coredeps_check() { ######################################################## -# If either Wine or DXVK is to be compiled -if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]; then +# If either Wine, DXVK or D9VK is to be compiled +if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]] || [[ ! -v NO_D9VK ]]; then mainQuestions coredeps_check fi @@ -456,23 +284,11 @@ fi #################### -# Run winetricks installation, if needed -if [[ ! -v NO_DXVK ]] && [[ ! -v NO_INSTALL ]]; then - if [[ ! -v NO_WINETRICKS ]]; then - winetricks_install_main - else - echo -e "Skipping Winetricks build & installation process.\n \ - DXVK will not be installed, unless Winetricks is already installed on your system.\n" - fi -fi - -#################### - -# If DXVK is going to be installed, then -if [[ ! -v NO_DXVK ]]; then +# If DXVK or D9VK is going to be installed, then +if [[ ! -v NO_DXVK ]] || [[ ! -v NO_D9VK ]]; then dxvk_install_main else - echo -e "Skipping DXVK build$(if [[ ! -v NO_INSTALL ]]; then printf " & installation"; fi) process.\n" + echo -e "Skipping DXVK/D9VK build$(if [[ ! -v NO_INSTALL ]]; then printf " & installation"; fi) process.\n" fi #################### @@ -482,9 +298,3 @@ if [[ ! -v NO_POL ]]; then echo -e "\e[1mINFO:\e[0m Updating your PlayOnLinux Wine prefixes.\n" bash -c "cd ${ROOTDIR} && bash playonlinux_prefixupdate.sh" fi - -# If error occured during Winetricks script runtime, then -if [[ -v WINETRICKS_ERROR ]]; then - echo -e "\e[1mWARNING:\e[0m Couldn't compile or install Winetricks.\ - $(if [[ ! -v NO_DXVK ]]; then printf " DXVK installation may have failed, too."; fi)\n" -fi diff --git a/updatewine.sh b/updatewine.sh index 8186d14..e2ccf1c 100755 --- a/updatewine.sh +++ b/updatewine.sh @@ -1,6 +1,6 @@ #!/bin/env bash -# DXVK/Wine-Staging scripts dispatcher for various Linux distributions +# DXVK/D9VK/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 @@ -34,7 +34,7 @@ fi # Just a title & author for this script, used in initialization and help page -SCRIPT_TITLE="\e[1mWine/Wine Staging & DXVK package builder & auto-installer\e[0m" +SCRIPT_TITLE="\e[1mWine/Wine Staging, DXVK & D9VK package builder & auto-installer\e[0m" SCRIPT_AUTHOR="Pekka Helenius (~Fincer), 2018" ######################################################## @@ -48,9 +48,12 @@ SCRIPT_AUTHOR="Pekka Helenius (~Fincer), 2018" # version available # Do NOT leave these variable empty! -git_commithash_dxvk=1af96347e1c6f1f2eb11aeb11009f380fd5761ec +git_commithash_dxvk=HEAD git_branch_dxvk=master +git_commithash_d9vk=HEAD +git_branch_d9vk=master + git_commithash_wine=HEAD git_branch_wine=master @@ -154,25 +157,24 @@ for arg in ${@}; do # Skip DXVK build & installation process all together NO_DXVK= ;; + --no-d9vk) + # Skip D9VK build & installation process all together + NO_D9VK= + ;; --no-pol) # Skip PlayOnLinux Wine prefixes update process ;; - --no-winetricks) - # Do not build Winetricks, do not install DXVK - # Debian only - ;; *) echo -e "\n\ \ ${SCRIPT_TITLE} by ${SCRIPT_AUTHOR}\n\n\ Usage:\n\nbash updatewine.sh\n\nArguments:\n\n\ ---no-install\tDo not install Wine, Winetricks or DXVK, just compile them. Wine, meson & glslang must be installed for DXVK compilation.\n\ +--no-install\tDo not install Wine, DXVK or D9VK. Just compile them. Wine, meson & glslang must be installed for DXVK & D9VK compilation.\n\ --no-dxvk\tDo not compile or install DXVK\n\ +--no-d9vk\tDo not compile or install D9VK\n\ --no-pol\tDo not update PlayOnLinux Wine prefixes\n\n\ --no-staging\tCompile Wine instead of Wine Staging\n\ ---no-wine\tDo not compile or install Wine/Wine Staging\n\ ---no-winetricks\t[Debian only] Do not compile or install Winetricks.\n\ -\t\tNo DXVK installation unless Winetricks already installed.\n\n\ +--no-wine\tDo not compile or install Wine/Wine Staging\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 @@ -198,6 +200,7 @@ datesuffix=$(echo $(date '+%Y-%m-%d-%H%M%S')) githash_overrides=( "${git_commithash_dxvk}" +"${git_commithash_d9vk}" "${git_commithash_glslang}" "${git_commithash_meson}" "${git_commithash_wine}" @@ -208,6 +211,7 @@ githash_overrides=( gitbranch_overrides=( "${git_branch_dxvk}" +"${git_branch_d9vk}" "${git_branch_glslang}" "${git_branch_meson}" "${git_branch_wine}" @@ -249,7 +253,7 @@ function sudoQuestion() { # 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 + sudo -nv && sleep 2 done } @@ -298,7 +302,7 @@ function determineDistroFamily() { esac } -if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]; then +if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]] || [[ ! -v NO_D9VK ]]; then echo -e "\n${SCRIPT_TITLE}\n\nBuild identifier:\t${datesuffix}\n" else echo "" @@ -311,11 +315,11 @@ fi determineDistroFamily INFO_SEP -echo -e "\e[1mNOTE: \e[0mDXVK requires very latest Nvidia/AMD drivers to work.\nMake sure these drivers are available on your Linux distribution.\n\ +echo -e "\e[1mNOTE: \e[0mDXVK/D9VK requires very latest Nvidia/AMD drivers to work.\nMake 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 [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]; then +if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]] || [[ ! -v NO_D9VK ]]; then sudoQuestion echo "" fi