aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-subprocess/APKBUILD
blob: f8a4d628c3d30a663ea3f57324907476377a767d (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
# Contributor: Ted Trask <ttrask01@yahoo.com>
# Maintainer: Ted Trask <ttrask01@yahoo.com>

_luaversions="5.1 5.2"
pkgname=lua-subprocess
pkgver=0.0.20141229
pkgrel=2
pkgdesc="A Lua module written in C that allows you to create child processes and communicate with them"
url="https://github.com/tdtrask/lua-subprocess"
arch="all"
license="AS-IS"
depends=""
install=""
depends_dev=""
makedepends="$depends_dev asciidoc"
subpackages=""
for _i in $_luaversions; do
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages lua$_i-subprocess:split_${_i/./_}"
done
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.gz
	makefile.patch"

_giturl="git://github.com/tdtrask/lua-subprocess.git"
_upload="dev.alpinelinux.org:/archive/$pkgname/"

snapshot() {
        local _date=$(date +%Y%m%d)
        local _ver=0.0.$_date
        local _pkg=$pkgname-$_ver.tar.gz
        mkdir -p "$srcdir"
        cd "$srcdir"
	msg "Creating snapshot: $_pkg"
	rm -rf ${_giturl##*/}
	git clone --depth=1 --bare $_giturl || return 1
        git --git-dir ${_giturl##*/} archive -o $_pkg \
                --prefix=$pkgname-$_ver/ HEAD \
                || return 1
        msg "Uploading to $_upload"
        rsync -Lave ssh $_pkg $_upload || return 1
        cd "$startdir"
        sed -i -e "s/^pkgver=.*/pkgver=$_ver/" \
		APKBUILD || return 1
	abuild checksum
}

_sdir="$srcdir"/$pkgname-$pkgver

prepare() {
	local i
	cd "$_sdir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i
	done
}

build() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make lua_package="lua$_i" || return 1
	done
}

package() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make lua_package="lua$_i" DESTDIR="$pkgdir" install || return 1
	done
}

_split() {
	local d= _ver=$1
	pkgdesc="A Lua $_ver module written in C that allows you to create child processes and communicate with them"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	replaces="$pkgname"
	depends=
	for d in usr/lib/lua usr/share/lua; do
		if [ -d "$pkgdir"/$d/$_ver ]; then
			mkdir -p "$subpkgdir"/$d
			mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/ || return 1
		fi
	done
}

for _i in $_luaversions; do
	eval "split_${_i/./_}() { _split $_i; }"
done

md5sums="a2ab629c701eba6f3300405daf104f1d  lua-subprocess-0.0.20141229.tar.gz
8e784d1a4c78ca60bdd61c635026ee72  makefile.patch"
sha256sums="6d58417d9e2791408092ec2b232072c0461343954d3f72ee6943b0103ac6ce20  lua-subprocess-0.0.20141229.tar.gz
019f7eb263abe4015581eae90c55ce2265b24ca213239bc02f565a107f8622ab  makefile.patch"
sha512sums="5d0648a883102172bc086a0054f76832d25ce760149f0e0ddac927a325815b1937e780efc5d553bb6b751ed7642d728ff37745be134dfdb42753bde3b338a1b9  lua-subprocess-0.0.20141229.tar.gz
af4e25d8d503e9cb8296a2b8d8b19577e64b412f56607bf38bc828a7c214904ecdf9619fc2541461bc4dda6c6fcd47cbb1051499bd2f132dad76092cf3ae5e9d  makefile.patch"