summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0cbc872c0984bbbc259427c3f47c248967eefe6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Maintainer: Tom Hale <tom[noodle]hale[point]ee>
# Contributor: twa022 <twa022 at gmail dot com>

_pkgname=nixnote2
pkgname=${_pkgname}-git
pkgver=2.1.9.r0.gf9cbad25
pkgrel=1
pkgdesc='Evernote clone (formerly Nevernote) - git checkout'
url="https://github.com/robert7/$_pkgname"
arch=(x86_64 i686 pentium4)
license=(GPL3)
depends=(curl gcc-libs glibc hunspell java-runtime hicolor-icon-theme poppler-qt5 tidy qt5-base qt5-declarative qt5-webkit)
makedepends=(boost gcc git qt5-tools)
conflicts=(nixnote2-appimage)
provides=("nixnote=${pkgver%.r*}" "$_pkgname=${pkgver%.r*}")
replaces=(nevernote nixnote nixnote-beta)
source=("git+${url}.git"  tidy-source-dir-location.patch)
sha256sums=(SKIP  8cb8e5c3d3d320ffb0991d34a5c155b631dd83b9a94d530815da4f92c5ebd5ff)

pkgver() {
  cd "$srcdir/$_pkgname"
  git describe --long | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
}

build() {
  # Patch needed as Debian has additional leading tidy/ in the include path
  # Support `makepkg -e`: `patch` doesn't support skipping an already applied patch file.
  # Only apply the patch if it couldn't be cleanly reversed with --dry-run
  if ! patch -p1 -d "$_pkgname" --reverse --force --dry-run < tidy-source-dir-location.patch &> /dev/null; then
    patch -p1 -d "$_pkgname" < tidy-source-dir-location.patch
  fi
  cd "$srcdir/$_pkgname"
  qmake PREFIX=/usr

  local threads  # make quickly but `nice`ly -- use ceil(#processors / 3) jobs
  threads=$(( 1 + ($(nproc)-1) / 3 ))
  echo "Making with $threads threads."
  nice -n 10 make -j "$threads"
}

package() {
  cd "$_pkgname"
  make INSTALL_ROOT="$pkgdir" install
  install -Dm644 -t "${pkgdir}/usr/share/doc/${_pkgname}/" CONTRIBUTING.md debian/changelog
  # shortcuts.txt is referenced in doc:
  # https://github.com/robert7/nixnote2/wiki/HowTo---Customize-keyboard-shortcuts
  install -Dm644 -t "${pkgdir}/usr/share/${_pkgname}/" shortcuts.txt
}