From d162a436bfe501b16fb0e1afd54ff2b28d9a8533 Mon Sep 17 00:00:00 2001 From: Fincer Date: Mon, 12 Nov 2018 23:08:30 +0200 Subject: [PATCH] DXVK: Add patchfile compatibility; Add licenses + minor fixes --- README.md | 12 +++++-- arch/0-dxvk-git/PKGBUILD | 36 ++++++++++++++++++-- arch/updatewine_arch.sh | 14 ++++---- debian/dxvkroot/dxvkbuild.sh | 64 ++++++++++++++++++++++++++++++++---- debian/wineroot/winebuild.sh | 2 +- 5 files changed, 110 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 02733b7..3d593fb 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,16 @@ All supported arguments are: ---------------- +## Custom patches for Wine & DXVK + +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). + +Folders `dxvk_disabled_patches` and `wine_disabled_patches` are just for management purposes, they do not have a role in script at all. + +Wine patches are not related to Wine Staging patchset. You can use your patches either with Wine Staging or vanilla Wine. + +---------------- + ## Compiled packages are stored for later usage Successfully compiled Wine & DXVK packages are stored as follows: @@ -239,8 +249,6 @@ ninja: build stopped: subcommand failed. - Remove temp folders in case of failure (meson/glslang/dxvk-git/wine... temp build folders) -- Add support for custom DXVK patches - - Add proper license information for meson, glslang, Wine & DXVK - Add option (?): do not store compiled packages, just install them diff --git a/arch/0-dxvk-git/PKGBUILD b/arch/0-dxvk-git/PKGBUILD index 34dae14..9ca683b 100755 --- a/arch/0-dxvk-git/PKGBUILD +++ b/arch/0-dxvk-git/PKGBUILD @@ -1,5 +1,5 @@ # Maintainer: AdriƠ Cereto i MassaguƩ -# Contributor: Pekka Helenius +# Contributor: Pekka Helenius (~Fincer) pkgname=dxvk-git _pkgname=dxvk @@ -22,6 +22,39 @@ options=(!strip !buildflags staticlibs) source=(${pkgname}::"git+https://github.com/doitsujin/dxvk.git") sha256sums=('SKIP') +############################## +# Custom patches, if present + +if [[ $(find ./dxvk-patches -mindepth 1 -maxdepth 1 -regex ".*\.\(patch\|diff\)$") ]]; then + cp -r ./dxvk-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 + +prepare() { + + # Apply patches, if present + if [[ $(ls "${srcdir}"/*.{patch,diff} | wc -w) -ne 0 ]]; then + + cd "${srcdir}"/dxvk-git + # Apply all custom patches + msg2 "Applying custom patches..." + + for i in "${srcdir}"/*.{patch,diff}; do + patch -Np1 < ${i} + done + + fi + +} + +############################## + pkgver() { cd "${pkgname}" git describe --long | sed 's/\-[a-z].*//; s/\-/\./; s/[a-z]//g' @@ -40,4 +73,3 @@ package() { chmod +x "${pkgdir}/usr/bin/setup_dxvk" } - diff --git a/arch/updatewine_arch.sh b/arch/updatewine_arch.sh index 278b1f4..8611eb9 100755 --- a/arch/updatewine_arch.sh +++ b/arch/updatewine_arch.sh @@ -217,8 +217,9 @@ $(for o in ${ERRPKGS[@]}; do printf '%s\n' ${o}; done)\ function prepare_env() { - # Copy Wine patch files + # Copy Wine & DXVK 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 # Create identifiable directory for this build mkdir -p ${ARCH_BUILDROOT}/compiled_pkg/"${datedir}" @@ -232,6 +233,7 @@ function prepare_env() { function cleanUp() { rm -rf ${ARCH_BUILDROOT}/*/{pkg,src,*.tar.xz} rm -rf ${ARCH_BUILDROOT}/0-wine-staging-git/{*.patch} + rm -rf ${ARCH_BUILDROOT}/0-dxvk-git/{*.patch} } ########################################################### @@ -316,12 +318,10 @@ function updatePOL() { ########################################################## -# Clean these temporary folders & files files +# Clean these temporary folders & 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 +dxvk_wine_cleanlist=('*.patch' '*.diff' 'pkg' 'src' '*-patches' '*.tar.xz') # dxvk-git wine-*git ########################################################## @@ -363,11 +363,11 @@ check_alldeps # are to be built if [[ ! -v NO_WINE ]]; then - build_pkg wine "${wine_name}" "0-wine-staging-git" "${wine_cleanlist[*]}" + build_pkg wine "${wine_name}" "0-wine-staging-git" "${dxvk_wine_cleanlist[*]}" fi if [[ ! -v NO_DXVK ]]; then - build_pkg dxvk DXVK "0-dxvk-git" "${dxvk_cleanlist[*]}" + build_pkg dxvk DXVK "0-dxvk-git" "${dxvk_wine_cleanlist[*]}" fi ######################### diff --git a/debian/dxvkroot/dxvkbuild.sh b/debian/dxvkroot/dxvkbuild.sh index 171e46f..9a57dae 100644 --- a/debian/dxvkroot/dxvkbuild.sh +++ b/debian/dxvkroot/dxvkbuild.sh @@ -165,7 +165,7 @@ function preparepackage() { if [[ $(apt version ${pkgdep} | wc -w) -eq 0 ]]; then - echo -e "Installing ${_pkgname} dependency ${pkgdep} ($(($a + 1 )) / $((${#*} + 1)))\n." + echo -e "Installing ${_pkgname} dependency ${pkgdep} ($(($a + 1 )) / $((${#*} + 1))).\n" sudo apt install -y ${pkgdep} &> /dev/null if [[ $? -eq 0 ]]; then let a++ @@ -287,7 +287,7 @@ function meson_install_main() { rm -r debian/*.{ex,EX} # Start deb builder. Do not build either debug symbols or doc files - DEB_BUILD_OPTIONS="strip nodocs noddebs" dpkg-buildpackage -rfakeroot -b -us -uc + DEB_BUILD_OPTIONS="strip nodocs noddebs nocheck" dpkg-buildpackage -rfakeroot -b -us -uc # Once compiled, install and store the compiled deb archive # We do not make installation optional because this is a core dependency for DXVK @@ -332,7 +332,7 @@ function glslang_install_main() { function glslang_debianbuild() { # Create debian subdirectory - dh_make --createorig -s -y + dh_make --createorig -s -y -c bsd # Set Build dependencies into debian/control file sed -ie "s/^Build-Depends:.*$/Build-Depends: debhelper (>=10), $(echo ${_coredeps[*]} | \ @@ -411,17 +411,64 @@ function dxvk_install_main() { 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 + + if [[ $? -ne 0 ]]; then + echo -e "Error occured while running 'update-alternatives' for '${package}'. Aborting\n" + exit 1 + fi + done } + function dxvk_custompatches() { + + # 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}/${pkgname}/ + + local dxvk_builddir=$(ls ${DXVKROOT}/${pkgname}/) + + # Expecting just one folder here. This method doesn't work with multiple dirs present + if [[ $(echo ${dxvk_builddir} | wc -l) -gt 1 ]]; then + echo "Error: Multiple dxvk build directories detected. Can't decide which one to use. Aborting\n" + exit 1 + fi + + local dxvk_buildpath=$(readlink -f ${dxvk_builddir}) + + cd ${dxvk_buildpath} + for pfile in ../*.{patch,diff}; do + if [[ -f ${pfile} ]]; then + echo -e "Applying DXVK patch: ${pfile}\n" + patch -Np1 < ${pfile} + fi + + if [[ $? -ne 0 ]]; then + echo -e "Error occured while applying DXVK patch '${pfile}'. Aborting\n" + cd ${CURDIR} + exit 1 + fi + + done + + cd ${CURDIR} + + fi + + } + # Debian-specific compilation & installation rules function dxvk_debianbuild() { local dxvx_relative_builddir="debian/source/dxvk-master" - # Create debian subdirectory - dh_make --createorig -s -y + # Create debian subdirectory, add supplied LICENSE file + dh_make --createorig -s -y -c custom --copyrightfile ../LICENSE # Set Build dependencies into debian/control file sed -ie "s/^Build-Depends:.*$/Build-Depends: debhelper (>=10), $(echo ${_coredeps[*]} | \ @@ -490,8 +537,13 @@ DXVK-DEBIANRULES } # Execute above functions - preparepackage "${pkgname}" "${pkgdeps_build[*]}" "${pkgurl}" "${pkgver_git}" "${pkgdeps_runtime[*]}" && \ + # Do not check runtime dependencies as our check method expects exact package name in + # function 'preparepackage'. This does not apply to runtime dependency 'wine', which + # may be 'wine', 'wine-git', 'wine-staging-git' etc. in truth + # + preparepackage "${pkgname}" "${pkgdeps_build[*]}" "${pkgurl}" "${pkgver_git}" && \ dxvk_posixpkgs && \ + dxvk_custompatches && \ dxvk_debianbuild } diff --git a/debian/wineroot/winebuild.sh b/debian/wineroot/winebuild.sh index a54b808..c8f0dd1 100644 --- a/debian/wineroot/winebuild.sh +++ b/debian/wineroot/winebuild.sh @@ -552,7 +552,7 @@ function buildDebianArchive() { cd "${WINEROOT}" mv "${WINEDIR_PACKAGE}" "${WINEROOT}/${PKGNAME}-${wine_version}" cd "${WINEROOT}/${PKGNAME}-${wine_version}" - dh_make --createorig -s -y + dh_make --createorig -s -y -c lgpl rm debian/*.{ex,EX} printf "usr/* /usr" > debian/install