# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Doug Newgard <scimmia at archlinux dot info>

pkgname=notepadqq
pkgver=1.4.8
pkgrel=2
pkgdesc='Notepad++-like text editor for Linux'
arch=('x86_64')
url='https://notepadqq.altervista.org/'
license=('GPL3')
depends=('desktop-file-utils' 'hicolor-icon-theme' 'qt5-svg' 'qt5-webkit')
makedepends=('git' 'qt5-tools')
options=('!emptydirs')
_commit=b371c5686e483b93e97c1b4dc5b8a9bb5604c760  # tags/v1.4.8^0
source=("git+https://github.com/notepadqq/notepadqq.git#commit=$_commit"
        "git+https://github.com/notepadqq/CodeMirror.git")
sha256sums=('SKIP'
            'SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  cd $pkgname
  git config submodule.src/editor/libs/codemirror.url "$srcdir/CodeMirror"
  git submodule update --init

  # Fixes to the appdata file
  git cherry-pick -n b8394792a002debd85574aeb79800d6ba46a6b20
  git cherry-pick -n 6b80d126341243f84eb02a1863320d1bc4b9bd53
  git cherry-pick -n 3c16a4134855639ff23b3275a0ceac3dcc30a2da
}

build() {
  cd $pkgname
  qmake-qt5 PREFIX=/usr LRELEASE=/usr/bin/lrelease notepadqq.pro
  make
}

package() {
  cd $pkgname
  make INSTALL_ROOT="$pkgdir" install
}
