Files
chromebrew/packages/lmstudio.rb
Satadru Pramanik, DO, MPH, MEng 5621163c84 Refactor ruby gems in packages, crew cleanup of debugging, install.sh refactor for gems (#10294)
* Some ruby gem updates and cleanup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* bump version

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* move gem installs to core install

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add webkitgtk_6 binaries for x86_64, add librsvg binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add rebuilt librsvg binary for x86_64.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rename gem function internals to make more sense

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust webkitgtk_6 deps

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update ruby gem packages, add a ruby gem package update script to tools

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild parted

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add parted binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* refactor ruby buildsystem

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add libsdl2, freerdp binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* sync crew function to lib/fixup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* shellcheck fix

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add const for CREW_UPDATE_CHECK_INTERVAL

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Move time_difference into function for neatness.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes from @uberhacker

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* @Zopolis4 suggested change: Use git last update time

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add .blank? usage to downloader to avoid undefined method `empty?' for nil (NoMethodError)

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
2024-08-13 11:25:39 -05:00

85 lines
2.4 KiB
Ruby

require 'package'
class Lmstudio < Package
description 'Discover, download, and run local LLMs'
homepage 'https://lmstudio.ai/'
version '0.2.26'
license 'MIT'
compatibility 'x86_64'
source_url "https://releases.lmstudio.ai/linux/x86/#{version}/beta/LM_Studio-#{version}.AppImage"
source_sha256 '857aa577b83e8af4182e830dc4f77482f04007ae6df52092242d5a8319868926'
depends_on 'alsa_lib' # R
depends_on 'at_spi2_core' # R
depends_on 'cairo' # R
depends_on 'harfbuzz' # R
depends_on 'cups' # R
depends_on 'dbus' # R
depends_on 'dbus_glib' # R
depends_on 'expat' # R
depends_on 'gcc_lib' # R
depends_on 'gdk_pixbuf' # R
depends_on 'glib' # R
depends_on 'glibc' # R
depends_on 'glibc_lib' # R
depends_on 'gtk2' # R
depends_on 'gtk3' # R
depends_on 'libdrm' # R
depends_on 'libx11' # R
depends_on 'libxcb' # R
depends_on 'libxcomposite' # R
depends_on 'libxdamage' # R
depends_on 'libxext' # R
depends_on 'libxfixes' # R
depends_on 'libxkbcommon' # R
depends_on 'libxrandr' # R
depends_on 'mesa' # R
depends_on 'nss' # R
depends_on 'opencl_icd_loader' # R
depends_on 'pango' # R
depends_on 'gdk_base' # R
depends_on 'sommelier' # R
no_shrink
no_compile_needed
print_source_bashrc
def self.build
File.write 'lmstudio.sh', <<~EOF
#!/bin/bash
rm -f "#{HOME}/.cache/lm-studio/gpu-preferences.json"
cd #{CREW_PREFIX}/share/lmstudio
GDK_BACKEND=x11 ./AppRun "$@"
EOF
end
def self.install
FileUtils.rm 'lm-studio.png'
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/bin"
FileUtils.mv 'usr/share', CREW_DEST_PREFIX
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share/lmstudio"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share/applications"
FileUtils.mv 'lm-studio.desktop', "#{CREW_DEST_PREFIX}/share/applications"
FileUtils.install 'lmstudio.sh', "#{CREW_DEST_PREFIX}/bin/lmstudio", mode: 0o755
FileUtils.mv Dir['*'], "#{CREW_DEST_PREFIX}/share/lmstudio"
end
def self.postinstall
ExitMessage.add "\nType 'lmstudio' to get started.\n".lightblue
end
def self.postremove
config_dir = "#{HOME}/.cache/lm-studio"
if Dir.exist? config_dir
print "Would you like to remove the #{config_dir} directory? [y/N] "
case $stdin.gets.chomp.downcase
when 'y', 'yes'
FileUtils.rm_rf config_dir
puts "#{config_dir} removed.".lightgreen
else
puts "#{config_dir} saved.".lightgreen
end
end
end
end