Skip to content

Instantly share code, notes, and snippets.

@ILadis
Last active September 25, 2021 20:44
Show Gist options
  • Save ILadis/e787349988a03d0913a05e3397a3ee11 to your computer and use it in GitHub Desktop.
Save ILadis/e787349988a03d0913a05e3397a3ee11 to your computer and use it in GitHub Desktop.
PKGBUILD for wine-staging with League of Legends fixes and GloriousEggroll patches
#!/bin/bash
export SELF_SRC="$(realpath ${BASH_SOURCE})"
export SELF_DIR="$(dirname "${SELF_SRC}")"
export WINEBIN="${SELF_DIR}/lutris-ge-lol/bin"
export WINARCH='win32'
export WINEDEBUG='-all'
export WINEPREFIX="${SELF_DIR}/files"
export WINEESYNC=1
export PULSE_PROP='media.role=game'
export PATH="${WINEBIN}:${PATH}"
export LD_LIBRARY_PATH="${WINEBIN}/../:${LD_LIBRARY_PATH}"
function install() {(
cd "${WINEPREFIX}/drive_c"
if [ ! -f "${SELF_DIR}/installer.exe" ]; then
curl -o "${SELF_DIR}/installer.exe" -L \
'https://lol.secure.dyn.riotcdn.net/channels/public/x/installer/current/live.euw.exe'
fi
"${WINEBIN}/wine" "${SELF_DIR}/installer.exe"
)}
function launch() {(
cd "${WINEPREFIX}/drive_c"
# new riot client launcher
if [ -f 'Riot Games/Riot Client/RiotClientServices.exe' ]; then
"${WINEBIN}/wine" 'C:/Riot Games/Riot Client/RiotClientServices.exe' \
--launch-product=league_of_legends \
--launch-patchline=live &
# old league launcher
elif [ -f 'Riot Games/League of Legends/LeagueClient.exe' ]; then
"${WINEBIN}/wine" 'C:/Riot Games/League of Legends/LeagueClient.exe' &
# if neither of these launchers exist panic
else exit 1; fi
disown
)}
function await_port() {
until uxpid=$(pidof 'LeagueClientUx.exe'); do sleep 1; done
local port=$(cat /proc/${uxpid}/cmdline | sed -n 's/.*--app-port=\([[:digit:]]*\).*/\1/p')
echo "LeagueClientUx: pid is ${uxpid}, waiting for port ${port}..."
kill -STOP "${uxpid}"
until $(openssl s_client -connect "localhost:${port}" <<< Q &> /dev/null); do sleep 1; done
echo 'Port ready, have fun with league!'
kill -CONT "${uxpid}"
}
function setup_dxvk() {(
cd "${WINEPREFIX}/drive_c"
"${SELF_DIR}/dxvk/setup_dxvk.sh" 'install'
)}
function main() {
case "${1}" in
install) install;;
dxvk) setup_dxvk;;
*) launch && await_port;;
esac
}
main "${@}"
pkgname=wine-lol
pkgver=6.16
pkgrel=1
arch=(x86_64)
pkgdesc='A compatibility layer for running Windows programs - Staging branch with League of Legends fixes'
makedepends=('autoconf' 'bison' 'flex' 'make' 'gcc' 'patch' 'pkgconfig' 'vulkan-headers')
depends=(
'fontconfig' 'lib32-fontconfig'
'freetype2' 'lib32-freetype2'
'libxml2' 'lib32-libxml2'
'libxcursor' 'lib32-libxcursor'
'libxrandr' 'lib32-libxrandr'
'libxdamage' 'lib32-libxdamage'
'libxi' 'lib32-libxi'
'libsm' 'lib32-libsm'
'gcc-libs' 'lib32-gcc-libs'
'libpng' 'lib32-libpng'
'libjpeg-turbo' 'lib32-libjpeg-turbo'
'faudio' 'lib32-faudio'
'mpg123' 'lib32-mpg123'
'gstreamer' 'lib32-gstreamer'
'gst-plugins-base-libs' 'lib32-gst-plugins-base-libs'
'vulkan-icd-loader' 'lib32-vulkan-icd-loader'
'vkd3d' 'lib32-vkd3d'
'glu' 'lib32-glu'
'gnutls' 'lib32-gnutls'
'libgcrypt' 'lib32-libgcrypt'
'libpulse' 'lib32-libpulse'
'desktop-file-utils')
source=(
"https://dl.winehq.org/wine/source/6.x/wine-${pkgver}.tar.xz"
"https://github.com/wine-staging/wine-staging/archive/v${pkgver}/wine-staging-v${pkgver}.tar.gz"
"https://github.com/GloriousEggroll/wine-ge-custom/archive/refs/tags/${pkgver}-GE-LoL.tar.gz"
'alternative_patch_by_using_a_fake_cs_segment.patch::https://bugs.winehq.org/attachment.cgi?id=70550&action=diff&context=patch&collapsed=&headers=1&format=raw'
'importc.patch::https://bugs.winehq.org/attachment.cgi?id=70530&action=diff&context=patch&collapsed=&headers=1&format=raw')
sha256sums=(
'695092050d98a129c4d7f3153cb0e4923248bae5f3d920639fa4ab1a73f8fae8'
'5b5b57b3419192b4b83f22774cade770fb33ffb415e62a7374703e3b5720f836'
'19e378b59d17c96def8d617f43dcf3af73c1c31b1e75989a442ef85302e0fca0'
'81aff380f440181bc9650ec0d35e2102d3590dc80452a52e98b8f4be389f68c4'
'9fb044f20b80d3edbb478736341eeeaf21e57e569c5f1fbdc965ee6ae75e5788')
prepare() {
cd "${srcdir}/wine-staging-${pkgver}/patches"
./patchinstall.sh DESTDIR="${srcdir}/wine-${pkgver}" --all \
-W winex11-_NET_ACTIVE_WINDOW \
-W winex11-WM_WINDOWPOSCHANGING \
-W imm32-com-initialization \
-W ntdll-NtAlertThreadByThreadId
cd "${srcdir}/wine-${pkgver}"
patch -p1 < "${srcdir}/alternative_patch_by_using_a_fake_cs_segment.patch"
patch -p1 < "${srcdir}/importc.patch"
# apply glorious eggroll patches
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/wine-hotfixes/staging/imm32-com-initialization_no_net_active_window.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/proton/01-proton-use_clock_monotonic.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/proton/04-proton-LAA_staging.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/proton/03-proton-fsync_staging.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/proton/40-proton-futex2.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/proton/49-proton_QPC.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/wine-hotfixes/LoL/lfh-non-proton-pre-needed.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/proton/50-proton_LFH.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/wine-hotfixes/pending/hotfix-winelib.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/wine-hotfixes/pending/hotfix-iphlpapi-212361.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/wine-hotfixes/pending/hotfix-ntdll-socket-212770.patch"
patch -Np1 < "${srcdir}/wine-ge-custom-6.16-GE-LoL/patches/wine-hotfixes/pending/hotfix-bf4_ping.patch"
# required after patching
./dlls/winevulkan/make_vulkan
./tools/make_requests
autoreconf -f
}
build() {
export PKG_CONFIG_PATH='/usr/lib32/pkgconfig'
export CFLAGS='-m32 -fcommon'
cd "${srcdir}/wine-${pkgver}"
./configure \
--prefix=/opt/wine-lol \
--libdir=/opt/wine-lol/lib32
make -j`nproc`
}
package() {
cd "${srcdir}/wine-${pkgver}"
make \
prefix="${pkgdir}/opt/wine-lol" \
libdir="${pkgdir}/opt/wine-lol/lib32" install-lib
i686-w64-mingw32-strip --strip-unneeded \
"${pkgdir}/opt/wine-lol/lib32/wine/i386-windows"/*.dll
}
@ILadis
Copy link
Author

ILadis commented Aug 26, 2021

Glad I could help. I also added my custom "launchhelper.sh" script.

@Dessix
Copy link

Dessix commented Aug 31, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment