diff --git a/.github/workflows/build-win-2.yml b/.github/workflows/build-win-2.yml index 61b157a4..85643072 100644 --- a/.github/workflows/build-win-2.yml +++ b/.github/workflows/build-win-2.yml @@ -1,27 +1,37 @@ name: Emu build 2 (Windows) on: - push: - branches: [ - "ci-build-emu-win*", - "ci-build-all" - ] - tags: - - release* + workflow_call: + inputs: + emu-variant: + description: | + Which variant of the emu to build: + regular: build the regular version of the emu + exp: build the experimental version of the emu + client: build the experimental steamclient version of the emu + tools: build the tools only + all: build all variants + default: 'all' + required: false + type: string + + x32: + description: | + build architecture, unused when 'emu-variant' == 'all' or 'emu-variant' == 'tools' + true: x32 + false: x64 + default: false + required: false + type: boolean - pull_request: - branches: [ "dev" ] - paths-ignore: - - '**/*.md' - - 'dev.notes/**' - - 'post_build/**' - - 'z_original_repo_files/**' - - 'sdk/*.txt' - - 'LICENSE' - # tools - - 'tools/generate_emu_config/**' - - 'tools/migrate_gse/**' - - 'tools/steamclient_loader/linux/**' + debug: + description: | + build mode, unused when 'emu-variant' == 'all' + true: build in debug mode + false: build in release mode + default: false + required: false + type: boolean workflow_dispatch: # allows manual trigger @@ -37,8 +47,8 @@ env: THIRD_PARTY_BASE_DIR: 'third-party' jobs: - # this helps in manual runs, if build fails, then deps are saved dependencies: + name: Restore or build deps if: ${{ !cancelled() }} uses: ./.github/workflows/deps-win.yml @@ -48,7 +58,46 @@ jobs: needs: [ dependencies ] if: ${{ !cancelled() }} steps: - # on Windows Git will auto change line ending to CRLF, not preferable +### setup build vars + - name: Setup build vars + shell: cmd + run: | + echo env file = "${{ GITHUB_ENV }}" + + if /i "${{ inputs.debug }}"=="true" ( + set "build_switches=%build_switches% debug" + >>"${{ GITHUB_ENV }}" echo build_mode=debug + ) else ( + >>"${{ GITHUB_ENV }}" echo build_mode=release + ) + + set "arch=" + if /i "${{ inputs.x32 }}"=="true" ( + set "arch=32" + ) else ( + set "arch=64" + ) + + set "build_switches=" + if "${{ inputs.emu-variant }}"=="regular" ( + set "build_switches=+lib-%arch%" + ) else if "${{ inputs.emu-variant }}"=="exp" ( + set "build_switches=+ex-lib-%arch% +ex-client-%arch%" + ) else if "${{ inputs.emu-variant }}"=="client" ( + set "build_switches=+exclient-%arch% +exclient-ldr-%arch% +exclient-extra-%arch% +lib-gameoverlay-%arch%" + ) else if "${{ inputs.emu-variant }}"=="tools" ( + set "build_switches=+tool-itf +tool-lobby" + ) else if "${{ inputs.emu-variant }}"=="all" ( + set "build_switches=+lib-32 +lib-64 +ex-lib-32 +ex-lib-64 +ex-client-32 +ex-client-64 +exclient-32 +exclient-64 +exclient-ldr-32 +exclient-ldr-64 +tool-itf +tool-lobby +exclient-extra-32 +exclient-extra-64 +lib-gameoverlay-32 +lib-gameoverlay-64" + ) else ( + 1>&2 echo [X] invalid emu variant "${{ inputs.emu-variant }}" + exit /b 1 + ) + + echo final build switches %build_switches% + >>"${{ GITHUB_ENV }}" echo build_switches=%build_switches% + +### on Windows Git will auto change line ending to CRLF, not preferable - name: Ensure LF line ending shell: cmd working-directory: ${{ github.workspace }} @@ -61,7 +110,7 @@ jobs: uses: actions/checkout@v4 ### deps - - name: Lookup cache for deps + - name: Restore deps id: emu-deps-cache-step uses: actions/cache@v4 with: @@ -87,54 +136,44 @@ jobs: ref: 'third-party/build/win' path: "${{env.THIRD_PARTY_BASE_DIR}}/build/win" -### build (release mode) - - name: Build release mode +### build target(s) + - name: Build target(s) + if: inputs.emu-variant != 'all' shell: cmd working-directory: ${{ github.workspace }} - run: build_win.bat -verbose release +build_str ${{ github.sha }} +exclient-extra-32 +exclient-extra-64 +lib-gameoverlay-32 +lib-gameoverlay-64 + run: build_win.bat -verbose ${{ env.build_mode }} clean +build_str ${{ github.sha }} ${{ env.build_switches }} -### package (release mode) - - name: Package build (release) +### build all + - name: Build all + if: inputs.emu-variant == 'all' shell: cmd working-directory: ${{ github.workspace }} - run: package_win.bat release + run: | + build_win.bat -verbose release clean +build_str ${{ github.sha }} ${{ env.build_switches }} || exit /b %errorlevel% + build_win.bat -verbose debug clean +build_str ${{ github.sha }} ${{ env.build_switches }} || exit /b %errorlevel% + +### package target(s) + - name: Package target(s) + if: inputs.emu-variant != 'all' + shell: cmd + working-directory: ${{ github.workspace }} + run: package_win.bat ${{ env.build_mode }} + +### package all + - name: Package all + if: inputs.emu-variant == 'all' + shell: cmd + working-directory: ${{ github.workspace }} + run: | + package_win.bat release || exit /b %errorlevel% + package_win.bat debug || exit /b %errorlevel% ### upload artifact/package to github Actions (release mode) - - name: Upload build package (release) + - name: Upload build package uses: actions/upload-artifact@v4 with: name: "build-win-release-${{ github.sha }}" - path: "${{ env.PACKAGE_BASE_DIR }}/release/" + path: "${{ env.PACKAGE_BASE_DIR }}/" if-no-files-found: 'error' compression-level: 9 retention-days: 1 - -### build (debug mode) - - name: Build debug mode - shell: cmd - working-directory: ${{ github.workspace }} - run: build_win.bat -verbose debug +build_str ${{ github.sha }} +exclient-extra-32 +exclient-extra-64 +lib-gameoverlay-32 +lib-gameoverlay-64 - -### package (debug mode) - - name: Package build (debug) - shell: cmd - working-directory: ${{ github.workspace }} - run: package_win.bat debug - -### upload artifact/package to github Actions (debug mode) - - name: Upload build package (debug) - uses: actions/upload-artifact@v4 - with: - name: "build-win-debug-${{ github.sha }}" - path: "${{ env.PACKAGE_BASE_DIR }}/debug/" - if-no-files-found: 'error' - compression-level: 9 - retention-days: 1 - -### release (debug + release modes) if this is a tag push - - name: Release - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - with: - files: "${{ env.PACKAGE_BASE_DIR }}/**/*" - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c435e9ac..d1aa5b9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ * for Windows ColdClientLoader: allow loading `.ini` file with the same name as the loader ex: if the loader is named `game_cold_loader.exe`, then it will first try to load `game_cold_loader.ini`, if that doesn't exist, it will fallback to `ColdClientLoader.ini` +* make all build switches opt-in --- diff --git a/README.md b/README.md index 0ce7d09e..6d2e6b59 100644 --- a/README.md +++ b/README.md @@ -153,25 +153,25 @@ Arguments you can pass to this script: >>>>>>>>> ___ -* `-lib-32`: prevent building normal `steam_api.dll` -* `-lib-64`: prevent building normal `steam_api64.dll` +* `+lib-32`: build normal `steam_api.dll` +* `+lib-64`: build normal `steam_api64.dll` >>>>>>>>> ___ -* `-ex-lib-32`: prevent building experimental `steam_api.dll` -* `-ex-lib-64`: prevent building experimental `steam_api64.dll` +* `+ex-lib-32`: build experimental `steam_api.dll` +* `+ex-lib-64`: build experimental `steam_api64.dll` >>>>>>>>> ___ -* `-ex-client-32`: prevent building experimental `steamclient.dll` -* `-ex-client-64`: prevent building experimental `steamclient64.dll` +* `+ex-client-32`: build experimental `steamclient.dll` +* `+ex-client-64`: build experimental `steamclient64.dll` >>>>>>>>> ___ -* `-exclient-32`: prevent building steamclient `steamclient.dll` -* `-exclient-64`: prevent building steamclient `steamclient64.dll` -* `-exclient-ldr-32`: prevent building steamclient loader (32) `steamclient_loader_32.exe` -* `-exclient-ldr-64`: prevent building steamclient loader (64) `steamclient_loader_64.exe` +* `+exclient-32`: build steamclient `steamclient.dll` +* `+exclient-64`: build steamclient `steamclient64.dll` +* `+exclient-ldr-32`: build steamclient loader (32) `steamclient_loader_32.exe` +* `+exclient-ldr-64`: build steamclient loader (64) `steamclient_loader_64.exe` >>>>>>>>> ___ @@ -180,8 +180,8 @@ Arguments you can pass to this script: >>>>>>>>> ___ -* `-tool-itf` prevent building the tool `find_interfaces` -* `-tool-lobby`: prevent building the tool `lobby_connect` +* `+tool-itf` build the tool `find_interfaces` +* `+tool-lobby`: build the tool `lobby_connect` >>>>>>>>> ___ @@ -218,31 +218,31 @@ Arguments you can pass to this script: >>>>>>>>> ___ -* `-lib-32`: prevent building normal 32-bit `libsteam_api.so` -* `-lib-64`: prevent building normal 64-bit `libsteam_api.so` +* `+lib-32`: build normal 32-bit `libsteam_api.so` +* `+lib-64`: build normal 64-bit `libsteam_api.so` >>>>>>>>> ___ -* `-exp-lib-32`: prevent building experimental 32-bit `libsteam_api.so` -* `-exp-lib-64`: prevent building experimental 64-bit `libsteam_api.so` -* `-exp-client-32`: prevent building experimental steam client 64-bit `steamclient.so` -* `-exp-client-64`: prevent building experimental steam client 64-bit `steamclient.so` +* `+exp-lib-32`: build experimental 32-bit `libsteam_api.so` +* `+exp-lib-64`: build experimental 64-bit `libsteam_api.so` +* `+exp-client-32`: build experimental steam client 64-bit `steamclient.so` +* `+exp-client-64`: build experimental steam client 64-bit `steamclient.so` >>>>>>>>> ___ -* `-client-32`: prevent building steam client 32-bit `steamclient.so` -* `-client-64`: prevent building steam client 64-bit `steamclient.so` +* `+client-32`: build steam client 32-bit `steamclient.so` +* `+client-64`: build steam client 64-bit `steamclient.so` >>>>>>>>> ___ -* `-tool-clientldr`: prevent copying the tool `steamclient_loader` +* `+tool-clientldr`: copy the tool `steamclient_loader` >>>>>>>>> ___ -* `-tool-itf-32`: prevent building the tool 32-bit `find_interfaces` -* `-tool-itf-64`: prevent building the tool 64-bit `find_interfaces` -* `-tool-lobby-32`: prevent building the tool 32-bit `lobby_connect` -* `-tool-lobby-64`: prevent building the tool 64-bit `lobby_connect` +* `+tool-itf-32`: build the tool 32-bit `find_interfaces` +* `+tool-itf-64`: build the tool 64-bit `find_interfaces` +* `+tool-lobby-32`: build the tool 32-bit `lobby_connect` +* `+tool-lobby-64`: build the tool 64-bit `lobby_connect` >>>>>>>>> ___ diff --git a/build_linux.sh b/build_linux.sh index 362b0ece..edd22d48 100644 --- a/build_linux.sh +++ b/build_linux.sh @@ -15,21 +15,21 @@ for emu_file in "${required_files[@]}"; do fi done -BUILD_LIB32=1 -BUILD_LIB64=1 -BUILD_EXP_LIB32=1 -BUILD_EXP_LIB64=1 +BUILD_LIB32=0 +BUILD_LIB64=0 +BUILD_EXP_LIB32=0 +BUILD_EXP_LIB64=0 -BUILD_CLIENT32=1 -BUILD_CLIENT64=1 -BUILD_EXPT_CLIENT32=1 -BUILD_EXPT_CLIENT64=1 -BUILD_TOOL_CLIENT_LDR=1 +BUILD_CLIENT32=0 +BUILD_CLIENT64=0 +BUILD_EXPT_CLIENT32=0 +BUILD_EXPT_CLIENT64=0 +BUILD_TOOL_CLIENT_LDR=0 -BUILD_TOOL_FIND_ITFS32=1 -BUILD_TOOL_FIND_ITFS64=1 -BUILD_TOOL_LOBBY32=1 -BUILD_TOOL_LOBBY64=1 +BUILD_TOOL_FIND_ITFS32=0 +BUILD_TOOL_FIND_ITFS64=0 +BUILD_TOOL_LOBBY32=0 +BUILD_TOOL_LOBBY64=0 BUILD_LIB_NET_SOCKETS_32=0 BUILD_LIB_NET_SOCKETS_64=0 @@ -63,32 +63,32 @@ for (( i=1; i<=$#; i++ )); do echo "[X] Expected a build string" >&2; exit 1; } - elif [[ "$var" = "-lib-32" ]]; then - BUILD_LIB32=0 - elif [[ "$var" = "-lib-64" ]]; then - BUILD_LIB64=0 - elif [[ "$var" = "-exp-lib-32" ]]; then - BUILD_EXP_LIB32=0 - elif [[ "$var" = "-exp-lib-64" ]]; then - BUILD_EXP_LIB64=0 - elif [[ "$var" = "-client-32" ]]; then - BUILD_CLIENT32=0 - elif [[ "$var" = "-client-64" ]]; then - BUILD_CLIENT64=0 - elif [[ "$var" = "-exp-client-32" ]]; then - BUILD_EXPT_CLIENT32=0 - elif [[ "$var" = "-exp-client-64" ]]; then - BUILD_EXPT_CLIENT64=0 - elif [[ "$var" = "-tool-clientldr" ]]; then - BUILD_TOOL_CLIENT_LDR=0 - elif [[ "$var" = "-tool-itf-32" ]]; then - BUILD_TOOL_FIND_ITFS32=0 - elif [[ "$var" = "-tool-itf-64" ]]; then - BUILD_TOOL_FIND_ITFS64=0 - elif [[ "$var" = "-tool-lobby-32" ]]; then - BUILD_TOOL_LOBBY32=0 - elif [[ "$var" = "-tool-lobby-64" ]]; then - BUILD_TOOL_LOBBY64=0 + elif [[ "$var" = "+lib-32" ]]; then + BUILD_LIB32=1 + elif [[ "$var" = "+lib-64" ]]; then + BUILD_LIB64=1 + elif [[ "$var" = "+exp-lib-32" ]]; then + BUILD_EXP_LIB32=1 + elif [[ "$var" = "+exp-lib-64" ]]; then + BUILD_EXP_LIB64=1 + elif [[ "$var" = "+client-32" ]]; then + BUILD_CLIENT32=1 + elif [[ "$var" = "+client-64" ]]; then + BUILD_CLIENT64=1 + elif [[ "$var" = "+exp-client-32" ]]; then + BUILD_EXPT_CLIENT32=1 + elif [[ "$var" = "+exp-client-64" ]]; then + BUILD_EXPT_CLIENT64=1 + elif [[ "$var" = "+tool-clientldr" ]]; then + BUILD_TOOL_CLIENT_LDR=1 + elif [[ "$var" = "+tool-itf-32" ]]; then + BUILD_TOOL_FIND_ITFS32=1 + elif [[ "$var" = "+tool-itf-64" ]]; then + BUILD_TOOL_FIND_ITFS64=1 + elif [[ "$var" = "+tool-lobby-32" ]]; then + BUILD_TOOL_LOBBY32=1 + elif [[ "$var" = "vtool-lobby-64" ]]; then + BUILD_TOOL_LOBBY64=1 elif [[ "$var" = "+lib-netsockets-32" ]]; then BUILD_LIB_NET_SOCKETS_32=1 elif [[ "$var" = "+lib-netsockets-64" ]]; then diff --git a/build_win.bat b/build_win.bat index d7992eea..acfd7229 100644 --- a/build_win.bat +++ b/build_win.bat @@ -17,24 +17,24 @@ for %%A in ( ) ) -set /a BUILD_LIB32=1 -set /a BUILD_LIB64=1 +set /a BUILD_LIB32=0 +set /a BUILD_LIB64=0 -set /a BUILD_EXP_LIB32=1 -set /a BUILD_EXP_LIB64=1 -set /a BUILD_EXP_CLIENT32=1 -set /a BUILD_EXP_CLIENT64=1 +set /a BUILD_EXP_LIB32=0 +set /a BUILD_EXP_LIB64=0 +set /a BUILD_EXP_CLIENT32=0 +set /a BUILD_EXP_CLIENT64=0 -set /a BUILD_EXPCLIENT32=1 -set /a BUILD_EXPCLIENT64=1 -set /a BUILD_EXPCLIENT_LDR_32=1 -set /a BUILD_EXPCLIENT_LDR_64=1 +set /a BUILD_EXPCLIENT32=0 +set /a BUILD_EXPCLIENT64=0 +set /a BUILD_EXPCLIENT_LDR_32=0 +set /a BUILD_EXPCLIENT_LDR_64=0 set /a BUILD_EXPCLIENT_EXTRA_32=0 set /a BUILD_EXPCLIENT_EXTRA_64=0 -set /a BUILD_TOOL_FIND_ITFS=1 -set /a BUILD_TOOL_LOBBY=1 +set /a BUILD_TOOL_FIND_ITFS=0 +set /a BUILD_TOOL_LOBBY=0 set /a BUILD_LIB_NET_SOCKETS_32=0 set /a BUILD_LIB_NET_SOCKETS_64=0 @@ -58,34 +58,34 @@ set /a VERBOSE=0 :args_loop if "%~1"=="" ( goto :args_loop_end - ) else if "%~1"=="-lib-32" ( - set /a BUILD_LIB32=0 - ) else if "%~1"=="-lib-64" ( - set /a BUILD_LIB64=0 - ) else if "%~1"=="-ex-lib-32" ( - set /a BUILD_EXP_LIB32=0 - ) else if "%~1"=="-ex-lib-64" ( - set /a BUILD_EXP_LIB64=0 - ) else if "%~1"=="-ex-client-32" ( - set /a BUILD_EXP_CLIENT32=0 - ) else if "%~1"=="-ex-client-64" ( - set /a BUILD_EXP_CLIENT64=0 - ) else if "%~1"=="-exclient-32" ( - set /a BUILD_EXPCLIENT32=0 - ) else if "%~1"=="-exclient-64" ( - set /a BUILD_EXPCLIENT64=0 - ) else if "%~1"=="-exclient-ldr-32" ( - set /a BUILD_EXPCLIENT_LDR_32=0 - ) else if "%~1"=="-exclient-ldr-64" ( - set /a BUILD_EXPCLIENT_LDR_64=0 + ) else if "%~1"=="+lib-32" ( + set /a BUILD_LIB32=1 + ) else if "%~1"=="+lib-64" ( + set /a BUILD_LIB64=1 + ) else if "%~1"=="+ex-lib-32" ( + set /a BUILD_EXP_LIB32=1 + ) else if "%~1"=="+ex-lib-64" ( + set /a BUILD_EXP_LIB64=1 + ) else if "%~1"=="+ex-client-32" ( + set /a BUILD_EXP_CLIENT32=1 + ) else if "%~1"=="+ex-client-64" ( + set /a BUILD_EXP_CLIENT64=1 + ) else if "%~1"=="+exclient-32" ( + set /a BUILD_EXPCLIENT32=1 + ) else if "%~1"=="+exclient-64" ( + set /a BUILD_EXPCLIENT64=1 + ) else if "%~1"=="+exclient-ldr-32" ( + set /a BUILD_EXPCLIENT_LDR_32=1 + ) else if "%~1"=="+exclient-ldr-64" ( + set /a BUILD_EXPCLIENT_LDR_64=1 ) else if "%~1"=="+exclient-extra-32" ( set /a BUILD_EXPCLIENT_EXTRA_32=1 ) else if "%~1"=="+exclient-extra-64" ( set /a BUILD_EXPCLIENT_EXTRA_64=1 - ) else if "%~1"=="-tool-itf" ( - set /a BUILD_TOOL_FIND_ITFS=0 - ) else if "%~1"=="-tool-lobby" ( - set /a BUILD_TOOL_LOBBY=0 + ) else if "%~1"=="+tool-itf" ( + set /a BUILD_TOOL_FIND_ITFS=1 + ) else if "%~1"=="+tool-lobby" ( + set /a BUILD_TOOL_LOBBY=1 ) else if "%~1"=="+lib-netsockets-32" ( set /a BUILD_LIB_NET_SOCKETS_32=1 ) else if "%~1"=="+lib-netsockets-64" (