2018-01-18 19:20:43 +03:00
#!/bin/bash
set -e
#./wine/ <-- wine source
#./build/ <-- built files
#./dist/ <-- proton build, ready to distribute
2018-01-18 19:38:13 +03:00
TOP = " $PWD "
2018-01-18 19:20:43 +03:00
2018-02-07 22:48:25 +03:00
PLATFORM = $( uname)
if [ " $PLATFORM " = = "Darwin" ] ; then
CC = "ccache clang -g"
STRIPFLAGS = ''
AMD64_WRAPPER = ""
I386_WRAPPER = ""
else
CC = "ccache gcc -g"
STRIPFLAGS = '-s'
AMD64_WRAPPER = "schroot --chroot steamrt_scout_beta_amd64 --"
I386_WRAPPER = "schroot --chroot steamrt_scout_beta_i386 --"
fi
2018-01-30 20:35:42 +03:00
STRIP = 'strip'
if [ " $1 " = = "--debug" ] ; then
#don't strip
STRIPFLAGS = ''
STRIP = ''
fi
2018-02-07 22:48:25 +03:00
DST_DIR = " $TOP /build/dist "
TOOLS_DIR64 = " $TOP /build/tools.win64 "
TOOLS_DIR32 = " $TOP /build/tools.win32 "
2018-01-19 20:03:54 +03:00
mkdir -p dist " $DST_DIR " /bin build/wine.win32 build/dist.win32 build/wine.win64
2018-01-18 19:20:43 +03:00
2018-01-18 19:38:13 +03:00
#build wine64
cd " $TOP " /build/wine.win64
2018-02-07 22:48:25 +03:00
CC = " $CC " $AMD64_WRAPPER " $TOP " /wine/configure --enable-win64 --disable-tests --prefix= " $DST_DIR "
2018-01-25 22:08:27 +03:00
$AMD64_WRAPPER make -j5
2018-01-30 20:35:42 +03:00
INSTALL_PROGRAM_FLAGS = " $STRIPFLAGS " $AMD64_WRAPPER make install-lib
INSTALL_PROGRAM_FLAGS = " $STRIPFLAGS " $AMD64_WRAPPER make prefix = " $TOOLS_DIR64 " libdir = " $TOOLS_DIR64 /lib64 " dlldir = " $TOOLS_DIR64 /lib64/wine " install-dev install-lib
rm -f " $DST_DIR " /bin/{ msiexec,notepad,regedit,regsvr32,wineboot,winecfg,wineconsole,winedbg,winefile,winemine,winepath}
rm -rf " $DST_DIR /share/man/ "
2018-01-18 19:20:43 +03:00
2018-01-18 19:38:13 +03:00
#build wine32
cd " $TOP " /build/wine.win32
2018-02-07 22:48:25 +03:00
CC = " $CC " $I386_WRAPPER " $TOP " /wine/configure --disable-tests --prefix= " $TOP /build/dist.win32/ "
2018-01-25 22:08:27 +03:00
$I386_WRAPPER make -j5
2018-01-30 20:35:42 +03:00
INSTALL_PROGRAM_FLAGS = " $STRIPFLAGS " $I386_WRAPPER make install-lib
INSTALL_PROGRAM_FLAGS = " $STRIPFLAGS " $I386_WRAPPER make prefix = " $TOOLS_DIR32 " libdir = " $TOOLS_DIR32 /lib " dlldir = " $TOOLS_DIR32 /lib/wine " install-dev install-lib
2018-01-18 19:20:43 +03:00
#install 32-bit stuff manually, see
# https://wiki.winehq.org/Packaging#WoW64_Workarounds
2018-01-18 19:38:13 +03:00
cd " $TOP " /build/dist.win32/
2018-01-18 19:20:43 +03:00
cp -a lib " $DST_DIR " /
cp -a bin/wine " $DST_DIR " /bin/
2018-02-07 22:48:25 +03:00
if [ " $PLATFORM " != "Darwin" ] ; then
cp -a bin/wine-preloader " $DST_DIR " /bin/
fi
2018-01-18 19:20:43 +03:00
cp -a bin/wineserver " $DST_DIR " /bin/wineserver32
2018-01-18 19:38:13 +03:00
#build 64-bit lsteamclient
cd " $TOP "
rm -rf build/lsteamclient.win64
cp -a lsteamclient build/lsteamclient.win64
cd " $TOP " /build/lsteamclient.win64/
2018-01-25 22:08:27 +03:00
$AMD64_WRAPPER " $TOP " /wine/tools/winemaker/winemaker \
2018-01-18 19:38:13 +03:00
--nosource-fix --nolower-include --nodlls --nomsvcrt \
-DSTEAM_API_EXPORTS \
-I" $TOOLS_DIR64 " /include/ \
-I" $TOOLS_DIR64 " /include/wine/ \
-I" $TOOLS_DIR64 " /include/wine/windows/ \
-L" $TOOLS_DIR64 " /lib64/ \
-L" $TOOLS_DIR64 " /lib64/wine/ \
--dll .
2018-02-07 23:01:25 +03:00
CXXFLAGS = "-Wno-attributes -O2" CFLAGS = "-O2" PATH = " $TOOLS_DIR64 /bin: $PATH " $AMD64_WRAPPER make
2018-01-30 20:35:42 +03:00
if [ x" $STRIP " != x ] ; then
$AMD64_WRAPPER " $STRIP " lsteamclient.dll.so
fi
2018-01-19 20:03:54 +03:00
cp -a lsteamclient.dll.so " $DST_DIR " /lib64/wine/
2018-01-18 19:38:13 +03:00
#build 32-bit lsteamclient
cd " $TOP "
rm -rf build/lsteamclient.win32
cp -a lsteamclient build/lsteamclient.win32
cd " $TOP " /build/lsteamclient.win32/
2018-01-25 22:08:27 +03:00
$I386_WRAPPER " $TOP " /wine/tools/winemaker/winemaker \
2018-01-18 19:38:13 +03:00
--nosource-fix --nolower-include --nodlls --nomsvcrt --wine32 \
-DSTEAM_API_EXPORTS \
-I" $TOOLS_DIR32 " /include/ \
-I" $TOOLS_DIR32 " /include/wine/ \
-I" $TOOLS_DIR32 " /include/wine/windows/ \
-L" $TOOLS_DIR32 " /lib/ \
-L" $TOOLS_DIR32 " /lib/wine/ \
--dll .
2018-02-07 23:01:25 +03:00
CXXFLAGS = "-Wno-attributes -O2" CFLAGS = "-O2" PATH = " $TOOLS_DIR32 /bin: $PATH " $I386_WRAPPER make
2018-01-30 20:35:42 +03:00
if [ x" $STRIP " != x ] ; then
$I386_WRAPPER " $STRIP " lsteamclient.dll.so
fi
2018-01-19 20:03:54 +03:00
cp -a lsteamclient.dll.so " $DST_DIR " /lib/wine/
2018-01-18 19:38:13 +03:00
2018-01-18 22:57:01 +03:00
#build 64-bit vrclient
cd " $TOP "
rm -rf build/vrclient_x64
cp -a vrclient_x64 build/vrclient_x64
cd " $TOP " /build/vrclient_x64/
2018-01-25 22:08:27 +03:00
$AMD64_WRAPPER " $TOP " /wine/tools/winemaker/winemaker \
2018-01-18 22:57:01 +03:00
--nosource-fix --nolower-include --nodlls --nomsvcrt \
-I" $TOOLS_DIR64 " /include/ \
-I" $TOOLS_DIR64 " /include/wine/ \
-I" $TOOLS_DIR64 " /include/wine/windows/ \
-L" $TOOLS_DIR64 " /lib64/ \
-L" $TOOLS_DIR64 " /lib64/wine/ \
--dll .
2018-02-07 23:01:25 +03:00
CXXFLAGS = "-Wno-attributes -std=c++0x -O2" CFLAGS = "-O2" PATH = " $TOOLS_DIR64 /bin: $PATH " $AMD64_WRAPPER make
2018-01-25 22:08:27 +03:00
PATH = " $TOOLS_DIR64 /bin: $PATH " $AMD64_WRAPPER winebuild --dll --fake-module -E vrclient_x64.spec -o vrclient_x64.dll.fake
2018-01-30 20:35:42 +03:00
if [ x" $STRIP " != x ] ; then
$AMD64_WRAPPER " $STRIP " vrclient_x64.dll.so
fi
2018-01-19 20:03:54 +03:00
cp -a vrclient_x64.dll.so " $DST_DIR " /lib64/wine/
cp -a vrclient_x64.dll.fake " $DST_DIR " /lib64/wine/fakedlls/vrclient_x64.dll
2018-01-18 22:57:01 +03:00
#build 32-bit vrclient
cd " $TOP "
rm -rf build/vrclient
cp -a vrclient_x64 build/vrclient
cd " $TOP " /build/vrclient/
mv vrclient_x64.spec vrclient.spec
2018-01-25 22:08:27 +03:00
$I386_WRAPPER " $TOP " /wine/tools/winemaker/winemaker \
2018-01-18 22:57:01 +03:00
--nosource-fix --nolower-include --nodlls --nomsvcrt --wine32 \
-I" $TOOLS_DIR32 " /include/ \
-I" $TOOLS_DIR32 " /include/wine/ \
-I" $TOOLS_DIR32 " /include/wine/windows/ \
-L" $TOOLS_DIR32 " /lib/ \
-L" $TOOLS_DIR32 " /lib/wine/ \
--dll .
2018-02-07 23:01:25 +03:00
CXXFLAGS = "-Wno-attributes -std=c++0x -O2" CFLAGS = "-O2" PATH = " $TOOLS_DIR32 /bin: $PATH " $I386_WRAPPER make
2018-01-25 22:08:27 +03:00
PATH = " $TOOLS_DIR32 /bin: $PATH " $I386_WRAPPER winebuild --dll --fake-module -E vrclient.spec -o vrclient.dll.fake
2018-01-30 20:35:42 +03:00
if [ x" $STRIP " != x ] ; then
$I386_WRAPPER " $STRIP " vrclient.dll.so
fi
2018-01-19 20:03:54 +03:00
cp -a vrclient.dll.so " $DST_DIR " /lib/wine/
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/
2018-02-06 22:26:01 +03:00
cp -a LICENSE dist/
2018-01-19 20:03:54 +03:00
date '+%s' > dist/version
2018-01-18 22:57:01 +03:00
2018-01-18 19:20:43 +03:00
echo "Proton ready in dist/"