Files
Shuery 9f07f2f2db 🛠️ fix(tools): 修正安装流程及打包参数的错误描述。
- 修正 `install-font.sh` 采用单次 `sudo pacman -U` 的批量安装说明。
- 补充 `options=('!debug')` 与 `conflicts` 历史遗留包名的相关说明。
- 更新 Mermaid 流程图,反映“先全部构建、后一次性安装”的两阶段流程。
- 同步中英文双语文档 (`README.md` 与 `README-en.md`)。
2026-11-21 21:11:12 +08:00

208 lines
8.3 KiB
Markdown

# Sarasa Gothic Nerd Fonts
[![AUR Version](https://img.shields.io/aur/version/ttf-sarasa-mono-sc-nerd-font?label=AUR&logo=archlinux)](https://aur.archlinux.org/packages/ttf-sarasa-mono-sc-nerd-font)
[![AUR Popularity](https://img.shields.io/aur/popularity/ttf-sarasa-nerd-font?label=popularity&logo=archlinux)](https://aur.archlinux.org/packages/ttf-sarasa-nerd-font)
[![License: OFL-1.1](https://img.shields.io/badge/font_license-OFL--1.1-blue)](aur-packages/LICENSE)
Independent AUR packages for every Sarasa Gothic Nerd Font variant —— **48 standalone font packages**
across 8 styles and 6 orthographies, plus metapackages at orthography, style, and collection level
(63 package bases in total).
> [!NOTE]
>
> Sarasa Gothic itself is a CJK programming font built on Iosevka and Source Han Sans,
> licensed under the SIL Open Font License 1.1. This repository only packages the Nerd Font
> patched builds; it does not modify the font data.
## Package layout
```text
aur-packages/
├── ttf-sarasa-<style>-<orthography>-nerd-font/ # standalone: 1 ZIP → 1 package (48)
├── ttf-sarasa-<orthography>-nerd-font/ # metapackage: all styles for one orthography (6)
├── ttf-sarasa-<style>-nerd-font/ # metapackage: all orthographies for one style (8)
└── ttf-sarasa-nerd-font/ # metapackage: all 48 standalone packages (1)
```
- `aur-packages/ttf-sarasa-<style>-<orthography>-nerd-font/` contains one standalone font package.
Each PKGBUILD downloads and packages only its matching upstream ZIP.
- `aur-packages/ttf-sarasa-<orthography>-nerd-font/` is a metapackage depending on all styles for one orthography.
- `aur-packages/ttf-sarasa-<style>-nerd-font/` is a metapackage depending on all orthographies for one style.
- `aur-packages/ttf-sarasa-nerd-font/` is a metapackage depending on all 48 standalone font packages.
Each directory under `aur-packages/` is an independent AUR package base.
Publish that directory's `PKGBUILD` and generated `.SRCINFO` to the matching AUR repository.
The root directory contains only shared metadata, source data, and tools.
Every generated PKGBUILD declares `conflicts=('ttf-sarasa-gothic-nerd-fonts')`.
That is the legacy aggregate package name, not the current metapackage:
the declaration lets pacman replace an old install instead of refusing it.
The root `LICENSE` is reserved for this repository's license.
The upstream font's SIL Open Font License is stored at `aur-packages/LICENSE`
and is used as the checksum source for font packages.
Per Arch font packaging guidelines, that license is installed under
`/usr/share/licenses/<pkgname>/` in each package.
> [!TIP]
>
> 48 standalone packages across 8 styles and 6 orthographies can look overwhelming.
> Start with a metapackage —— `ttf-sarasa-nerd-font` pulls in everything,
> while `ttf-sarasa-mono-sc-nerd-font` gives you just Mono + Simplified Chinese.
## Publish to AUR
The publishing helper supports first submissions and updates.
First, prepare upload archives containing only `PKGBUILD` and `.SRCINFO`:
```bash
bash tools/publish-aur.sh prepare
```
This creates one tarball per package in `aur-upload/` (all 63 packages under `aur-packages/`).
Upload each tarball through the AUR website's package submission page.
You can prepare selected packages by listing their package bases,
replace existing archives with `--force`,
or set `AUR_UPLOAD_DIR` to choose another output directory.
After the AUR package exists, updates can be pushed with:
```bash
bash tools/publish-aur.sh push ttf-sarasa-mono-sc-nerd-font
```
The script clones the matching AUR repository into `aur-repos/` if needed,
verifies its remote, refuses to overwrite a dirty checkout,
stages only `PKGBUILD` and `.SRCINFO`, commits, and pushes to `master`.
Set `AUR_REPO_DIR` to use another clone directory.
Use `push --all` only when intentionally updating every package.
The local ZIPs are never included in upload tarballs or Git commits.
> [!WARNING]
>
> `push --all` iterates over every package base under `aur-packages/`.
> Run it only when you have regenerated and verified the whole collection ——
> a single stale `.SRCINFO` will be pushed alongside the intended updates.
## Install from this checkout
Build and install one font package from the local checkout:
```bash
bash tools/install-font.sh ttf-sarasa-mono-sc-nerd-font
```
You can also select a style, orthography, or full collection metapackage.
The installer reads `.SRCINFO`, resolves local dependencies from `aur-packages/`,
builds every selected package with `makepkg --nodeps`, and installs all of them
in **one** `pacman -U` transaction; use `--dry-run` to review the order without
touching the system:
```bash
bash tools/install-font.sh --dry-run ttf-sarasa-ui-nerd-font
```
> [!IMPORTANT]
>
> `install-font.sh` builds as your regular user but installs with a single
> `sudo pacman -U` at the end, so the pacman confirmation prompt appears once
> for the whole batch rather than once per package. Running the script as root
> is refused, because `makepkg` must not run as root.
`pacman -U --needed` skips a package when the installed version is not older
than the one being built. If you rebuilt the same `pkgver`/`pkgrel` with
different contents, drop `--needed` (or remove the package first) to force
the reinstall.
## Regenerate packages
Edit version, checksums, and bilingual names in `package-data.sh`, then run:
```bash
bash tools/generate-packages.sh --force
```
The generator writes each standalone PKGBUILD with one font ZIP source,
produces `.SRCINFO` files using `makepkg`, and refreshes all 63 packages under `aur-packages/`,
including the all-font metapackage.
Every generated PKGBUILD carries `options=('!debug')`, so `makepkg` produces no
separate `-debug` subpackage and `install-font.sh` never has to filter one out.
```mermaid
flowchart LR
A[package-data.sh<br/>version / checksums / names] --> B[generate-packages.sh --force]
B --> C[48 standalone PKGBUILDs<br/>1 ZIP + LICENSE each]
B --> D[15 metapackage PKGBUILDs<br/>orthography / style / collection]
C --> E[makepkg --printsrcinfo]
D --> E
E --> F[aur-packages/<br/>PKGBUILD + .SRCINFO]
F --> G[publish-aur.sh prepare]
F --> H[install-font.sh]
H --> I[makepkg --nodeps for every selected package]
I --> J[single sudo pacman -U]
G --> K[aur-upload/*.tar.gz]
```
## Update checksums
Update checksums and regenerate package metadata with:
```bash
bash tools/update-checksums.sh
```
The default mode compares each ZIP with the `pkgver` and first `sha256sums` entry in its `.SRCINFO`.
Missing ZIPs, stale `.SRCINFO`, old-version ZIPs, or modified ZIPs are downloaded
from the release selected by `pkgver` into their corresponding package directories.
To force-refresh all 48 ZIPs, use:
```bash
bash tools/update-checksums.sh --download
```
To prefer SHA-256 digests reported by GitHub's Release Assets API, use:
```bash
bash tools/update-checksums.sh --api
```
The API's `digest` field can be null or unavailable.
A matching API digest can validate a cached ZIP;
otherwise the script uses `.SRCINFO` to verify its version and hash,
downloading it when stale or unknown.
`--download` forces a refresh even when the API digest matches.
An optional GitHub token can raise the API rate limit.
Export it only in the current shell, then run the API mode:
```bash
export GITHUB_TOKEN='your-token'
bash tools/update-checksums.sh --api
unset GITHUB_TOKEN
```
The token is sent only in the API request and is not written to package files.
Font LICENSE checksums are calculated from `aur-packages/LICENSE`.
> [!CAUTION]
>
> The API `digest` field is not guaranteed to be present.
> When it is missing, `--api` silently falls back to `.SRCINFO` verification ——
> a green API run does not prove every ZIP matched an API digest.
> Use `--download` when you need a guaranteed full refresh.
## Requirements
- Arch Linux or an Arch-based system with `base-devel` and `pacman`.
- `bash`, `curl`, `makepkg`, and `sha256sum` available in `PATH`.
- Network access to `github.com` and `aur.archlinux.org` for publishing and checksum refresh.
- AUR account with SSH key configured for `publish-aur.sh push`.
## License
This repository's own code and metadata are covered by the root `LICENSE`.
The font data and the upstream SIL Open Font License are stored at `aur-packages/LICENSE`
and remain under OFL-1.1.