Skip to content

Commit d825a3d

Browse files
committed
scripts: gha: build for e2k-8c on GitHub Actions machines
1 parent 6cf0d7a commit d825a3d

File tree

6 files changed

+108
-0
lines changed

6 files changed

+108
-0
lines changed

.github/workflows/c-cpp.yml

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ jobs:
4040
# - os: ubuntu-aarch64-20.04
4141
# targetos: linux
4242
# targetarch: aarch64
43+
- os: ubuntu-latest
44+
targetos: linux
45+
targetarch: e2k-8c
46+
cross: true
4347
- os: ubuntu-20.04
4448
targetos: android
4549
targetarch: multiarch

scripts/gha/build_linux-e2k.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
. scripts/lib.sh
6+
. scripts/lib-e2k.sh
7+
8+
export CC=${E2K_CROSS_COMPILER_PATH[$GH_CPU_ARCH]}/bin/lcc
9+
export CXX=${E2K_CROSS_COMPILER_PATH[$GH_CPU_ARCH]}/bin/l++
10+
11+
APP=xash3d-fwgs
12+
13+
APPDIR=$APP-linux-$ARCH # FIXME: not conforms to libpublic's build arch strings but in parity with xashds directory name
14+
APPTARGZ=$APP-linux-$ARCH.tar.gz
15+
16+
DS=xashds-linux
17+
DSDIR=$DS-$ARCH
18+
DSTARGZ=$DS-$ARCH.tar.gz
19+
20+
build_engine()
21+
{
22+
# Build engine
23+
cd "$BUILDDIR"
24+
25+
./waf configure --enable-dedicated -s usr --enable-stbtt --enable-utils --enable-bundled-deps --enable-all-renderers || die_configure
26+
./waf build || die_configure
27+
}
28+
29+
make_client_tarball()
30+
{
31+
cd "$BUILDDIR"
32+
./waf install --destdir="$APPDIR"
33+
tar -czvf "artifacts/$APPTARGZ" "$APPDIR"
34+
}
35+
36+
make_server_tarball()
37+
{
38+
cd "$BUILDDIR"
39+
./waf install --destdir="$DSDIR"
40+
# FIXME: make an option for Waf to only install dedicated
41+
rm -rf "$DSDIR"/libref* "$DSDIR"/libxash.so "$DSDIR"/libmenu.so "$DSDIR"/valve
42+
tar -czvf "artifacts/$DSTARGZ" "$DSDIR"
43+
}
44+
45+
mkdir -p artifacts/
46+
47+
rm -rf build # clean-up build directory
48+
build_engine
49+
50+
make_client_tarball
51+
make_server_tarball

scripts/gha/build_linux.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22

3+
# As e2k builds for distro that's vastly different from Ubuntu/Debian and specially handles cross-compiling
4+
# keep it in separate script for now
5+
if [[ $GH_CPU_ARCH == e2k* ]]; then
6+
exec bash scripts/gha/build_linux-e2k.sh
7+
fi
8+
39
. scripts/lib.sh
410

511
# "booo, bash feature!"

scripts/gha/deps_linux-e2k.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
cd "$GITHUB_WORKSPACE"
6+
7+
. scripts/lib-e2k.sh
8+
9+
wget "${E2K_CROSS_COMPILER_URL[$GH_CPU_ARCH]}" -O- | sudo tar -C / -xzvf -
10+
11+
for i in ${E2K_PACKAGES_URLS[$GH_CPU_ARCH]}; do
12+
wget "$i" -O package.deb
13+
ar x package.deb data.tar.xz
14+
tar -xvf data.tar.xz
15+
rm package.deb data.tar.xz
16+
done

scripts/gha/deps_linux.sh

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22

3+
# As e2k builds for distro that's vastly different from Ubuntu/Debian and specially handles cross-compiling
4+
# keep it in separate script for now
5+
if [[ $GH_CPU_ARCH == e2k* ]]; then
6+
exec bash scripts/gha/deps_linux-e2k.sh
7+
fi
8+
39
. scripts/lib.sh
410

511
cd "$GITHUB_WORKSPACE" || exit 1

scripts/lib-e2k.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
declare -A E2K_CROSS_COMPILER_URL E2K_CROSS_COMPILER_PATH E2K_PACKAGES_URLS
2+
3+
# NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
4+
# NOTE NOTE
5+
# NOTE The cross-compiler is officially distributed on dev.mcst.ru website. NOTE
6+
# NOTE setwd.ws is OpenE2K's unofficial mirror for Elbrus dev community. NOTE
7+
# NOTE Do NOT hammer down the server with your CI/CD, AI and other bullshit! NOTE
8+
# NOTE Cache the archives on YOUR OWN INFRASTRUCTURE! NOTE
9+
# NOTE NOTE
10+
# NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
11+
E2K_CROSS_COMPILER_URL[e2k-4c]="https://setwd.ws/sp/1.27/1.27.21/cross-sp-rel-1.27.21.e2k-v3.5.10_64.tgz"
12+
E2K_CROSS_COMPILER_URL[e2k-1c]="https://setwd.ws/sp/1.27/1.27.21/cross-sp-rel-1.27.21.e2k-v4.1c%2B.5.10_64.tgz"
13+
E2K_CROSS_COMPILER_URL[e2k-8c]="https://setwd.ws/sp/1.27/1.27.21/cross-sp-rel-1.27.21.e2k-v4.5.10_64.tgz"
14+
E2K_CROSS_COMPILER_URL[e2k-8c2]="https://setwd.ws/sp/1.27/1.27.21/cross-sp-rel-1.27.21.e2k-v5.5.10_64.tgz"
15+
E2K_CROSS_COMPILER_URL[e2k-16c]="https://setwd.ws/sp/1.27/1.27.21/cross-sp-rel-1.27.21.e2k-v6.5.10-e16c_64.tgz"
16+
E2K_CROSS_COMPILER_URL[e2k-2c3]="https://setwd.ws/sp/1.27/1.27.21/cross-sp-rel-1.27.21.e2k-v6.5.10-e2c3_64.tgz"
17+
18+
# TODO: fill in the gaps
19+
E2K_CROSS_COMPILER_PATH[e2k-8c]="/opt/mcst/lcc-1.27.21.e2k-v4.5.10/"
20+
21+
# TODO: split by some character, as bash can't assign lists to array members
22+
E2K_PACKAGES_URLS[e2k-4c]="https://setwd.ws/osl/8.2/pool/main/e2k-4c/SDL2_2.30.0-vd8u4_e2k-4c.deb"
23+
E2K_PACKAGES_URLS[e2k-8c]="https://setwd.ws/osl/8.2/pool/main/e2k-8c/SDL2_2.30.0-vd8u4_e2k-8c.deb"
24+
E2K_PACKAGES_URLS[e2k-8c2]="https://setwd.ws/osl/8.2/pool/main/e2k-8c2/SDL2_2.30.0-vd8u4_e2k-8c2.deb"
25+
E2K_PACKAGES_URLS[e2k-16c]="https://setwd.ws/osl/8.2/pool/main/e2k-16c/SDL2_2.30.0-vd8u4_e2k-16c.deb"

0 commit comments

Comments
 (0)