Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| #!/bin/bash | |
| # Script that was used to build this package. Enjoy | |
| # Usage: ./flatpak-make app-name-here app-source-directory-here app-exe-here(no path needed) app-arch(default is x86_64, use i386 for 32 bit) | |
| # Example: ./flatpak-make leagueoflegends leagueoflegends/ LeagueClient.exe i386 | |
| NAME="$1"; shift | |
| APP="$1"; shift | |
| EXE="$1"; shift | |
| ARCHDEFAULT="$1"; shift | |
| BUILDWINE="flatpak build ../$NAME ./configure --prefix=/app --libdir=/app/lib --with-x --with-xattr --disable-tests --enable-win64" | |
| NICE_NAME=$(echo $(echo "$NAME" | sed 's/[A-Z]/ \0/g')) | |
| DOT_NAME=$(echo "$NICE_NAME" | tr " " . ) | |
| WINEEXE="/app/bin/wine64" | |
| ARCH="x86_64" | |
| if [[ $ARCHDEFAULT == i386 ]] ; then | |
| WINEEXE="/app/bin/wine" | |
| ARCH="i386" | |
| BUILDWINE=${BUILDWINE//--enable-win64/} | |
| fi | |
| NB_CORES=$(grep -c '^processor' /proc/cpuinfo) | |
| export MAKEFLAGS="-j$((NB_CORES+1)) -l${NB_CORES}" | |
| flatpak --user remote-add --no-gpg-verify --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
| flatpak --user install flathub org.freedesktop.Platform/$ARCH/1.6 | |
| flatpak --user install flathub org.freedesktop.Sdk/$ARCH/1.6 | |
| flatpak build-init $NAME org.RiotGames.$NAME org.freedesktop.Sdk/$ARCH org.freedesktop.Platform/$ARCH 1.6 | |
| flatpak build $NAME mkdir -p /app/bin/ | |
| flatpak build $NAME mkdir -p /app/share/applications/ | |
| cat << EOF > $NAME/files/bin/run.sh | |
| #!/bin/bash | |
| mkdir -p /tmp/wine.$$.prefix/ | |
| export WINEPREFIX=\$HOME/.local/share/flatpak-riotgames/$NAME/ | |
| export WINEEXE="$WINEEXE" | |
| export WINEDEBUG="-all" | |
| export GPU_MAX_HEAP_SIZE="100" | |
| export GPU_MAX_ALLOC_PERCENT="100" | |
| export MESA_GLTHREAD=true | |
| export __GL_THREADED_OPTIMIZATIONS=1 | |
| if ! [ -e "\$WINEPREFIX/drive_c/Riot Games" ] ; then | |
| winetricks -q directx9 winxp && | |
| curl -L -o "\$WINEPREFIX/drive_c/LeagueInstallerNA.exe" https://riotgamespatcher-a.akamaihd.net/releases/live/installer/deploy/League%20of%20Legends%20installer%20NA.exe | |
| \$WINEEXE regedit /C /app/$NAME.reg && | |
| cp /app/$NAME.md "\$WINEPREFIX/$NAME.md" && | |
| sed -i 's/FLATPAKNAME/org.RiotGames.$NAME/g' "\$WINEPREFIX/$NAME.md" && | |
| sed -i "s|WINEPREFIX|\$WINEPREFIX|" "\$WINEPREFIX/$NAME.md" | |
| \$WINEEXE "\$WINEPREFIX/drive_c/LeagueInstallerNA.exe" \$@ | |
| exit $? | |
| fi | |
| if [ "\$1" == "winecfg" ] ; then | |
| \$WINEEXE winecfg | |
| elif [ "\$1" == "winetricks" ] ; then | |
| winetricks | |
| elif [ "\$1" == "regedit" ] ; then | |
| \$WINEEXE regedit | |
| elif [ "\$1" == "bash" ] ; then | |
| bash | |
| elif [ -e run.sh ] ; then | |
| sh run.sh \$@ | |
| exit $? | |
| else | |
| \$WINEEXE "\$WINEPREFIX/drive_c/Riot Games/League of Legends/$EXE" \$@ | |
| exit $? | |
| fi | |
| EOF | |
| cat << EOF > $NAME/files/share/applications/org.RiotGames.$NAME.desktop | |
| [Desktop Entry] | |
| Version=1.0 | |
| Name=League of Legends | |
| Exec=flatpak run org.RiotGames.leagueoflegends $@ | |
| Icon=\$HOME/.local/share/flatpak-riotgames/$NAME/Riot Games/League of Legends/RADS/system/lcu.ico | |
| StartupNotify=true | |
| Terminal=false | |
| Type=Application | |
| Categories=Game; | |
| EOF | |
| cat << EOF > $NAME/files/leagueoflegends.reg | |
| REGEDIT4 | |
| [HKEY_CURRENT_USER\Software\Wine\DllRedirects] | |
| "wined3d"="wined3d-csmt.dll" | |
| [HKEY_CURRENT_USER\Software\Wine\Direct3D] | |
| "UseGLSL"="disabled" | |
| [HKEY_CURRENT_USER\Software\Wine\DirectInput] | |
| "MouseWarpOverride"="enable" | |
| [HKEY_CURRENT_USER\Software\Wine\DllOverrides] | |
| "msvcp140"="native,builtin" | |
| "msvcp120"="native,builtin" | |
| "vcomp120"="native,builtin" | |
| "atl120"="native,builtin" | |
| EOF | |
| cat << EOF > $NAME/files/leagueoflegends.md | |
| This game uses wine. | |
| Run flatpak run FLATPAKNAME winecfg to configure it if needed. | |
| Run flatpak run FLATPAKNAME config to run configuration tool. | |
| Run flatpak run FLATPAKNAME winetricks to run winetricks tool. | |
| Run flatpak run FLATPAKNAME regedit to run regedit tool. | |
| Wineprefix is WINEPREFIX. | |
| If you are looking for saved games, they are most likely there. | |
| EOF | |
| # league of legends | |
| curl -L -O http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/openldap_2.4.42+dfsg.orig.tar.gz | |
| curl -L https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks -o $NAME/files/bin/winetricks | |
| curl -L -O https://github.com/wine-compholio/wine-patched/archive/staging-2.21.tar.gz | |
| curl -L -O https://github.com/sarnex/wine-d3d9-patches/archive/wine-d3d9-2.21.tar.gz | |
| cat *.tar.gz | tar -xzf - -i | |
| cd openldap-2.4.42+dfsg | |
| flatpak build ../$NAME ./configure --prefix=/app --enable-crypt --enable-dynamic --with-threads --disable-wrappers --disable-spasswd --without-cyrus-sasl --disable-bdb --disable-hdb | |
| flatpak build ../$NAME make | |
| flatpak build ../$NAME make install | |
| cd .. | |
| cd wine-patched-staging-2.21 | |
| patch -p1 < ../wine-d3d9-patches-wine-d3d9-2.21/staging-helper.patch | |
| patch -p1 < ../wine-d3d9-patches-wine-d3d9-2.21/wine-d3d9.patch | |
| autoreconf -f | |
| export LDAP_LIBS=../$NAME/files/lib | |
| $BUILDWINE | |
| flatpak build ../$NAME make | |
| flatpak build ../$NAME make install | |
| cd .. | |
| rm $NAME/files/share/applications/wine.desktop | |
| # endfixme | |
| set -ex | |
| chmod +x $NAME/files/bin/run.sh | |
| chmod +x $NAME/files/bin/winetricks | |
| flatpak build-finish leagueoflegends --socket=x11 --socket=pulseaudio --share=network --share=ipc --device=dri --filesystem=xdg-documents --filesystem=~/.local/share/flatpak-riotgames/:create --command=run.sh --allow=devel --allow=multiarch | |
| flatpak build-export repo $NAME | |
| flatpak build-bundle --arch=$ARCH repo $NAME.flatpak org.RiotGames.$NAME | |
| # cleanup | |
| rm -Rf openldap* repo $NAME wine-* staging* |