# $Id: PKGBUILD 141603 2015-09-25 13:04:46Z fyan $
# Maintainer: Felix Yan <felixonmars@gmail.com>
# Contributor: Albert.Zhou <albert.zhou@wiz.cn>

pkgname=wiznote
pkgver=2.2.5.20150924
_commit=c2cbd42e6a1f38a3b95626b21951c5804f085009
pkgrel=1
pkgdesc="Opensource cross-platform cloud based note-taking client"
arch=('i686' 'x86_64')
url="http://www.wiznote.com"
license=('GPL3' 'custom')
depends=('desktop-file-utils' 'hicolor-icon-theme' 'xdg-utils' 'qt5-base' 'qt5-webkit' 'crypto++') # indirect: qt5-declarative qt5-sensors zlib glic gcc-libs
# shared clucene/quazip triggers segfault
makedepends=('cmake' 'qt5-tools' 'git' 'boost')
install=wiznote.install
_wiznote_project_name="WizQTClient"
source=("git+https://github.com/WizTeam/${_wiznote_project_name}.git#commit=$_commit")
md5sums=('SKIP')

prepare() {
  rm $_wiznote_project_name/share/skins/default/Thumbs.db

  sed -e 's/add_subdirectory(cryptopp)//' \
      -i $_wiznote_project_name/lib/CMakeLists.txt
  
  sed -e 's/cryptlib/cryptopp/' \
      -i $_wiznote_project_name/src/CMakeLists.txt

  rm -rf build; mkdir build
}

build() {
  cd build

  cmake \
    -DWIZNOTE_USE_QT5=YES \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    ../$_wiznote_project_name
  make
}

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