Package proton into a tar.gz and extract on first-run
Valve requested that we distribute as few small files as possible, as their content pipeline is very inefficient with small files.
This commit is contained in:
parent
34ee1f3295
commit
74e96ab1ec
3 changed files with 38 additions and 19 deletions
|
@ -6,16 +6,13 @@ set -e
|
||||||
#./build/ <-- built files
|
#./build/ <-- built files
|
||||||
#./dist/ <-- proton build, ready to distribute
|
#./dist/ <-- proton build, ready to distribute
|
||||||
|
|
||||||
mkdir -p dist/bin build/wine.win32 build/dist.win32 build/wine.win64
|
|
||||||
|
|
||||||
TOP="$PWD"
|
TOP="$PWD"
|
||||||
RUNTIME_PATH="$TOP/../../runtime/steam-runtime-both/"
|
RUNTIME_PATH="$TOP/../../runtime/steam-runtime-both/"
|
||||||
DST_DIR="$TOP/dist"
|
DST_DIR="$TOP/build/dist"
|
||||||
TOOLS_DIR64="$TOP/build/tools.win64"
|
TOOLS_DIR64="$TOP/build/tools.win64"
|
||||||
TOOLS_DIR32="$TOP/build/tools.win32"
|
TOOLS_DIR32="$TOP/build/tools.win32"
|
||||||
|
|
||||||
cp -a toolmanifest.vdf dist/
|
mkdir -p dist "$DST_DIR"/bin build/wine.win32 build/dist.win32 build/wine.win64
|
||||||
cp -a proton dist/bin/
|
|
||||||
|
|
||||||
#build wine64
|
#build wine64
|
||||||
cd "$TOP"/build/wine.win64
|
cd "$TOP"/build/wine.win64
|
||||||
|
@ -54,7 +51,7 @@ cd "$TOP"/build/lsteamclient.win64/
|
||||||
-L"$TOOLS_DIR64"/lib64/wine/ \
|
-L"$TOOLS_DIR64"/lib64/wine/ \
|
||||||
--dll .
|
--dll .
|
||||||
CXXFLAGS=-Wno-attributes PATH="$TOOLS_DIR64/bin:$PATH" "$RUNTIME_PATH/shell-amd64.sh" make
|
CXXFLAGS=-Wno-attributes PATH="$TOOLS_DIR64/bin:$PATH" "$RUNTIME_PATH/shell-amd64.sh" make
|
||||||
cp -a lsteamclient.dll.so "$TOP"/dist/lib64/wine/
|
cp -a lsteamclient.dll.so "$DST_DIR"/lib64/wine/
|
||||||
|
|
||||||
#build 32-bit lsteamclient
|
#build 32-bit lsteamclient
|
||||||
cd "$TOP"
|
cd "$TOP"
|
||||||
|
@ -71,7 +68,7 @@ cd "$TOP"/build/lsteamclient.win32/
|
||||||
-L"$TOOLS_DIR32"/lib/wine/ \
|
-L"$TOOLS_DIR32"/lib/wine/ \
|
||||||
--dll .
|
--dll .
|
||||||
CXXFLAGS=-Wno-attributes PATH="$TOOLS_DIR32/bin:$PATH" "$RUNTIME_PATH/shell-i386.sh" make -j1
|
CXXFLAGS=-Wno-attributes PATH="$TOOLS_DIR32/bin:$PATH" "$RUNTIME_PATH/shell-i386.sh" make -j1
|
||||||
cp -a lsteamclient.dll.so "$TOP"/dist/lib/wine/
|
cp -a lsteamclient.dll.so "$DST_DIR"/lib/wine/
|
||||||
|
|
||||||
#build 64-bit vrclient
|
#build 64-bit vrclient
|
||||||
cd "$TOP"
|
cd "$TOP"
|
||||||
|
@ -88,8 +85,8 @@ cd "$TOP"/build/vrclient_x64/
|
||||||
--dll .
|
--dll .
|
||||||
CXXFLAGS="-Wno-attributes -std=c++0x" PATH="$TOOLS_DIR64/bin:$PATH" "$RUNTIME_PATH/shell-amd64.sh" make
|
CXXFLAGS="-Wno-attributes -std=c++0x" PATH="$TOOLS_DIR64/bin:$PATH" "$RUNTIME_PATH/shell-amd64.sh" make
|
||||||
PATH="$TOOLS_DIR64/bin:$PATH" "$RUNTIME_PATH/shell-amd64.sh" winebuild --dll --fake-module -E vrclient_x64.spec -o vrclient_x64.dll.fake
|
PATH="$TOOLS_DIR64/bin:$PATH" "$RUNTIME_PATH/shell-amd64.sh" winebuild --dll --fake-module -E vrclient_x64.spec -o vrclient_x64.dll.fake
|
||||||
cp -a vrclient_x64.dll.so "$TOP"/dist/lib64/wine/
|
cp -a vrclient_x64.dll.so "$DST_DIR"/lib64/wine/
|
||||||
cp -a vrclient_x64.dll.fake "$TOP"/dist/lib64/wine/fakedlls/vrclient_x64.dll
|
cp -a vrclient_x64.dll.fake "$DST_DIR"/lib64/wine/fakedlls/vrclient_x64.dll
|
||||||
|
|
||||||
#build 32-bit vrclient
|
#build 32-bit vrclient
|
||||||
cd "$TOP"
|
cd "$TOP"
|
||||||
|
@ -107,7 +104,17 @@ mv vrclient_x64.spec vrclient.spec
|
||||||
--dll .
|
--dll .
|
||||||
CXXFLAGS="-Wno-attributes -std=c++0x" PATH="$TOOLS_DIR32/bin:$PATH" "$RUNTIME_PATH/shell-i386.sh" make
|
CXXFLAGS="-Wno-attributes -std=c++0x" PATH="$TOOLS_DIR32/bin:$PATH" "$RUNTIME_PATH/shell-i386.sh" make
|
||||||
PATH="$TOOLS_DIR32/bin:$PATH" "$RUNTIME_PATH/shell-i386.sh" winebuild --dll --fake-module -E vrclient.spec -o vrclient.dll.fake
|
PATH="$TOOLS_DIR32/bin:$PATH" "$RUNTIME_PATH/shell-i386.sh" winebuild --dll --fake-module -E vrclient.spec -o vrclient.dll.fake
|
||||||
cp -a vrclient.dll.so "$TOP"/dist/lib/wine/
|
cp -a vrclient.dll.so "$DST_DIR"/lib/wine/
|
||||||
cp -a vrclient.dll.fake "$TOP"/dist/lib/wine/fakedlls/vrclient.dll
|
cp -a vrclient.dll.fake "$DST_DIR"/lib/wine/fakedlls/vrclient.dll
|
||||||
|
|
||||||
|
echo "Packaging..."
|
||||||
|
cd "$TOP"
|
||||||
|
|
||||||
|
#the difference between -1 and -9 is about 20 MB, so prioritize quick startup over file size
|
||||||
|
tar -C build/dist -c . | gzip -c -1 > dist/proton_dist.tar.gz
|
||||||
|
|
||||||
|
cp -a toolmanifest.vdf dist/
|
||||||
|
cp -a proton dist/
|
||||||
|
date '+%s' > dist/version
|
||||||
|
|
||||||
echo "Proton ready in dist/"
|
echo "Proton ready in dist/"
|
||||||
|
|
26
proton
26
proton
|
@ -2,11 +2,13 @@
|
||||||
|
|
||||||
#script to launch Wine with the correct environment
|
#script to launch Wine with the correct environment
|
||||||
|
|
||||||
|
import filecmp
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import tarfile
|
||||||
|
|
||||||
PFX="Proton: "
|
PFX="Proton: "
|
||||||
|
|
||||||
|
@ -17,13 +19,23 @@ if not ("STEAM_COMPAT_DATA_PATH" in os.environ):
|
||||||
log("No compat data path?")
|
log("No compat data path?")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
prefix = os.environ["STEAM_COMPAT_DATA_PATH"]
|
basedir = os.path.dirname(sys.argv[0])
|
||||||
|
bindir = basedir + "/dist/bin/"
|
||||||
bindir = os.path.dirname(sys.argv[0])
|
libdir = basedir + "/dist/lib64:" + basedir + "/dist/lib"
|
||||||
basedir = os.path.dirname(bindir)
|
|
||||||
wine_path = bindir + "/wine64"
|
wine_path = bindir + "/wine64"
|
||||||
|
|
||||||
libdir = basedir + "/lib64:" + basedir + "/lib"
|
#extract if needed
|
||||||
|
if not os.path.exists(basedir + "/dist") or \
|
||||||
|
not os.path.exists(basedir + "/dist/version") or \
|
||||||
|
not filecmp.cmp(basedir + "/version", basedir + "/dist/version"):
|
||||||
|
if os.path.exists(basedir + "/dist"):
|
||||||
|
shutil.rmtree(basedir + "/dist")
|
||||||
|
tar = tarfile.open(basedir + "/proton_dist.tar.gz", mode="r:gz")
|
||||||
|
tar.extractall(path=basedir + "/dist")
|
||||||
|
tar.close()
|
||||||
|
shutil.copy(basedir + "/version", basedir + "/dist/")
|
||||||
|
|
||||||
|
prefix = os.environ["STEAM_COMPAT_DATA_PATH"]
|
||||||
|
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
|
|
||||||
|
@ -62,8 +74,8 @@ if not os.path.isdir(prefix + "/drive_c"):
|
||||||
#copy openvr files into place
|
#copy openvr files into place
|
||||||
dst = prefix + "/drive_c/vrclient/bin/"
|
dst = prefix + "/drive_c/vrclient/bin/"
|
||||||
os.makedirs(dst)
|
os.makedirs(dst)
|
||||||
shutil.copy(basedir + "/lib/wine/fakedlls/vrclient.dll", dst)
|
shutil.copy(basedir + "/dist/lib/wine/fakedlls/vrclient.dll", dst)
|
||||||
shutil.copy(basedir + "/lib64/wine/fakedlls/vrclient_x64.dll", dst)
|
shutil.copy(basedir + "/dist/lib64/wine/fakedlls/vrclient_x64.dll", dst)
|
||||||
os.makedirs(prefix + "/drive_c/users/" + env["USER"] + "/Local Settings/Application Data/openvr")
|
os.makedirs(prefix + "/drive_c/users/" + env["USER"] + "/Local Settings/Application Data/openvr")
|
||||||
|
|
||||||
#parse linux openvr config and present it in win32 format to the app.
|
#parse linux openvr config and present it in win32 format to the app.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"manifest"
|
"manifest"
|
||||||
{
|
{
|
||||||
"commandline" "/bin/proton"
|
"commandline" "/proton"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue