fix(ollama): fix macOS segfault and exclude mlx/rocm/jetpack variants

- pkg_link called webi_link which called pkg_link — infinite recursion
  causing SIGSEGV on macOS; fixed by switching to WEBI_SINGLE-style paths
  so the template's webi_link handles symlinking directly
- macOS pkg_src now points to the flat ollama binary (not ./bin/ollama)
- mlx, rocm, jetpack5, jetpack6 tagged as variants so generic installs
  get the standard build instead of a GPU-specific one
This commit is contained in:
AJ ONeal
2026-05-18 00:17:25 -06:00
parent d62cbb1be0
commit c3fff12f2b
3 changed files with 13 additions and 32 deletions

View File

@@ -1,7 +1,4 @@
// Package ollama provides variant tagging for Ollama releases.
//
// Ollama publishes GPU accelerator builds: -rocm (AMD), -jetpack5
// and -jetpack6 (NVIDIA Jetson).
package ollamadist
import (
@@ -11,14 +8,10 @@ import (
)
// TagVariants tags ollama-specific build variants.
// Suffix variants (mlx, rocm, jetpack5, jetpack6) are handled by the
// conf-driven loop in classifypkg.TagVariants; this handles the rest.
func TagVariants(assets []storage.Asset) {
for i := range assets {
lower := strings.ToLower(assets[i].Filename)
for _, v := range []string{"rocm", "jetpack5", "jetpack6"} {
if strings.Contains(lower, "-"+v) {
assets[i].Variants = append(assets[i].Variants, v)
}
}
// Ollama-darwin.zip (capital O) is the macOS .app bundle.
// Installable by Go (extract .app), but not in legacy cache.
if strings.HasPrefix(assets[i].Filename, "Ollama-") {

View File

@@ -13,35 +13,33 @@ __init_ollama() {
pkg_cmd_name="ollama"
pkg_dst_dir="${HOME}/.local/opt/ollama"
pkg_dst="${pkg_dst_dir}"
pkg_dst_cmd="${HOME}/.local/bin/ollama"
pkg_src_dir="${HOME}/.local/opt/ollama-v${WEBI_VERSION}"
pkg_src="${pkg_src_dir}"
# linux default: bin/ollama + lib/ollama/ hierarchy
pkg_dst_cmd="${HOME}/.local/opt/ollama/bin/ollama"
pkg_src_cmd="${HOME}/.local/opt/ollama-v${WEBI_VERSION}/bin/ollama"
my_os=$(uname -s)
if test "Darwin" = "${my_os}"; then
pkg_dst_cmd="${HOME}/.local/opt/ollama/ollama"
pkg_dst_cmd="${HOME}/.local/bin/ollama"
pkg_src_cmd="${HOME}/.local/opt/ollama-v${WEBI_VERSION}/ollama"
fi
pkg_dst="${pkg_dst_cmd}"
pkg_src="${pkg_src_cmd}"
# pkg_install must be defined by every package
pkg_install() {
if test -f ./ollama; then
# macOS tgz: flat — bare binary + dylibs/mlx backends in root
mkdir -p "${pkg_src_dir}"
mv ./* "${pkg_src_dir}/"
chmod a+x "${pkg_src_cmd}"
elif test -d ./bin; then
if test -d ./bin; then
# linux tar.zst: bin/ollama + lib/ollama/
mkdir -p "${pkg_src_dir}"
mv ./bin "${pkg_src_dir}/bin"
if test -d ./lib; then
mv ./lib "${pkg_src_dir}/lib"
fi
elif test -f ./ollama; then
# macOS tgz: flat — bare binary + dylibs/mlx backends in root
mkdir -p "${pkg_src_dir}"
mv ./* "${pkg_src_dir}/"
elif test -d ./Ollama.app; then
# macOS zip: install app bundle to /Applications
mv -f ./Ollama.app /Applications/Ollama.app
@@ -49,22 +47,12 @@ __init_ollama() {
# older bare binary format
mkdir -p "$(dirname "${pkg_src_cmd}")"
mv ./ollama-* "${pkg_src_cmd}"
chmod a+x "${pkg_src_cmd}"
else
echo "error: unrecognized ollama archive format" >&2
return 1
fi
}
pkg_link() {
if test -d /Applications/Ollama.app; then
mkdir -p "${HOME}/.local/bin"
ln -sf /Applications/Ollama.app/Contents/Resources/ollama "${HOME}/.local/bin/ollama"
return 0
fi
webi_link
}
pkg_get_current_version() {
# 'ollama --version' has output in this format:
# ollama version is 0.3.10

View File

@@ -1,2 +1,2 @@
github_releases = jmorganca/ollama
variants = rocm jetpack5 jetpack6
variants = mlx rocm jetpack5 jetpack6