summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d81e7c87cebb0cd254b5360dc5d197097f4c113d (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
69
70
71
72
73
74
75
76
# Maintainer: Gesh <gesh@gesh.uni.cx>
# based on pandoc-sile-git, by
# Contributor: Caleb Maclennan <caleb@alerque.com>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Arch Haskell Team <arch-haskell@haskell.org>

shopt -s extglob

pkgname=pandoc-static-git
# convention: _^{n+1}pkgname is the vanilla pkgname, n renamings ago
_pkgname="${pkgname%-static-git}-cli"
__pkgname="${_pkgname%-cli}"
pkgver=3.6.2.r6.gba04a9987
pkgrel=1
pkgdesc='Conversion between markup formats (static build, dynamic Lua support)'
arch=('i686' 'x86_64')
url='https://pandoc.org'
license=('GPL-2.0-or-later')
provides=(
    "$_pkgname=${pkgver%%*([a-z]).r*}"
    "$__pkgname=${pkgver%%*([a-z]).r*}"
)
conflicts=("$_pkgname" "$__pkgname")
depends=('gmp' 'zlib')
makedepends=('git' 'stack')
optdepends=('texlive-core: for pdf output')
_url=https://github.com/jgm/pandoc
source=("$pkgname::git+$_url.git")
sha256sums=('SKIP')

pkgver() {
  cd "$pkgname"
  git describe --tags --long --match 'pandoc-cli-*' \
    | sed 's/^pandoc-cli-//;s/^v//' \
    | awk -F- \
    'BEGIN { OFS="" }
    {
        revcount=$(NF-1)
        sha=$NF
        NF=(NF-2)
        printf "%s.r%s.%s\n", $0, revcount, sha
    }'
}

prepare() {
  cd "$pkgname"
  stack config set resolver lts-23.1 # ghc-9.8.4
}

build() {
  cd "$pkgname"

  stack build \
      --install-ghc \
      --ghc-options='-fdiagnostics-color=always' \
      --flag 'pandoc:embed_data_files' \
        --fast
  stack run -- --bash-completion > pandoc.bash
}

check() {
  cd "$pkgname"
  stack test
}

package() {
  cd "$pkgname"
  find ./ -path '*/dist/*' -type f -name pandoc -perm /u+x \
      -execdir install -Dm755 -t "$pkgdir/usr/bin/" {} \;
  install -Dm644 pandoc-cli/man/pandoc.1 \
      "$pkgdir"/usr/share/man/man1/pandoc.1
  install -Dm644 pandoc.bash \
      "$pkgdir"/usr/share/bash-completion/completions/pandoc
}

# vim:set ts=2 sw=2 et