Skip to content

Commit 4d7c6a9

Browse files
feat: improve linux and mac support
1 parent b1cf32b commit 4d7c6a9

File tree

8 files changed

+172
-12
lines changed

8 files changed

+172
-12
lines changed

.github/workflows/rust.yml

Lines changed: 137 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ jobs:
4949
clang \
5050
libpango-1.0-0 \
5151
libatk1.0-dev \
52-
libgtk-3-dev
52+
libgtk-3-dev \
53+
file
5354
- uses: actions/checkout@v3
5455
- name: Install latest nightly
5556
uses: actions-rs/toolchain@v1
@@ -59,20 +60,78 @@ jobs:
5960
components: rustfmt, clippy
6061
- name: Build Rust
6162
run: cargo build --verbose --release
62-
- name: Create Linux zip
63-
run: zip "celemod-linux.zip" ./target/release/cele-mod
63+
- name: Download AppImage tools
64+
run: |
65+
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
66+
wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
67+
chmod +x linuxdeploy-x86_64.AppImage appimagetool-x86_64.AppImage
68+
- name: Create AppDir
69+
run: |
70+
mkdir -p AppDir/usr/bin
71+
mkdir -p AppDir/usr/lib
72+
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
73+
mkdir -p AppDir/usr/share/applications
74+
75+
# Copy binary and library
76+
cp ./target/release/cele-mod AppDir/usr/bin/cele-mod
77+
cp ./resources/libsciter.so AppDir/usr/lib/libsciter.so
78+
chmod +x AppDir/usr/bin/cele-mod
79+
80+
# Copy icon
81+
cp ./resources/icon.png AppDir/usr/share/icons/hicolor/256x256/apps/celemod.png
82+
83+
# Create .desktop file
84+
cat > AppDir/usr/share/applications/celemod.desktop << 'EOF'
85+
[Desktop Entry]
86+
Name=CeleMod
87+
Comment=Celeste Mod Manager
88+
Exec=cele-mod
89+
Icon=celemod
90+
Terminal=false
91+
Type=Application
92+
Categories=Game;Utility;
93+
EOF
94+
95+
# Create symlinks
96+
ln -s usr/share/applications/celemod.desktop AppDir/celemod.desktop
97+
ln -s usr/share/icons/hicolor/256x256/apps/celemod.png AppDir/celemod.png
98+
ln -s usr/bin/cele-mod AppDir/AppRun
99+
- name: Build AppImage
100+
run: |
101+
ARCH=x86_64 ./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage || true
102+
# Fallback: use appimagetool directly if linuxdeploy fails
103+
if [ ! -f CeleMod-*.AppImage ]; then
104+
ARCH=x86_64 ./appimagetool-x86_64.AppImage AppDir CeleMod-x86_64.AppImage
105+
fi
106+
mv CeleMod-*.AppImage celemod-linux.AppImage || true
107+
- name: Create zip fallback
108+
run: |
109+
mkdir -p celemod-linux
110+
cp ./target/release/cele-mod celemod-linux/cele-mod
111+
cp ./resources/libsciter.so celemod-linux/libsciter.so
112+
cp ./resources/icon.png celemod-linux/celemod.png
113+
zip -r "celemod-linux.zip" celemod-linux
64114
- uses: actions/upload-artifact@v4.3.1
65115
with:
66116
name: linux-zip
67117
path: celemod-linux.zip
68-
build-osx:
118+
- uses: actions/upload-artifact@v4.3.1
119+
with:
120+
name: linux-appimage
121+
path: celemod-linux.AppImage
122+
- uses: actions/upload-artifact@v4.3.1
123+
with:
124+
name: linux-zip
125+
path: celemod-linux.zip
126+
build-macos:
69127
runs-on: macos-latest
70128
steps:
71129
- name: Install dependencies
72130
run: |
73131
brew install pango
74132
brew install gtk+3
75133
brew install protobuf
134+
brew install create-dmg
76135
- uses: actions/checkout@v3
77136
- name: Install latest nightly
78137
uses: actions-rs/toolchain@v1
@@ -82,15 +141,76 @@ jobs:
82141
components: rustfmt, clippy
83142
- name: Build Rust
84143
run: cargo build --verbose --release
85-
- name: Create OSX zip
86-
run: zip "celemod-osx.zip" ./target/release/cele-mod
144+
- name: Create macOS app bundle
145+
run: |
146+
mkdir -p CeleMod.app/Contents/MacOS
147+
mkdir -p CeleMod.app/Contents/Resources
148+
cp ./target/release/cele-mod CeleMod.app/Contents/MacOS/CeleMod
149+
cp ./resources/libsciter.dylib CeleMod.app/Contents/MacOS/libsciter.dylib
150+
cp ./resources/icon.icns CeleMod.app/Contents/Resources/AppIcon.icns
151+
chmod +x CeleMod.app/Contents/MacOS/CeleMod
152+
153+
# Create Info.plist with icon
154+
cat > CeleMod.app/Contents/Info.plist << 'EOF'
155+
<?xml version="1.0" encoding="UTF-8"?>
156+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
157+
<plist version="1.0">
158+
<dict>
159+
<key>CFBundleDevelopmentRegion</key>
160+
<string>en</string>
161+
<key>CFBundleExecutable</key>
162+
<string>CeleMod</string>
163+
<key>CFBundleIconFile</key>
164+
<string>AppIcon</string>
165+
<key>CFBundleIdentifier</key>
166+
<string>com.celemod.app</string>
167+
<key>CFBundleInfoDictionaryVersion</key>
168+
<string>6.0</string>
169+
<key>CFBundleName</key>
170+
<string>CeleMod</string>
171+
<key>CFBundleDisplayName</key>
172+
<string>CeleMod</string>
173+
<key>CFBundlePackageType</key>
174+
<string>APPL</string>
175+
<key>CFBundleShortVersionString</key>
176+
<string>1.0</string>
177+
<key>CFBundleVersion</key>
178+
<string>1</string>
179+
<key>LSMinimumSystemVersion</key>
180+
<string>10.13</string>
181+
<key>NSHighResolutionCapable</key>
182+
<true/>
183+
<key>NSHumanReadableCopyright</key>
184+
<string>Copyright © 2024 CeleMod. All rights reserved.</string>
185+
</dict>
186+
</plist>
187+
EOF
188+
- name: Create DMG (optional)
189+
run: |
190+
create-dmg --volname "CeleMod" --volicon "./resources/icon.icns" --window-pos 200 120 --window-size 800 400 --icon-size 100 --app-drop-link 600 185 "CeleMod.dmg" "CeleMod.app" || true
191+
# If create-dmg fails, just zip the app
192+
if [ ! -f CeleMod.dmg ]; then
193+
zip -r "celemod-macos.zip" CeleMod.app
194+
fi
195+
- name: Prepare artifact
196+
run: |
197+
if [ -f CeleMod.dmg ]; then
198+
mv CeleMod.dmg celemod-macos.dmg
199+
else
200+
# Ensure zip exists
201+
if [ ! -f celemod-macos.zip ]; then
202+
zip -r "celemod-macos.zip" CeleMod.app
203+
fi
204+
fi
87205
- uses: actions/upload-artifact@v4.3.1
88206
with:
89-
name: osx-zip
90-
path: celemod-osx.zip
207+
name: macos-app
208+
path: |
209+
celemod-macos.dmg
210+
celemod-macos.zip
91211
release:
92212
runs-on: ubuntu-latest
93-
needs: [build-windows, build-linux, build-osx]
213+
needs: [build-windows, build-linux, build-macos]
94214
if: github.event_name == 'release'
95215
steps:
96216
- uses: actions/download-artifact@v4
@@ -107,7 +227,11 @@ jobs:
107227
path: .
108228
- uses: actions/download-artifact@v4
109229
with:
110-
name: osx-zip
230+
name: linux-appimage
231+
path: .
232+
- uses: actions/download-artifact@v4
233+
with:
234+
name: macos-app
111235
path: .
112236
- name: Prepare release files
113237
run: mv cele-mod.exe "cele-mod-no-dependencies.exe"
@@ -117,6 +241,8 @@ jobs:
117241
cele-mod-no-dependencies.exe
118242
celemod-windows.zip
119243
celemod-linux.zip
120-
celemod-osx.zip
244+
celemod-linux.AppImage
245+
celemod-macos.dmg
246+
celemod-macos.zip
121247
env:
122248
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ msgbox = "0.7.0"
2323
[target.'cfg(windows)'.dependencies]
2424
winapi = { version = "*", features = ["wincon", "consoleapi"] }
2525

26-
[target.'cfg(unix)'.dependencies]
26+
[target.'cfg(target_os = "linux")'.dependencies]
27+
include-bytes-zstd = "*"
28+
29+
[target.'cfg(target_os = "macos")'.dependencies]
2730

2831
[build-dependencies]
2932
winres = "0.1.12"

resources/dist.rc

27 Bytes
Binary file not shown.

resources/icon.icns

4.79 KB
Binary file not shown.

resources/icon.png

6.05 KB
Loading

src/celemod-ui/src/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
window-maximizable="true"
77
window-min-width="800px"
88
window-min-height="600px"
9+
window-icon="./Celemod.b5f3f7f9.png"
910
>
1011
<head>
1112
<meta charset="utf-8" />

src/main.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,36 @@ fn main() {
954954

955955
println!("CeleMod v{} ({})", env!("VERSION"), env!("GIT_HASH"));
956956

957+
// Linux: extract embedded libsciter.so at startup
958+
#[cfg(target_os = "linux")]
959+
{
960+
use std::io::Write;
961+
962+
let lib_name = "libsciter.so";
963+
let exe_dir = std::env::current_exe()
964+
.unwrap()
965+
.parent()
966+
.unwrap()
967+
.to_path_buf();
968+
let lib_path = exe_dir.join(lib_name);
969+
970+
if !lib_path.exists() {
971+
println!("Extracting {}...", lib_name);
972+
let lib_bytes = include_bytes_zstd::include_bytes_zstd!("../resources/libsciter.so", 19);
973+
let mut file = std::fs::File::create(&lib_path).expect("Failed to create libsciter.so");
974+
file.write_all(&lib_bytes).expect("Failed to write libsciter.so");
975+
976+
// Set library file permissions
977+
#[cfg(unix)]
978+
{
979+
use std::os::unix::fs::PermissionsExt;
980+
std::fs::set_permissions(&lib_path, std::fs::Permissions::from_mode(0o755))
981+
.expect("Failed to set permissions");
982+
}
983+
println!("{} extracted successfully", lib_name);
984+
}
985+
}
986+
957987
// windows only
958988
#[cfg(windows)]
959989
{

0 commit comments

Comments
 (0)