aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-turbo/APKBUILD
blob: 59413aa25b8af0491ad1fb0caf9b8feeedde811b (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>

pkgname=lua-turbo
_jitver=2.1.0_beta2
pkgver=2.0.4
pkgrel=4
pkgdesc="a framework built for LuaJIT 2 and Linux"
url="http://www.turbolua.org/"
# luajit is not available for disabled arches
arch="all !s390x"
license="GPL"
depends="luajit"
depends_dev=""
makedepends="$depends_dev libressl-dev"
install=""
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/kernelsauce/turbo/archive/v$pkgver.tar.gz
	${pkgname}.initd
	${pkgname}.confd"

_builddir="$srcdir/turbo-$pkgver"

prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	# check if we are using the current luajit version
	if [ -r ../../../../main/luajit/APKBUILD ]; then
		local _currentjit=$(grep "^pkgver=" ../../../../main/luajit/APKBUILD)
		export LUAJIT_VERSION="$_jitver"
		msg "Building for luajit version $_jitver"
		if [ "${_currentjit#*=}" != "$LUAJIT_VERSION" ]; then
			die "luajit version does not match!"
		fi
	else
		die "cannot locate luajit APKBUILD!"
	fi
	# we need to fix the loading of libssl.
	# so we replace symlink with real filename
	sed -i -e \
		"s|os.getenv(\"TURBO_LIBSSL\") or \"ssl\"|\"$(readlink /usr/lib/libssl.so)\"|" \
		turbo/hash.lua || return 1
	sed -i -e \
		"s|os.getenv(\"TURBO_LIBSSL\") or \"ssl\"|\"$(readlink /usr/lib/libssl.so)\"|" \
		turbo/crypto_linux.lua || return 1
}

build() {
	cd "$_builddir"
	make PREFIX=/usr || return 1
}

package() {
	cd "$_builddir"
	make PREFIX="$pkgdir"/usr install || return 1
	install -Dm 755 "$srcdir"/${pkgname}.initd \
		$pkgdir/etc/init.d/$pkgname || return 1
	install -Dm 644 "$srcdir"/${pkgname}.confd \
		$pkgdir/etc/conf.d/$pkgname || return 1
}

md5sums="450d9025014f314ad555cb2b61acce2f  lua-turbo-2.0.4.tar.gz
61c475d79bef1c65d9913e7c8fbfc9e3  lua-turbo.initd
321fe55bbd0b124b65339ad22823eda0  lua-turbo.confd"
sha256sums="5bee3132d28e56b432bd76221b4bd221666130000814a7eb5867f12b11d23b0f  lua-turbo-2.0.4.tar.gz
379fe987aaab428051cf6ab4f3b9246b0ce29e09b0dee0b74a7b6c85b3e14629  lua-turbo.initd
9796bf17f8971440453b636f4fe2f132cbceea0ca091fe1165be274310746f4b  lua-turbo.confd"
sha512sums="68617d912e5bbc967de912fdcc3053e6fcf48495b92e423c687ec3ee4c48aba9ac0e385678e101e384ac836b481fc34e3285b5999fd41cb4a75c077071db9dc3  lua-turbo-2.0.4.tar.gz
2e91d5dda33b4bf09667fd23c80a471e93605125a820c440c2b1b022b8bce6ab065493473b153f1fa1863e9655f6413dbe42dc983260da4ed8bee3b2e3743ec2  lua-turbo.initd
3d2816738a2ee615bb6523b6b0aff12a51062e56ade5dbaa4b1b63afda8dce0a532c099b8a03fe67d589058ac8a7d49434a68fb28d93b167a56c56acc7596fdb  lua-turbo.confd"