app: package the UI icons and resolve assets at runtime

- the packager resources only carried assets/i18n, so installed builds
  showed blank toolbar glyphs: add assets/icons to the Windows/macOS
  packages and install it to /usr/share/oak/icons in the deb/rpm/pkg
  scripts;
- icon_path resolved through the compile-time CARGO_MANIFEST_DIR (the CI
  checkout path), which never exists on a user machine: search the
  runtime layouts instead — dev checkout, next to the executable,
  Contents/Resources, usr/lib/oak-editor (cargo-packager's deb/AppImage
  layout) and /usr/share/oak — mirroring the i18n pack search, which
  gains the same usr/lib/oak-editor candidate so the AppImage finds its
  language packs too.

Verified: oak-app 556 tests pass; the deb and rpm now carry
/usr/share/oak/icons/{dark,light}/*.png.
This commit is contained in:
2026-09-24 19:44:21 +08:00
parent c9ba8695fc
commit aba7298ab3
6 changed files with 58 additions and 6 deletions
+8
View File
@@ -40,4 +40,12 @@ package() {
for f in "$OAK_ROOT"/assets/i18n/*.yaml; do
install -Dm644 "$f" "$pkgdir/usr/share/oak/i18n/$(basename "$f")"
done
# The theme-aware UI glyphs (resolved at runtime from
# /usr/share/oak/icons; see crates/oak-app/src/oakui/icons.rs).
for d in "$OAK_ROOT"/assets/icons/*/; do
fam=$(basename "$d")
for f in "$d"*.png; do
install -Dm644 "$f" "$pkgdir/usr/share/oak/icons/$fam/$(basename "$f")"
done
done
}
+4
View File
@@ -39,6 +39,7 @@ STAGING=target/pkg/deb
rm -rf "$STAGING"
mkdir -p "$STAGING/usr/bin" "$STAGING/usr/share/applications" \
"$STAGING/usr/share/icons/hicolor/512x512/apps" "$STAGING/usr/share/oak/i18n" \
"$STAGING/usr/share/oak/icons" \
"$STAGING/usr/share/icons/hicolor/scalable/apps" "$STAGING/DEBIAN"
install -m755 target/release/oak-editor target/release/oak-cli target/release/oak-worker \
@@ -53,6 +54,9 @@ else
fi
install -m644 Oak_Icon.svg "$STAGING/usr/share/icons/hicolor/scalable/apps/oak.svg"
install -m644 assets/i18n/*.yaml "$STAGING/usr/share/oak/i18n/"
# The theme-aware UI glyphs (resolved at runtime from
# /usr/share/oak/icons; see crates/oak-app/src/oakui/icons.rs).
cp -a assets/icons/. "$STAGING/usr/share/oak/icons/"
# vcpkg's libva/libva-drm are shared libraries that FFmpeg links
# dynamically. Debian 12 / openKylin carry an older libva than FFmpeg 8
+4
View File
@@ -33,6 +33,7 @@ mkdir -p "$TOP"/{BUILD,RPMS,SOURCES,SPECS,BUILDROOT}
STAGE="$TOP/stage"
mkdir -p "$STAGE/usr/bin" "$STAGE/usr/share/applications" \
"$STAGE/usr/share/icons/hicolor/512x512/apps" "$STAGE/usr/share/oak/i18n" \
"$STAGE/usr/share/oak/icons" \
"$STAGE/usr/share/icons/hicolor/scalable/apps"
install -m755 target/release/oak-editor target/release/oak-cli target/release/oak-worker \
"$STAGE/usr/bin/"
@@ -40,6 +41,9 @@ install -m644 packaging/oak.desktop "$STAGE/usr/share/applications/oak.desktop"
install -m644 icons/icon.png "$STAGE/usr/share/icons/hicolor/512x512/apps/oak.png"
install -m644 Oak_Icon.svg "$STAGE/usr/share/icons/hicolor/scalable/apps/oak.svg"
install -m644 assets/i18n/*.yaml "$STAGE/usr/share/oak/i18n/"
# The theme-aware UI glyphs (resolved at runtime from
# /usr/share/oak/icons; see crates/oak-app/src/oakui/icons.rs).
cp -a assets/icons/. "$STAGE/usr/share/oak/icons/"
rpmbuild -bb \
--define "_topdir $TOP" \