Skip to content

Commit 8c3f74a

Browse files
committed
feat: update Windows build process and add embedded resources
1 parent 78e9cb8 commit 8c3f74a

9 files changed

Lines changed: 119 additions & 34 deletions

File tree

.github/workflows/release-windows.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ jobs:
6060
mingw-w64-clang-x86_64-gtk4
6161
mingw-w64-clang-x86_64-gtksourceview5
6262
mingw-w64-clang-x86_64-libadwaita
63-
mingw-w64-clang-x86_64-imagemagick
6463
mingw-w64-clang-x86_64-openssl
6564
mingw-w64-clang-x86_64-pkg-config
6665
mingw-w64-clang-x86_64-toolchain
@@ -119,18 +118,6 @@ jobs:
119118
cp /clang64/ssl/certs/ca-bundle.crt "$bundle/ssl/certs/" 2>/dev/null || true
120119
cp /clang64/etc/ssl/certs/ca-bundle.crt "$bundle/ssl/certs/" 2>/dev/null || true
121120
122-
cat > "$bundle/aetheris.bat" <<'EOF'
123-
@echo off
124-
set "AETHERIS_DIR=%~dp0"
125-
set "PATH=%AETHERIS_DIR%bin;%PATH%"
126-
set "XDG_DATA_DIRS=%AETHERIS_DIR%share"
127-
set "GSETTINGS_SCHEMA_DIR=%AETHERIS_DIR%share\glib-2.0\schemas"
128-
set "GDK_PIXBUF_MODULEDIR=%AETHERIS_DIR%lib\gdk-pixbuf-2.0\2.10.0\loaders"
129-
set "GIO_MODULE_DIR=%AETHERIS_DIR%lib\gio\modules"
130-
set "SSL_CERT_FILE=%AETHERIS_DIR%ssl\certs\ca-bundle.crt"
131-
"%AETHERIS_DIR%bin\aetheris.exe" %*
132-
EOF
133-
134121
(
135122
cd target/windows
136123
zip -r "../../dist/${{ steps.names.outputs.windows_name }}" aetheris
@@ -146,18 +133,9 @@ jobs:
146133
shell: msys2 {0}
147134
run: |
148135
set -euo pipefail
149-
mkdir -p target/windows
150-
magick \
151-
data/icons/hicolor/64x64/apps/org.luminusos.Aetheris.png \
152-
data/icons/hicolor/128x128/apps/org.luminusos.Aetheris.png \
153-
data/icons/hicolor/256x256/apps/org.luminusos.Aetheris.png \
154-
data/icons/hicolor/512x512/apps/org.luminusos.Aetheris.png \
155-
target/windows/aetheris.ico
156-
cp target/windows/aetheris.ico target/windows/aetheris/aetheris.ico
157-
158136
source_dir="$(cygpath -w "$(pwd)/target/windows/aetheris")"
159137
output_dir="$(cygpath -w "$(pwd)/dist")"
160-
setup_icon_file="$(cygpath -w "$(pwd)/target/windows/aetheris.ico")"
138+
setup_icon_file="$(cygpath -w "$(pwd)/data/icons/windows/aetheris.ico")"
161139
inno_script="$(cygpath -w "$(pwd)/build-aux/inno/aetheris.iss")"
162140
163141
MSYS2_ARG_CONV_EXCL='*' iscc \

Cargo.lock

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-aux/inno/aetheris.iss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ AppSupportURL=https://github.com/luminusOS/aetheris/issues
3232
AppUpdatesURL=https://github.com/luminusOS/aetheris/releases
3333
DefaultDirName={localappdata}\Programs\Aetheris
3434
DefaultGroupName=Aetheris
35-
UninstallDisplayIcon={app}\aetheris.ico
35+
UninstallDisplayIcon={app}\bin\aetheris.exe
3636
OutputDir={#OutputDir}
3737
OutputBaseFilename=aetheris-setup
3838
Compression=lzma2/ultra64
@@ -66,9 +66,9 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
6666
Source: "{#SourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
6767

6868
[Icons]
69-
Name: "{group}\Aetheris"; Filename: "{app}\aetheris.bat"; IconFilename: "{app}\aetheris.ico"
69+
Name: "{group}\Aetheris"; Filename: "{app}\bin\aetheris.exe"
7070
Name: "{group}\Uninstall Aetheris"; Filename: "{uninstallexe}"
71-
Name: "{autodesktop}\Aetheris"; Filename: "{app}\aetheris.bat"; IconFilename: "{app}\aetheris.ico"; Tasks: desktopicon
71+
Name: "{autodesktop}\Aetheris"; Filename: "{app}\bin\aetheris.exe"; Tasks: desktopicon
7272

7373
[Run]
74-
Filename: "{app}\aetheris.bat"; Description: "Launch Aetheris"; Flags: nowait postinstall skipifnotsilent
74+
Filename: "{app}\bin\aetheris.exe"; Description: "Launch Aetheris"; Flags: nowait postinstall skipifnotsilent

crates/aetheris-app/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,6 @@ vte4 = "0.10"
7676

7777
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
7878
gettext-rs = { version = "0.7", features = ["gettext-system"] }
79+
80+
[target.'cfg(target_os = "windows")'.build-dependencies]
81+
embed-resource = "3.0.11"

crates/aetheris-app/aetheris.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 ICON "../../data/icons/windows/aetheris.ico"

crates/aetheris-app/build.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
fn main() {
2+
#[cfg(target_os = "windows")]
3+
{
4+
println!("cargo:rerun-if-changed=aetheris.rc");
5+
println!("cargo:rerun-if-changed=../../data/icons/windows/aetheris.ico");
6+
embed_resource::compile("aetheris.rc", embed_resource::NONE)
7+
.manifest_required()
8+
.unwrap();
9+
}
10+
}

crates/aetheris-app/src/app/ansi.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ pub(super) fn setup_log_highlighting(buffer: &gtk::TextBuffer) {
1515
ensure_text_tag(buffer, "ansi-fg-white", &[("foreground", &"#f6f5f4")]);
1616
}
1717

18-
/// Appends `line` to `buffer`, translating ANSI SGR color/bold escape
19-
/// codes (the ones frameworks like Logback/Spring Boot emit for console
20-
/// output) into GTK text tags instead of leaving the raw escape bytes in
21-
/// the log text.
2218
pub(super) fn insert_ansi_line(buffer: &gtk::TextBuffer, line: &str) {
2319
let mut iter = buffer.end_iter();
2420
for (text, tags) in parse_ansi_line(line) {
@@ -33,8 +29,6 @@ pub(super) fn insert_ansi_line(buffer: &gtk::TextBuffer, line: &str) {
3329
}
3430
}
3531

36-
/// Splits `line` into (text, active-tag-names) segments, dropping the
37-
/// escape sequences themselves from the text.
3832
fn parse_ansi_line(line: &str) -> Vec<(String, Vec<&'static str>)> {
3933
let mut segments = Vec::new();
4034
let mut current_text = String::new();
@@ -46,7 +40,7 @@ fn parse_ansi_line(line: &str) -> Vec<(String, Vec<&'static str>)> {
4640
current_text.push(ch);
4741
continue;
4842
}
49-
chars.next(); // consume '['
43+
chars.next();
5044

5145
let mut code = String::new();
5246
let mut terminator = None;

crates/aetheris-app/src/main.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,56 @@
1+
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
2+
13
mod app;
24

35
use relm4::RelmApp;
46

57
pub const APP_ID: &str = "org.luminusos.Aetheris";
68
pub const GETTEXT_PACKAGE: &str = APP_ID;
79

10+
#[cfg(windows)]
11+
fn configure_bundled_runtime() {
12+
let Ok(exe) = std::env::current_exe() else {
13+
return;
14+
};
15+
let Some(root) = exe.parent().and_then(|bin| bin.parent()) else {
16+
return;
17+
};
18+
19+
let share = root.join("share");
20+
let vars = [
21+
("XDG_DATA_DIRS", share.clone()),
22+
(
23+
"GSETTINGS_SCHEMA_DIR",
24+
share.join("glib-2.0").join("schemas"),
25+
),
26+
(
27+
"GDK_PIXBUF_MODULEDIR",
28+
root.join("lib")
29+
.join("gdk-pixbuf-2.0")
30+
.join("2.10.0")
31+
.join("loaders"),
32+
),
33+
(
34+
"GIO_MODULE_DIR",
35+
root.join("lib").join("gio").join("modules"),
36+
),
37+
(
38+
"SSL_CERT_FILE",
39+
root.join("ssl").join("certs").join("ca-bundle.crt"),
40+
),
41+
];
42+
43+
for (key, value) in vars {
44+
// SAFETY: called once, single-threaded, before GTK/GLib or any other
45+
// thread reads the environment.
46+
unsafe { std::env::set_var(key, value) };
47+
}
48+
}
49+
850
fn main() {
51+
#[cfg(windows)]
52+
configure_bundled_runtime();
53+
954
app::i18n::init();
1055

1156
tracing_subscriber::fmt()

data/icons/windows/aetheris.ico

178 KB
Binary file not shown.

0 commit comments

Comments
 (0)