Skip to content

Commit 31f167b

Browse files
committed
Add Win32 builds
1 parent 7f9d666 commit 31f167b

File tree

5 files changed

+99
-82
lines changed

5 files changed

+99
-82
lines changed

.github/workflows/c-cpp.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ jobs:
2626
- os: ubuntu-20.04
2727
targetos: linux
2828
targetarch: ppc64el
29+
- os: windows-latest
30+
targetos: win32
31+
targetarch: amd64
32+
- os: windows-2019 # always use the oldest possible for 32-bit because of older compilers, and better support of certain legacy OSes
33+
targetos: win32
34+
targetarch: i386
2935
env:
3036
YQ_VERSION: 4.44.6
3137
GH_CPU_OS: ${{ matrix.targetos }}

scripts/gha/build_common.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/bash
2+
3+
MODS=$(./yq length manifest.yml)
4+
5+
build_with_waf()
6+
{
7+
local WAF_ENABLE_VGUI_OPTION=''
8+
local WAF_ENABLE_AMD64_OPTION=''
9+
10+
# run build in it's out build folder
11+
export WAFLOCK=".lock-waf_$1"
12+
13+
if [ "$GH_CPU_ARCH" == "amd64" ]; then
14+
WAF_ENABLE_AMD64_OPTION="-8"
15+
elif [ "$GH_CPU_ARCH" == "i386" ]; then
16+
# not all waf-based hlsdk trees have vgui support
17+
python waf --help | grep 'enable-vgui' && WAF_ENABLE_VGUI_OPTION=--enable-vgui
18+
19+
export CXXFLAGS="-I../../external"
20+
fi
21+
22+
python waf -o "build/$1" \
23+
configure \
24+
--disable-werror \
25+
$WAF_ENABLE_AMD64_OPTION \
26+
$WAF_ENABLE_VGUI_OPTION \
27+
install \
28+
--destdir=../stage || return 1
29+
30+
unset WAFLOCK
31+
unset CXXFLAGS
32+
33+
return 0
34+
}
35+
36+
build_hlsdk_portable_branch()
37+
{
38+
# hlsdk-portable has mods in git branches
39+
git checkout "$1" || return 1
40+
41+
# all hlsdk-portable branches have mod_options.txt file
42+
GAMEDIR=$(grep GAMEDIR mod_options.txt | tr '=' ' ' | cut -d' ' -f2 )
43+
44+
build_with_waf "$GAMEDIR"
45+
SUCCESS=$?
46+
47+
if [ $SUCCESS -eq 2 ]; then # means something went wrong during install phase
48+
rm -rf "../stage/$GAMEDIR" # better cleanup
49+
fi
50+
51+
if [ $SUCCESS -ne 0 ]; then
52+
return 2
53+
fi
54+
55+
return 0
56+
}
57+
58+
pack_staged_gamedir()
59+
{
60+
mkdir -p out || return 1
61+
62+
pushd stage/ || return 1
63+
7z a "../out/$1-$2.zip" "$1" || return 2
64+
popd || return 1
65+
66+
return 0
67+
}
68+
69+
for (( i = 0 ; i < MODS ; i++ )); do
70+
BRANCH=$(./yq -r ".[$i].branch" manifest.yml)
71+
72+
GAMEDIR="" # expected to be set within build_hlsdk_portable_branch
73+
74+
pushd hlsdk-portable || exit 1
75+
build_hlsdk_portable_branch "$BRANCH"
76+
SUCCESS=$?
77+
78+
if [ $SUCCESS -ne 0 ]; then
79+
continue
80+
fi
81+
popd || exit 1
82+
83+
pack_staged_gamedir "$GAMEDIR" "$GH_CPU_OS-$GH_CPU_ARCH"
84+
done

scripts/gha/build_linux.sh

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -20,85 +20,4 @@ export PKG_CONFIG_PATH=${ARCH_TRIPLET[$GH_CPU_ARCH]}
2020
export CC=${CROSS_COMPILE_CC[$GH_CPU_ARCH]}
2121
export CXX=${CROSS_COMPILE_CXX[$GH_CPU_ARCH]}
2222

23-
MODS=$(./yq length manifest.yml)
24-
25-
build_with_waf()
26-
{
27-
local WAF_ENABLE_VGUI_OPTION=''
28-
local WAF_ENABLE_AMD64_OPTION=''
29-
30-
# run build in it's out build folder
31-
export WAFLOCK=".lock-waf_$1"
32-
33-
if [ "$GH_CPU_ARCH" == "amd64" ]; then
34-
WAF_ENABLE_AMD64_OPTION="-8"
35-
elif [ "$GH_CPU_ARCH" == "i386" ]; then
36-
# not all waf-based hlsdk trees have vgui support
37-
python waf --help | grep 'enable-vgui' && WAF_ENABLE_VGUI_OPTION=--enable-vgui
38-
39-
export CXXFLAGS="-I../../external"
40-
fi
41-
42-
python waf -o "build/$1" \
43-
configure \
44-
--disable-werror \
45-
$WAF_ENABLE_AMD64_OPTION \
46-
$WAF_ENABLE_VGUI_OPTION \
47-
install \
48-
--destdir=../stage || return 1
49-
50-
unset WAFLOCK
51-
unset CXXFLAGS
52-
53-
return 0
54-
}
55-
56-
build_hlsdk_portable_branch()
57-
{
58-
# hlsdk-portable has mods in git branches
59-
git checkout "$1" || return 1
60-
61-
# all hlsdk-portable branches have mod_options.txt file
62-
GAMEDIR=$(grep GAMEDIR mod_options.txt | tr '=' ' ' | cut -d' ' -f2 )
63-
64-
build_with_waf "$GAMEDIR"
65-
SUCCESS=$?
66-
67-
if [ $SUCCESS -eq 2 ]; then # means something went wrong during install phase
68-
rm -rf "../stage/$GAMEDIR" # better cleanup
69-
fi
70-
71-
if [ $SUCCESS -ne 0 ]; then
72-
return 2
73-
fi
74-
75-
return 0
76-
}
77-
78-
pack_staged_gamedir()
79-
{
80-
mkdir -p out || return 1
81-
82-
pushd stage/ || return 1
83-
zip -r "../out/$1-$2.zip" "$1" || return 2
84-
popd || return 1
85-
86-
return 0
87-
}
88-
89-
for (( i = 0 ; i < MODS ; i++ )); do
90-
BRANCH=$(./yq -r ".[$i].branch" manifest.yml)
91-
92-
GAMEDIR="" # expected to be set within build_hlsdk_portable_branch
93-
94-
pushd hlsdk-portable || exit 1
95-
build_hlsdk_portable_branch "$BRANCH"
96-
SUCCESS=$?
97-
98-
if [ $SUCCESS -ne 0 ]; then
99-
continue
100-
fi
101-
popd || exit 1
102-
103-
pack_staged_gamedir "$GAMEDIR" "$GH_CPU_OS-$GH_CPU_ARCH"
104-
done
23+
source scripts/gha/build_common.sh

scripts/gha/build_win32.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
source scripts/gha/build_common.sh

scripts/gha/deps_win32.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
git clone --recursive https://github.com/FWGS/hlsdk-portable
4+
5+
curl -L "https://github.com/mikefarah/yq/releases/download/v4.44.6/yq_windows_amd64.exe" -o yq.exe

0 commit comments

Comments
 (0)