The Japanese fonts (BIZ UDPGothic Regular/Bold for the UI, BIZ UDMincho for text watermarks; #110, #114) now come from storytold/craft-fonts instead of assets/fonts/. - crates/engine/build.rs: the craft-fonts recipe. With CRAFT_FONTS_DIR set it embeds the manifest's fonts as lightcraft_engine::CRAFT_FONTS (wasm32: BIZ UDPGothic Regular only, for the web size budget); unset, CRAFT_FONTS is empty. Local files only, no network; craft-fonts is not in any Cargo.toml. - UI: theme::font_definitions adds the Japanese faces after Inter and egui's defaults in every family (BIZ UDPGothic first, Bold first for semibold). About box lists the embedded families. - Watermarks: Inter, then the craft-fonts Japanese faces (Mincho first). - Removed BIZUDPGothic-Regular/Bold.ttf, BIZUDMincho-Regular.ttf and their OFL files, and their ATTRIBUTION rows; added an attribution row for craft-fonts as an optional build input; NOTICE updated. - Tests: Japanese glyph tests use CRAFT_FONTS and skip without it; new tests for Japanese in the UI with craft-fonts and for the UI and watermarks without it. - CI: the FreeBSD job builds/tests with craft-fonts. Releases check out craft-fonts at a pinned commit, build with CRAFT_FONTS_DIR + CRAFT_FONTS_REQUIRED=1, and ship the fonts' OFL licences (plus NOTICE) in every package. - Docs: AGENTS.md, CLAUDE.md, README, docs/web.md, docs/localization-ja.md, ROADMAP, parity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
73 lines
2.7 KiB
Bash
73 lines
2.7 KiB
Bash
# shellcheck shell=bash
|
|
# Shared setup for the packaging scripts. Source it: `. "$(dirname "$0")/../env.sh"`.
|
|
#
|
|
# Exports:
|
|
# ROOT workspace root
|
|
# VERSION [workspace.package] version from Cargo.toml (override: LIGHTCRAFT_VERSION)
|
|
# DIST output directory for release artifacts (default: $ROOT/dist/release)
|
|
# LIGHTCRAFT_BUILD_SHA git commit baked into the binaries (see crates/engine/src/build_info.rs)
|
|
# LIGHTCRAFT_BUILD_DATE UTC build date, YYYY-MM-DD
|
|
# CARGO_TARGET_DIR cargo's target dir (default: $ROOT/target)
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
export ROOT
|
|
|
|
# The version lives in exactly one place: `[workspace.package] version` in the root Cargo.toml.
|
|
# (`cargo xtask version` prints the same thing; awk avoids compiling xtask here.)
|
|
workspace_version() {
|
|
awk '
|
|
/^\[/ { in_pkg = ($0 == "[workspace.package]") ; next }
|
|
in_pkg && $1 == "version" { gsub(/[" ]/, "", $3); print $3; exit }
|
|
' "$ROOT/Cargo.toml"
|
|
}
|
|
|
|
VERSION="${LIGHTCRAFT_VERSION:-$(workspace_version)}"
|
|
if [ -z "$VERSION" ]; then
|
|
echo "error: could not read [workspace.package] version from $ROOT/Cargo.toml" >&2
|
|
exit 1
|
|
fi
|
|
export VERSION
|
|
|
|
DIST="${DIST:-$ROOT/dist/release}"
|
|
mkdir -p "$DIST"
|
|
export DIST
|
|
|
|
if [ -z "${LIGHTCRAFT_BUILD_SHA:-}" ]; then
|
|
LIGHTCRAFT_BUILD_SHA="$(git -C "$ROOT" rev-parse HEAD 2>/dev/null || true)"
|
|
fi
|
|
export LIGHTCRAFT_BUILD_SHA
|
|
export LIGHTCRAFT_BUILD_DATE="${LIGHTCRAFT_BUILD_DATE:-$(date -u +%Y-%m-%d)}"
|
|
export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$ROOT/target}"
|
|
|
|
# Emit a GitHub Actions warning (plain stderr outside Actions).
|
|
warn() {
|
|
if [ -n "${GITHUB_ACTIONS:-}" ]; then echo "::warning::$*"; else echo "warning: $*" >&2; fi
|
|
}
|
|
|
|
# Copy licence and readme files that exist into a package directory (plus the craft-fonts licences
|
|
# when building with CRAFT_FONTS_DIR).
|
|
copy_docs() {
|
|
local dest="$1" f
|
|
for f in README.md LICENSE LICENSE-MIT LICENSE-APACHE COPYRIGHT NOTICE; do
|
|
if [ -f "$ROOT/$f" ]; then cp "$ROOT/$f" "$dest/"; fi
|
|
done
|
|
copy_font_licences "$dest"
|
|
}
|
|
|
|
# Builds made with CRAFT_FONTS_DIR (storytold/craft-fonts, an optional build input) embed its fonts;
|
|
# their OFL licences go with the package as OFL-<family-dir>.txt. Nothing to do without it.
|
|
copy_font_licences() {
|
|
local dest="$1" lic family
|
|
[ -n "${CRAFT_FONTS_DIR:-}" ] || return 0
|
|
for lic in "$CRAFT_FONTS_DIR"/fonts/*/OFL.txt; do
|
|
[ -f "$lic" ] || continue
|
|
family="$(basename "$(dirname "$lic")")"
|
|
cp "$lic" "$dest/OFL-$family.txt"
|
|
done
|
|
}
|
|
|
|
# Portable SHA-256 of a file (prints just the hash).
|
|
sha256() {
|
|
if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi
|
|
}
|