From a9d73913f518f3c9f514e769733d01b318d358cb Mon Sep 17 00:00:00 2001 From: Guoliang Chen Date: Tue, 25 Aug 2026 10:33:15 -0700 Subject: [PATCH] Cross-platform release: x86_64 macOS, Linux, Windows; author metadata tools/release.sh --cross builds, next to the host Apple Silicon pair, x86_64-apple-darwin (runs under Rosetta here, full smoke passed), x86_64-unknown-linux-musl (static, no glibc dependency) and x86_64-pc-windows-gnu (.exe depending only on DLLs Windows 10+ ships, audited). The rustup stable toolchain is addressed by absolute path so the Homebrew rust on PATH keeps owning day-to-day builds; the musl link needs DYLD_FALLBACK_LIBRARY_PATH for rust-lld's libLLVM, the Windows link needs mingw-w64's import libraries - both encoded in the script and RELEASING.md so nobody rediscovers them. Author metadata: Cargo.toml authors, package.json publisher guoliangchen + author, LICENSE holder - all Guoliang Chen. Co-Authored-By: Claude Fable 5 --- Cargo.toml | 1 + LICENSE | 2 +- TODO.md | 3 ++- editors/vscode/README.md | 2 +- editors/vscode/package.json | 3 ++- tools/RELEASING.md | 33 ++++++++++++++++++++++- tools/release.sh | 52 +++++++++++++++++++++++++++++++++---- 7 files changed, 86 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6664b24..95b94a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ members = [ [workspace.package] version = "0.5.0" +authors = ["Guoliang Chen"] edition = "2021" license = "MIT" diff --git a/LICENSE b/LICENSE index 3ed2908..a39c302 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 lucio +Copyright (c) 2026 Guoliang Chen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/TODO.md b/TODO.md index f94f810..8ebcd97 100644 --- a/TODO.md +++ b/TODO.md @@ -565,7 +565,8 @@ later: **Publishing (owner actions):** fully optional and deferred per the owner (2026-08-19) — sideloading the `.vsix` is the supported path. If it is ever revisited, only the owner can do it: create a Marketplace publisher id and - replace `REPLACE-ME`, hold the `vsce`/`ovsx` tokens, supply an extension + replace `REPLACE-ME` (done 2026-08-25: publisher `guoliangchen`, author + Guoliang Chen), hold the `vsce`/`ovsx` tokens, supply an extension icon, and confirm the public repo URL. Commands are in `tools/RELEASING.md`'s appendix. diff --git a/editors/vscode/README.md b/editors/vscode/README.md index a24d04c..119ca8a 100644 --- a/editors/vscode/README.md +++ b/editors/vscode/README.md @@ -64,7 +64,7 @@ Code and press F5. That starts an Extension Development Host with the extension loaded from disk, with no packaging step. **Sideloading is the supported install.** Marketplace publishing is optional -and deferred: `publisher` is the literal placeholder `REPLACE-ME`, so +and deferred: `publisher` is `guoliangchen` (unregistered on any marketplace), so `vsce publish` would fail, while packaging a `.vsix` and installing it locally works exactly as above. `tools/RELEASING.md` records what publishing would take if it ever happens. diff --git a/editors/vscode/package.json b/editors/vscode/package.json index b4172e7..4403d51 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -3,7 +3,8 @@ "displayName": "vfmt — Verilog/SystemVerilog", "description": "Formatting, diagnostics, navigation and semantic highlighting for Verilog and SystemVerilog, served by the vfmt language server.", "version": "0.5.0", - "publisher": "REPLACE-ME", + "publisher": "guoliangchen", + "author": "Guoliang Chen", "license": "MIT", "repository": { "type": "git", diff --git a/tools/RELEASING.md b/tools/RELEASING.md index a824ffc..59a18f8 100644 --- a/tools/RELEASING.md +++ b/tools/RELEASING.md @@ -6,6 +6,36 @@ supported way to install the VS Code extension is to sideload the `.vsix` that `tools/release.sh` produces. Marketplace publishing is optional and deferred — it lives in the appendix at the bottom. +## Cross-platform builds (`--cross`) + +`tools/release.sh --cross` adds, next to the host (Apple Silicon) pair: +`x86_64-apple-darwin` (Intel Mac), `x86_64-unknown-linux-musl` (any x86-64 +Linux — statically linked, no glibc dependency) and `x86_64-pc-windows-gnu` +(`.exe`, depends only on DLLs Windows 10+ ships). The `.vsix` is +platform-independent JavaScript; only the binaries are per-platform. + +One-time setup on the build Mac (2026-08-25, all via Homebrew): + +```bash +brew install rustup mingw-w64 +/opt/homebrew/opt/rustup/bin/rustup toolchain install stable --profile minimal +/opt/homebrew/opt/rustup/bin/rustup target add --toolchain stable \ + x86_64-apple-darwin x86_64-unknown-linux-musl x86_64-pc-windows-gnu +``` + +Notes the script encodes so nobody rediscovers them: the Homebrew *rust* +package stays the project's day-to-day toolchain (rustup is keg-only and +never on PATH; the script addresses `~/.rustup/toolchains/.../bin` +absolutely, with `RUSTC` pinned so cargo cannot fall back to the PATH +rustc, which lacks the cross std libs). The musl build links with +`rust-lld`, which needs `DYLD_FALLBACK_LIBRARY_PATH` pointed at the +toolchain's `lib/` — its own rpath misses `libLLVM.dylib` in rustup's +layout. The Windows build needs mingw-w64 for the import libraries +(`libkernel32.a` and friends); rust's self-contained mode does not carry +them. Only the host binaries can be smoke-tested here (the Intel-Mac pair +also runs under Rosetta and is); Linux and Windows artifacts are +file-type- and DLL-audited, not executed. + ## 1. Bump the version Four files, one number. Keep them identical. @@ -139,7 +169,8 @@ the information is not lost, not as a checklist step. What would have to change first: - `editors/vscode/package.json`'s `publisher` is the literal string - `REPLACE-ME`. `vsce publish` fails until it is a real publisher id the owner + `guoliangchen` (author: Guoliang Chen). Marketplace publishing would still need +that id registered with vsce by the owner has created in the Visual Studio Marketplace. - An **icon** (128×128 PNG, `"icon"` in `package.json`) and optionally a `galleryBanner`. Deliberately not added: binary brand assets are the owner's diff --git a/tools/release.sh b/tools/release.sh index 4a7c65c..d0bc968 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -8,10 +8,12 @@ # dist/SHA256SUMS # # Standard tooling only -- cargo, npm and shasum, nothing installed globally. -# This does not cross-compile and does not publish anything anywhere; see -# tools/RELEASING.md for the whole checklist. +# With --cross it also builds x86_64 macOS, static-musl Linux and Windows +# binaries, when the toolchains are present (rustup stable + the three +# targets, and mingw-w64 for Windows; see tools/RELEASING.md). It publishes +# nothing anywhere. # -# Usage: tools/release.sh [-o dist-dir] [--no-vsix] +# Usage: tools/release.sh [-o dist-dir] [--no-vsix] [--cross] # # Exit status: 0 if every requested artifact was built and checksummed. @@ -20,12 +22,14 @@ set -eu repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) dist=$repo_root/dist want_vsix=1 +want_cross=0 while [ $# -gt 0 ]; do case $1 in -o) dist=$2; shift 2 ;; --no-vsix) want_vsix=0; shift ;; - *) echo "usage: $0 [-o dist-dir] [--no-vsix]" >&2; exit 2 ;; + --cross) want_cross=1; shift ;; + *) echo "usage: $0 [-o dist-dir] [--no-vsix] [--cross]" >&2; exit 2 ;; esac done @@ -49,6 +53,44 @@ mkdir -p "$dist" cp "$repo_root/target/release/vfmt" "$dist/vfmt-$version-$host" cp "$repo_root/target/release/vfmt-server" "$dist/vfmt-server-$version-$host" +# Cross targets: each built only if its toolchain is available, each an +# explicit failure otherwise -- a release with silently missing platforms is +# worse than one that says why. The rustup toolchain is addressed by absolute +# path so the Homebrew rust on PATH keeps owning the host build above. +cross_built="" +if [ "$want_cross" -eq 1 ]; then + tc=$HOME/.rustup/toolchains/stable-aarch64-apple-darwin + if [ ! -x "$tc/bin/cargo" ]; then + echo "error: --cross needs the rustup stable toolchain (see tools/RELEASING.md)" >&2 + exit 2 + fi + cross_build() { # triple, extra env as VAR=VAL args + triple=$1; shift + echo "==> building for $triple" + env RUSTC="$tc/bin/rustc" "$@" \ + "$tc/bin/cargo" build --release --manifest-path "$repo_root/Cargo.toml" \ + --target "$triple" -p vfmt -p vfmt_server + } + exe="" + cross_build x86_64-apple-darwin + cross_build x86_64-unknown-linux-musl \ + DYLD_FALLBACK_LIBRARY_PATH="$tc/lib" \ + CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=rust-lld + if command -v x86_64-w64-mingw32-gcc >/dev/null 2>&1; then + cross_build x86_64-pc-windows-gnu \ + CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc + else + echo "error: --cross needs mingw-w64 for the Windows build (brew install mingw-w64)" >&2 + exit 2 + fi + for triple in x86_64-apple-darwin x86_64-unknown-linux-musl x86_64-pc-windows-gnu; do + case $triple in *windows*) exe=.exe ;; *) exe="" ;; esac + cp "$repo_root/target/$triple/release/vfmt$exe" "$dist/vfmt-$version-$triple$exe" + cp "$repo_root/target/$triple/release/vfmt-server$exe" "$dist/vfmt-server-$version-$triple$exe" + cross_built="$cross_built vfmt-$version-$triple$exe vfmt-server-$version-$triple$exe" + done +fi + # Prove the server binary still speaks LSP before it is handed to anyone. # `smoke.js` is plain node with no dependencies, so this runs before `npm ci`. if command -v node >/dev/null 2>&1; then @@ -73,7 +115,7 @@ if [ "$want_vsix" -eq 1 ]; then fi echo "==> checksums" -artifacts="vfmt-$version-$host vfmt-server-$version-$host" +artifacts="vfmt-$version-$host vfmt-server-$version-$host$cross_built" if [ "$want_vsix" -eq 1 ]; then artifacts="$artifacts vfmt-$version.vsix" fi