Files
kryon/tests/native_text_test.sh
T

30 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
set -eu
repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
. "$repo/tests/toolchain.sh"
cd "$repo"
build=$repo/build/text-shaping
mkdir -p "$build"
exec 9>"$build/lock"
flock 9
"$ziran" ir --project --root "$repo/tests" -o "$build/ir" "$repo/tests/cairo_text.zi"
for source in source saved; do
input=$repo/tests/cairo_text.zi
root=$repo/tests
if [ "$source" = saved ]; then input=$build/ir/cairo_text.zir; root=$build/ir; fi
for target in c; do
output=$build/$source-$target
"$ziran" build --project --target="$target" --no-main --root "$root" \
--module-path "$build/ir" --entry cairo_text:Run -o "$output" "$input"
suffix=c; header=h; compiler=${CC:-cc}; standard=c11
printf '#include "cairo_text.%s"\nint main(void) { return Run(); }\n' "$header" >"$output/driver.$suffix"
"$compiler" -std="$standard" -O2 -I"$ziran_root/include" -I"$output" \
"$output"/*."$suffix" $(pkg-config --libs pangocairo fontconfig freetype2) \
-lm -lpthread -ldl -o "$output/run"
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
-u SESSION_MANAGER -u GDK_DISPLAY YUE_DESKTOP_RECOVERY=0 \
KRYON_FONT_PATH="$repo/assets/fonts/LiberationSans-Regular.ttf" "$output/run"
done
done
echo 'Native shaping, typography, retained paint, RTL caret and style codecs: source/saved IR, C PASS'