run=(gtk3 alsa-lib pulseaudio gstreamer gstreamer-plugins-base gstreamer-plugins-ugly xorg-libxscrnsaver \
     nss nspr dejavu-ttf ttf-liberation desktop-file-utils hicolor-icon-theme xorg-libxdamage xorg-libxcomposite)

description="An office suite that combines text, spreadsheet and presentation editors"
url="https://www.onlyoffice.com/"

packager="Great-OS Team"
maintainer="Great-OS Team"

name="onlyoffice"
version="9.4.0"
release=1

source=(https://github.com/ONLYOFFICE/DesktopEditors/releases/download/v$version/onlyoffice-desktopeditors_amd64.deb)

package() {
  local _file
  local _res
  while read -r -d '' _file; do
    _res="$(sed 's/\.png$//;s/^.*-//' <<< "$_file")"
    install -d -m755 "${PKG}/usr/share/icons/hicolor/${_res}x${_res}/apps"
    ln -s "../../../../../../opt/onlyoffice/desktopeditors/asc-de-${_res}.png" \
      "${PKG}/usr/share/icons/hicolor/${_res}x${_res}/apps/onlyoffice-desktopeditors.png"
  done < <(find "${PKG}/opt/onlyoffice/desktopeditors" -maxdepth 1 -type f -name 'asc-de-*.png' -print0)
  install -d -m755 "${PKG}/usr/share/licenses/${name}"
  ln -s ../../../../opt/onlyoffice/desktopeditors/3DPARTYLICENSE "${PKG}/usr/share/licenses/${name}/3DPARTYLICENSE"
}
