summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a31dd3287d026994729010aa89cb2b11b9379fe0 (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
89
90
91
# Maintainer: dreieck

# PKGBUILD last time manually edited: At least on 2016-12-11.

_pkgname=ttf-timetable
pkgname="${_pkgname}-latest"
pkgver=1.352.r20170825
pkgrel=3
pkgdesc="Font with train timetable symbols, used by the offline timetable by CHAPS (IDOS, Timetable-Browser) or INPROP (CP, ELIS) (also retailed by České Dráhy or ŽSR)."
arch=('any')
url="http://chaps.cz/eng/download/idos/zip#kotvaprg"
license=('custom')

depends=(
  "fontconfig"
  "xorg-mkfontscale"
  "xorg-mkfontdir"
  "xorg-xset"
)

makedepends=(
  "fontconfig"
  "unzip"
  "xorg-mkfontscale"
  "xorg-mkfontdir"
  "xorg-xset"
)

provides=("${_pkgname}=${pkgver}")
conflicts=("${_pkgname}")
replaces=("${_pkgname}<=${pkgver}")

install='tt.install'

source=(
  "ttfont.zip::http://ttakt.chaps.cz/TTAktual/Win/Zip/TTFONT.ZIP"
  "IDOS-Licence.pdf::http://chaps.cz/files/idos/IDOS-Licence.pdf"
  "license-dummy.txt"
  "info.url"
  "${install}"
)

sha256sums=(
  "SKIP" # "2ef1aea2b3775d6d3a2cc47f1fac3b40ae273a2e89dbb9dce844c2b474d94886"
  "SKIP"
  "c6bb216055d3670d3100b7a74e04ce0644030f365f4349a09e630ef60fbcb9a4"
  "4c021678394399056573ae7f85779a7fde86f0c70fec6e64f6e1a379195ef4da"
  "6a00ba2e7e0e7610dd4a4a064716bcf368b4269f75046aee585208dd3d6a998f"
)

_fontfile="TT.ttf"

pkgver() {
  _unpackeddir="${srcdir}"
  cd "${_unpackeddir}"
  
  # _ver="$(fc-query -f "%{fontversion}" "${_fontfile}")"
  # _ver="$(wget -q -O- "${url}" | html2text -b 0 | grep 'Font Timetable, version' | sed 's|^.*version[[:space:]]\([0-9\.]*\)[^0-9].*$|\1|g')"
  _ver="$(wget -nv -O- "${url}" | sed -n 's|^.*Font Timetable, version[[:space:]]*\([0-9\.]*\)[^0-9].*$|\1|p')"
  _rel="$(wget -nv -O- "${url}" | sed -n 's|^.*/updates/ttfont_d#\([0-9]*\)[^0-9].*$|\1|p')"

  _exitcode=0
  if [ -z "${_ver}" ]; then
    echo "$0: Error: Could not determine version." > /dev/stderr
    false
    _exitcode=1
  fi
  
  if [ -z "${_rel}" ]; then
    echo "$0: Error: Could not determine release date." > /dev/stderr
    false
    _exitcode=2
  fi

  echo "${_ver}.r${_rel}"
  return ${_exitcode}
}

package() {
  _unpackeddir="${srcdir}"
  cd "${_unpackeddir}"

  install -D -m644 "${_unpackeddir}/${_fontfile}" "${pkgdir}/usr/share/fonts/timetable/TT.ttf"
  ln -s TT.ttf "${pkgdir}/usr/share/fonts/timetable/tt.ttf"
  ln -s TT.ttf "${pkgdir}/usr/share/fonts/timetable/timetable.ttf"
  
  install -D -m644 info.url "${pkgdir}/usr/share/doc/${pkgname}/info.url"

  install -D -m644 license-dummy.txt "${pkgdir}/usr/share/licenses/${pkgname}/copying.txt"
  install -D -m644 "${srcdir}/IDOS-Licence.pdf" "${pkgdir}/usr/share/licenses/${pkgname}/IDOS-Licence.pdf"
}