makedepends=(gtk-update-icon-cache hicolor-icon-theme)

description="Kora icon theme"
packager="Great-OS Team"
maintainer="Gratos"
url="https://github.com/bikass/kora/"

name=icon-theme-kora
version=2.0.1

PKGMK_KEEP_SOURCES="no"

source=(https://github.com/bikass/kora/archive/refs/tags/v${version}.tar.gz)

build() {

  cd kora-$version

  # Delete useless files from source folder
  rm -f "kora/create-new-icon-theme.cache.sh"
  rm -f "kora/icon-theme.cache"
  rm -f "kora-light/create-new-icon-theme.cache.sh"
  rm -f "kora-light/icon-theme.cache"
  rm -f "kora-light-panel/create-new-icon-theme.cache.sh"
  rm -f "kora-light-panel/icon-theme.cache"
  rm -f "kora-pgrey/create-new-icon-theme.cache.sh"
  rm -f "kora-pgrey/icon-theme.cache"

  install -dm755 "$PKG/usr/share/icons"
  install -dm755 "$PKG/usr/share/licenses/$pkgname"
  
  # The following --no-preserve=mode option is necessary since the creator works with 
  # the theme locally and he messed with modes in the past making some icons unreadable 
  # and some directories not executable if installed system wide while he didn't notice 
  # any issue because he installed the theme under the local icon folder on his system.
  cp -dr --no-preserve=mode "kora" "$PKG/usr/share/icons/kora"
  cp -dr --no-preserve=mode "kora-pgrey" "$PKG/usr/share/icons/kora-pgrey"
  
  install -Dm644 "LICENSE" "$PKG/usr/share/licenses/$name/LICENSE"

}
