Commit c3b5cdb

mo khan <mo@mokhan.ca>
2026-09-08 02:35:26
prune vendored llama.cpp test/doc/example dirs from packaged gem
spec.files was shipping the entire vendor/llama.cpp submodule tree, including tests, docs, models (GGUF fixtures), examples, tools, and gguf-py -- none of which extconf.rb's build needs. Drops the packaged gem from 35M to 6.5M. Verified by building and unpacking the gem and running extconf.rb against the pruned tree end to end.
1 parent 67a762f
Changed files (1)
elelem-llama.gemspec
@@ -26,7 +26,14 @@ Gem::Specification.new do |spec|
     "ext/elelem/llama/elelem.cpp",
     "ext/elelem/llama/extconf.rb",
   ]
-  spec.files += Dir["vendor/llama.cpp/**/*"].select { |path| File.file?(path) }
+  # Only what extconf.rb's cmake build (LLAMA_BUILD_COMMON=ON, tests/docs/
+  # examples/tools/server all OFF) actually needs to configure and compile.
+  # Anchored to the vendor root so this doesn't also strip required nested
+  # dirs with the same name, e.g. src/models/ (per-architecture model code).
+  vendor_exclude = %r{\Avendor/llama\.cpp/(tests|docs|models|examples|tools|\.github|gguf-py|scripts)/}
+  spec.files += Dir["vendor/llama.cpp/**/*"].select do |path|
+    File.file?(path) && path !~ vendor_exclude
+  end
   spec.extensions = ["ext/elelem/llama/extconf.rb"]
   spec.bindir = "exe"
   spec.executables = ["elelem-llama"]