# Maintainer: Jah Way <jahway603 at protonmail dot com>
# Previous Maintainer: Alad Wenter <alad@archlinux.org>
# Contributor: Lukas Jirkovsky <l.jirkovsky@gmail.com>
pkgname=asoundconf
epoch=1
pkgver=1.2
export srcname="stativ-asoundconf-55cdf2e78b7f"
pkgrel=9slint
slackdesc="$pkgname (utility to read/change user's ALSA library configuration)"
url="https://bitbucket.org/stativ/asoundconf"
license=('GPL')
depends=('python')
makedepends=('git' 'python-build' 'python-installer' 'python-wheel')
optdepends=('python-gobject: asoundconf-gtk GUI'
            'gtk3: for GUI')
source=("https://bitbucket.org/stativ/asoundconf/get/55cdf2e78b7f28ee1808346e5d4e32f7e95618dc.tar.gz"
        '0001-python3-syntax.patch'
        '0002-python3-spaces.patch'
        '0003-python3-gobject.patch')
sha256sums=('SKIP'
            '7a93b1b05615ea73172e8d7a017d2557dbdaa3d34c51d91d46961c5e85f0d2af'
            'dfde8ccc2d57fee3132a3f7b58858300765e56c5a165e605fc52e8c7550bbcbf'
            'ae7bf3c388e1e6a45f6e0fcd44350d9e5bffb2453e2f397470dab9175ccc1072')
doinst() {
  # Update any existing icon cache files:
  if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then
    for theme_dir in /usr/share/icons/* ; do
      if [ -r ${theme_dir}/icon-theme.cache ]; then
        /usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null &
      fi
    done
    # This would be a large file and probably shouldn't be there.
    if [ -r /usr/share/icons/icon-theme.cache ]; then
      rm -f /usr/share/icons/icon-theme.cache
    fi
  fi
  
  # Update desktop database:
  if [ -x /usr/bin/update-desktop-database ]; then
    /usr/bin/update-desktop-database /usr/share/applications 1> /dev/null 2> /dev/null
  fi
}
build() {
    cd "$srcname"
    patch -p1 --verbose < "../0001-python3-syntax.patch"
    patch -p1 --verbose < "../0002-python3-spaces.patch"
    patch -p1 --verbose < "../0003-python3-gobject.patch"
    python3 -m build --wheel --no-isolation
    python3 -m installer --destdir="$PKG" dist/*.whl
}

# vim:set ts=2 sw=2 et:
