From 606458fea69c05e2c2c74d21f70d403ce85abe44 Mon Sep 17 00:00:00 2001 From: Fincer Date: Wed, 14 Nov 2018 07:51:59 +0200 Subject: [PATCH] Add Debian compatibility, improve script logic --- arch/updatewine_arch.sh | 2 +- debian/dxvkroot/dxvkbuild.sh | 50 +-- debian/playonlinux_prefixupdate.sh | 2 +- debian/updatewine_debian.sh | 109 ++++--- debian/wineroot/winebuild.sh | 476 +++++++++++++++++------------ debian_devpkgremoval.sh | 11 +- debian_install_nvidia.sh | 25 +- updatewine.sh | 75 ++--- 8 files changed, 420 insertions(+), 330 deletions(-) mode change 100644 => 100755 debian/dxvkroot/dxvkbuild.sh mode change 100644 => 100755 debian/playonlinux_prefixupdate.sh mode change 100644 => 100755 debian/updatewine_debian.sh mode change 100644 => 100755 debian/wineroot/winebuild.sh mode change 100644 => 100755 debian_devpkgremoval.sh mode change 100644 => 100755 debian_install_nvidia.sh mode change 100644 => 100755 updatewine.sh diff --git a/arch/updatewine_arch.sh b/arch/updatewine_arch.sh index 6293f09..440737f 100755 --- a/arch/updatewine_arch.sh +++ b/arch/updatewine_arch.sh @@ -286,7 +286,7 @@ function updatePOL() { 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" + echo -e "Warning: Couldn't find PoL directories in $USER's homedir.\n" return 0 fi fi diff --git a/debian/dxvkroot/dxvkbuild.sh b/debian/dxvkroot/dxvkbuild.sh old mode 100644 new mode 100755 index ac426f3..cd12f86 --- a/debian/dxvkroot/dxvkbuild.sh +++ b/debian/dxvkroot/dxvkbuild.sh @@ -84,47 +84,15 @@ 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 for package compilation -_coredeps=('dh-make' 'make' 'gcc' 'build-essential' 'fakeroot') - ################################## -# Update package databases -# Check existence of necessary commands -# Check and install core dependencies - -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 - - if [[ $(apt version ${coredep} | wc -w) -eq 0 ]]; then - echo -e "Installing core dependency ${coredep}.\n" - sudo apt install -y ${coredep} - if [[ $? -ne 0 ]]; then - echo -e "Could not install ${coredep}. Aborting.\n" - exit 1 - fi - fi - done - -} +# Update all packages if updateoverride given -customReqs +if [[ -v updateoverride ]]; then + echo -en "Updating all packages" && \ + 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 && sudo apt upgrade -y +fi ################################## @@ -136,7 +104,7 @@ function pkgcompilecheck() { local pkg=${1} local install_function=${2} - if [[ $(apt version ${coredep} | wc -w) -eq 0 ]] || [[ -v updateoverride ]]; then + if [[ $(echo $(dpkg -s ${coredep} &>/dev/null)$?) -ne 0 ]] || [[ -v updateoverride ]]; then ${install_function} fi @@ -163,7 +131,7 @@ function preparepackage() { # Generate a list of missing dependencies local a=0 for p in ${@}; do - if [[ $(apt version ${p} | wc -w) -eq 0 ]]; then + if [[ $(echo $(dpkg -s ${p} &>/dev/null)$?) -ne 0 ]]; then local list[$a]=${p} let a++ fi @@ -172,7 +140,7 @@ function preparepackage() { # Install missing dependencies, be informative local b=0 for pkgdep in ${list[@]}; do - echo -e "Installing ${_pkgname} dependency ${pkgdep} ($(( $b + 1 )) / $(( ${#list[*]} ))).\n" + echo -e "$(( $b + 1 ))/$(( ${#list[*]} )) - Installing ${_pkgname} dependency ${pkgdep}" sudo apt install -y ${pkgdep} &> /dev/null if [[ $? -eq 0 ]]; then let b++ diff --git a/debian/playonlinux_prefixupdate.sh b/debian/playonlinux_prefixupdate.sh old mode 100644 new mode 100755 index bb56cfc..01fbd18 --- a/debian/playonlinux_prefixupdate.sh +++ b/debian/playonlinux_prefixupdate.sh @@ -20,7 +20,7 @@ # 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." + echo -e "Warning: Couldn't find PoL directories in $USER's homedir.\n" exit 0 fi diff --git a/debian/updatewine_debian.sh b/debian/updatewine_debian.sh old mode 100644 new mode 100755 index 7bc05cf..1760422 --- a/debian/updatewine_debian.sh +++ b/debian/updatewine_debian.sh @@ -93,7 +93,7 @@ trap "Deb_intCleanup" INT # Check existence of ccache package function ccacheCheck() { - if [[ $(apt version ccache | wc -w) -eq 0 ]]; then + if [[ $(echo $(dpkg -s ccache &>/dev/null)$?) -eq 0 ]]; then echo -e "NOTE: Please consider using 'ccache' for faster compilation times.\nInstall it by typing 'sudo apt install ccache'\n" fi } @@ -117,84 +117,117 @@ Using $(nproc --ignore 1) of $(nproc) available CPU cores for Wine source code c ######################################################## -# General function for question responses +function mainQuestions() { -function questionresponse() { + # General function for question responses + function questionresponse() { - local response=${1} + 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 + 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 \ + 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 + questionresponse -if [[ $? -ne 0 ]]; then - echo -e "Cancelling.\n" - exit 1 -fi + if [[ $? -ne 0 ]]; then + echo -e "Cancelling.\n" + exit 1 + fi #################### -AVAIL_SPACE=$(df -h -B MB --output=avail . | sed '1d; s/[A-Z]*//g') -REC_SPACE=8000 + 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 + 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\ + 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 + questionresponse - if [[ $? -ne 0 ]]; then - echo -e "Cancelling.\n" - exit 1 - fi + if [[ $? -ne 0 ]]; then + echo -e "Cancelling.\n" + exit 1 + fi - unset AVAIL_SPACE REC_SPACE -fi + unset AVAIL_SPACE REC_SPACE + fi #################### -INFO_SEP + 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\ + 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 + questionresponse -if [[ $? -eq 0 ]]; then - args+=('--updateoverride') -fi + if [[ $? -eq 0 ]]; then + args+=('--updateoverride') + fi + + INFO_SEP + +} + +######################################################## -INFO_SEP +function coredeps_check() { + + # Universal core dependencies for package compilation + _coredeps=('dh-make' 'make' 'gcc' 'build-essential' 'fakeroot') + + for coredep in ${_coredeps[@]}; do + + if [[ $(echo $(dpkg -s ${coredep} &>/dev/null)$?) -ne 0 ]]; then + echo -e "Installing core dependency ${coredep}.\n" + sudo apt install -y ${coredep} + if [[ $? -ne 0 ]]; then + echo -e "Could not install ${coredep}. Aborting.\n" + exit 1 + fi + fi + done + +} ######################################################## +# If either Wine or DXVK is to be installed +if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]; then + mainQuestions + coredeps_check +fi + +#################### + if [[ ! -v NO_WINE ]]; then wine_install_main else diff --git a/debian/wineroot/winebuild.sh b/debian/wineroot/winebuild.sh old mode 100644 new mode 100755 index 80cc443..421fc15 --- a/debian/wineroot/winebuild.sh +++ b/debian/wineroot/winebuild.sh @@ -1,6 +1,6 @@ #!/bin/env bash -# Wine/Wine Staging build script for Ubuntu & variants (amd64) +# Wine/Wine Staging build script for Debian & variants (amd64) # Copyright (C) 2018 Pekka Helenius # # This program is free software: you can redistribute it and/or modify @@ -34,114 +34,9 @@ staging_patchsets=(--all) ######################################################## -# 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 - -######################################################## - -# If the script is interrupted (Ctrl+C/SIGINT), do the following - -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() { - - local wine_url="git://source.winehq.org/git/wine.git" - local winestaging_url="git://github.com/wine-staging/wine-staging.git" - - 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 ${wine_url} - - if [[ ! -v NO_STAGING ]]; then - git clone ${winestaging_url} - WINEDIR_STAGING="${WINEROOT}/wine-staging" - PKGNAME="wine-staging-git" - else - PKGNAME="wine-git" - fi +# Wine build dependency lists on Debian - 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=( +wine_deps_build_common=( 'make' 'gcc-multilib' 'g++-multilib' @@ -153,7 +48,7 @@ wine_deps_build=( 'bison' 'quilt' 'gettext' -'oss4-dev' +# 'oss4-dev' # Not available on Debian 'sharutils' 'pkg-config' 'dctrl-tools' @@ -164,6 +59,9 @@ wine_deps_build=( 'librsvg2-bin' 'imagemagick' 'fontforge' +) + +wine_deps_build_amd64=( 'libxi-dev:amd64' 'libxt-dev:amd64' 'libxmu-dev:amd64' @@ -213,6 +111,9 @@ wine_deps_build=( 'libgstreamer-plugins-base1.0-dev:amd64' 'ocl-icd-opencl-dev:amd64' 'libvulkan-dev:amd64' +) + +wine_deps_build_i386=( 'libxi-dev:i386' 'libxt-dev:i386' 'libxmu-dev:i386' @@ -256,27 +157,29 @@ wine_deps_build=( 'libfontconfig1-dev:i386' 'ocl-icd-opencl-dev:i386' 'libvulkan-dev:i386' +'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' ) -# 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 runtime dependency lists on Debian -wine_deps_runtime=( +wine_deps_runtime_common=( +'desktop-file-utils' +) + +wine_deps_runtime_i386=( 'libxcursor1:i386' 'libxrandr2:i386' 'libxi6:i386' +# 'gettext:i386' # Conflicts with amd64 version on multiple distros 'libsm6:i386' 'libvulkan1:i386' 'libasound2:i386' @@ -301,6 +204,11 @@ wine_deps_runtime=( 'libxml2:i386' 'ocl-icd-libopencl1:i386' 'zlib1g:i386' +'libgstreamer-plugins-base1.0-0:i386' +'libgstreamer1.0-0:i386' +) + +wine_deps_runtime_amd64=( 'fontconfig:amd64' 'libxcursor1:amd64' 'libxrandr2:amd64' @@ -330,117 +238,248 @@ wine_deps_runtime=( '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 staging override list +# Wine Staging replaces and conflicts with these packages +# Applies to debian/control file + +wine_overr_pkgs=( +'wine' +'wine-development' +'wine64-development' +'wine1.6' +'wine1.6-i386' +'wine1.6-amd64' +'libwine:amd64' +'libwine:i386' +'wine-stable' +'wine32' +'wine64' +'fonts-wine' +) + +############################ + +# Suggest section in debian/control file + +wine_suggested_pkgs=( +'winbind' +'winetricks' +'playonlinux' +'wine-binfmt' +'dosbox' +) + +######################################################## + +# Architecture check. We do not support independent +# i386 environments + +if [[ $(uname -a | grep -c x86_64) -eq 0 ]]; then + echo "This script supports 64-bit architectures only." + exit 1 +fi + +######################################################## + +# 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 + +######################################################## + +# If the script is interrupted (Ctrl+C/SIGINT), do the following + +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 -w) -eq 0 ]]; then + sudo dpkg --add-architecture i386 + sudo apt update +fi + +######################################################## + +function getWine() { + + local wine_url="git://source.winehq.org/git/wine.git" + local winestaging_url="git://github.com/wine-staging/wine-staging.git" + + 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 ${wine_url} + + if [[ ! -v NO_STAGING ]]; then + git clone ${winestaging_url} + 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 dependencies: +# Wine dependencies removal/installation function WineDeps() { local a=0 - local deps="${1}" - local depsname=${2} - - echo -e "Installing Wine dependencies.\n" # Sudo password may be required.\n" + local method=${1} + local deps="${2}" + local depsname=${3} + + case ${method} in + install) + local str="Installing" + local mgrcmd="sudo apt install -y" + ;; + remove) + local str="Removing" + local mgrcmd="sudo apt purge --remove -y" + ;; + *) + echo -e "Error: Unknown package management input method. Aborting\n" + exit 1 + esac - # 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 + echo -e "${str} Wine dependencies (${depsname}).\n" - # Check and install package related dependencies if they are missing + # Check and install/remove package related dependencies if they are missing/installed function pkgdependencies() { - # Generate a list of missing dependencies + # Get a valid logic for generating 'list' array below + case ${method} in + install) + local checkstatus=0 + ;; + remove) + local checkstatus=1 + ;; + esac + + # Generate a list of missing/removable dependencies, depending on the logic local a=0 for p in ${@}; do - if [[ $(apt version ${p} | wc -w) -eq 0 ]]; then + if [[ $(echo $(dpkg -s ${p} &>/dev/null)$?) -ne ${checkstatus} ]]; then local list[$a]=${p} let a++ fi done - # Install missing dependencies, be informative + # Install missing/Remove existing dependencies, be informative local b=0 for pkgdep in ${list[@]}; do - echo -e "Installing ${_pkgname} dependency ${pkgdep} ($(( $b + 1 )) / $(( ${#list[*]} ))).\n" - sudo apt install -y ${pkgdep} &> /dev/null + echo -e "$(( $b + 1 ))/$(( ${#list[*]} )) - ${str} ${depsname} dependency ${pkgdep}" + eval ${mgrcmd} ${pkgdep} &> /dev/null if [[ $? -eq 0 ]]; then let b++ else - echo -e "\nError occured while installing ${pkgdep}. Aborting.\n" + echo -e "\nError occured while processing ${pkgdep}. Aborting.\n" exit 1 fi done } - pkgdependencies ${deps[*]} + 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 +# If we separate i386 build to be an independent one, this function +# must be improved, if built with amd64 package together +# If we just bundle them together, single package description for +# debian/control file is enough + 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/^Build-Depends:.*$/Build-Depends: debhelper (>=10), $(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/^Suggests:.*$/Suggests: $(echo ${wine_suggested_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 + sed -ie "s/^${ctrl_section}:.*$/${ctrl_section}: $(echo ${wine_overr_pkgs[*]} | sed 's/\s/, /g')/g" debian/control done } @@ -589,6 +628,7 @@ DEBIANCONTROL feedControlfile + # Start compilation process DEB_BUILD_OPTIONS="strip nodocs noddebs" dpkg-buildpackage -b -us -uc } @@ -607,7 +647,7 @@ function storeDebianArchive() { rm -rf winebuild_${datedir} } -function clearTree() { +function cleanTree() { rm -rf "${WINEROOT}" } @@ -616,9 +656,7 @@ function clearTree() { # 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 @@ -629,9 +667,65 @@ patchWineSource # Get Wine/Wine Staging version getWineVersion +######################################################## + # Compile 64 & 32 bit Wine/Wine Staging -wine64Build -wine32Build + +# WE MUST BUILD 64-BIT FIRST, THEN 32-BIT. THIS ORDER IS MANDATORY! + +# We split 64-bit & 32-bit compilation due to two major reasons: +# - pure Debian has major conflicts between 32/64 bit dev packages +# - on Mint/Ubuntu, some 32-bit dev packages must be excluded due to conflicts, too + +########################## + +# Install Wine common buildtime dependencies +WineDeps install "${wine_deps_build_common[*]}" "Wine common build time" + +# Install Wine common runtime dependencies +WineDeps install "${wine_deps_runtime_common[*]}" "Wine common runtime" + +########################## + +# TODO If we do architecture separation in the future, add if check for amd64 here +# Condition would be: if amd64, then +# +# Purge amd64 buildtime dependencies +# On Debian, we can't have them with i386 at the same time +# i386/amd64 runtime dependencies have been tested and they are able to co-exist on Debian system +# +echo -e "Preparing system environment for 64-bit Wine compilation.\n" +WineDeps remove "${wine_deps_build_i386[*]}" "Wine build time (32-bit)" + +WineDeps install "${wine_deps_build_amd64[*]}" "Wine build time (64-bit)" +WineDeps install "${wine_deps_runtime_amd64[*]}" "Wine runtime (64-bit)" +wine64Build && \ +echo -e "\nWine 64-bit build process finished.\n" + +########################## + +# TODO if i386 / amd64 +# TODO If we do architecture separation in the future, add if check for i386 here +# Condition would be: if i386 or amd64, then +# +# Purge amd64 buildtime dependencies +# On Debian, we can't have them with i386 at the same time +# i386/amd64 runtime dependencies have been tested and they are able to co-exist on Debian system +# +echo -e "Preparing system environment for 32-bit Wine compilation.\n" +WineDeps remove "${wine_deps_build_amd64[*]}" "Wine build time (64-bit)" + +WineDeps install "${wine_deps_build_i386[*]}" "Wine build time (32-bit)" +WineDeps install "${wine_deps_runtime_i386[*]}" "Wine runtime (32-bit)" +wine32Build && +echo -e "\nWine 32-bit build process finished.\n" + +########################## + +# Remove i386 buildtime dependencies after successful compilation process +WineDeps remove "${wine_deps_build_i386[*]}" "Wine build time (64-bit)" + +######################################################## # Bundle compiled Wine/Wine-Staging files mergeWineBuilds @@ -645,6 +739,6 @@ fi storeDebianArchive -# Clear all temporary files -clearTree +# Clean all temporary files +cleanTree diff --git a/debian_devpkgremoval.sh b/debian_devpkgremoval.sh old mode 100644 new mode 100755 index 73f1f1d..cf7d1b5 --- a/debian_devpkgremoval.sh +++ b/debian_devpkgremoval.sh @@ -76,6 +76,7 @@ wine_deps=( 'libgstreamer-plugins-base1.0-dev:amd64' 'ocl-icd-opencl-dev:amd64' 'libvulkan-dev:amd64' + 'libxi-dev:i386' 'libxt-dev:i386' 'libxmu-dev:i386' @@ -119,6 +120,14 @@ wine_deps=( 'libfontconfig1-dev:i386' 'ocl-icd-opencl-dev:i386' 'libvulkan-dev:i386' +'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' ) dxvk_deps=( @@ -143,7 +152,7 @@ wine_deps_noremove=( 'bison' 'quilt' 'gettext' -'oss4-dev' +#'oss4-dev' 'sharutils' 'pkg-config' 'dctrl-tools' diff --git a/debian_install_nvidia.sh b/debian_install_nvidia.sh old mode 100644 new mode 100755 index 5d4acf3..aef02f4 --- a/debian_install_nvidia.sh +++ b/debian_install_nvidia.sh @@ -32,6 +32,13 @@ fi ######################################################## +# Just a title & author for this script, used in initialization and help page + +SCRIPT_TITLE="\e[1mNvidia drivers package builder & installer\e[0m" +SCRIPT_AUTHOR="Pekka Helenius (~Fincer), 2018" + +######################################################## + BUILD_MAINDIR=${PWD}/debian_nvidia ######################################################## @@ -157,11 +164,6 @@ function INFO_SEP() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - ; ########################################################### -# Just a title & author for this script, used in initialization and help page - -SCRIPT_TITLE="\e[1mNvidia drivers package builder & installer\e[0m" -SCRIPT_AUTHOR="Pekka Helenius (~Fincer), 2018" - echo -e "\n${SCRIPT_TITLE}\n" ######################################################## @@ -201,11 +203,12 @@ rm -rf ${WORKDIR}/{${pkgdir}/{debian,NVIDIA-Linux,NVIDIA-Linux-amd64,NVIDIA-Linu ########################################################### COMMANDS=( - sudo - wget apt + dpkg grep + sudo wc + wget ) function checkCommands() { @@ -311,7 +314,7 @@ function pkgdependencies() { # Generate a list of missing dependencies local a=0 for p in ${@}; do - if [[ $(apt version ${p} | wc -w) -eq 0 ]]; then + if [[ $(echo $(dpkg -s ${p} &>/dev/null)$?) -ne 0 ]]; then list[$a]=${p} let a++ fi @@ -332,7 +335,7 @@ function pkgdependencies() { # Install missing dependencies, be informative local b=0 for pkgdep in ${list[@]}; do - echo -e "Installing ${_pkgname} dependency ${pkgdep} ($(( $b + 1 )) / $(( ${#list[*]} ))).\n" + echo -e "$(( $b + 1 ))/$(( ${#list[*]} )) - Installing ${_pkgname} dependency ${pkgdep}" sudo apt install -y ${pkgdep} &> /dev/null if [[ $? -eq 0 ]]; then let b++ @@ -502,7 +505,7 @@ function compile_nvidia() { function install_nvidia() { for syspkg in ${nvidia_required_packages[@]}; do - if [[ $(apt version ${syspkg} | wc -w) -eq 0 ]]; then + if [[ $(echo $(dpkg -s ${syspkg} &>/dev/null)$?) -ne 0 ]]; then echo -e "Installing missing dependency ${syspkg}\n" sudo apt install -y ${syspkg} if [[ $? -ne 0 ]]; then @@ -545,7 +548,7 @@ function install_vulkan() { # Vulkan loader if [[ $? -eq 0 ]]; then local syspkg=libvulkan1 - if [[ $(apt version ${syspkg} | wc -w) -eq 0 ]]; then + if [[ $(echo $(dpkg -s ${syspkg} &>/dev/null)$?) -ne 0 ]]; then sudo apt update && sudo apt install -y ${syspkg} fi fi diff --git a/updatewine.sh b/updatewine.sh old mode 100644 new mode 100755 index 2cdf003..4d970ef --- a/updatewine.sh +++ b/updatewine.sh @@ -30,6 +30,13 @@ Please run this script using bash (/usr/bin/bash). exit 1 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_AUTHOR="Pekka Helenius (~Fincer), 2018" + ########################################################### # Allow interruption of the script at any time (Ctrl + C) trap "exit" INT @@ -37,15 +44,18 @@ trap "exit" INT ########################################################### COMMANDS=( - groups - sudo - wget date find + git grep - uname - readlink + groups patch + readlink + sudo + tar + uname + wc + wget ) function checkCommands() { @@ -95,40 +105,6 @@ fi ########################################################### -# Prevent running on pure Debian - -# 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 - -# Additionally, package 'winetricks' is not found on Debian. -# This is quite trivial to get fixed, though. - -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 - -case "${distroname}" in - *Debian*) - echo -e "\nSorry, pure Debian is not supported yet. See README for details. Aborting.\n" - exit 0 - ;; -esac - -########################################################### - -# 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_AUTHOR="Pekka Helenius (~Fincer), 2018" - -########################################################### - # User-passed arguments for the script # We check the values of this array # and pass them to the subscripts if supported @@ -146,9 +122,11 @@ for arch_arg in ${@}; do ;; --no-wine) # Skip Wine build & installation process all together + NO_WINE= ;; --no-dxvk) # Skip DXVK build & installation process all together + NO_DXVK= ;; --no-pol) # Skip PlayOnLinux Wine prefixes update process @@ -178,10 +156,10 @@ done 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 + sudo -v if [[ $? -ne 0 ]]; then - echo "Invalid sudo password.\n" + echo -e "Invalid sudo password.\n" exit 1 fi @@ -249,7 +227,11 @@ function determineDistroFamily() { esac } -echo -e "\n${SCRIPT_TITLE}\n\nBuild identifier:\t${datesuffix}\n" +if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]; then + echo -e "\n${SCRIPT_TITLE}\n\nBuild identifier:\t${datesuffix}\n" +else + echo "" +fi if [[ -n ${args[*]} ]]; then echo -e "Using arguments:\t${args[*]}\n" @@ -258,12 +240,13 @@ fi determineDistroFamily 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\ +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\ This script comes with GPU driver installation scripts for Debian-based Linux distributions.\n" INFO_SEP -sudoQuestion -echo "" -INFO_SEP +if [[ ! -v NO_WINE ]] || [[ ! -v NO_DXVK ]]; then + sudoQuestion + echo "" +fi bash -c "cd ${distro} && bash ./updatewine_${distro}.sh \"${datesuffix}\" ${args[*]}"