summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1c5b6d9ebce22ac35bcad356ac55572096369aef (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- mode: sh -*-

# Maintainer: Klaus Alexander Seistrup <$(echo 0x1fd+d59decfa=40 | tr 0-9+a-f=x ka-i@p-u.l)>

pkgname='json-bash-git'
_pkgname="${pkgname/-git}"
_srcname="${_pkgname/-/.}"
pkgver=0.2.2.r17.g5aacc24
pkgrel=3
epoch=
pkgdesc='Command-line tool and bash library that creates JSON (latest git commit)'
arch=('any')
url="https://github.com/h4l/$_srcname"
license=('MIT')  # SPDX-License-Identifier: MIT
depends=('bash')
makedepends=('git')
#optdepends=('python: needed to run some of the documentation scripts')
provides=("$_pkgname" "$_srcname")
conflicts=("$_pkgname" "$_srcname")
source=("git+$url.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_srcname"

  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "$_srcname"

  ./json.bash --version
}

package() {
  cd "$_srcname"

  install -vDm0755 -t "$pkgdir/usr/bin" \
    "bin/$_srcname"
  install -vDm0644 -t "$pkgdir/usr/share/doc/$pkgname" \
    CHANGELOG.md README.md
  install -vDm0644 -t "$pkgdir/usr/share/licenses/$pkgname" \
    LICENSE.md

  cp -vfa examples hack "$pkgdir/usr/share/doc/$pkgname/"

  cd 'bin'

  _sources=(
    'jb-cat'
    'jb-echo'
    'jb-stream'
  )
  install -vDm0755 -t "$pkgdir/usr/bin" "${_sources[@]}"

  cd "$pkgdir/usr/bin"

  _symlinks=(
    'jb'
    'jb-array'
    'jb-object'
  )
  for _target in "${_symlinks[@]}"; do
    ln -srvf "$_srcname" "$_target"
  done
}

# eof