summaryrefslogtreecommitdiff
path: root/main/haserl/APKBUILD
blob: 335ed6d664d4c5c9ca1352b435928f5cb3fe4e9d (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_luaversions="5.4 5.3 5.2 5.1"
_defaultlua="5.4"
pkgname=haserl
pkgver=0.9.36
pkgrel=2
pkgdesc="Html And Shell Embedded Report Language"
url="https://haserl.sourceforge.net/"
arch="all"
license="GPL-2.0"
depends=""
makedepends="automake autoconf"
subpackages="$pkgname-doc"
for _i in $_luaversions; do
	depends="$depends haserl-lua$_i"
	makedepends="$makedepends lua$_i-dev"
	subpackages="$subpackages haserl-lua$_i:split_${_i/./_}"
done
options="suid !check" # no test suite
source="https://downloads.sourceforge.net/haserl/haserl-$pkgver.tar.gz"

# secfixes:
#   0.9.36-r0:
#     - CVE-2021-29133

_sdir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_sdir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i;;
		esac
	done
	sed -i -e 's/^        /\t/' src/Makefile.am
	rm -f src/haserl_lualib.inc

	aclocal && autoconf && autoheader && automake --add-missing

	for _i in $_luaversions; do
		cp -r "$_sdir" "$srcdir"/build-$_i
	done
}

build() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		./configure \
			--build=$CBUILD \
			--host=$CHOST \
			--prefix=/usr \
			--with-lua=lua$_i
		make
	done
}

package() {
	for _i in $_luaversions; do
		cd "$srcdir"/build-$_i
		make DESTDIR="$pkgdir/" install
		chmod 4111 "$pkgdir"/usr/bin/haserl
		mv "$pkgdir"/usr/bin/haserl "$pkgdir"/usr/bin/haserl-lua$_i
	done
	ln -s haserl-lua$_defaultlua "$pkgdir"/usr/bin/haserl
}

_split() {
	local d= _ver=$1
	pkgdesc="Html And Shell Embedded Report Language with Lua $_ver support"
	replaces="$pkgname"
	depends=
	if [ -f "$pkgdir"/usr/bin/haserl-lua$_ver ]; then
		mkdir -p "$subpkgdir"/usr/bin
		mv "$pkgdir"/usr/bin/haserl-lua$_ver "$subpkgdir"/usr/bin/
	fi
}

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

sha512sums="727c6b4cf26bb7fd9d55c328dcca47dc0093b2836cd4874ad28a9c07d9ad4c82c22b899f64df33bad37325f66ce1af8aec1fe0a90e42b9f6cc06b01afe3062d9  haserl-0.9.36.tar.gz"