summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 08de37a5febefe8103aa97dff47428b0ce43a28d (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
77
78
# Maintainer: Dreieck
# Contributor: Tomasz Zok
_pkgname=pandoc-eisvogel-template
pkgname="${_pkgname}-git"
epoch=1
pkgver=3.2.0.r314.20250426.62377f3
pkgrel=1
pkgdesc="The 'eisvogel' LaTeX-template for pandoc. A clean pandoc LaTeX template to convert your markdown files to PDF or LaTeX. It is designed for lecture notes and exercises with a focus on computer science. The template is compatible with pandoc 2."
arch=(any)
url="https://github.com/Wandmalfarbe/pandoc-latex-template"
license=('BSD-3-Clause')
depends=('pandoc')
makedepends=(
  'bash'
  'git'
  'tar'
  'zip'
)
provides=(
  "${_pkgname}=${pkgver}"
)
conflicts=(
  "${_pkgname}"
)
source=(
  "${_pkgname}::git+https://github.com/Wandmalfarbe/pandoc-latex-template.git"
)

sha256sums=('SKIP')

prepare() {
  cd "${srcdir}/${_pkgname}"

  chmod u+x tools/release.sh

  git log > "${srcdir}/git.log"
}

pkgver() {
  cd "${srcdir}/${_pkgname}"
  _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|\-g[0-9a-f]*$||' | tr '-' '+')"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  # if [ -z "${_majorver}" ]; then
  if [ -z "${_ver}" ]; then
    error "Version could not be determined."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}

build() {
  cd "${srcdir}/${_pkgname}"

  tools/release.sh
}

package() {
  cd "${srcdir}/${_pkgname}"

  install -D -v -m644 -t "${pkgdir}/usr/share/pandoc/data/templates/"  dist/eisvogel.{latex,beamer}

  install -D -v -m644 "${srcdir}/git.log" "${pkgdir}/usr/share/doc/${_pkgname}/git.log"
  for _docfile in CHANGELOG.md README.md icon.png icon.svg .texlife.profile; do
    install -D -v -m644 "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}"
  done
  for _docdir in docs examples tests; do
    cp -rv "${_docdir}" "${pkgdir}/usr/share/doc/${_pkgname}/"
  done
  chmod a+x "${pkgdir}/usr/share/doc/${_pkgname}/"/*/*.sh
  chmod a+x "${pkgdir}/usr/share/doc/${_pkgname}/"*/*/*.sh

  install -D -v -m644 'LICENSE' "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  ln -sv "/usr/share/licenses/${pkgname}/LICENSE" "${pkgdir}/usr/share/doc/${_pkgname}/LICENSE"
}