Skip to content

Commit ca33745

Browse files
committed
update scripts for cross platform
1 parent 16810e5 commit ca33745

File tree

4 files changed

+44
-30
lines changed

4 files changed

+44
-30
lines changed

game_clean/copy.sh

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
#
33
# Run script within the directory
44
BIN_DIR=$(dirname "$(readlink -fn "$0")")
@@ -10,36 +10,36 @@ source ./shared.sh
1010

1111
rm -rf ${CLEAN_DIR}
1212
rm -rf ${CLEAN_DEBUG_DIR}
13-
mkdir -p ${CLEAN_DIR}/{bin/x64,tc2/bin/x64,tc2/materials,tc2/cfg}
14-
mkdir -p ${CLEAN_DEBUG_DIR}/{bin/x64,tc2/bin/x64,tc2/materials,tc2/cfg}
13+
mkdir -p ${CLEAN_DIR}/{bin/$PLAT_DIR,tc2/bin/$PLAT_DIR,tc2/materials,tc2/cfg,tc2/scripts}
14+
mkdir -p ${CLEAN_DEBUG_DIR}/{bin/$PLAT_DIR,tc2/bin/$PLAT_DIR}
1515

1616
declare -a EXES=(
1717
tc2_win64
18-
bin/x64/captioncompiler
19-
bin/x64/glview
20-
bin/x64/height2normal
21-
bin/x64/motionmapper
22-
bin/x64/qc_eyes
23-
bin/x64/tgadiff
24-
bin/x64/vbsp
25-
bin/x64/vice
26-
bin/x64/vrad
27-
bin/x64/vtf2tga
28-
bin/x64/vtfdiff
29-
bin/x64/vvis
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
3030
)
3131

3232
declare -a DLLS=(
33-
bin/x64/vrad_dll
34-
bin/x64/vvis_dll
35-
tc2/bin/x64/{client,server}
33+
bin/$PLAT_DIR/vrad_dll
34+
bin/$PLAT_DIR/vvis_dll
35+
tc2/$PLAT_DIR/{client,server}
3636
)
3737

3838
declare -a DLLS_LIB=(
39-
bin/x64/steam_api64
39+
bin/$PLAT_DIR/steam_api64
4040
)
4141

42-
declare -a REP_FILES=(
42+
declare -a FILES_REP=(
4343
tc2/cfg/valve.rc
4444
tc2/cfg/default.cfg
4545
tc2/cfg/user_default.scr
@@ -59,19 +59,20 @@ declare -a FILES=(
5959
)
6060

6161
for F in "${EXES[@]}"; do
62-
cp -f ${DEV_DIR}/${F}.exe ${CLEAN_DIR}/${F}.exe
62+
cp -f ${DEV_DIR}/${F}${EXE_EXT} ${CLEAN_DIR}/${F}${EXE_EXT}
6363
done
6464

6565
for F in "${DLLS[@]}"; do
66-
cp -f ${DEV_DIR}/${F}.dll ${CLEAN_DIR}/${F}.dll
66+
DLL=${F}${DLL_EXT}
67+
cp -f ${DEV_DIR}/${DLL} ${CLEAN_DIR}/${DLL}
6768
cp -f ${DEV_DIR}/${F,,}.pdb ${CLEAN_DEBUG_DIR}/${F,,}.pdb
6869
done
6970

7071
for F in "${DLLS_LIB[@]}"; do
71-
cp -f ${DEV_DIR}/${F}.dll ${CLEAN_DIR}/${F}.dll
72+
cp -f ${DEV_DIR}/${F}${DLL_EXT} ${CLEAN_DIR}/${F}${DLL_EXT}
7273
done
7374

74-
for F in "${REP_FILES[@]}"; do
75+
for F in "${FILES_REP[@]}"; do
7576
cp -rf ${DEV_DIR}/${F} ${CLEAN_DIR}/${F}
7677
done
7778

game_clean/publish.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
#
33
# Run script within the directory
44
BIN_DIR=$(dirname "$(readlink -fn "$0")")

game_clean/push.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
#
33
# Run script within the directory
44
BIN_DIR=$(dirname "$(readlink -fn "$0")")
@@ -8,15 +8,14 @@ set -e
88

99
source ./shared.sh
1010

11-
PLATFORM_STR=win
12-
SOURCE_MANIFEST=./.itch.${PLATFORM_STR}.toml
11+
SOURCE_MANIFEST=./.itch.${PLATFORM}.toml
1312
TARGET_MANIFEST=${CLEAN_DIR}/.itch.toml
1413

1514
cp -f ${SOURCE_MANIFEST} ${TARGET_MANIFEST}
1615

1716
PROJECT_STR="mastercoms/tc2"
1817
BRANCH_STR=stable
19-
CHANNEL_STR=${PLATFORM_STR}-${BRANCH_STR}
18+
CHANNEL_STR=${PLATFORM}-${BRANCH_STR}
2019
VERSION="0.12.0"
2120

2221
butler push "${CLEAN_DIR}" "${PROJECT_STR}:${CHANNEL_STR}" "--userversion" "${VERSION}"

game_clean/shared.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
DEV_DIR=../game
22
CLEAN_DIR=../game_dist
3-
CLEAN_DEBUG_DIR=${CLEAN_DIR}_debug
3+
CLEAN_DEBUG_DIR=${CLEAN_DIR}_debug
4+
if [[ "$OSTYPE" == "linux"* ]]; then
5+
PLATFORM="linux"
6+
PLAT_DIR="linux64"
7+
DLL_EXT=".so"
8+
EXE_EXT=""
9+
elif [[ "$OSTYPE" == "msys"* ]]; then
10+
PLATFORM="win"
11+
PLAT_DIR="x64"
12+
DLL_EXT=".dll"
13+
EXE_EXT=".exe"
14+
else
15+
echo "OS is not supported! Exiting."
16+
exit 1
17+
fi

0 commit comments

Comments
 (0)