summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ba7090f33cf59a1534e75deafc741c228c210ecd (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
# Maintainer: zopieux <web+oss at zopieux dot com>

pkgbase=lua-cjson
pkgname=(lua-cjson lua51-cjson lua52-cjson lua53-cjson)
pkgver=2.1.0
pkgrel=5
_tag=${pkgver}
pkgdesc='A fast JSON parsing and encoding support for Lua.'
arch=('x86_64')
url='https://www.kyne.com.au/~mark/software/lua-cjson.php'
license=('custom:MIT')
makedepends=('lua' 'lua51' 'lua52' 'lua53')
optdepends=('perl: UTF8 implementation test')
source=(
  "https://www.kyne.com.au/~mark/software/download/$pkgname-$pkgver.tar.gz"
  'no-tests.patch')
sha256sums=('51bc69cd55931e0cba2ceae39e9efa2483f4292da3a88a1ed470eda829f6c778'
            'f19c685cbc345c14c6df86979b3150e74c1e99da091f7b3c6d9841bf2fee4114')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  patch --forward --strip=1 --input="${srcdir}/no-tests.patch"
}

build() {
  cp -a lua-cjson-${_tag} lua-cjson-${_tag}-51
  make -C lua-cjson-${_tag}-51 PREFIX=/usr LIB_OPTION="-shared ${LDFLAGS}" LUA_VERSION=5.1

  cp -a lua-cjson-${_tag} lua-cjson-${_tag}-52
  make -C lua-cjson-${_tag}-52 PREFIX=/usr LIB_OPTION="-shared ${LDFLAGS}" LUA_VERSION=5.2

  cp -a lua-cjson-${_tag} lua-cjson-${_tag}-53
  make -C lua-cjson-${_tag}-53 PREFIX=/usr LIB_OPTION="-shared ${LDFLAGS}" LUA_VERSION=5.3

  make -C lua-cjson-${_tag} PREFIX=/usr LIB_OPTION="-shared ${LDFLAGS}" LUA_VERSION=5.4
}

package_lua51-cjson() {
  cd lua-cjson-${_tag}-51
  make DESTDIR="$pkgdir" PREFIX=/usr LUA_VERSION=5.1 install{,-extra}
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

package_lua52-cjson() {
  cd lua-cjson-${_tag}-52
  make DESTDIR="$pkgdir" PREFIX=/usr LUA_VERSION=5.2 install{,-extra}
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

package_lua53-cjson() {
  cd lua-cjson-${_tag}-53
  make DESTDIR="$pkgdir" PREFIX=/usr LUA_VERSION=5.3 install{,-extra}
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

package_lua-cjson() {
  cd lua-cjson-${_tag}
  make DESTDIR="$pkgdir" PREFIX=/usr LUA_VERSION=5.4 install{,-extra}
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et: