# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Santiago Torres-Arias <santiago[at]archlinux[dot]org>
# Contributor: Aaron McDaniel (mcd1992) <'aur' at the domain 'fgthou.se'>

pkgname=iaito
_gitcommit=b1bafef891694c34aaf41b9bb0110659be7fe7a0
pkgver=5.3.1
pkgrel=1
pkgdesc='Qt and C++ GUI for radare2 reverse engineering framework'
url='https://github.com/radareorg/iaito'
arch=('x86_64')
license=('GPL3')
depends=('radare2' 'capstone' 'qt5-base' 'qt5-svg' 'qt5-webengine' 'icu' 'python' 'jupyter'
         'pyside2' 'python-shiboken2' 'graphviz' 'gcc-libs' 'syntax-highlighting')
makedepends=('git' 'cmake' 'ninja' 'shiboken2' 'qt5-tools')
optdepends=('r2ghidra: ghidra decompiler plugin')
replaces=('r2cutter')
source=("git+https://github.com/radareorg/iaito#commit=${_gitcommit}"
        "git+https://github.com/radareorg/iaito-translations")
sha512sums=('SKIP'
            'SKIP')
b2sums=('SKIP'
        'SKIP')

pkgver() {
  cd iaito
  git describe --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd iaito
  git config 'submodule.src/translations.url' "${srcdir}/iaito-translations"
  git submodule update --init src/translations
}

build() {
  cd iaito/src
  cmake -B build \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=None \
    -DIAITO_ENABLE_PYTHON=ON \
    -DIAITO_ENABLE_PYTHON_BINDINGS=ON \
    -DIAITO_USE_BUNDLED_RADARE2=OFF \
    -DIAITO_USE_ADDITIONAL_RADARE2_PATHS=OFF \
    -DIAITO_ENABLE_CRASH_REPORTS=OFF \
    -DIAITO_ENABLE_GRAPHVIZ=ON \
    -Wno-dev \
    -G Ninja
  ninja -C build
}

package() {
  cd iaito
  DESTDIR="${pkgdir}" ninja -C src/build install
  install -d "${pkgdir}/usr/share/doc/${pkgname}"
  cp -a docs/* "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
