summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0cf23cf5f1f69b1a2ddc0235ad7eee8da10dd286 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash

# Maintainer: dreieck

_pkgname=tapecalc
pkgname="${_pkgname}"
epoch=1
pkgver=20180401
pkgrel=1

pkgdesc="Fixed-point calculator as a fullscreen editor. You may edit at any position in the expression list. Supports basic arithmetic, interest and sales tax computation. Designed for use as a checkbook or expense-account balancing tool. Formerly known as 'add'."
url="http://invisible-island.net/add/add.html"
license=('custom: free software')

arch=(
  'i686'
  'x86_64'
  'arm'
  'arm64'
)

depends=(
  'ncurses'
  'libncursesw.so'
)
makedepends=()
optdepends=()
provides=()
replaces=()
conflicts=()

options=('emptydirs' 'strip')

source=(
  # "ftp://ftp.invisible-island.net/add/add.tar.gz"
  "ftp://ftp.invisible-island.net/add/add-20180401.tgz"
)

sha256sums=(
  '05996d853cfe7fdebfc3aac4458b3980f5548515599a745d6033743ee2cd3314'
)

# Since the downloaded file extracts to directories having the version in the name, we want to get the latest one, in case we have old source lying around.
_latestdir() {
  # Arguments: $1 (optional): Base directory where to search.
  local _dir
  if [ $# -ge 1 ]; then
    _dir="$1/"
  else
    _dir=''
  fi
  find "${_dir}"add-* -maxdepth 0 -mindepth 0 -type d | sort --version-sort -r | head -n 1
}

prepare() {
  cd "$(_latestdir "${srcdir}")"
  
  # The make system's renaming does not change the executable name in 'x+', so we do it by hand here:
  msg "Fixing executable name in 'x+' ..."
  sed -E "s|([[:space:]])add([[:space:]])|\1${_pkgname}\2|" -i "xterm.sh"
  
  # The way specifiyng a font size is a bit broken. Changing it ...
  msg "Changing the way to specify fontsize in 'x+' ..."
  sed -E "s|([[:space:]])\-fn[[:space:]]+[0-9]+x[0-9]+([[:space:]])|\1-xrm 'xterm*font:*-fixed-*-*-*-20-*'\2|" -i "xterm.sh"
}

pkgver() {
  # # We can extract the version information from the extracted directory name, which is simpler:
  # echo "t$(basename "$(_latestdir "${srcdir}")" | sed 's|^[^\-]*-||')"
  
  # Or we can extract it from the makefile.in, which is consistent with what would end up in the executable:
  cd "$(_latestdir "${srcdir}")"
  grep -E '^[[:space:]]*RELEASE[[:space:]]*=.*[0-9]+' makefile.in | cut -d= -f2 | tr -d '[[:space:]]' | sed -E 's|^t||'
}


build() {
  cd "$(_latestdir "${srcdir}")"
  ./configure \
    --prefix=/usr \
    --bindir=/usr/bin \
    --sbindir=/usr/bin \
    --sysconfdir=/etc \
    --sharedstatedir=/var/lib \
    --includedir=/usr/include \
    --oldincludedir=/usr/include \
    --program-transform-name 's|add|tapecalc|' \
    --with-ncurses \
    --with-ncursesw \
    --without-pdcurses \
    --without-x \
    --without-Xaw3d \
    --without-Xaw3dxft \
    --without-neXtaw \
    --without-XawPlus
  make
}

package() {
  cd "$(_latestdir "${srcdir}")"
  
  make DESTDIR="${pkgdir}" install
  chmod 644 "${pkgdir}/usr/share"/*.hlp
  
  for _docfile in CHANGES README; do
    install -v -D -m644 "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}"
  done
  
  install -v -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}