diff --git a/misc/Makefile b/misc/Makefile index 10ad9ff1e43c..c7728cbd8c79 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -1,682 +1,683 @@ COMMENT = Miscellaneous utilities SUBDIR += R-cran-mime SUBDIR += R-cran-optimx SUBDIR += R-cran-xfun SUBDIR += aclgen SUBDIR += actiona SUBDIR += adios2 SUBDIR += aichat SUBDIR += air SUBDIR += amanda-client SUBDIR += amanda-perl-wrapper SUBDIR += amanda-server SUBDIR += amazon-qldb-shell SUBDIR += ansiweather SUBDIR += apparix SUBDIR += arrow-datafusion SUBDIR += artikulate SUBDIR += asbutton SUBDIR += asr-manpages SUBDIR += astc-encoder SUBDIR += bb SUBDIR += bbjd SUBDIR += bdelta SUBDIR += bedrust SUBDIR += bestfit SUBDIR += bible-kjv SUBDIR += biblesync SUBDIR += bibletime SUBDIR += biblical-curse SUBDIR += binbloom SUBDIR += binclock SUBDIR += binocle SUBDIR += biosfont-demos SUBDIR += birthday SUBDIR += bogosort SUBDIR += bottlerocket SUBDIR += box2d SUBDIR += boxes SUBDIR += broot SUBDIR += bsod SUBDIR += caffe SUBDIR += chatgpt-shell-cli SUBDIR += cheat SUBDIR += chef SUBDIR += chmlib SUBDIR += chrono SUBDIR += cinnamon-translations SUBDIR += cldr-emoji-annotation SUBDIR += clex SUBDIR += clifm SUBDIR += cloc SUBDIR += clpbar SUBDIR += colortail SUBDIR += coloursum SUBDIR += colwide SUBDIR += compat.el SUBDIR += compat10x SUBDIR += compat11x SUBDIR += compat12x SUBDIR += compat13x SUBDIR += compat4x SUBDIR += compat5x SUBDIR += compat6x SUBDIR += compat7x SUBDIR += compat8x SUBDIR += compat9x SUBDIR += concourse SUBDIR += copperspice-examples SUBDIR += countrycodes SUBDIR += cpuid SUBDIR += crosti SUBDIR += cryptoballot SUBDIR += cs SUBDIR += cstream SUBDIR += ctm SUBDIR += cuttlefish SUBDIR += dahdi SUBDIR += dahdi-kmod26 SUBDIR += darknet SUBDIR += dartsim SUBDIR += ddate SUBDIR += deco SUBDIR += dejagnu SUBDIR += delay SUBDIR += diction SUBDIR += digitemp SUBDIR += dijo SUBDIR += dive SUBDIR += dlib-models SUBDIR += dlpack SUBDIR += dnetc SUBDIR += dotenv-linter SUBDIR += dtach SUBDIR += dvorak7min SUBDIR += dynomite SUBDIR += e2fsprogs-libblkid SUBDIR += e2fsprogs-libuuid SUBDIR += ecflow SUBDIR += edfbrowser SUBDIR += edflib SUBDIR += elki SUBDIR += elscreen SUBDIR += estic SUBDIR += exercism SUBDIR += explosions SUBDIR += ezc3d SUBDIR += far2l SUBDIR += fastscapelib SUBDIR += felis SUBDIR += figlet SUBDIR += figlet-fonts SUBDIR += findutils SUBDIR += flag SUBDIR += flashlight SUBDIR += fortune-mod-bible SUBDIR += fortune-mod-bofh SUBDIR += fortune-mod-epictetus SUBDIR += fortune-mod-freebsd-classic SUBDIR += fortune-mod-futurama SUBDIR += fortune-mod-psalms SUBDIR += fortuneit SUBDIR += fq SUBDIR += free42 SUBDIR += freebsd-doc-all SUBDIR += freebsd-doc-bn SUBDIR += freebsd-doc-da SUBDIR += freebsd-doc-de SUBDIR += freebsd-doc-el SUBDIR += freebsd-doc-en SUBDIR += freebsd-doc-es SUBDIR += freebsd-doc-fr SUBDIR += freebsd-doc-hu SUBDIR += freebsd-doc-id SUBDIR += freebsd-doc-it SUBDIR += freebsd-doc-ja SUBDIR += freebsd-doc-ko SUBDIR += freebsd-doc-mn SUBDIR += freebsd-doc-nl SUBDIR += freebsd-doc-pl SUBDIR += freebsd-doc-pt SUBDIR += freebsd-doc-ru SUBDIR += freebsd-doc-tr SUBDIR += freebsd-doc-zh_cn SUBDIR += freebsd-doc-zh_tw SUBDIR += freebsd-release-manifests SUBDIR += freeguide SUBDIR += frugally-deep SUBDIR += ftdi-eeprom SUBDIR += fxload SUBDIR += g810-led SUBDIR += gedkeeper SUBDIR += geekcode SUBDIR += getopt SUBDIR += gimp-help-en SUBDIR += gkrellm-gamma SUBDIR += gkrellm-xkb SUBDIR += gkrellmbgchg2 SUBDIR += gkrellmlaunch2 SUBDIR += gkrellshoot2 SUBDIR += gkx86info2 SUBDIR += global-tz SUBDIR += gnome-devel-docs SUBDIR += gnome-getting-started-docs SUBDIR += gnome-icon-theme SUBDIR += gnome-icon-theme-extras SUBDIR += gnome-mime-data SUBDIR += gnome-user-docs SUBDIR += gnu-watch SUBDIR += gnuls SUBDIR += gobuster SUBDIR += gone SUBDIR += gplink SUBDIR += gpsim SUBDIR += granulate SUBDIR += grc SUBDIR += gwhich SUBDIR += hashdb SUBDIR += hello SUBDIR += help2man SUBDIR += heyu2 SUBDIR += hicolor-icon-theme SUBDIR += histring SUBDIR += hotkeys SUBDIR += hs-hascard SUBDIR += hulgalugha SUBDIR += hwdata SUBDIR += hxtools SUBDIR += ignition-fuel-tools SUBDIR += iio-oscilloscope SUBDIR += imerge SUBDIR += img2xterm SUBDIR += ini_file_manager SUBDIR += inplace SUBDIR += ipa_conv SUBDIR += ipbt SUBDIR += ironscanner SUBDIR += iselect SUBDIR += iso-codes SUBDIR += jargon SUBDIR += jbidwatcher SUBDIR += jirust SUBDIR += jojodiff SUBDIR += json-tui SUBDIR += kbdscan SUBDIR += kcd SUBDIR += kde-thumbnailer-chm SUBDIR += kde-thumbnailer-epub SUBDIR += kde-thumbnailer-fb2 SUBDIR += kdeedu SUBDIR += kdeedu-data SUBDIR += kdeutils SUBDIR += kenny SUBDIR += kf5-purpose SUBDIR += kf6-purpose SUBDIR += kgeography SUBDIR += klettres SUBDIR += kookbook SUBDIR += ktouch SUBDIR += kwordquiz SUBDIR += lastools SUBDIR += latex-mk SUBDIR += lazyread SUBDIR += lbann SUBDIR += lc SUBDIR += lesspipe SUBDIR += lf SUBDIR += libad9361-iio SUBDIR += libartnet SUBDIR += libcomps SUBDIR += libeatmydata SUBDIR += libemos SUBDIR += libiio SUBDIR += libkeduvocdocument SUBDIR += liblxi SUBDIR += libmetalink SUBDIR += libmodulemd SUBDIR += libpostal SUBDIR += libpredict SUBDIR += libpri SUBDIR += librepo SUBDIR += libsolv SUBDIR += libspnav SUBDIR += libsupertone SUBDIR += libsweep-lidar SUBDIR += libutf SUBDIR += libxdf SUBDIR += lifelines SUBDIR += lightgbm SUBDIR += llama-cpp SUBDIR += locale-en_DK SUBDIR += localedata SUBDIR += logsurfer SUBDIR += ls-lint SUBDIR += lscolors SUBDIR += lsix SUBDIR += lv SUBDIR += lxde-common SUBDIR += lxi-tools SUBDIR += magicpoint SUBDIR += man.el SUBDIR += mate-user-guide SUBDIR += mbuffer SUBDIR += mc SUBDIR += mdp SUBDIR += meshoptimizer SUBDIR += metalink-checker SUBDIR += metalink-tools SUBDIR += mime-support SUBDIR += minidnn SUBDIR += mirmon SUBDIR += mmdnn SUBDIR += mmv SUBDIR += mnn SUBDIR += molequeue SUBDIR += morse SUBDIR += mtx SUBDIR += mxnet SUBDIR += najitool SUBDIR += navi SUBDIR += ncnn SUBDIR += netron SUBDIR += nms SUBDIR += nn-insight SUBDIR += nnn SUBDIR += nsf SUBDIR += numchar SUBDIR += nut SUBDIR += ola + SUBDIR += ollama SUBDIR += ompl SUBDIR += ondir SUBDIR += onnx SUBDIR += opencyc SUBDIR += openhab SUBDIR += openhab-addons SUBDIR += openhab2 SUBDIR += openhab2-addons SUBDIR += openhantek SUBDIR += openhmd SUBDIR += openmvg SUBDIR += opennn SUBDIR += openr2 SUBDIR += openvdb SUBDIR += orange3 SUBDIR += orville-write SUBDIR += osinfo-db SUBDIR += ossp-uuid SUBDIR += otter SUBDIR += owrep SUBDIR += p5-Acme-ButFirst SUBDIR += p5-Array-Compare SUBDIR += p5-Array-Diff SUBDIR += p5-Array-FileReader SUBDIR += p5-Array-IntSpan SUBDIR += p5-Array-LineReader SUBDIR += p5-Array-PrintCols SUBDIR += p5-Array-RefElem SUBDIR += p5-Array-Utils SUBDIR += p5-Asterisk-FastAGI SUBDIR += p5-Bot-Training SUBDIR += p5-Bot-Training-MegaHAL SUBDIR += p5-Bot-Training-StarCraft SUBDIR += p5-Business-EDI SUBDIR += p5-Business-Hours SUBDIR += p5-Business-ISBN SUBDIR += p5-Business-ISBN-Data SUBDIR += p5-Business-ISIN SUBDIR += p5-Business-ISMN SUBDIR += p5-Business-ISSN SUBDIR += p5-Business-UPS SUBDIR += p5-Chatbot-Eliza SUBDIR += p5-Data-Buffer SUBDIR += p5-File-CounterFile SUBDIR += p5-File-Sort SUBDIR += p5-Geo-Address-Formatter SUBDIR += p5-Geo-Cache SUBDIR += p5-Geo-Coder-Bing SUBDIR += p5-Geo-Coder-Google SUBDIR += p5-Geo-Coder-Googlev3 SUBDIR += p5-Geo-Coder-Mapquest SUBDIR += p5-Geo-Coder-Multimap SUBDIR += p5-Geo-Coder-Multiple SUBDIR += p5-Geo-Coder-Navteq SUBDIR += p5-Geo-Coder-OSM SUBDIR += p5-Geo-Coder-OpenCage SUBDIR += p5-Geo-Coder-Ovi SUBDIR += p5-Geo-Coder-PlaceFinder SUBDIR += p5-Geo-Coder-TomTom SUBDIR += p5-Geo-GeoNames SUBDIR += p5-Geo-Postcodes SUBDIR += p5-Geo-Postcodes-DK SUBDIR += p5-Geo-Postcodes-NO SUBDIR += p5-Geo-Weather SUBDIR += p5-Geography-Countries SUBDIR += p5-I18N-Charset SUBDIR += p5-I18N-LangTags SUBDIR += p5-LEGO-RCX SUBDIR += p5-Library-CallNumber-LC SUBDIR += p5-List-Compare SUBDIR += p5-List-Util-WeightedRoundRobin SUBDIR += p5-Locale-Codes SUBDIR += p5-Locale-Geocode SUBDIR += p5-Locale-Msgcat SUBDIR += p5-Locale-SubCountry SUBDIR += p5-Locale-US SUBDIR += p5-Net-vCard SUBDIR += p5-OSSP-uuid SUBDIR += p5-OpenAI-API SUBDIR += p5-Software-License SUBDIR += p5-Software-License-CCpack SUBDIR += p5-Test-Dir SUBDIR += p5-Text-FIGlet SUBDIR += p5-Tie-DxHash SUBDIR += p5-Zen-Koans SUBDIR += p5-asterisk-perl SUBDIR += parley SUBDIR += pastebinit SUBDIR += patchutils SUBDIR += pauker SUBDIR += pciids SUBDIR += pdmenu SUBDIR += pear-Services_Weather SUBDIR += pear-Text_Figlet SUBDIR += pecl-timezonedb SUBDIR += perkeep SUBDIR += pfm SUBDIR += php81-calendar SUBDIR += php82-calendar SUBDIR += php83-calendar SUBDIR += php84-calendar SUBDIR += pinfo SUBDIR += pipe SUBDIR += posixtestsuite SUBDIR += pqrs SUBDIR += proxyper SUBDIR += pspresent SUBDIR += ptsort SUBDIR += pubs SUBDIR += py-PyUserInput SUBDIR += py-PyWavefront SUBDIR += py-QSpectrumAnalyzer SUBDIR += py-SQCommon SUBDIR += py-SQImFil SUBDIR += py-SQSnobFit SUBDIR += py-SimpleSoapy SUBDIR += py-SoapySDR SUBDIR += py-accelerate SUBDIR += py-aider-chat SUBDIR += py-alive-progress SUBDIR += py-anthropic SUBDIR += py-apache-beam SUBDIR += py-ascii-magic SUBDIR += py-ast-comments SUBDIR += py-boost-histogram SUBDIR += py-censys SUBDIR += py-codecarbon SUBDIR += py-colorbrewer SUBDIR += py-colored SUBDIR += py-crudini SUBDIR += py-datasets SUBDIR += py-detecta SUBDIR += py-dictdiffer SUBDIR += py-eemeter SUBDIR += py-einops SUBDIR += py-emoji SUBDIR += py-ezc3d SUBDIR += py-facenet-pytorch SUBDIR += py-fast-histogram SUBDIR += py-fastscapelib SUBDIR += py-files-to-prompt SUBDIR += py-fleep SUBDIR += py-fuzzy SUBDIR += py-gluoncv SUBDIR += py-gluonnlp SUBDIR += py-halo SUBDIR += py-hist SUBDIR += py-histoprint SUBDIR += py-huepy SUBDIR += py-huggingface-hub SUBDIR += py-icoextract SUBDIR += py-instructor SUBDIR += py-ipyfastscape SUBDIR += py-jiwer SUBDIR += py-kartograph SUBDIR += py-laspy SUBDIR += py-lazrs SUBDIR += py-lightgbm SUBDIR += py-lightning-utilities SUBDIR += py-litellm SUBDIR += py-llama-cpp-python SUBDIR += py-llm SUBDIR += py-llm-claude-3 SUBDIR += py-log_symbols SUBDIR += py-mffpy SUBDIR += py-mmcv SUBDIR += py-mmdet SUBDIR += py-mmengine SUBDIR += py-mmsegmentation SUBDIR += py-molequeue SUBDIR += py-mxnet SUBDIR += py-natten SUBDIR += py-npTDMS SUBDIR += py-numcodecs SUBDIR += py-onnx SUBDIR += py-onnx-tf SUBDIR += py-openai SUBDIR += py-openai-whisper SUBDIR += py-openpaperwork-core SUBDIR += py-openpaperwork-gtk SUBDIR += py-openvdb SUBDIR += py-optuna SUBDIR += py-orange3-associate SUBDIR += py-orange3-datafusion SUBDIR += py-orange3-educational SUBDIR += py-orange3-network SUBDIR += py-orange3-timeseries SUBDIR += py-palettable SUBDIR += py-papermill SUBDIR += py-pexpect SUBDIR += py-pkbar SUBDIR += py-placekey SUBDIR += py-polars SUBDIR += py-powerline-status SUBDIR += py-progressbar SUBDIR += py-progressbar2 SUBDIR += py-pyEDFlib SUBDIR += py-pyct SUBDIR += py-pyfiglet SUBDIR += py-pykml SUBDIR += py-pymatreader SUBDIR += py-pypatent SUBDIR += py-pyprind SUBDIR += py-pyqir SUBDIR += py-python-geohash SUBDIR += py-python-utils SUBDIR += py-pytorch SUBDIR += py-pytorch-lightning SUBDIR += py-pyviz-comms SUBDIR += py-safetensors SUBDIR += py-scikit-fusion SUBDIR += py-scikit-quant SUBDIR += py-serverfiles SUBDIR += py-shap2 SUBDIR += py-shell-gpt SUBDIR += py-sigopt SUBDIR += py-soapy_power SUBDIR += py-spdx SUBDIR += py-spdx-lookup SUBDIR += py-spdx-tools SUBDIR += py-spinners SUBDIR += py-synced-collections SUBDIR += py-tes SUBDIR += py-tflearn SUBDIR += py-tflite SUBDIR += py-tflite-support SUBDIR += py-thermocouples_reference SUBDIR += py-timm SUBDIR += py-timm-vis SUBDIR += py-toil SUBDIR += py-torch-geometric SUBDIR += py-torchmetrics SUBDIR += py-torchvision SUBDIR += py-tqdm SUBDIR += py-tvm SUBDIR += py-uhi SUBDIR += py-vaderSentiment SUBDIR += py-wandb SUBDIR += py-wurlitzer SUBDIR += py-xformers SUBDIR += py-xgboost SUBDIR += pyobd SUBDIR += pytorch SUBDIR += qbrew SUBDIR += qlas SUBDIR += qlcplus SUBDIR += qt5-doc SUBDIR += qt5-examples SUBDIR += qt5-l10n SUBDIR += qt5ct SUBDIR += qt6-doc SUBDIR += qt6-examples SUBDIR += qt6ct SUBDIR += quantum++ SUBDIR += quary SUBDIR += randomx SUBDIR += raspberrypi-gpioshutdown SUBDIR += raspberrypi-userland SUBDIR += raspbsd-led SUBDIR += ree SUBDIR += retry SUBDIR += rfc SUBDIR += rgb-tui SUBDIR += ringtonetools SUBDIR += rname SUBDIR += rpl SUBDIR += rsclock SUBDIR += rtfm SUBDIR += rubygem-dotenv SUBDIR += rubygem-dotenv-rails SUBDIR += rubygem-dotenv-rails-rails4 SUBDIR += rubygem-dotenv-rails-rails5 SUBDIR += rubygem-dotenv-rails-rails50 SUBDIR += rubygem-dotenv-rails-rails61 SUBDIR += rubygem-dotenv2 SUBDIR += rubygem-haversine_distance SUBDIR += rubygem-iesd SUBDIR += rubygem-mime-types SUBDIR += rubygem-mime-types-data SUBDIR += rubygem-mimemagic SUBDIR += rubygem-octicons SUBDIR += rubygem-rabbit SUBDIR += rubygem-vpim SUBDIR += rump SUBDIR += ruut SUBDIR += schilytools SUBDIR += sdformat SUBDIR += seabios SUBDIR += sent SUBDIR += seq2 SUBDIR += sfm SUBDIR += shared-mime-info SUBDIR += shc SUBDIR += shuffle SUBDIR += shuffle-db SUBDIR += silicon SUBDIR += since SUBDIR += slides SUBDIR += sloccount SUBDIR += sls SUBDIR += snakemake SUBDIR += soapysdr SUBDIR += solarized SUBDIR += sshbuddy SUBDIR += sssnips SUBDIR += star-history SUBDIR += susv2 SUBDIR += susv3 SUBDIR += susv4 SUBDIR += swissfileknife SUBDIR += sword SUBDIR += table.el SUBDIR += talkfilters SUBDIR += tdfiglet SUBDIR += tdrop SUBDIR += team SUBDIR += tellico SUBDIR += tempcontrol SUBDIR += tenere SUBDIR += termatrix SUBDIR += terminfo-db SUBDIR += teseq SUBDIR += thefuck SUBDIR += thrill SUBDIR += timetrace SUBDIR += timezonemap SUBDIR += tkcron SUBDIR += tkinfo SUBDIR += tkregexp SUBDIR += tkrunit SUBDIR += tlci SUBDIR += toilet SUBDIR += translate SUBDIR += trurl SUBDIR += ttyrec SUBDIR += tudu SUBDIR += tvbrowser SUBDIR += tvm SUBDIR += tzdiff SUBDIR += uk-phone SUBDIR += uk-postcodes SUBDIR += umodunpack SUBDIR += unclutter SUBDIR += unclutter-xfixes SUBDIR += unicode-emoji SUBDIR += upclient SUBDIR += urh SUBDIR += usbids SUBDIR += usbrh-libusb SUBDIR += usd SUBDIR += utftools SUBDIR += utouch-kmod SUBDIR += valentina SUBDIR += vdmfec SUBDIR += veles SUBDIR += vera SUBDIR += vfc SUBDIR += vifm SUBDIR += visp SUBDIR += viz SUBDIR += vote SUBDIR += vxl SUBDIR += wego SUBDIR += whichman SUBDIR += window SUBDIR += with SUBDIR += wmScoreBoard SUBDIR += wmcalendar SUBDIR += wmforecast SUBDIR += wmjulia SUBDIR += wmpal SUBDIR += wmtunlo SUBDIR += wmweather+ SUBDIR += wmwork SUBDIR += wthrr SUBDIR += xd-rust SUBDIR += xdelta SUBDIR += xdelta3 SUBDIR += xfce4-appfinder SUBDIR += xfce4-weather-plugin SUBDIR += xfce4-wm-themes SUBDIR += xgboost SUBDIR += xiphos SUBDIR += xless SUBDIR += xosd SUBDIR += xplr SUBDIR += xtail SUBDIR += xtar SUBDIR += ytree SUBDIR += zine SUBDIR += zoneinfo .include diff --git a/misc/ollama/Makefile b/misc/ollama/Makefile new file mode 100644 index 000000000000..b097932499b4 --- /dev/null +++ b/misc/ollama/Makefile @@ -0,0 +1,34 @@ +PORTNAME= ollama +DISTVERSIONPREFIX= v +DISTVERSION= 0.3.4 +CATEGORIES= misc # machine-learning + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Run Llama 2, Mistral, and other large language models +WWW= https://ollama.com/ + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +BUILD_DEPENDS= bash:shells/bash \ + cmake:devel/cmake-core \ + vulkan-headers>0:graphics/vulkan-headers +LIB_DEPENDS= libvulkan.so:graphics/vulkan-loader + +USES= go:1.22,modules pkgconfig + +GO_MODULE= github.com/${PORTNAME}/${PORTNAME} +GO_TARGET= . + +USE_GITHUB= nodefault +GH_TUPLE= ggerganov:llama.cpp:6eeaeba:llama_cpp/llm/llama.cpp + +PLIST_FILES= bin/${PORTNAME} + +pre-build: + @${CP} ${WRKSRC}/app/store/store_linux.go ${WRKSRC}/app/store/store_bsd.go + @cd ${GO_WRKSRC} && \ + ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${GO_ENV} GOMAXPROCS=${MAKE_JOBS_NUMBER} GOPROXY=off ${GO_CMD} generate ${GO_BUILDFLAGS} \ + ./... + +.include diff --git a/misc/ollama/distinfo b/misc/ollama/distinfo new file mode 100644 index 000000000000..c436195aa415 --- /dev/null +++ b/misc/ollama/distinfo @@ -0,0 +1,7 @@ +TIMESTAMP = 1722929347 +SHA256 (go/misc_ollama/ollama-v0.3.4/v0.3.4.mod) = ec7b6ce8fd820503671d269fd43ea5ae7275b1ff095c77d6422ac8540ccb410b +SIZE (go/misc_ollama/ollama-v0.3.4/v0.3.4.mod) = 2992 +SHA256 (go/misc_ollama/ollama-v0.3.4/v0.3.4.zip) = d9bc3d3901272f8fbc9b57ce1af1caa2209127978bb5f72257b6a3fb84161969 +SIZE (go/misc_ollama/ollama-v0.3.4/v0.3.4.zip) = 1832031 +SHA256 (go/misc_ollama/ollama-v0.3.4/ggerganov-llama.cpp-6eeaeba_GH0.tar.gz) = f749f494dc5e672926179524cf28c834151edba5acae18e132c954df76ffdf33 +SIZE (go/misc_ollama/ollama-v0.3.4/ggerganov-llama.cpp-6eeaeba_GH0.tar.gz) = 19003544 diff --git a/misc/ollama/files/patch-FreeBSD-compatibility b/misc/ollama/files/patch-FreeBSD-compatibility new file mode 100644 index 000000000000..02af4cec63c0 --- /dev/null +++ b/misc/ollama/files/patch-FreeBSD-compatibility @@ -0,0 +1,266 @@ +-- patch based on https://github.com/ollama/ollama/issues/1102#issuecomment-2270042340 + +new file mode 100644 +--- gpu/gpu_bsd.go.orig 2024-08-06 07:41:26 UTC ++++ gpu/gpu_bsd.go +@@ -0,0 +1,101 @@ ++//go:build dragonfly || freebsd || netbsd || openbsd ++ ++package gpu ++ ++import "github.com/ollama/ollama/format" ++ ++/* ++#cgo CFLAGS: -I/usr/local/include ++#cgo LDFLAGS: -L/usr/local/lib -lvulkan ++ ++#include ++#include ++#include ++ ++bool hasVulkanSupport(uint64_t *memSize) { ++ VkInstance instance; ++ ++ VkApplicationInfo appInfo = { VK_STRUCTURE_TYPE_APPLICATION_INFO }; ++ appInfo.pApplicationName = "Ollama"; ++ appInfo.apiVersion = VK_API_VERSION_1_0; ++ ++ VkInstanceCreateInfo createInfo = { VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO }; ++ createInfo.pApplicationInfo = &appInfo; ++ ++ // Create a Vulkan instance ++ if (vkCreateInstance(&createInfo, NULL, &instance) != VK_SUCCESS) ++ return false; ++ ++ // Fetch the first physical Vulkan device. Note that numDevices is overwritten with the number of devices found ++ uint32_t numDevices = 1; ++ VkPhysicalDevice device; ++ vkEnumeratePhysicalDevices(instance, &numDevices, &device); ++ if (numDevices == 0) { ++ vkDestroyInstance(instance, NULL); ++ return false; ++ } ++ ++ // Fetch the memory information for this device. ++ VkPhysicalDeviceMemoryProperties memProperties; ++ vkGetPhysicalDeviceMemoryProperties(device, &memProperties); ++ ++ // Add up all the heaps. ++ VkDeviceSize totalMemory = 0; ++ for (uint32_t i = 0; i < memProperties.memoryHeapCount; ++i) { ++ if (memProperties.memoryHeaps[i].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) { ++ *memSize += memProperties.memoryHeaps[i].size; ++ } ++ } ++ ++ vkDestroyInstance(instance, NULL); ++ return true; ++} ++*/ ++import "C" ++ ++func GetGPUInfo() GpuInfoList { ++ var gpuMem C.uint64_t ++ if C.hasVulkanSupport(&gpuMem) { ++ // Vulkan supported ++ return []GpuInfo{ ++ { ++ Library: "vulkan", ++ ID: "0", ++ MinimumMemory: 512 * format.MebiByte, ++ memInfo: memInfo{ ++ FreeMemory: uint64(gpuMem), ++ TotalMemory: uint64(gpuMem), ++ }, ++ }, ++ } ++ } ++ ++ // CPU fallback ++ cpuMem, _ := GetCPUMem() ++ return []GpuInfo{ ++ { ++ Library: "cpu", ++ memInfo: cpuMem, ++ }, ++ } ++} ++ ++func GetCPUInfo() GpuInfoList { ++ mem, _ := GetCPUMem() ++ return []GpuInfo{ ++ { ++ Library: "cpu", ++ Variant: GetCPUCapability(), ++ memInfo: mem, ++ }, ++ } ++} ++ ++func GetCPUMem() (memInfo, error) { ++ size := C.sysconf(C._SC_PHYS_PAGES) * C.sysconf(C._SC_PAGE_SIZE) ++ return memInfo{TotalMemory: uint64(size)}, nil ++} ++ ++func (l GpuInfoList) GetVisibleDevicesEnv() (string, string) { ++ return "", "" ++} +--- gpu/gpu_test.go.orig 1979-11-30 08:00:00 UTC ++++ gpu/gpu_test.go +@@ -11,7 +11,7 @@ func TestBasicGetGPUInfo(t *testing.T) { + func TestBasicGetGPUInfo(t *testing.T) { + info := GetGPUInfo() + assert.NotEmpty(t, len(info)) +- assert.Contains(t, "cuda rocm cpu metal", info[0].Library) ++ assert.Contains(t, "cuda rocm cpu metal vulkan", info[0].Library) + if info[0].Library != "cpu" { + assert.Greater(t, info[0].TotalMemory, uint64(0)) + assert.Greater(t, info[0].FreeMemory, uint64(0)) +@@ -24,6 +24,8 @@ func TestCPUMemInfo(t *testing.T) { + switch runtime.GOOS { + case "darwin": + t.Skip("CPU memory not populated on darwin") ++ case "dragonfly", "freebsd", "netbsd", "openbsd": ++ t.Skip("CPU memory is not populated on *BSD") + case "linux", "windows": + assert.Greater(t, info.TotalMemory, uint64(0)) + assert.Greater(t, info.FreeMemory, uint64(0)) +--- llm/generate/gen_bsd.sh.orig 2024-08-06 07:41:26 UTC ++++ llm/generate/gen_bsd.sh +@@ -0,0 +1,64 @@ ++#!/bin/sh ++# This script is intended to run inside the go generate ++# working directory must be ./llm/generate/ ++ ++set -ex ++set -o pipefail ++echo "Starting BSD generate script" ++. $(dirname $0)/gen_common.sh ++init_vars ++#git_module_setup ++apply_patches ++ ++COMMON_BSD_DEFS="-DCMAKE_SYSTEM_NAME=$(uname -s)" ++CMAKE_TARGETS="--target llama --target ggml" ++ ++case "${GOARCH}" in ++ "amd64") ++ COMMON_CPU_DEFS="${COMMON_BSD_DEFS} -DCMAKE_SYSTEM_PROCESSOR=${ARCH}" ++ ++ # Static build for linking into the Go binary ++ init_vars ++ CMAKE_DEFS="${COMMON_CPU_DEFS} -DBUILD_SHARED_LIBS=off -DLLAMA_ACCELERATE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}" ++ BUILD_DIR="../build/bsd/${ARCH}_static" ++ echo "Building static library" ++ build ++ ++ init_vars ++ CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}" ++ BUILD_DIR="../build/bsd/${ARCH}/cpu" ++ echo "Building LCD CPU" ++ build ++ compress ++ ++ init_vars ++ CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}" ++ BUILD_DIR="../build/bsd/${ARCH}/cpu_avx" ++ echo "Building AVX CPU" ++ build ++ compress ++ ++ init_vars ++ CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=on -DLLAMA_AVX2=on -DLLAMA_AVX512=off -DLLAMA_FMA=on -DLLAMA_F16C=on ${CMAKE_DEFS}" ++ BUILD_DIR="../build/bsd/${ARCH}/cpu_avx2" ++ echo "Building AVX2 CPU" ++ build ++ compress ++ ++ init_vars ++ CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_VULKAN=on ${CMAKE_DEFS}" ++ BUILD_DIR="../build/bsd/${ARCH}/vulkan" ++ echo "Building Vulkan GPU" ++ build ++ compress ++ ;; ++ ++ *) ++ echo "GOARCH must be set" ++ echo "this script is meant to be run from within go generate" ++ exit 1 ++ ;; ++esac ++ ++cleanup ++echo "go generate completed. LLM runners: $(cd ${BUILD_DIR}/..; echo *)" +--- llm/generate/generate_bsd.go.orig 2024-08-06 07:41:26 UTC ++++ llm/generate/generate_bsd.go +@@ -0,0 +1,5 @@ ++//go:build dragonfly || freebsd || netbsd || openbsd ++ ++package generate ++ ++//go:generate bash ./gen_bsd.sh +--- llm/llm.go.orig 1979-11-30 08:00:00 UTC ++++ llm/llm.go +@@ -8,6 +8,10 @@ package llm + // #cgo windows,arm64 LDFLAGS: -static-libstdc++ -static-libgcc -static -L${SRCDIR}/build/windows/arm64_static -L${SRCDIR}/build/windows/arm64_static/src -L${SRCDIR}/build/windows/arm64_static/ggml/src + // #cgo linux,amd64 LDFLAGS: -L${SRCDIR}/build/linux/x86_64_static -L${SRCDIR}/build/linux/x86_64_static/src -L${SRCDIR}/build/linux/x86_64_static/ggml/src + // #cgo linux,arm64 LDFLAGS: -L${SRCDIR}/build/linux/arm64_static -L${SRCDIR}/build/linux/arm64_static/src -L${SRCDIR}/build/linux/arm64_static/ggml/src ++// #cgo dragonfly,amd64 LDFLAGS: ${SRCDIR}/build/bsd/x86_64_static/src/libllama.a -lstdc++ -lm ++// #cgo freebsd,amd64 LDFLAGS: -L${SRCDIR}/build/bsd/x86_64_static/src -lllama -L${SRCDIR}/build/bsd/x86_64_static/ggml/src -lggml -lstdc++ -lm -lomp ++// #cgo netbsd,amd64 LDFLAGS: ${SRCDIR}/build/bsd/x86_64_static/src/libllama.a -lstdc++ -lm ++// #cgo openbsd,amd64 LDFLAGS: ${SRCDIR}/build/bsd/x86_64_static/src/libllama.a -lstdc++ -lm + // #include + // #include "llama.h" + import "C" +--- llm/llm_bsd.go.orig 2024-08-06 07:41:26 UTC ++++ llm/llm_bsd.go +@@ -0,0 +1,13 @@ ++//go:build dragonfly || freebsd || netbsd || openbsd ++ ++package llm ++ ++import ( ++ "embed" ++ "syscall" ++) ++ ++//go:embed build/bsd/*/*/bin/* ++var libEmbed embed.FS ++ ++var LlamaServerSysProcAttr = &syscall.SysProcAttr{} +--- scripts/build_bsd.sh.orig 2024-08-06 07:41:26 UTC ++++ scripts/build_bsd.sh +@@ -0,0 +1,27 @@ ++#!/bin/sh ++ ++set -e ++ ++case "$(uname -s)" in ++ DragonFly) ++ ;; ++ FreeBSD) ++ ;; ++ NetBSD) ++ ;; ++ OpenBSD) ++ ;; ++ *) ++ echo "$(uname -s) is not supported" ++ exit 1 ++ ;; ++esac ++ ++export VERSION=${VERSION:-$(git describe --tags --first-parent --abbrev=7 --long --dirty --always | sed -e "s/^v//g")} ++export GOFLAGS="'-ldflags=-w -s \"-X=github.com/ollama/ollama/version.Version=$VERSION\" \"-X=github.com/ollama/ollama/server.mode=release\"'" ++ ++mkdir -p dist ++rm -rf llm/llama.cpp/build ++ ++go generate ./... ++CGO_ENABLED=1 go build -trimpath -o dist/ollama-bsd +--- scripts/build_freebsd.sh.orig 2024-08-06 07:41:26 UTC ++++ scripts/build_freebsd.sh +@@ -0,0 +1 @@ ++build_bsd.sh +\ No newline at end of file diff --git a/misc/ollama/files/patch-llm_generate_gen__common.sh b/misc/ollama/files/patch-llm_generate_gen__common.sh new file mode 100644 index 000000000000..6033d77dc663 --- /dev/null +++ b/misc/ollama/files/patch-llm_generate_gen__common.sh @@ -0,0 +1,35 @@ +--- llm/generate/gen_common.sh.orig 1979-11-30 08:00:00 UTC ++++ llm/generate/gen_common.sh +@@ -68,13 +68,8 @@ apply_patches() { + if [ -n "$(ls -A ../patches/*.diff)" ]; then + # apply temporary patches until fix is upstream + for patch in ../patches/*.diff; do +- for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/); do +- (cd ${LLAMACPP_DIR}; git checkout ${file}) +- done ++ (cd ${LLAMACPP_DIR} && patch -B '' -p1 < ${patch}) + done +- for patch in ../patches/*.diff; do +- (cd ${LLAMACPP_DIR} && git apply ${patch}) +- done + fi + } + +@@ -106,14 +101,8 @@ compress() { + } + + # Keep the local tree clean after we're done with the build +-cleanup() { +- (cd ${LLAMACPP_DIR}/ && git checkout CMakeLists.txt) + +- if [ -n "$(ls -A ../patches/*.diff)" ]; then +- for patch in ../patches/*.diff; do +- for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/); do +- (cd ${LLAMACPP_DIR}; git checkout ${file}) +- done +- done +- fi ++cleanup() { ++ echo "cleanup done" + } ++ diff --git a/misc/ollama/pkg-descr b/misc/ollama/pkg-descr new file mode 100644 index 000000000000..96a69944f608 --- /dev/null +++ b/misc/ollama/pkg-descr @@ -0,0 +1,3 @@ +Ollama allows to get up and running with large language models. + +Ollama supports a list of models available on ollama.com/library.