Skip to content

Commit 706e848

Browse files
authored
Merge pull request #14 from ReplayCoding/port/linux
Package linux builds
2 parents f98b280 + 23d5673 commit 706e848

File tree

9 files changed

+109
-24
lines changed

9 files changed

+109
-24
lines changed

.github/workflows/build_linux.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build - Linux
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@v4
11+
- name: Setup ccache
12+
id: setup-ccache
13+
uses: actions/cache@v4
14+
with:
15+
path: ${{ github.workspace }}/.ccache
16+
key: ${{ runner.os }}-ccache
17+
- name: Build dist
18+
env:
19+
CCACHE_DIR: ${{ github.workspace }}/.ccache
20+
run: |
21+
mkdir -p $CCACHE_DIR
22+
./src/buildallprojects
23+
./game_clean/copy.sh
24+
- name: Archive production artifacts
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: game
28+
path: |
29+
game_dist
30+
- name: Archive debug info
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: game-debug-info
34+
path: |
35+
game_dist_debug

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ ipch
2323
# OSX/Linux build products
2424
*.mak
2525
*.mak.vpc_crc
26+
.ninja_deps
27+
.ninja_log
28+
compile_commands.json
2629
*.xcodeproj/
2730
obj*/
2831
!devtools/*.mak
@@ -48,6 +51,12 @@ client.dylib.dSYM/
4851
server.dylib
4952
server.dylib.dSYM/
5053

54+
# Stupid build system puts these alongside commited build artifacts (WHY)
55+
src/lib/public/linux64/mathlib.a
56+
src/lib/public/linux64/raytrace.a
57+
src/lib/public/linux64/tier1.a
58+
src/lib/public/linux64/vgui_controls.a
59+
5160
# files generated by running a mod
5261
config.cfg
5362

@@ -505,8 +514,10 @@ FodyWeavers.xsd
505514

506515
# TC2 MOD
507516
mod_hl2mp_win64.exe
517+
mod_hl2mp_linux64
508518
mod_tf_win64.exe
509519
tc2_win64.exe
520+
tc2_linux64
510521

511522
game/platform/config
512523

game_clean/.itch.linux.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[[actions]]
2+
name = "play"
3+
path = "tc2.sh"
4+
platform = "linux"
5+
args = ["-noborder", "-particles", "1", "-precachefontchars"]

game_clean/copy.sh

100644100755
Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,10 @@ rm -rf ${CLEAN_DEBUG_DIR}
1313
mkdir -p ${CLEAN_DIR}/{bin/$PLAT_DIR,tc2/bin/$PLAT_DIR,tc2/materials,tc2/cfg,tc2/scripts}
1414
mkdir -p ${CLEAN_DEBUG_DIR}/{bin/$PLAT_DIR,tc2/bin/$PLAT_DIR}
1515

16-
declare -a EXES=(
17-
tc2_win64
18-
bin/$PLAT_DIR/captioncompiler
19-
bin/$PLAT_DIR/glview
20-
bin/$PLAT_DIR/height2normal
21-
bin/$PLAT_DIR/motionmapper
22-
bin/$PLAT_DIR/qc_eyes
23-
bin/$PLAT_DIR/tgadiff
24-
bin/$PLAT_DIR/vbsp
25-
bin/$PLAT_DIR/vice
26-
bin/$PLAT_DIR/vrad
27-
bin/$PLAT_DIR/vtf2tga
28-
bin/$PLAT_DIR/vtfdiff
29-
bin/$PLAT_DIR/vvis
30-
)
31-
3216
declare -a DLLS=(
33-
bin/$PLAT_DIR/vrad_dll
34-
bin/$PLAT_DIR/vvis_dll
3517
tc2/bin/$PLAT_DIR/{client,server}
3618
)
3719

38-
declare -a DLLS_LIB=(
39-
bin/$PLAT_DIR/steam_api64
40-
)
41-
4220
declare -a FILES_REP=(
4321
tc2/cfg/valve.rc
4422
tc2/cfg/default.cfg
@@ -60,14 +38,61 @@ declare -a FILES=(
6038
../LICENSE
6139
)
6240

41+
if [ $PLATFORM = "win" ]; then
42+
declare -a EXES=(
43+
tc2_win64
44+
bin/$PLAT_DIR/captioncompiler
45+
bin/$PLAT_DIR/glview
46+
bin/$PLAT_DIR/height2normal
47+
bin/$PLAT_DIR/motionmapper
48+
bin/$PLAT_DIR/qc_eyes
49+
bin/$PLAT_DIR/tgadiff
50+
bin/$PLAT_DIR/vbsp
51+
bin/$PLAT_DIR/vice
52+
bin/$PLAT_DIR/vrad
53+
bin/$PLAT_DIR/vtf2tga
54+
bin/$PLAT_DIR/vtfdiff
55+
bin/$PLAT_DIR/vvis
56+
)
57+
58+
DLLS+=(
59+
bin/$PLAT_DIR/vrad_dll
60+
bin/$PLAT_DIR/vvis_dll
61+
)
62+
63+
declare -a DLLS_LIB=(
64+
bin/$PLAT_DIR/steam_api64
65+
)
66+
elif [ $PLATFORM = "linux" ]; then
67+
declare -a EXES=(
68+
tc2_linux64
69+
)
70+
71+
declare -a DLLS_LIB=(
72+
bin/$PLAT_DIR/libsteam_api
73+
)
74+
75+
FILES+=(
76+
tc2.sh
77+
)
78+
fi
79+
6380
for F in "${EXES[@]}"; do
6481
cp -f ${DEV_DIR}/${F}${EXE_EXT} ${CLEAN_DIR}/${F}${EXE_EXT}
6582
done
6683

6784
for F in "${DLLS[@]}"; do
6885
DLL=${F}${DLL_EXT}
6986
cp -f ${DEV_DIR}/${DLL} ${CLEAN_DIR}/${DLL}
70-
cp -f ${DEV_DIR}/${F,,}.pdb ${CLEAN_DEBUG_DIR}/${F,,}.pdb
87+
if [ $PLATFORM = "win" ]; then
88+
cp -f ${DEV_DIR}/${F,,}.pdb ${CLEAN_DEBUG_DIR}/${F,,}.pdb
89+
elif [ $PLATFORM = "linux" ]; then
90+
# Linux binaries aren't stripped by the build scripts, so separate the
91+
# debug info and strip them here.
92+
cp -f ${CLEAN_DIR}/${DLL} ${CLEAN_DEBUG_DIR}/${DLL}.dbg
93+
objcopy --add-gnu-debuglink=${CLEAN_DEBUG_DIR}/${DLL}.dbg ${CLEAN_DIR}/${DLL}
94+
strip ${CLEAN_DIR}/${DLL}
95+
fi
7196
done
7297

7398
for F in "${DLLS_LIB[@]}"; do

game_clean/publish.sh

100644100755
File mode changed.

game_clean/push.sh

100644100755
File mode changed.

game_clean/shared.sh

100644100755
File mode changed.

game_clean/tc2.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
# Launch the game under the steam runtime
4+
/home/$USER/.steam/bin32/steam-runtime/run.sh ./tc2_linux64 "$@"

src/buildallprojects

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
set -euo pipefail
44

@@ -8,6 +8,10 @@ pushd "$(dirname -- "$script")" > /dev/null
88
source sdk_container
99
run_in_sniper "$@"
1010

11+
export CCACHE_SLOPPINESS="pch_defines,time_macros"
12+
export VPC_ENABLE_CCACHE="1"
13+
ccache -z
14+
1115
if [ $# -eq 0 ]; then
1216
export VPC_NINJA_BUILD_MODE="release"
1317
else
@@ -34,5 +38,6 @@ if [[ ! -e "$solution_out.ninja" ]]; then
3438
fi
3539

3640
ninja -f "$solution_out.ninja" -j$(nproc)
41+
ccache -s
3742

3843
popd

0 commit comments

Comments
 (0)