#!/usr/bin/env bash set -euo pipefail project=$(cd -- "$(dirname -- "$0")" && pwd) source_dir="$project/build/Iosevka" if [[ ! -d "$source_dir" ]]; then git clone --depth 1 --branch v34.4.0 https://github.com/be5invis/Iosevka.git "$source_dir" fi cd "$source_dir" if [[ $(git rev-parse HEAD) != 8eb49cd124eb96e3817dd660f720c8d2885d2864 ]]; then echo 'Expected Iosevka v34.4.0 in build/Iosevka; remove that directory to reclone.' >&2 exit 1 fi if git apply --reverse --check "$project/patches/iosevka.patch" 2>/dev/null; then : # Already patched. elif git apply --check "$project/patches/iosevka.patch"; then git apply "$project/patches/iosevka.patch" else echo 'Expected a clean v34.4.0 checkout or this exact Koeln patch in build/Iosevka.' >&2 exit 1 fi cp "$project"/iocgn-*.mjs packages/font-glyphs/ npm ci node --input-type=module - "$project/build-plan.toml" <<'JS' import fs from 'node:fs'; import * as toml from '@iarna/toml'; const config = toml.parse(fs.readFileSync(process.argv[2], 'utf8')); fs.writeFileSync('private-build-plans.toml', toml.stringify({buildPlans: config.buildPlans})); // Verda tracks .mjs sources, so a module rebuilds the masters when only the config changes. fs.writeFileSync('packages/font-glyphs/iocgn-config.mjs', `export default ${JSON.stringify(config)};\n`); JS npm run build -- ttf-unhinted::iocgnMono --jCmd=2 mkdir -p "$project/build/native" cp private-build-plans.toml "$project/build/native/build-plan.toml" cp dist/iocgnMono/TTF-Unhinted/*.ttf "$project/build/native/" python3 "$project/tools/masters.py" python3 "$project/tools/oblique.py" python3 "$project/tools/combine.py" python3 "$project/tools/woff2.py" python3 "$project/tools/render_variable.py" python3 "$project/tools/render.py"