makedeb


sillytavern 1.12.1-0


Multy-API LLM frontend

Viewing /PKGBUILD.

View raw.

Click here to go back to the Git tree for sillytavern.

# Maintainer: exponential <echo ZXhwb25lbnRpYWxtYXRyaXhAcHJvdG9ubWFpbC5jb20K | base64 -d>

# Uncomment or export in your build environment,
# to use the central cache instead of the local one
#_LOCALCACHE=0
pkgname=sillytavern
_pkgname=SillyTavern
pkgver=1.12.1
_nodeminver=20.0.0
pkgrel=0
pkgdesc="Multy-API LLM frontend"
# actually onnxruntime-node is amd64 and arm64
arch=("all")
url="https://docs.sillytavern.app/"
license=('AGPL3')
depends=('unionfs-fuse')
# many ways to install nodejs
optmakedepends=("nodejs>=${_nodeminver}: install nodejs from the repo"
                'npm: needed with distro repo nodejs'
                'nvm: install several versions of nodejs in parallel')
optdepends=("nodejs>=${_nodeminver}"
            'nvm')
source=("${pkgname}-$pkgver.tar.gz::https://github.com/SillyTavern/SillyTavern/archive/refs/tags/${pkgver}.tar.gz"
        "${pkgname}-wrapper.sh"
        "${pkgname}.desktop")
b2sums=('02b39e22a1fda30d0e85a8ab0783889073e630aa69f79fc644e34acd87269965092408e5c00582fb892cba45a3f034baa0943ba75c6942e882e1bd5287fdf0d0'
        '6d175c44126429ad83554240b757346ac18d62ad12e5fcbd9fda0d1021a96a7fe2206bc9c4a64125172af5ed4ea37c8a73abc71eea81ac987f803c5e649edb18'
        '160572cef639c048310380659d95c7adb277c7a9959c3c617f3d5640585d16bc0e25b90fb12182da43158a4e24cf557330a9246fb3acb881d9565530deaff457')

prepare() {
  cd "$srcdir/${_pkgname}-$pkgver"
  # Download the nodejs libs in local PKGBUILD cache (or in the general cache)
  [ -z "$_LOCALCACHE" ] && npm i --no-audit --cache "${startdir}/${pkgname}-npm-cache" || npm i --no-audit
  # readme
  mv .github/readme* .
  # Cleanup
  rm -Rf *.sh *.bat replit.nix Dockerfile docker package-lock.json post-install.js .*
  rm -Rf node_modules/onnxruntime-node/bin/napi-v3/{darwin,win32}
}

package() {
  cd "$srcdir/${_pkgname}-$pkgver"
  _SHAREPREFIX="/usr/share/${pkgname}"
  _LIBPREFIX="/usr/lib/${pkgname}"
  # Creating Directories
  install -dm755 $pkgdir/usr/{bin,share/{${pkgname},doc/${pkgname},applications,icons/hicolor/72x72/apps},lib/${pkgname}}
  # doc
  ln -s "${_SHAREPREFIX}/LICENSE" "$pkgdir/usr/share/doc/${pkgname}/license"
  ln -s "${_SHAREPREFIX}/SECURITY.md" "$pkgdir/usr/share/doc/${pkgname}/security"
  mv readme* "$pkgdir/usr/share/doc/${pkgname}/"
  # Install
  install -Dm755 "$srcdir/${pkgname}-wrapper.sh" -v "$pkgdir/usr/bin/${pkgname}"
  mv "$srcdir/${_pkgname}-$pkgver/node_modules" "$pkgdir${_LIBPREFIX}"
  mv "$srcdir/${_pkgname}-$pkgver/"* "$pkgdir${_SHAREPREFIX}"
  ln -s /usr/lib/sillytavern/node_modules "$pkgdir${_SHAREPREFIX}/"
  # Icon and desktop file
  ln -s "${_SHAREPREFIX}/public/img/apple-icon-72x72.png" "$pkgdir/usr/share/icons/hicolor/72x72/apps/${pkgname}.png"
  install -Dm644 "$srcdir/${pkgname}.desktop" -vt "$pkgdir/usr/share/applications"
}