diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8e6284a47..6da0186250 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,7 @@ jobs: env: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} + STEAMRT_SNAPSHOT: latest-steam-client-general-availability steps: - name: Checkout uses: actions/checkout@v4 @@ -38,10 +39,10 @@ jobs: uses: actions/cache@v4 with: path: com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz - key: ${{ runner.os }}-steam-runtime + key: steam-runtime-${{ env.STEAMRT_SNAPSHOT }} - name: Download steam-runtime if: startsWith(matrix.os, 'ubuntu') && steps.cache-steam-runtime.outputs.cache-hit != 'true' - run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/0.20210610.0/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz + run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/${{ env.STEAMRT_SNAPSHOT }}/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz - name: Install steam runtime if: startsWith(matrix.os, 'ubuntu') run: | @@ -52,14 +53,15 @@ jobs: - name: Build on Linux if: startsWith(matrix.os, 'ubuntu') run: | - schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist" + schroot --chroot steamrt_scout_i386 -- cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist" schroot --chroot steamrt_scout_i386 -- cmake --build build --target all schroot --chroot steamrt_scout_i386 -- cmake --build build --target install - name: Build on Linux with vgui if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cc, 'gcc') run: | - schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build-vgui -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui" + schroot --chroot steamrt_scout_i386 -- cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build-vgui -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui" cp vgui_support/vgui-dev/lib/vgui.so build-vgui/cl_dll + cp vgui_support/vgui-dev/lib/vgui.so build-vgui schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target all schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target install diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index f34153b11c..270da87505 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -15,6 +15,10 @@ on: options: - 'OFF' - 'ON' + steamrt_snapshot: + type: string + description: SteamRT Snapshot + default: 'latest-steam-client-general-availability' jobs: build: runs-on: ${{ matrix.os }} @@ -48,10 +52,10 @@ jobs: uses: actions/cache@v4 with: path: com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz - key: ${{ runner.os }}-steam-runtime + key: steam-runtime-${{ github.event.inputs.steamrt_snapshot }} - name: Download steam-runtime if: startsWith(matrix.os, 'ubuntu') && steps.cache-steam-runtime.outputs.cache-hit != 'true' - run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/0.20210610.0/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz + run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/${{ github.event.inputs.steamrt_snapshot }}/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz - name: Install steam runtime if: startsWith(matrix.os, 'ubuntu') run: | @@ -64,10 +68,11 @@ jobs: run: | mkdir -p build/cl_dll cp vgui_support/vgui-dev/lib/vgui.so build/cl_dll + cp vgui_support/vgui-dev/lib/vgui.so build - name: Build on Linux if: startsWith(matrix.os, 'ubuntu') run: | - schroot --chroot steamrt_scout_i386 -- cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_BUILD_TYPE=${{ github.event.inputs.buildtype }} -DCMAKE_INSTALL_PREFIX="$PWD/dist" -DUSE_VGUI=${{ github.event.inputs.usevgui }} + schroot --chroot steamrt_scout_i386 -- cmake -GNinja -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_BUILD_TYPE=${{ github.event.inputs.buildtype }} -DCMAKE_INSTALL_PREFIX="$PWD/dist" -DUSE_VGUI=${{ github.event.inputs.usevgui }} schroot --chroot steamrt_scout_i386 -- cmake --build build --target all schroot --chroot steamrt_scout_i386 -- cmake --build build --target install diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 46d22efc16..c28315fbde 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -233,6 +233,8 @@ install( TARGETS ${CLDLL_LIBRARY} GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) -add_custom_command(TARGET ${CLDLL_LIBRARY} +if(CMAKE_BUILD_TYPE MATCHES "Release") + add_custom_command(TARGET ${CLDLL_LIBRARY} POST_BUILD DEPENDS ${CLDLL_LIBRARY} - COMMAND $<$:${CMAKE_STRIP}> -s $) + COMMAND ${CMAKE_STRIP} -s $) +endif() diff --git a/cl_dll/hud_spectator.cpp b/cl_dll/hud_spectator.cpp index 0e9d440f80..21d0235f16 100644 --- a/cl_dll/hud_spectator.cpp +++ b/cl_dll/hud_spectator.cpp @@ -727,9 +727,9 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf ) v1[1] = READ_COORD(); v1[2] = READ_COORD(); // vJumpOrigin - v1[0] = READ_COORD(); // view angle - v1[1] = READ_COORD(); // vJumpAngles - v1[2] = READ_COORD(); + v2[0] = READ_COORD(); // view angle + v2[1] = READ_COORD(); // vJumpAngles + v2[2] = READ_COORD(); f1 = READ_BYTE(); // fov i1 = READ_WORD(); // target diff --git a/cl_dll/wscript b/cl_dll/wscript index 386a245255..5fe9266777 100644 --- a/cl_dll/wscript +++ b/cl_dll/wscript @@ -20,6 +20,7 @@ def options(opt): opt.load('vgui') def configure(conf): + conf.options.VGUI_DEV = os.path.join('vgui_support', 'vgui-dev') # vgui is in submodule conf.env.USE_VGUI = conf.options.USE_VGUI conf.env.USE_NOVGUI_MOTD = conf.options.USE_NOVGUI_MOTD conf.env.USE_NOVGUI_SCOREBOARD = conf.options.USE_NOVGUI_SCOREBOARD diff --git a/cmake/LibraryNaming.cmake b/cmake/LibraryNaming.cmake index d71919fa2c..5f2634363b 100644 --- a/cmake/LibraryNaming.cmake +++ b/cmake/LibraryNaming.cmake @@ -54,6 +54,8 @@ check_group_build_target(XASH_SERENITY XASH_PLATFORM) check_group_build_target(XASH_IRIX XASH_PLATFORM) check_group_build_target(XASH_NSWITCH XASH_PLATFORM) check_group_build_target(XASH_PSVITA XASH_PLATFORM) +check_group_build_target(XASH_WASI XASH_PLATFORM) +check_group_build_target(XASH_SUNOS XASH_PLATFORM) check_group_build_target(XASH_X86 XASH_ARCHITECTURE) check_group_build_target(XASH_AMD64 XASH_ARCHITECTURE) check_group_build_target(XASH_ARM XASH_ARCHITECTURE) @@ -105,6 +107,10 @@ elseif(XASH_PSVITA) set(BUILDOS "psvita") elseif(XASH_IRIX) set(BUILDOS "irix") +elseif(XASH_WASI) + set(BUILDOS "wasi") +elseif(XASH_SUNOS) + set(BUILDOS "sunos") else() message(SEND_ERROR "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug") endif() diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index cdfe02bda0..e4f63e7877 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -194,6 +194,8 @@ install( TARGETS ${SVDLL_LIBRARY} GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -add_custom_command(TARGET ${SVDLL_LIBRARY} +if(CMAKE_BUILD_TYPE MATCHES "Release") + add_custom_command(TARGET ${SVDLL_LIBRARY} POST_BUILD DEPENDS ${SVDLL_LIBRARY} - COMMAND $<$:${CMAKE_STRIP}> -s $) + COMMAND ${CMAKE_STRIP} -s $) +endif() diff --git a/dlls/game.cpp b/dlls/game.cpp index 1780d60a0c..22b69d3c83 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -19,7 +19,7 @@ #include "vcs_info.h" static cvar_t build_commit = { "sv_game_build_commit", g_VCSInfo_Commit }; -static cvar_t build_branch = { "sv_game_build_branch", g_VCSInfo_Commit }; +static cvar_t build_branch = { "sv_game_build_branch", g_VCSInfo_Branch }; cvar_t displaysoundlist = {"displaysoundlist","0"}; diff --git a/public/build.h b/public/build.h index 851939b557..24fd9d5bbf 100644 --- a/public/build.h +++ b/public/build.h @@ -81,10 +81,13 @@ Then you can use another oneliner to query all variables: #undef XASH_RISCV_SINGLEFP #undef XASH_RISCV_SOFTFP #undef XASH_SERENITY +#undef XASH_SUNOS #undef XASH_WIN32 #undef XASH_X86 #undef XASH_NSWITCH #undef XASH_PSVITA +#undef XASH_WASI +#undef XASH_WASM //================================================================ // @@ -126,6 +129,10 @@ Then you can use another oneliner to query all variables: #define XASH_NSWITCH 1 #elif defined __vita__ #define XASH_PSVITA 1 + #elif defined __wasi__ + #define XASH_WASI 1 + #elif defined __sun__ + #define XASH_SUNOS 1 #else #error #endif @@ -234,10 +241,19 @@ Then you can use another oneliner to query all variables: #else #error "Unknown RISC-V float ABI" #endif +#elif defined __wasm__ + #if defined __wasm64__ + #define XASH_64BIT 1 + #endif + #define XASH_WASM 1 #else #error "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug" #endif +#if !XASH_64BIT && ( defined( __LP64__ ) || defined( _LP64 )) +#define XASH_64BIT 1 +#endif + #if XASH_ARM == 8 #define XASH_ARMv8 1 #elif XASH_ARM == 7 diff --git a/scripts/waifulib/library_naming.py b/scripts/waifulib/library_naming.py index ac2faf6f9f..dc5f13ee1d 100644 --- a/scripts/waifulib/library_naming.py +++ b/scripts/waifulib/library_naming.py @@ -60,6 +60,8 @@ 'XASH_X86', 'XASH_NSWITCH', 'XASH_PSVITA', +'XASH_WASI', +'XASH_SUNOS', ] def configure(conf): @@ -75,8 +77,12 @@ def configure(conf): # engine/common/build.c if conf.env.XASH_ANDROID: buildos = "android" - elif conf.env.XASH_WIN32 or conf.env.XASH_LINUX or conf.env.XASH_APPLE: - buildos = "" # no prefix for default OS + elif conf.env.XASH_WIN32: + buildos = "win32" + elif conf.env.XASH_LINUX: + buildos = "linux" + elif conf.env.XASH_APPLE: + buildos = "apple" elif conf.env.XASH_FREEBSD: buildos = "freebsd" elif conf.env.XASH_NETBSD: @@ -97,6 +103,10 @@ def configure(conf): buildos = "psvita" elif conf.env.XASH_IRIX: buildos = "irix" + elif conf.env.XASH_WASI: + buildos = "wasi" + elif conf.env.XASH_SUNOS: + buildos = "sunos" else: conf.fatal("Place your operating system name in build.h and library_naming.py!\n" "If this is a mistake, try to fix conditions above and report a bug") @@ -104,10 +114,7 @@ def configure(conf): if conf.env.XASH_AMD64: buildarch = "amd64" elif conf.env.XASH_X86: - if conf.env.XASH_WIN32 or conf.env.XASH_LINUX or conf.env.XASH_APPLE: - buildarch = "" - else: - buildarch = "i386" + buildarch = "i386" elif conf.env.XASH_ARM and conf.env.XASH_64BIT: buildarch = "arm64" elif conf.env.XASH_ARM: @@ -160,6 +167,14 @@ def configure(conf): raise conf.fatal("Place your architecture name in build.h and library_naming.py!\n" "If this is a mistake, try to fix conditions above and report a bug") + node = conf.bldnode.make_node('true_postfix.txt') + node.write('%s-%s' % (buildos, buildarch)) + + if not conf.env.XASH_ANDROID and (conf.env.XASH_WIN32 or conf.env.XASH_LINUX or conf.env.XASH_APPLE): + buildos = '' + if conf.env.XASH_X86: + buildarch = '' + conf.env.revert() if buildos == 'android': diff --git a/wscript b/wscript index be199f58c5..3d1d4279a9 100644 --- a/wscript +++ b/wscript @@ -48,7 +48,7 @@ def configure(conf): conf.env.MSVC_SUBSYSTEM = 'WINDOWS' # Load compilers early - conf.load('xcompile compiler_c compiler_cxx') + conf.load('xcompile compiler_c compiler_cxx gccdeps') # HACKHACK: override msvc DEST_CPU value by something that we understand if conf.env.DEST_CPU == 'amd64': @@ -63,8 +63,7 @@ def configure(conf): if conf.env.GIT_BRANCH: conf.define('XASH_BUILD_BRANCH', conf.env.GIT_BRANCH) - enforce_pic = True # modern defaults - conf.check_pic(enforce_pic) + conf.check_pic(True) # modern defaults # We restrict 64-bit builds ONLY for Win/Linux/OSX running on Intel architecture # Because compatibility with original GoldSrc