PKGBUILDS/wine-tkg-git/proton-tkg/PKGBUILD

236 lines
8.3 KiB
Bash

# Created by: Tk-Glitch <ti3nou at gmail dot com>
pkgname=proton-tkg-git
pkgver=0
pkgrel=1
_frogwhere="$PWD"
# Arch chroot workaround
if [[ "${_frogwhere}" != "/startdir" ]]; then
export BUILDDIR="${_frogwhere}" # Override makepkg BUILDDIR path and use PKGBUILDs dirs instead
fi
arch=('x86_64')
pkgdesc='Custom Proton build with even more frog spice'
url='https://github.com/Tk-Glitch/PKGBUILDS/tree/master/proton-tkg'
options=(staticlibs !lto !strip !ccache)
license=('LGPL')
depends=(
'attr' 'lib32-attr'
'fontconfig' 'lib32-fontconfig'
'lcms2' 'lib32-lcms2'
'libxml2' 'lib32-libxml2'
'libxcursor' 'lib32-libxcursor'
'libxrandr' 'lib32-libxrandr'
'libxdamage' 'lib32-libxdamage'
'libxi' 'lib32-libxi'
'gettext' 'lib32-gettext'
'freetype2' 'lib32-freetype2'
'glu' 'lib32-glu'
'libsm' 'lib32-libsm'
'gcc-libs' 'lib32-gcc-libs'
'libpcap' 'lib32-libpcap'
'faudio' 'lib32-faudio'
'desktop-file-utils' 'tk'
'vulkan-icd-loader' 'lib32-vulkan-icd-loader'
'jxrlib' 'gst-plugins-ugly'
)
makedepends=(
'git' 'autoconf'
'ncurses' 'bison'
'perl' 'fontforge'
'flex' 'python-fonttools'
'gcc>=4.5.0-2' 'pkgconf'
'giflib' 'lib32-giflib'
'libpng' 'lib32-libpng'
'gnutls' 'lib32-gnutls'
'libxinerama' 'lib32-libxinerama'
'libxcomposite' 'lib32-libxcomposite'
'libxmu' 'lib32-libxmu'
'libxxf86vm' 'lib32-libxxf86vm'
'libldap' 'lib32-libldap'
'mpg123' 'lib32-mpg123'
'openal' 'lib32-openal'
'v4l-utils' 'lib32-v4l-utils'
'alsa-lib' 'lib32-alsa-lib'
'libxcomposite' 'lib32-libxcomposite'
'mesa' 'lib32-mesa'
'libgl' 'lib32-libgl'
'libxslt' 'lib32-libxslt'
'libpulse' 'lib32-libpulse'
'libva' 'lib32-libva'
'gtk3' 'lib32-gtk3'
'gst-plugins-base-libs' 'lib32-gst-plugins-base-libs'
'gst-plugins-good' 'lib32-gst-plugins-good'
'vulkan-icd-loader' 'lib32-vulkan-icd-loader'
'sdl2' 'lib32-sdl2'
'libcups' 'lib32-libcups'
'samba' 'schedtool'
'meson' 'ninja'
'glslang' 'wget'
'ocl-icd' 'lib32-ocl-icd'
'opencl-headers' 'mingw-w64-gcc'
'vulkan-headers' 'jack'
'lib32-jack' 'python-pefile'
'rust' 'lib32-rust-libs'
$_user_makedeps
)
optdepends=(
'giflib' 'lib32-giflib'
'libpng' 'lib32-libpng'
'libldap' 'lib32-libldap'
'gnutls' 'lib32-gnutls'
'mpg123' 'lib32-mpg123'
'openal' 'lib32-openal'
'v4l-utils' 'lib32-v4l-utils'
'libpulse' 'lib32-libpulse'
'alsa-plugins' 'lib32-alsa-plugins'
'alsa-lib' 'lib32-alsa-lib'
'libjpeg-turbo' 'lib32-libjpeg-turbo'
'libxcomposite' 'lib32-libxcomposite'
'libxinerama' 'lib32-libxinerama'
'ncurses' 'lib32-ncurses'
'libxslt' 'lib32-libxslt'
'libva' 'lib32-libva'
'gtk3' 'lib32-gtk3'
'gst-plugins-base-libs' 'lib32-gst-plugins-base-libs'
'sdl2' 'lib32-sdl2'
'cups' 'zapcc'
'samba' 'clang'
'dosbox' 'ccache'
)
if msg2; then # Arch chroot workaround for even more looping fun
# Remove gst-editing-services
if pacman -Qq gst-editing-services &> /dev/null; then
warning '! found gst-editing-services package, known to break wine prefix creation !'
read -rp " Uninstall it?"$'\n> N/y : ' _gst_editing_services;
if [[ "$_gst_editing_services" =~ [yY] ]]; then
sudo pacman -R gst-editing-services
fi
fi
fi
exit_cleanup() {
if [ "$pkgver" != "0" ]; then
sed -i "s/pkgver=$pkgver.*/pkgver=0/g" "${_frogwhere}"/PKGBUILD
fi
rm -rf src
remove_deps
msg2 'exit cleanup done'
}
recursive_installer() {
for _f in $1; do
if [ -f "$_f" ]; then
install -v -D "$_f" "$2"/"$_f"
elif [ -d "$_f" ]; then
recursive_installer "$_f/*" "$2"
fi
done
}
pkgver() {
cd "${_frogwhere}/../wine-tkg-git/${_pkgvertargdir}"
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//;s/\.rc/rc/;s/^wine\.//'
}
prepare() {
# Arch chroot workaround
if [[ "${_frogwhere}" = "/startdir" ]]; then
msg2 "Arch chroot detected!"
export _frogwhere=/build/proton-tkg-git
git clone https://github.com/Frogging-Family/wine-tkg-git.git || true
if [ -d wine-tkg-git/wine-tkg-git ]; then
mv wine-tkg-git/wine-tkg-git /build/wine-tkg-git
fi
if [ -d wine-tkg-git/proton-tkg ]; then
mv wine-tkg-git/proton-tkg/* /build/proton-tkg-git/
fi
fi
# overcomplicated BS
_srcdirlock="${_frogwhere}/../wine-tkg-git"
warning "The next step might take some time, please be patient..."
source "${_frogwhere}"/proton-tkg.cfg
source "${_frogwhere}"/proton-tkg-profiles/advanced-customization.cfg
if [ -e "$_EXT_CONFIG_PATH" ]; then
source "$_EXT_CONFIG_PATH"
fi
if [ -n "$_LOCAL_PRESET" ] && [ -e "${_frogwhere}"/../wine-tkg-git/wine-tkg-profiles/wine-tkg-"$_LOCAL_PRESET".cfg ]; then
source "${_frogwhere}"/../wine-tkg-git/wine-tkg-profiles/wine-tkg.cfg && source "${_frogwhere}"/../wine-tkg-git/wine-tkg-profiles/wine-tkg-"$_LOCAL_PRESET".cfg
fi
if [ -n "$_custom_wine_source" ]; then
_winesrcdir=$( sed 's|/|-|g' <<< $(sed 's|.*://.[^/]*/||g' <<< $_custom_wine_source))
else
if [ "$_plain_mirrorsrc" = "true" ]; then
_winesrcdir="wine-mirror-git"
_winesrctarget="https://github.com/wine-mirror/wine.git"
else
_winesrcdir="wine-git"
_winesrctarget="git://source.winehq.org/git/wine.git"
fi
fi
cd "${_srcdirlock}"
_pkgvertargdir="${_winesrcdir}"
# Empty clone failsafe
git clone --mirror "${_winesrctarget}" "$_winesrcdir" || true
if [ "$_use_staging" = "true" ]; then
_stgsrcdir='wine-staging-git'
_pkgvertargdir="${_stgsrcdir}"
# Empty clone failsafe
git clone --mirror https://github.com/wine-staging/wine-staging.git "$_stgsrcdir" || true
fi
cd "${_srcdirlock}/${_pkgvertargdir}"
git fetch --all -p >/dev/null 2>&1
rm -rf "${_srcdirlock}/src/${_pkgvertargdir}" && git clone "${_srcdirlock}/${_pkgvertargdir}" "${_srcdirlock}/src/${_pkgvertargdir}" >/dev/null 2>&1
cd "${_srcdirlock}/src/${_pkgvertargdir}"
git checkout --force --no-track -B makepkg origin/HEAD
if [ -n "$_plain_version" ] && [ "$_use_staging" != "true" ]; then
git checkout "${_plain_version}"
fi
if [ -n "$_staging_version" ] && [ "$_use_staging" = "true" ]; then
git checkout "${_staging_version}"
fi
cd "${_frogwhere}"
if [ ! -d "${_frogwhere}/external-resources" ]; then
mkdir -p "${_frogwhere}/external-resources"
fi
ln -s -f "${_frogwhere}/external-resources" "${srcdir}/"
ln -s -f "${_frogwhere}/proton_template" "${srcdir}/"
ln -s -f "${_frogwhere}/proton-tkg.cfg" "${srcdir}/"
ln -s -f "${_frogwhere}/proton-tkg.sh" "${srcdir}/"
ln -s -f "${_frogwhere}/proton-tkg-userpatches" "${srcdir}/"
ln -s -f "${_frogwhere}/proton-tkg-profiles" "${srcdir}/"
}
build() {
warning "Using this PKGBUILD is not the recommended way to build proton-tkg."
warning "Unless you really want a package, please favor the proton-tkg.sh script route instead."
warning "Also note that SteamVR support is forcefully disabled when using the PKGBUILD,"
warning "independently of its functioning state in proton-tkg."
sleep 2
cd "${srcdir}"
_ispkgbuild="true" ./proton-tkg.sh
}
package() {
provides=("$pkgname=$pkgver")
conflicts=("$pkgname")
cd "${srcdir}"
rm -f proton_tkg_token
recursive_installer proton_tkg_* "${pkgdir}/usr/share/steam/compatibilitytools.d" >>"${_frogwhere}"/proton-tkg.log 2>&1
cd "${pkgdir}"/usr/share/steam/compatibilitytools.d/proton_tkg_*
ln -s -f "/tmp" "__pycache__"
}
trap exit_cleanup EXIT