I took over the disowned package nixnote2-git.
Attached is my first attempt at a PKGBUILD. I would appreciate
constructive feedback.
Thanks in advance,
--
Tom Hale
# Maintainer: Tom Hale <tom[noodle]hale[point]ee>
# Contributor: twa022 <twa022 at gmail dot com>
# Build the highest versioned tag of nixnote2.
# For versioning, see https://github.com/robert7/nixnote2/issues/28
_pkgname=nixnote2
_repo_url="https://github.com/robert7/${_pkgname}.git"
pkgname=${_pkgname}-git
pkgver=2.1.0.beta4g
pkgrel=1
pkgdesc="Evernote clone (formerly Nevernote) - latest tagged version"
url="https://github.com/robert7/nixnote2"
arch=(x86_64)
license=('GPL3')
depends=(tidy java-runtime hicolor-icon-theme poppler-qt5 qt5-webkit)
makedepends=(git)
provides=("nixnote=${pkgver%.r*}" "nixnote2=${pkgver%.r*}")
replaces=(nevernote nixnote nixnote-beta)
source=("${_pkgname}"::git+$_repo_url)
sha256sums=('SKIP')
set -o pipefail
# Get the tag of the commit to use
# Separated out to allow for `makepkg -e` not running prepare()
_get_tag() {
_tag=$(git -c 'versionsort.suffix=-' ls-remote -t --exit-code --refs
--sort=-v:refname \
"$_repo_url" 'v*' \
| sed -E 's/^[[:xdigit:]]+[[:space:]]+refs\/tags\/(.+)/\1/g' | head -n1)
echo "Selected git tag: $_tag" >&2 # To STDERR as called from pkgver()
}
prepare() {
_get_tag
cd "$srcdir/$_pkgname"
git reset --hard "$_tag"
}
pkgver() {
cd "$srcdir/$_pkgname"
[[ -z ${_tag-} ]] && _get_tag
# Example: v2.1.0-beta3 -> 2.1.0.beta3
echo "$_tag" | sed -E 's/^v//;s/-/./'
}
build() {
echo "Building package: $_pkgname-$pkgver" >&2
cd "$srcdir/$_pkgname"
/usr/bin/qmake PREFIX=/usr
make
# Strip the binary to save 160MB of disk
strip qmake-build-release/"$_pkgname"
}
package() {
cd "$_pkgname"
make INSTALL_ROOT="${pkgdir}" install
install -Dm644 shortcuts.txt
"${pkgdir}/usr/share/doc/$_pkgdir/shortcuts_sample.txt"
install -Dm644 docs/{shortcuts-howto,CHANGELOG}.md
"${pkgdir}/usr/share/doc/$_pkgdir/"
}