aboutsummaryrefslogtreecommitdiffstats
path: root/community/unit/APKBUILD
blob: 9c0efa7c0511a5ea9112b179eb3f6a0f817cf659 (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
# Contributor: André Klitzing <aklitzing@gmail.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=unit
pkgver=1.12.0
pkgrel=1
pkgdesc="NGINX Unit is a dynamic web application server"
url="https://unit.nginx.org/"
arch="all"
license="Apache-2.0"
_phpver=7
makedepends="perl-dev php$_phpver-dev php$_phpver-embed python3-dev ruby-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="https://unit.nginx.org/download/unit-$pkgver.tar.gz
	Python-fixing-build-for-Python-3.8.patch
	$pkgname.initd
	$pkgname.confd
	$pkgname.logrotate"

for _mod in perl php$_phpver python3 ruby; do
	subpackages="$subpackages $pkgname-$_mod:_module"
done

_modules_dir="/usr/lib/unit/modules"

build() {
	# Needed for building perl module.
	export CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"

	./configure \
		--prefix="/usr" \
		--state="/var/lib/unit" \
		--control="unix:/run/control.unit.sock" \
		--pid="/run/unit.pid" \
		--log="/var/log/unit.log" \
		--modules="$_modules_dir" \
		--user=unit \
		--group=unit \
		--tests
	./configure perl
	./configure php --module=php$_phpver --config=php-config$_phpver
	./configure python --config=python3-config
	./configure ruby

	make
	make tests
}

check() {
	./build/tests

	# FIXME: Some tests are broken.
	#make install DESTDIR=".dest"
	#./test/run.py
}

package() {
	make unitd-install DESTDIR="$pkgdir"

	install -D -m 755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -D -m 644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	install -D -m 644 "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname
}

openrc() {
	default_openrc
	depends="curl"
}

_module() {
	local modname=${subpkgname#$pkgname-}
	pkgdesc="$modname module for NGINX Unit"
	depends="$pkgname=$pkgver-r$pkgrel"

	cd "$builddir"
	make $modname-install DESTDIR="$subpkgdir"
}

sha512sums="a55a084ed6e1cd3f784bd81571772ca29ca9a0d19089c9bb74c88258d2e1ef872978219c47b6dc2610711ae1aa95ef68ddb77f45747a2eacdd9d92c6f8fee28b  unit-1.12.0.tar.gz
e9741cceacf9cb1cfbc8788ce4b6abc4145dc36c28e06ade42e77367d0ef668f4773a483f5b68d109788631f19e34b36ea049f5475abef1160b35e75a851e06c  Python-fixing-build-for-Python-3.8.patch
a835b83284d7bd4afb445dd93c84e2c6dd5906f137784ff3189edc82c3f14f07c5de00681125924138e3ac420cc849cc93e52cabbd6b550ded09d055d30e091c  unit.initd
f85112726dfcace2b6d94b10669615fef517f5aa10ac858890dd9f5c868a6e2569500f7411f758fcb24c98c9630760d36a74bd33ea510ab0f8ca8cd6cb1fb1e8  unit.confd
723e465162dfdb31881680200221542add414e54ef4f4f1fc57e91b7b57777dfb21c2eee4727ecbba0c1943bb77a2597cc0225b16e334c38258c296d15b1df74  unit.logrotate"