No package carried ONNX Runtime: tools/yams-cli tried to install_subdir()
the runtime's libdir, but read it with get_variable('libdir') from the
dependency meson.build had already normalized into a declare_dependency,
which has no variables, so it installed nothing. Packaged ONNX and Glint
plugins therefore only worked where the user had installed a compatible
runtime themselves.
meson.build now records the directories it resolved ONNX Runtime from,
and the runtime install bundles the shared library from the first that
holds one into <libdir>/yams/onnxruntime/ (install tag runtime). A small
configure-time helper (scripts/list-onnxruntime-libs.py) lists the real
files and the soname symlinks, so the chain libonnxruntime.so ->
.so.1 -> .so.1.23.0 is recreated instead of tripled, and only the core
library and providers_shared are taken (no static archives, CMake or
pkg-config files). The plugins use this copy only when no compatible
system copy exists. Windows is unchanged: onnxruntime.dll already ships
next to the executables in the MSI and is found by the loader search.
- scripts/split-debug-symbols.sh leaves the bundled runtime
byte-identical: it is an upstream release build, already stripped, and
re-stripping would void a macOS code signature.
- install_surface_policy: <libdir>/yams/onnxruntime/* is allowed and
exempt from first-party export/hardening checks; the Glint size budget
grows to 850,000 bytes (711,352 measured with real ONNX Runtime code).
- Homebrew formulas depend on Homebrew's onnxruntime, which the plugins
prefer, so they drop the archive's private copy (rm_rf
lib/yams/onnxruntime).
- Arch: optdepends now reads 'onnxruntime: use the system ONNX Runtime
instead of the bundled copy' (PKGBUILD and the CI .PKGINFO).
Measured on grim (Linux x86_64 release, --with-onnx, stripped staged
payload): 87,883,247 -> 110,236,706 bytes (+22.4 MB: the 22,207,288-byte
libonnxruntime.so.1.23.0, 14,632-byte providers_shared, and +111 KB of
real GLiNER code in yams_glint.so).
Signed-off-by: trvon <me@trevon.dev>
121 lines
4.4 KiB
Text
121 lines
4.4 KiB
Text
class YamsNightly < Formula
|
|
desc "Yet Another Memory System - High-performance content-addressed storage (Nightly)"
|
|
homepage "https://github.com/trvon/yams"
|
|
version "__VERSION__"
|
|
license "GPL-3.0-or-later"
|
|
|
|
if Hardware::CPU.arm?
|
|
url "https://github.com/trvon/yams/releases/download/__TAG__/__ASSET_ARM64__"
|
|
sha256 "__SHA256_ARM64__"
|
|
else
|
|
url "https://github.com/trvon/yams/releases/download/__TAG__/__ASSET_X86_64__"
|
|
sha256 "__SHA256_X86_64__"
|
|
end
|
|
|
|
conflicts_with "yams", because: "both install the same binaries"
|
|
|
|
depends_on "onnxruntime"
|
|
|
|
def install
|
|
# Homebrew may stage archives either directly into buildpath (e.g. opt/homebrew/bin)
|
|
# or under an extra top-level directory. Be tolerant by searching for the yams binary.
|
|
root = if Dir.exist?("opt/homebrew/bin")
|
|
Pathname("opt/homebrew")
|
|
elsif Dir.exist?("local/bin")
|
|
Pathname("local")
|
|
elsif Dir.exist?("usr/local/bin")
|
|
Pathname("usr/local")
|
|
elsif Dir.exist?("bin")
|
|
Pathname(".")
|
|
else
|
|
yams_exe = Dir["**/bin/yams"].first
|
|
if yams_exe
|
|
Pathname(yams_exe).dirname.parent
|
|
else
|
|
odie "Could not locate install tree (expected opt/homebrew/bin, local/bin, usr/local/bin, bin, or a directory containing bin/yams)"
|
|
end
|
|
end
|
|
|
|
bin.install Dir[(root/"bin/*").to_s]
|
|
|
|
# Runtime-only Homebrew package: skip headers, pkg-config metadata, and static archives.
|
|
# Those developer artifacts dominate keg size and are not needed for normal CLI/daemon use.
|
|
if (root/"lib").exist?
|
|
lib.install Dir[(root/"lib/*.{dylib,so}").to_s]
|
|
# Private runtime libraries (ONNX resource registry) live in lib/yams and are
|
|
# found through @loader_path / @executable_path RUNPATHs.
|
|
(lib/"yams").install Dir[(root/"lib/yams/*.{dylib,so}").to_s]
|
|
if (root/"lib/yams/plugins").exist?
|
|
(lib/"yams/plugins").mkpath
|
|
(lib/"yams/plugins").install Dir[(root/"lib/yams/plugins/*").to_s]
|
|
end
|
|
end
|
|
|
|
# The formula depends on Homebrew's onnxruntime, which the plugins prefer over
|
|
# the private fallback copy the archive carries in lib/yams/onnxruntime; do not
|
|
# install that copy (or stray copies from older archive layouts).
|
|
rm_f Dir[lib/"libonnxruntime*"]
|
|
rm_f Dir[lib/"yams/libonnxruntime*"]
|
|
rm_rf lib/"yams/onnxruntime"
|
|
|
|
# Runtime assets (schemas, etc.)
|
|
share.install Dir[(root/"share/*").to_s] if (root/"share").exist?
|
|
|
|
generate_completions_from_executable(bin/"yams", "completion") if (bin/"yams").exist?
|
|
end
|
|
|
|
service do
|
|
run [opt_bin/"yams-daemon", "--foreground"]
|
|
keep_alive true
|
|
log_path var/"log/yams-daemon.log"
|
|
error_log_path var/"log/yams-daemon.log"
|
|
environment_variables YAMS_STORAGE: var/"lib/yams"
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
You have installed the nightly build of YAMS.
|
|
This version is updated frequently and may be unstable.
|
|
|
|
For stable releases, use: brew install trvon/yams/yams
|
|
|
|
Initialize YAMS storage:
|
|
yams init .
|
|
|
|
To start the YAMS daemon as a service:
|
|
brew services start yams-nightly
|
|
|
|
Homebrew installs completion files for bash, zsh, and fish.
|
|
If completion is not active in your current shell yet, start a new shell or use:
|
|
source <(yams completion bash)
|
|
autoload -U compinit && compinit && source <(yams completion zsh)
|
|
mkdir -p ~/.config/fish/completions && yams completion fish > ~/.config/fish/completions/yams.fish
|
|
|
|
Zsh persistent setup:
|
|
mkdir -p ~/.local/share/zsh/site-functions
|
|
yams completion zsh > ~/.local/share/zsh/site-functions/_yams
|
|
# Ensure ~/.local/share/zsh/site-functions is on fpath before compinit
|
|
# then run: autoload -U compinit && compinit
|
|
|
|
Nested subcommands are included, e.g.:
|
|
yams config embeddings <TAB>
|
|
yams plugin trust <TAB>
|
|
yams plugins trust <TAB>
|
|
yams daemon start --log-level <TAB>
|
|
yams config search path-tree enable --mode <TAB>
|
|
|
|
PowerShell completion is available manually:
|
|
pwsh -NoLogo -NoProfile -Command 'Invoke-Expression (yams completion powershell | Out-String)'
|
|
|
|
Documentation: https://yamsmemory.ai
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
ENV["HOME"] = testpath
|
|
assert_match(/nightly|dev/, shell_output("#{bin}/yams --version"))
|
|
system bin/"yams", "init", "--non-interactive"
|
|
assert_path_exists testpath/".local/share/yams/yams.db"
|
|
assert_path_exists testpath/".config/yams/config.toml"
|
|
end
|
|
end
|