From 0b2c856af709673bd6dfd03345108640db360672 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 18 Jan 2018 10:38:13 -0600 Subject: [PATCH] lsteamclient: Fix building as a winemaker project --- build_proton.sh | 56 ++++++++++++++++++--- lsteamclient/cxx.h | 6 +++ lsteamclient/gen.sh | 2 + lsteamclient/gen_wrapper.py | 2 - lsteamclient/steamclient_main.c | 2 - lsteamclient/steamclient_private.h | 4 ++ lsteamclient/steamclient_wrappers.c | 2 - lsteamclient/winISteamAppList.c | 4 -- lsteamclient/winISteamAppTicket.c | 4 -- lsteamclient/winISteamApps.c | 4 -- lsteamclient/winISteamClient.c | 4 -- lsteamclient/winISteamController.c | 4 -- lsteamclient/winISteamFriends.c | 4 -- lsteamclient/winISteamGameCoordinator.c | 4 -- lsteamclient/winISteamGameServer.c | 4 -- lsteamclient/winISteamGameServerStats.c | 4 -- lsteamclient/winISteamHTMLSurface.c | 4 -- lsteamclient/winISteamHTTP.c | 4 -- lsteamclient/winISteamInventory.c | 4 -- lsteamclient/winISteamMasterServerUpdater.c | 4 -- lsteamclient/winISteamMatchmaking.c | 4 -- lsteamclient/winISteamMatchmakingServers.c | 4 -- lsteamclient/winISteamMusic.c | 4 -- lsteamclient/winISteamMusicRemote.c | 4 -- lsteamclient/winISteamNetworking.c | 4 -- lsteamclient/winISteamParentalSettings.c | 4 -- lsteamclient/winISteamRemoteStorage.c | 4 -- lsteamclient/winISteamScreenshots.c | 4 -- lsteamclient/winISteamUGC.c | 4 -- lsteamclient/winISteamUnifiedMessages.c | 4 -- lsteamclient/winISteamUser.c | 4 -- lsteamclient/winISteamUserStats.c | 4 -- lsteamclient/winISteamUtils.c | 4 -- lsteamclient/winISteamVideo.c | 4 -- 34 files changed, 60 insertions(+), 122 deletions(-) diff --git a/build_proton.sh b/build_proton.sh index b7b8daf9..3def3aa3 100755 --- a/build_proton.sh +++ b/build_proton.sh @@ -2,34 +2,74 @@ set -e -RUNTIME_PATH="$PWD/../../runtime/steam-runtime-both/" - #./wine/ <-- wine source #./build/ <-- built files #./dist/ <-- proton build, ready to distribute mkdir -p dist/ build/wine.win32 build/dist.win32 build/wine.win64 -DST_DIR="$PWD/dist" +TOP="$PWD" +RUNTIME_PATH="$TOP/../../runtime/steam-runtime-both/" +DST_DIR="$TOP/dist" +TOOLS_DIR64="$TOP/build/tools.win64" +TOOLS_DIR32="$TOP/build/tools.win32" cp -a toolmanifest.vdf dist/ -cd build/wine.win64 -CC="ccache gcc" "$RUNTIME_PATH/shell-amd64.sh" ../../wine/configure --enable-win64 --disable-tests --prefix="$DST_DIR" +#build wine64 +cd "$TOP"/build/wine.win64 +CC="ccache gcc" "$RUNTIME_PATH/shell-amd64.sh" "$TOP"/wine/configure --enable-win64 --disable-tests --prefix="$DST_DIR" "$RUNTIME_PATH/shell-amd64.sh" make "$RUNTIME_PATH/shell-amd64.sh" make install-lib +"$RUNTIME_PATH/shell-amd64.sh" make prefix="$TOOLS_DIR64" libdir="$TOOLS_DIR64/lib64" dlldir="$TOOLS_DIR64/lib64/wine" install-dev install-lib -cd ../wine.win32 -CC="ccache gcc" "$RUNTIME_PATH/shell-i386.sh" ../../wine/configure --disable-tests --prefix="$PWD/../dist.win32/" +#build wine32 +cd "$TOP"/build/wine.win32 +CC="ccache gcc" "$RUNTIME_PATH/shell-i386.sh" "$TOP"/wine/configure --disable-tests --prefix="$TOP/build/dist.win32/" "$RUNTIME_PATH/shell-i386.sh" make "$RUNTIME_PATH/shell-i386.sh" make install-lib +"$RUNTIME_PATH/shell-i386.sh" make prefix="$TOOLS_DIR32" libdir="$TOOLS_DIR32/lib" dlldir="$TOOLS_DIR32/lib/wine" install-dev install-lib #install 32-bit stuff manually, see # https://wiki.winehq.org/Packaging#WoW64_Workarounds -cd ../dist.win32/ +cd "$TOP"/build/dist.win32/ cp -a lib "$DST_DIR"/ cp -a bin/wine "$DST_DIR"/bin/ cp -a bin/wine-preloader "$DST_DIR"/bin/ cp -a bin/wineserver "$DST_DIR"/bin/wineserver32 +#build 64-bit lsteamclient +cd "$TOP" +rm -rf build/lsteamclient.win64 +cp -a lsteamclient build/lsteamclient.win64 +cd "$TOP"/build/lsteamclient.win64/ +"$RUNTIME_PATH/shell-amd64.sh" "$TOP"/wine/tools/winemaker/winemaker \ + --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 . +CXXFLAGS=-Wno-attributes PATH="$TOOLS_DIR64/bin:$PATH" "$RUNTIME_PATH/shell-amd64.sh" make +cp -a lsteamclient.dll.so "$TOP"/dist/lib64/wine/ + +#build 32-bit lsteamclient +cd "$TOP" +rm -rf build/lsteamclient.win32 +cp -a lsteamclient build/lsteamclient.win32 +cd "$TOP"/build/lsteamclient.win32/ +"$RUNTIME_PATH/shell-i386.sh" "$TOP"/wine/tools/winemaker/winemaker \ + --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 . +CXXFLAGS=-Wno-attributes PATH="$TOOLS_DIR32/bin:$PATH" "$RUNTIME_PATH/shell-i386.sh" make -j1 +cp -a lsteamclient.dll.so "$TOP"/dist/lib/wine/ + echo "Proton ready in dist/" diff --git a/lsteamclient/cxx.h b/lsteamclient/cxx.h index a2f59d7c..6307e7e3 100644 --- a/lsteamclient/cxx.h +++ b/lsteamclient/cxx.h @@ -18,6 +18,12 @@ /* Copied from dlls/msvcrt/cxx.h */ #undef __thiscall + +#define __ASM_NAME(name) name +#define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t.globl " #name suffix "\n\t.type " #name suffix ",@function\n" #name suffix ":\n\t.cfi_startproc\n\t" code "\n\t.cfi_endproc\n\t.previous"); +#define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(name,"",code) +#define __ASM_STDCALL(args) "" + #ifdef __i386__ /* thiscall functions are i386-specific */ #define THISCALL(func) __thiscall_ ## func diff --git a/lsteamclient/gen.sh b/lsteamclient/gen.sh index b80c818c..2ac0dbc1 100755 --- a/lsteamclient/gen.sh +++ b/lsteamclient/gen.sh @@ -8,3 +8,5 @@ rm cpp*.h rm cb*.h rm cb*.cpp rm cb*.dat + +./gen_wrapper.py diff --git a/lsteamclient/gen_wrapper.py b/lsteamclient/gen_wrapper.py index 07c1a05b..ce2be488 100755 --- a/lsteamclient/gen_wrapper.py +++ b/lsteamclient/gen_wrapper.py @@ -296,8 +296,6 @@ def handle_class(sdkver, classnode): cfile = open("%s.c" % winname, "a") if not file_exists: cfile.write("""/* This file is auto-generated, do not edit. */ -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/steamclient_main.c b/lsteamclient/steamclient_main.c index 6ad43882..5ee00d9d 100644 --- a/lsteamclient/steamclient_main.c +++ b/lsteamclient/steamclient_main.c @@ -22,8 +22,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) switch (reason) { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(instance); break; diff --git a/lsteamclient/steamclient_private.h b/lsteamclient/steamclient_private.h index 5ef97a12..deb0632d 100644 --- a/lsteamclient/steamclient_private.h +++ b/lsteamclient/steamclient_private.h @@ -31,3 +31,7 @@ typedef struct __winX winX; void *create_win_interface(const char *name, void *linux_side); unsigned int steamclient_unix_path_to_dos_path(unsigned int api_result, char *inout, unsigned int inout_bytes); void *create_LinuxMatchmakingServerListResponse(void *win); + +#define TRACE WINE_TRACE +#define ERR WINE_ERR +#define WARN WINE_WARN diff --git a/lsteamclient/steamclient_wrappers.c b/lsteamclient/steamclient_wrappers.c index 593e0c01..99c56b89 100644 --- a/lsteamclient/steamclient_wrappers.c +++ b/lsteamclient/steamclient_wrappers.c @@ -1,7 +1,5 @@ /* Linux-to-Windows conversions (i.e. callbacks) here. */ -#include "config.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamAppList.c b/lsteamclient/winISteamAppList.c index e6269420..42f6d68e 100644 --- a/lsteamclient/winISteamAppList.c +++ b/lsteamclient/winISteamAppList.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamAppTicket.c b/lsteamclient/winISteamAppTicket.c index 446380f9..4616983c 100644 --- a/lsteamclient/winISteamAppTicket.c +++ b/lsteamclient/winISteamAppTicket.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamApps.c b/lsteamclient/winISteamApps.c index 693afeca..aa91e34b 100644 --- a/lsteamclient/winISteamApps.c +++ b/lsteamclient/winISteamApps.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamClient.c b/lsteamclient/winISteamClient.c index fcd31e27..e9cb4bf4 100644 --- a/lsteamclient/winISteamClient.c +++ b/lsteamclient/winISteamClient.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamController.c b/lsteamclient/winISteamController.c index 8c7ec418..180bdc55 100644 --- a/lsteamclient/winISteamController.c +++ b/lsteamclient/winISteamController.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamFriends.c b/lsteamclient/winISteamFriends.c index c400e4bb..2dc8ce2e 100644 --- a/lsteamclient/winISteamFriends.c +++ b/lsteamclient/winISteamFriends.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamGameCoordinator.c b/lsteamclient/winISteamGameCoordinator.c index 78b33049..d1524a9c 100644 --- a/lsteamclient/winISteamGameCoordinator.c +++ b/lsteamclient/winISteamGameCoordinator.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamGameServer.c b/lsteamclient/winISteamGameServer.c index fccb2159..e747e846 100644 --- a/lsteamclient/winISteamGameServer.c +++ b/lsteamclient/winISteamGameServer.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamGameServerStats.c b/lsteamclient/winISteamGameServerStats.c index 27fde6d1..ee8bd1f3 100644 --- a/lsteamclient/winISteamGameServerStats.c +++ b/lsteamclient/winISteamGameServerStats.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamHTMLSurface.c b/lsteamclient/winISteamHTMLSurface.c index 485e7b98..baa7c1d4 100644 --- a/lsteamclient/winISteamHTMLSurface.c +++ b/lsteamclient/winISteamHTMLSurface.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamHTTP.c b/lsteamclient/winISteamHTTP.c index 2f54b7e0..3a95a7f5 100644 --- a/lsteamclient/winISteamHTTP.c +++ b/lsteamclient/winISteamHTTP.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamInventory.c b/lsteamclient/winISteamInventory.c index 2041a0e4..6c0dbc3c 100644 --- a/lsteamclient/winISteamInventory.c +++ b/lsteamclient/winISteamInventory.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamMasterServerUpdater.c b/lsteamclient/winISteamMasterServerUpdater.c index d0997d06..929c76a0 100644 --- a/lsteamclient/winISteamMasterServerUpdater.c +++ b/lsteamclient/winISteamMasterServerUpdater.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamMatchmaking.c b/lsteamclient/winISteamMatchmaking.c index f0ccdada..30f81437 100644 --- a/lsteamclient/winISteamMatchmaking.c +++ b/lsteamclient/winISteamMatchmaking.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamMatchmakingServers.c b/lsteamclient/winISteamMatchmakingServers.c index 9182c084..a5a63bbb 100644 --- a/lsteamclient/winISteamMatchmakingServers.c +++ b/lsteamclient/winISteamMatchmakingServers.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamMusic.c b/lsteamclient/winISteamMusic.c index 30e75e90..cdd04bd2 100644 --- a/lsteamclient/winISteamMusic.c +++ b/lsteamclient/winISteamMusic.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamMusicRemote.c b/lsteamclient/winISteamMusicRemote.c index 914b879d..5b47214d 100644 --- a/lsteamclient/winISteamMusicRemote.c +++ b/lsteamclient/winISteamMusicRemote.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamNetworking.c b/lsteamclient/winISteamNetworking.c index 1e1614e8..604e2c14 100644 --- a/lsteamclient/winISteamNetworking.c +++ b/lsteamclient/winISteamNetworking.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamParentalSettings.c b/lsteamclient/winISteamParentalSettings.c index 7bccedcd..e1df0102 100644 --- a/lsteamclient/winISteamParentalSettings.c +++ b/lsteamclient/winISteamParentalSettings.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamRemoteStorage.c b/lsteamclient/winISteamRemoteStorage.c index a9ab5135..148891a0 100644 --- a/lsteamclient/winISteamRemoteStorage.c +++ b/lsteamclient/winISteamRemoteStorage.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamScreenshots.c b/lsteamclient/winISteamScreenshots.c index 5320c476..75d4ebd0 100644 --- a/lsteamclient/winISteamScreenshots.c +++ b/lsteamclient/winISteamScreenshots.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamUGC.c b/lsteamclient/winISteamUGC.c index 06ddaf5f..4ad99a6d 100644 --- a/lsteamclient/winISteamUGC.c +++ b/lsteamclient/winISteamUGC.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamUnifiedMessages.c b/lsteamclient/winISteamUnifiedMessages.c index d8073167..759a7861 100644 --- a/lsteamclient/winISteamUnifiedMessages.c +++ b/lsteamclient/winISteamUnifiedMessages.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamUser.c b/lsteamclient/winISteamUser.c index ead3d883..03306715 100644 --- a/lsteamclient/winISteamUser.c +++ b/lsteamclient/winISteamUser.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamUserStats.c b/lsteamclient/winISteamUserStats.c index c9f5945f..1ebf3718 100644 --- a/lsteamclient/winISteamUserStats.c +++ b/lsteamclient/winISteamUserStats.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamUtils.c b/lsteamclient/winISteamUtils.c index 4eb2d747..bc0155ba 100644 --- a/lsteamclient/winISteamUtils.c +++ b/lsteamclient/winISteamUtils.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/lsteamclient/winISteamVideo.c b/lsteamclient/winISteamVideo.c index e424dd41..8c7eafdb 100644 --- a/lsteamclient/winISteamVideo.c +++ b/lsteamclient/winISteamVideo.c @@ -1,8 +1,4 @@ /* This file is auto-generated, do not edit. */ - -#include "config.h" -#include "wine/port.h" - #include #include "windef.h"