summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 861ba418af3bacef1d3d1165f8152f2d58bdbf26 (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
# Maintainer: Cameron Banta <cbanta@gmail.com>
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Contributor: Lennart Eichhorn <lennart@madmanfred.com>

pkgname=( lua-stringy lua51-stringy lua52-stringy lua53-stringy )
pkgver=0.5.1
_pkgver=0.5-1
pkgrel=1
pkgdesc="Lua string utility library"
license=('MIT')
arch=("i686" "x86_64")
url="https://github.com/brentp/lua-projects/"
makedepends=('lua' 'lua51' 'lua52' 'lua53')
source=("lua-stringy-$_pkgver.tar.gz::https://github.com/brentp/$pkgname/archive/v${_pkgver}.tar.gz")
md5sums=('6b66ca5f644775673a0035ef89322288')

build() {
	mkdir -p 5.1 5.2 5.3 5.4

	local i
	cd lua-stringy-$_pkgver/stringy
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done

	${CC:-gcc} ${CFLAGS} -fPIC -shared ${LDFLAGS} -I/usr/include/lua5.1 -llua5.1 -o "$srcdir/5.1/stringy.so" stringy.c || return 1
	${CC:-gcc} ${CFLAGS} -fPIC -shared ${LDFLAGS} -I/usr/include/lua5.2 -llua5.2 -o "$srcdir/5.2/stringy.so" stringy.c || return 1
	${CC:-gcc} ${CFLAGS} -fPIC -shared ${LDFLAGS} -I/usr/include/lua5.3 -llua5.3 -o "$srcdir/5.3/stringy.so" stringy.c || return 1
	${CC:-gcc} ${CFLAGS} -fPIC -shared ${LDFLAGS} -I/usr/include/lua5.4 -llua5.4 -o "$srcdir/5.4/stringy.so" stringy.c || return 1
}

check() {
	cd "$srcdir/5.1" ; lua5.1 "$srcdir/lua-stringy-$_pkgver/stringy/stringy_test.lua"
	cd "$srcdir/5.2" ; lua5.2 "$srcdir/lua-stringy-$_pkgver/stringy/stringy_test.lua"
	cd "$srcdir/5.3" ; lua5.3 "$srcdir/lua-stringy-$_pkgver/stringy/stringy_test.lua"
	cd "$srcdir/5.4" ; lua5.4 "$srcdir/lua-stringy-$_pkgver/stringy/stringy_test.lua"
}

package_lua51-stringy() {
  pkgdesc='Lua string utility library for Lua 5.1'
  depends+=('lua51')

  local _lualibdir=/usr/lib/lua/5.1
  mkdir -p "$pkgdir/$_lualibdir"
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  cp $srcdir/5.1/stringy.so "$pkgdir/$_lualibdir/"
  cp "$srcdir/lua-stringy-$_pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname"
}

package_lua52-stringy() {
  pkgdesc='Lua string utility library for Lua 5.2'
  depends+=('lua52')

  local _lualibdir=/usr/lib/lua/5.2
  mkdir -p "$pkgdir/$_lualibdir"
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  cp $srcdir/5.2/stringy.so "$pkgdir/$_lualibdir/"
  cp "$srcdir/lua-stringy-$_pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname"
}

package_lua53-stringy() {
  pkgdesc='Lua string utility library for Lua 5.3'
  depends+=('lua53')

  local _lualibdir=/usr/lib/lua/5.3
  mkdir -p "$pkgdir/$_lualibdir"
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  cp $srcdir/5.3/stringy.so "$pkgdir/$_lualibdir/"
  cp "$srcdir/lua-stringy-$_pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname"
}

package_lua-stringy() {
  pkgdesc='Lua string utility library for Lua 5.4'
  depends+=('lua')

  local _lualibdir=/usr/lib/lua/5.4
  mkdir -p "$pkgdir/$_lualibdir"
  mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
  cp $srcdir/5.4/stringy.so "$pkgdir/$_lualibdir/"
  cp "$srcdir/lua-stringy-$_pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname"
}