summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fcde7e3809430a1d36afbaa76ba3ecc23cc0c43b (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
# Maintainer: Dominik Fischer <d dot f dot fischer at web dot de>
pkgname=git-makepkg-template-git
pkgver=1
pkgrel=1
pkgdesc="makepkg-template for git source packages"
arch=('any')
url="https://github.com/dffischer/git-makepkg-template"
license=('GPL')
depends=('pacman>=4.1.2' 'git')

makedepends+=('git')
source+=("${_gitname:=${pkgname%-git}}::${_giturl:-git+$url}")
md5sums+=('SKIP')
provides+=($_gitname)
conflicts+=($_gitname)
pkgver() {
  cd ${_gitname:-$pkgname}
  git describe --long --tags 2>/dev/null | sed 's/[^[:digit:]]*\(.\+\)-\([[:digit:]]\+\)-g\([[:xdigit:]]\{7\}\)/\1.r\2.g\3/;t;q1'
  [ ${PIPESTATUS[0]} -ne 0 ] && \
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
  cd "$_gitname"
  install -m644 -Dt "$pkgdir/usr/share/$pkgname/" README.md
  local destdir="$pkgdir/usr/share/makepkg-template"
  find -iname '*.template' -type f -exec install -m644 -Dt "$destdir" '{}' +
  cd "$destdir"
  for file in *
  do
    ln -s $file ${file%-*.template}.template
  done
}