if ab_match_arch loongarch64; then
    abinfo "Overriding Electron mirror for loongarch64 ..."
    export ELECTRON_MIRROR="https://github.com/darkyzhou/electron-loong64/releases/download/"
    export electron_use_remote_checksums=1
fi

abinfo "Installing pnpm dependencies ..."
# FIXME: [ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: abstract-socket@2.1.1, electron-winstaller@5.4.0, electron@39.8.6, esbuild@0.25.12, esbuild@0.27.7
# pnpm 11 defaults `strictDepBuilds` to true
export pnpm_config_strict_dep_builds=false
pnpm install

abinfo "Building Feishin ..."
pnpm run package:dev

abinfo "Installing Feishin ..."
install -dvm755 "$PKGDIR"/usr/lib/feishin
cp -rv "$SRCDIR"/dist/linux*-unpacked/* "$PKGDIR"/usr/lib/feishin/

abinfo "Creating symbolic link ..."
mkdir -pv "$PKGDIR"/usr/bin
ln -sv ../lib/feishin/feishin "$PKGDIR"/usr/bin/feishin

abinfo "Installing application icon ..."
install -Dvm644 "$SRCDIR"/resources/icon.png \
		"$PKGDIR"/usr/share/pixmaps/feishin.png
