summaryrefslogtreecommitdiff
path: root/context-mkiv/PKGBUILD
blob: 599bf958841edf2576eb294feaca6e8ef4392912 (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
79
80
81
82
83
84
85
86
87
88
# Context MkIV additional distribution files
# Maintainer: Philipp Gesang <phg@phi-gamma.net>
pkgname=context-mkiv
pkgver=20160905_1028
pkgrel=1
pkgdesc="The ConTeXt MkIV typesetting system; additional files"
arch=(any)
url=""
license=('GPL')
groups=()
depends=(luatex-svn context-git)
## mtxrun is part of Context; to execute it we need Luatex as the interpreter
makedepends=(rsync luatex-svn context-git)
conflicts=(context-minimals-git)
source=( \
  context-setup-env.sh \
  context-wrap-mtxrun.sh \
)
sha512sums=('92ede9be2a244a065cd133e7300d3c807c212e588eb164d941bb89eda9f72601101b754235bce06442e0e75793ce2de99053f094a8510811d4c8e84e9f445993'
            '1151100c043c25c2a09f04ee1ef067a0f81a6f17aafb88446bb168242d70a069e8b0d351263df31fe02fa662660325dc568e96944ed06b2cf65a24e4a127a750')

# binaries and scripts installed with deps
readonly _luatex=/usr/bin/texlua
readonly _cntroot=/usr/share/context-git
readonly _mtxpath=./texmf-context/scripts/context/lua
readonly _mtxrun=${_mtxpath}/mtxrun.lua

_mtx-script () {
  local scr="mtx-$1.lua"
  shift
  ${_luatex} ${_mtxrun} --script "${_mtxpath}/${scr}" $@
}

pkgver() {
  # no colon, hyphen, or whitespace permitted
  cd context
  _mtx-script context --version 2>/dev/null \
    |egrep "^mtx-context *| current version: .*$" \
    |sed -n 's/^.*: \(....\)\.\(..\)\.\(..\) \(..\):\(..\)$/\1\2\3_\4\5/p'
  exit 42
}

prepare() {
  [[ ! -d context ]] && mkdir context
  cd context
  if [[ -L ./texmf-context ]]; then
    msg "Repo symlink already present"
  else
    ln -s "${_cntroot}" ./texmf-context
  fi
  _mtx-script update \
    --force --update --context=beta --platform=linux \
    --engine=luatex --modules=all --texroot=.
}

build() {
  cd context
  ${_luatex} ${_mtxrun} --generate
}

package() {
  rm -rf "${pkgdir}"/*
  local texdst="${pkgdir}/usr/share/texmf"
  local libdst="${pkgdir}/usr/lib"
  local execdst="${pkgdir}/usr/bin"
  local platformdst="${texdst}/texmf-linux/bin"
  local subdirs=( texmf texmf-fonts texmf-modules )
  cd context
  install -dm755 "${texdst}"
  for dir in ${subdirs[@]}; do
    cp -a "${dir}" "${texdst}"
  done
  # install symlink to Context git
  ln -s /usr/share/context-git "${texdst}/texmf-context"

  # move mtxrun out of the way, we’ll call it with the wrapper
  install -dm755 "${platformdst}"
  install -Dm755 texmf-linux/bin/mtxrun "${platformdst}"
  install -dm755 "${execdst}"
  install -Dm755 "${srcdir}/context-wrap-mtxrun.sh" "${execdst}/mtxrun"

  # mktexlsr is the only script we take as-is
  install -Dm755 texmf-linux/bin/mktexlsr "${execdst}"
  install -dm755 "${libdst}"
  install -Dm644 "${srcdir}/context-setup-env.sh" "${libdst}"
}

# vim:et:ft=sh:sw=2:ts=8