makedeb


sillytavern 1.11.5-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.11.5
_nodeminver=18.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=('48a24d49d26413f6f67420b2c3d92d88e1e6c68a0c24cdcee54a3ecc3351cd640d5b5759b5808a4fcafb6a781ca5c4e1e4635971963821d8898d6027b4801d2d'
        'daf3fb9d70c5155b8b14eae1d6efd6dee93874e3628666023cfc264a657a2c5af8bd643744123a85b7fe5122eb5313977cccb649fe8e2ce69cda3f701b1677f1'
        '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}"
  # bug, hardcoded node_modules path
  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"
}