Skip to content

Commit a22d422

Browse files
committed
Update launcher to the latest version
As part of the update, I had to refactor quite a bit of how the build process works. flatpak-node-generator is quite bugged: - Output `generated-source.json` expects the package to be in the main directory, so I've split the build into modules but still had to add `flatpak-node` exclusion to build - I had to patch locally flatpak/flatpak-builder-tools#382 and use that because flatpak/flatpak-builder-tools#381 - I've also run into flatpak/flatpak-builder-tools#377 I've also: - Made copying of addr2line dependencies more reliable - Merged the startup scripts into one - Added permission and setup for discord so that rich presence works
1 parent 254f60f commit a22d422

6 files changed

+1022
-706
lines changed

generated-sources.json

+954-659
Large diffs are not rendered by default.

info.beyondallreason.bar.appdata.xml

+6
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@
9898
</screenshot>
9999
</screenshots>
100100
<releases>
101+
<release version="1.2988.0.0" date="2024-03-02">
102+
<description>
103+
<p>New stable release of the game launcher.</p>
104+
</description>
105+
<url>https://github.com/beyond-all-reason/BYAR-Chobby/releases/tag/v1.2988.0</url>
106+
</release>
101107
<release version="1.2838.0.0" date="2024-01-04">
102108
<description>
103109
<p>New stable release of the game launcher.</p>

info.beyondallreason.bar.desktop

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Desktop Entry]
22
Name=Beyond All Reason
3-
Exec=launcher-args.sh
3+
Exec=run.sh
44
Comment=The Total Annihilation Inspired RTS you've been waiting for
55
Type=Application
66
Icon=info.beyondallreason.bar

info.beyondallreason.bar.yml

+55-45
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ runtime-version: "23.08"
44
base: org.electronjs.Electron2.BaseApp
55
base-version: "23.08"
66
sdk: org.freedesktop.Sdk
7-
command: launcher-args.sh
7+
command: run.sh
88
sdk-extensions:
9-
- org.freedesktop.Sdk.Extension.node18
9+
- org.freedesktop.Sdk.Extension.node20
1010
build-options:
11-
append_path: "/usr/lib/sdk/node18/bin"
11+
append_path: "/usr/lib/sdk/node20/bin"
1212
cflags: -O2 -g
1313
cxxflags: -O2 -g
1414
env:
15-
npm_config_nodedir: /usr/lib/sdk/node18
15+
npm_config_nodedir: /usr/lib/sdk/node20
1616
npm_config_offline: 'true'
1717
NPM_CONFIG_LOGLEVEL: info
1818
XDG_CACHE_HOME: /run/build/spring-launcher/flatpak-node/cache
@@ -24,81 +24,91 @@ finish-args:
2424
- --socket=pulseaudio
2525
- --device=dri
2626
- --share=network
27-
- --env=PATH=/usr/bin:/app/bin:/usr/lib/sdk/node18/bin
27+
- --env=PATH=/usr/bin:/app/bin:/usr/lib/sdk/node20/bin
28+
- --filesystem=xdg-run/app/com.discordapp.Discord:create
29+
cleanup:
30+
- '/chobby'
2831
modules:
32+
- name: chobby
33+
buildsystem: simple
34+
build-commands:
35+
sources:
36+
- type: git
37+
url: https://github.com/beyond-all-reason/BYAR-Chobby
38+
commit: eece9ffed260ff110ec2cc31fac25c4daf7a9c51
39+
# We do full clone to make sure PACKAGE_VERSION is computed correctly.
40+
disable-shallow-clone: true
41+
build-commands:
42+
- |
43+
mkdir -p /app/chobby
44+
echo "1.$(git rev-list --count HEAD).0" > /app/chobby/PACKAGE_VERSION
45+
cp -r dist_cfg /app/chobby
46+
cp -r build /app/chobby
2947
- name: spring-launcher
3048
buildsystem: simple
3149
build-commands:
3250
# First steps from https://github.com/beyond-all-reason/BYAR-Chobby/blob/master/.github/workflows/launcher.yml
3351
# GitHub Action step: Patch launcher with dist_cfg
3452
- |
35-
cp -r BYAR-Chobby/dist_cfg/* launcher/src/
53+
cp -r /app/chobby/dist_cfg/* src/
3654
for dir in bin files build; do
37-
mkdir -p launcher/$dir
38-
if [ -d launcher/src/$dir/ ]; then
39-
mv launcher/src/$dir/* launcher/$dir/
40-
rm -rf launcher/src/$dir
55+
mkdir -p $dir
56+
if [ -d src/$dir/ ]; then
57+
mv src/$dir/* $dir/
58+
rm -rf src/$dir
4159
fi
4260
done
4361
# GitHub Action step: Make package.json
4462
- |
45-
cd BYAR-Chobby
46-
export PACKAGE_VERSION=1.$(git rev-list --count HEAD).0
63+
export PACKAGE_VERSION=$(cat /app/chobby/PACKAGE_VERSION)
4764
echo "Making build for version: $PACKAGE_VERSION"
48-
node build/make_package_json.js ../launcher/package.json dist_cfg/config.json $GITHUB_REPOSITORY $PACKAGE_VERSION
65+
node /app/chobby/build/make_package_json.js package.json /app/chobby/dist_cfg/config.json $GITHUB_REPOSITORY $PACKAGE_VERSION
4966
5067
# For flatpak we don't want to build AppImage, but unpacked
5168
- |
52-
cd launcher
5369
jq '.build.linux.target="dir"' <<<$(<package.json) > package.json
70+
jq '.build.files+=["!flatpak-node/**"]' <<<$(<package.json) > package.json
5471
cat package.json
5572
# Install all packages, use `--ignore-scripts`, so electron does not make a postinstall request
5673
- |
57-
cd launcher
58-
npm ci --offline --ignore-scripts --cache=/run/build/spring-launcher/flatpak-node/npm-cache/
74+
npm ci --ignore-scripts
5975
# Build electron app
6076
- |
6177
. flatpak-node/electron-builder-arch-args.sh
62-
cd launcher
63-
node_modules/.bin/electron-builder -- $ELECTRON_BUILDER_ARCH_ARGS --linux --dir --project /run/build/spring-launcher/launcher
78+
node_modules/.bin/electron-builder -- $ELECTRON_BUILDER_ARCH_ARGS --linux --dir
6479
# Install application in destination folder
6580
- |
66-
cp -a launcher/dist/linux*unpacked /app/main
67-
install -Dm755 -t /app/bin/ launcher-args.sh
81+
cp -a dist/linux*unpacked /app/main
82+
sources:
83+
- type: git
84+
url: https://github.com/beyond-all-reason/spring-launcher
85+
commit: 2c0a6e17b50ab04ea592c53963c571e5ccb071ba
86+
# This generated-sources.json from npm generator *really* wants that source is in the top directory
87+
# and not in some sub directory, that's why there is a bunch of complexity with moving files around etc
88+
- generated-sources.json
89+
build-options:
90+
env:
91+
XDG_CACHE_HOME: /run/build/spring-launcher/flatpak-node/cache
92+
npm_config_cache: /run/build/spring-launcher/flatpak-node/npm-cache
93+
npm_config_nodedir: /usr/lib/sdk/node20
94+
npm_config_offline: 'true'
95+
- name: main
96+
buildsystem: simple
97+
build-commands:
98+
- |
6899
install -Dm755 -t /app/bin/ run.sh
69-
install -Dm644 BYAR-Chobby/dist_cfg/build/icon.png /app/share/icons/hicolor/128x128/apps/info.beyondallreason.bar.png
100+
install -Dm644 /app/chobby/dist_cfg/build/icon.png /app/share/icons/hicolor/128x128/apps/info.beyondallreason.bar.png
70101
install -Dm644 info.beyondallreason.bar.desktop /app/share/applications/info.beyondallreason.bar.desktop
71102
install -Dm644 info.beyondallreason.bar.appdata.xml /app/share/metainfo/info.beyondallreason.bar.appdata.xml
72103
# Copy addr2line to bin so that engine can execute it to generate stacktrace
73104
- |
74105
cp /usr/bin/addr2line /app/bin
75-
cp /lib/x86_64-linux-gnu/libbfd-2.41.so /app/lib
76-
cp /usr/lib/x86_64-linux-gnu/libsframe.so.1 /app/lib
106+
cp /lib/x86_64-linux-gnu/libbfd* /app/lib
107+
cp /usr/lib/x86_64-linux-gnu/libsframe* /app/lib
77108
sources:
78-
- type: git
79-
url: https://github.com/beyond-all-reason/BYAR-Chobby
80-
commit: bbad0ab7c5ccbc207754449c47c65db4da436009
81-
dest: BYAR-Chobby
82-
# We do full clone to make sure PACKAGE_VERSION is computed correctly.
83-
disable-shallow-clone: true
84-
- type: git
85-
url: https://github.com/beyond-all-reason/spring-launcher
86-
commit: 6792caf2ede73f3f601a0ab7fbb4fb38c96fbb40
87-
dest: launcher
88109
- type: file
89110
path: info.beyondallreason.bar.desktop
90111
- type: file
91112
path: info.beyondallreason.bar.appdata.xml
92-
- generated-sources.json
93113
- type: file
94-
path: launcher-args.sh
95-
- type: script
96-
dest-filename: run.sh
97-
commands:
98-
- zypak-wrapper.sh /app/main/beyond-all-reason "$@"
99-
build-options:
100-
env:
101-
XDG_CACHE_HOME: /run/build/spring-launcher/flatpak-node/cache
102-
npm_config_cache: /run/build/spring-launcher/flatpak-node/npm-cache
103-
npm_config_nodedir: /usr/lib/sdk/node18
104-
npm_config_offline: 'true'
114+
path: run.sh

launcher-args.sh

-1
This file was deleted.

run.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# https://github.com/flathub/com.discordapp.Discord/wiki/Rich-Precense-(discord-rpc)
2+
for i in {0..9}; do
3+
test -S $XDG_RUNTIME_DIR/discord-ipc-$i || ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-$i;
4+
done
5+
6+
zypak-wrapper.sh /app/main/beyond-all-reason --disable-launcher-update -w $XDG_DATA_HOME "$@"

0 commit comments

Comments
 (0)