# Maintainer: Valeria Fadeeva <valeria@fadeeva.me>

_gitname="$(basename $(pwd))"
pkgname=("melawy-$_gitname")
pkgver=3.3.0.2
pkgrel=1
pkgdesc="$(head -n 2 README.md | tail -n 1)"
arch=('i686' 'x86_64')
url="https://git.melawy.ru/Melawy-Linux/$_gitname"
license=('AGPL')

depends=('appstream-qt' 'boost' 'boost-libs' 'ckbcomp' 'cmake' 'cryptsetup' 'dmidecode' 'doxygen' 'efibootmgr' 'extra-cmake-modules' 'git' 'gptfdisk' 'gtk-update-icon-cache' 'hwinfo' 'icu' 'kconfig' 'kcoreaddons' 'kdbusaddons' 'ki18n' 'kiconthemes' 'kio' 'kparts' 'kpmcore' 'kservice' 'kwidgetsaddons' 'libpwquality' 'mkinitcpio-openswap' 'networkmanager' 'plasma-framework' 'polkit-qt5' 'python' 'python-jsonschema' 'python-pyaml' 'python-unidecode' 'qt5-quickcontrols2' 'qt5-svg' 'qt5-tools' 'qt5-translations' 'qt5-webengine' 'qt5-xmlpatterns' 'rsync' 'solid' 'squashfs-tools' 'upower' 'yaml-cpp')

makedepends=('appstream-qt' 'boost' 'boost-libs' 'ckbcomp' 'cmake' 'cryptsetup' 'dmidecode' 'doxygen' 'efibootmgr' 'extra-cmake-modules' 'git' 'gptfdisk' 'gtk-update-icon-cache' 'hwinfo' 'icu' 'kconfig' 'kcoreaddons' 'kdbusaddons' 'ki18n' 'kiconthemes' 'kio' 'kparts' 'kpmcore' 'kservice' 'kwidgetsaddons' 'libpwquality' 'mkinitcpio-openswap' 'networkmanager' 'plasma-framework' 'polkit-qt5' 'python' 'python-jsonschema' 'python-pyaml' 'python-unidecode' 'qt5-quickcontrols2' 'qt5-svg' 'qt5-tools' 'qt5-translations' 'qt5-webengine' 'qt5-xmlpatterns' 'rsync' 'solid' 'squashfs-tools' 'upower' 'yaml-cpp')

optdepends=()

backup=()
provides=("${pkgname}")
conflicts=("calamares" "${pkgname}")
options=(!strip !emptydirs)
source=("file:///disk/github/active/Melawy/Melawy-Dev/CORE/calamares_local/calamares.tar.gz")
sha256sums=("SKIP")
validpgpkeys=('BC8B600E8DDA1F4CB77B10D2BA803A261A5EE6B8')

# pkgver() {
#       cd "${srcdir}/$_gitname"
#       printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
# }

# pkgver() {
#         cd "${srcdir}/$_gitname"
#         printf "3.3.0.%s" "$(git rev-list --count HEAD)"
# }

package() {
  make -C ${srcdir}/calamares/build DESTDIR="${pkgdir}" install
  install -Dm644 "${srcdir}/calamares/melawy-linux.desktop" "${pkgdir}/usr/share/applications/melawy-linux.desktop"
  install -Dm644 "${srcdir}/calamares/melawy-linux-debugging.desktop" "${pkgdir}/usr/share/applications/melawy-linux-debugging.desktop"
  install -Dm755 "${srcdir}/calamares/calamares_polkit" "${pkgdir}/usr/bin/calamares_polkit"
  #rm "${pkgdir}/usr/share/applications/calamares.desktop"
  install -dm 755 "${pkgdir}/etc"
  cp -rp "${srcdir}/calamares/configs/melawy" "${pkgdir}/etc/calamares"
}
