# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Albert.Zhou <albert.zhou@wiz.cn>

pkgname=wiznote
pkgver=2.7.1
_commit=2bca5aec23eb3998d2b06790fdb293c332d9f915
pkgrel=1
pkgdesc="Opensource cross-platform cloud based note-taking client"
arch=('x86_64')
url="http://www.wiznote.com"
license=('GPL3' 'custom')
depends=('desktop-file-utils' 'hicolor-icon-theme' 'xdg-utils' 'qt5-websockets' 'qt5-webengine'
         'qt5-svg') # 'crypto++')
# shared clucene/quazip triggers segfault
makedepends=('cmake' 'qt5-tools' 'boost')
source=("$pkgname-$_commit.tar.gz::https://github.com/WizTeam/WizQTClient/archive/$_commit.tar.gz")
sha512sums=('dc72fbd80e1a06fd260ff2bd85e4ffe9f4b30cafb7123812eae88cde64f886357183cd74955fc30434593003ee160a8ebe0e1e070e22ef88503bdcf9340641a5')

prepare() {
  #sed -e 's/add_subdirectory(cryptopp)//' \
  #    -i WizQTClient-$_commit/lib/CMakeLists.txt
  #sed -e 's/cryptlib/cryptopp/' \
  #    -i WizQTClient-$_commit/src/CMakeLists.txt

  rm -rf build; mkdir build
}

build() {
  cd build

  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    ../WizQTClient-$_commit
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir/" install
}
