From e217e277c430c73ea7b6197f9cbffa038dc3168d Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Wed, 7 Feb 2018 13:48:25 -0600 Subject: [PATCH] Support building for Mac Patch by Aric --- build_proton.sh | 32 ++++++++++++++++++++++---------- lsteamclient/cxx.h | 17 +++++++++++++---- lsteamclient/steam_defs.h | 2 ++ vrclient_x64/cxx.h | 17 +++++++++++++---- 4 files changed, 50 insertions(+), 18 deletions(-) diff --git a/build_proton.sh b/build_proton.sh index f69c9661..cc7e83a6 100755 --- a/build_proton.sh +++ b/build_proton.sh @@ -7,14 +7,20 @@ set -e #./dist/ <-- proton build, ready to distribute TOP="$PWD" -RUNTIME_PATH="$TOP/../../runtime/steam-runtime-both/" -AMD64_WRAPPER="schroot --chroot steamrt_scout_beta_amd64 --" -I386_WRAPPER="schroot --chroot steamrt_scout_beta_i386 --" -DST_DIR="$TOP/build/dist" -TOOLS_DIR64="$TOP/build/tools.win64" -TOOLS_DIR32="$TOP/build/tools.win32" -STRIPFLAGS='-s' +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 + STRIP='strip' if [ "$1" == "--debug" ]; then #don't strip @@ -22,11 +28,15 @@ if [ "$1" == "--debug" ]; then STRIP='' fi +DST_DIR="$TOP/build/dist" +TOOLS_DIR64="$TOP/build/tools.win64" +TOOLS_DIR32="$TOP/build/tools.win32" + mkdir -p dist "$DST_DIR"/bin build/wine.win32 build/dist.win32 build/wine.win64 #build wine64 cd "$TOP"/build/wine.win64 -CC="ccache gcc" $AMD64_WRAPPER "$TOP"/wine/configure --enable-win64 --disable-tests --prefix="$DST_DIR" +CC="$CC" $AMD64_WRAPPER "$TOP"/wine/configure --enable-win64 --disable-tests --prefix="$DST_DIR" $AMD64_WRAPPER make -j5 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 @@ -35,7 +45,7 @@ rm -rf "$DST_DIR/share/man/" #build wine32 cd "$TOP"/build/wine.win32 -CC="ccache gcc" $I386_WRAPPER "$TOP"/wine/configure --disable-tests --prefix="$TOP/build/dist.win32/" +CC="$CC" $I386_WRAPPER "$TOP"/wine/configure --disable-tests --prefix="$TOP/build/dist.win32/" $I386_WRAPPER make -j5 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 @@ -45,7 +55,9 @@ INSTALL_PROGRAM_FLAGS="$STRIPFLAGS" $I386_WRAPPER make prefix="$TOOLS_DIR32" lib 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/ +if [ "$PLATFORM" != "Darwin" ]; then + cp -a bin/wine-preloader "$DST_DIR"/bin/ +fi cp -a bin/wineserver "$DST_DIR"/bin/wineserver32 #build 64-bit lsteamclient diff --git a/lsteamclient/cxx.h b/lsteamclient/cxx.h index 6307e7e3..67bc2c5b 100644 --- a/lsteamclient/cxx.h +++ b/lsteamclient/cxx.h @@ -19,13 +19,22 @@ /* 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 __APPLE__ +# define __ASM_NAME(name) "_" name +#else +# define __ASM_NAME(name) name +#endif #ifdef __i386__ /* thiscall functions are i386-specific */ +#ifdef __APPLE__ +# define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t.globl _" #name suffix "\n\t\n_" #name suffix ":\n\t.cfi_startproc\n\t" code "\n\t.cfi_endproc\n\t.previous"); +#else +# 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"); +#endif +#define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(name,"",code) +#define __ASM_STDCALL(args) "" + #define THISCALL(func) __thiscall_ ## func #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) #define __thiscall __stdcall diff --git a/lsteamclient/steam_defs.h b/lsteamclient/steam_defs.h index 9dc50bc0..45ebbb73 100644 --- a/lsteamclient/steam_defs.h +++ b/lsteamclient/steam_defs.h @@ -1,7 +1,9 @@ typedef int EHTMLMouseButton, EHTMLKeyModifiers; #ifndef __cplusplus +#ifndef bool typedef char bool; /* 1 byte on modern visual studio c++ */ +#endif typedef int EAccountType; typedef int EUniverse; diff --git a/vrclient_x64/cxx.h b/vrclient_x64/cxx.h index 6307e7e3..67bc2c5b 100644 --- a/vrclient_x64/cxx.h +++ b/vrclient_x64/cxx.h @@ -19,13 +19,22 @@ /* 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 __APPLE__ +# define __ASM_NAME(name) "_" name +#else +# define __ASM_NAME(name) name +#endif #ifdef __i386__ /* thiscall functions are i386-specific */ +#ifdef __APPLE__ +# define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t.globl _" #name suffix "\n\t\n_" #name suffix ":\n\t.cfi_startproc\n\t" code "\n\t.cfi_endproc\n\t.previous"); +#else +# 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"); +#endif +#define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(name,"",code) +#define __ASM_STDCALL(args) "" + #define THISCALL(func) __thiscall_ ## func #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) #define __thiscall __stdcall