summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 050af45180c54cde631c9002ac28bc9d41db81f1 (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
# 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
_pkgname="${pkgname%-static-git}"
pkgver=3.1.13.r56.g509cc3ac8
pkgrel=2
pkgdesc='Conversion between markup formats (static build, dynamic Lua support)'
url='https://pandoc.org'
license=('GPL-2.0-or-later')
arch=('x86_64')
depends=('gmp' 'zlib')
optdepends=('texlive-core: for pdf output')
conflicts=('haskell-pandoc' 'pandoc' 'pandoc-bin')
replaces=('haskell-pandoc' 'pandoc' 'pandoc-bin')
provides=("pandoc=${pkgver%%*([a-z]).r*}")
makedepends=('git' 'stack')
source=("git+https://github.com/jgm/pandoc.git")
sha512sums=('SKIP')

pkgver() {
    cd "$_pkgname"
    eval "$(git for-each-ref --shell --sort=creatordate \
        --format 'git tag --force %(refname:lstrip=-1)rc %(refname)' \
        'refs/**/rc/*' | tail -n1)"
    git tag --force \
      "$(awk -F' *: *' '$1 ~ /^[Vv]ersion/ { print $2 }' *.cabal)"-rc \
      "$(git blame -p -L /^[Vv]ersion:/,+1 *.cabal | head -n1 | cut -d' ' -f1)"
    git describe --tags --long --match '[0-9]*' --match 'v[0-9]*' \
        | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    cd "$_pkgname"
    stack config set resolver lts-22.19 # ghc-9.6.4
    echo 'compiler: ghc-9.6.5' >> stack.yaml
}

build() {
    cd "$_pkgname"

    stack build \
        --install-ghc \
        --ghc-options='-fdiagnostics-color=always' \
        --flag 'pandoc:embed_data_files' \
        --fast
}

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
}