aboutsummaryrefslogtreecommitdiffstats
path: root/testing/litespeed/APKBUILD
blob: c3c4976c37683b7c3f312b05df0a122f8976e8e3 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=litespeed
pkgver=1.4.27
pkgrel=0
_pkgreal=open$pkgname
_pkghome=var/lib/$pkgname
_php=php7
pkgdesc="High-performance, lightweight, open source HTTP server"
url="https://open.litespeedtech.com"
arch="all !aarch64 !ppc64le"
license="GPL3"
pkgusers=litespeed
pkggroups=litespeed
depends="$_php-$pkgname $_php-bcmath $_php-json $_php-mcrypt $_php-session"
depends_dev=
makedepends="linux-headers libressl-dev geoip-dev expat-dev pcre-dev zlib-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-snmp::noarch"
source="http://open.litespeedtech.com/packages/$_pkgreal-$pkgver.tgz
	$pkgname.initd
	include.patch
	install.patch
	ls_lock.patch
	thread.patch
	"
builddir="$srcdir/$_pkgreal-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--host=$CHOST \
		--build=$CBUILD \
		--prefix=/$_pkghome \
		--with-user=$pkgusers \
		--with-group=$pkggroups \
		--enable-adminssl=no \
		--disable-rpath \
		--disable-static \
		--with-openssl=/usr \
		--with-expat \
		--with-pcre \
		--with-zlib \
		|| return 1
	make || return 1
}

package() {
	local file;
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1

	mkdir -p "$pkgdir"/usr/lib/$pkgname \
		"$pkgdir"/usr/sbin \
		"$pkgdir"/var/log || return 1

	# remove trash
	rm -fr "$pkgdir"/$_pkghome/php* \
		"$pkgdir"/$_pkghome/lib \
		"$pkgdir"/$_pkghome/GPL* \
		"$pkgdir"/$_pkghome/gdata \
		"$pkgdir"/$_pkghome/autoupdate \
		"$pkgdir"/$_pkghome/fcgi-bin/* \
		"$pkgdir"/$_pkghome/bin/lshttpd \
		"$pkgdir"/$_pkghome/admin/conf/php.* \
		"$pkgdir"/$_pkghome/admin/misc/gdb-bt \
		"$pkgdir"/$_pkghome/admin/misc/convertxml.* \
		"$pkgdir"/$_pkghome/admin/misc/build_admin_php.sh \
		|| return 1

	# fix ownership
	chown -R $pkgusers:$pkggroups \
		"$pkgdir"/$_pkghome/tmp \
		"$pkgdir"/$_pkghome/conf \
		"$pkgdir"/$_pkghome/logs \
		"$pkgdir"/$_pkghome/backup \
		"$pkgdir"/$_pkghome/cachedata \
		"$pkgdir"/$_pkghome/admin/tmp \
		"$pkgdir"/$_pkghome/admin/logs \
		"$pkgdir"/$_pkghome/admin/conf \
		"$pkgdir"/$_pkghome/Example/logs || return 1

	# install configs
	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname || return 1
	mv "$pkgdir"/$_pkghome/conf \
		"$pkgdir"/etc/$pkgname || return 1
	mv "$pkgdir"/$_pkghome/admin/conf \
		"$pkgdir"/etc/$pkgname/admin || return 1
	ln -s /etc/$pkgname "$pkgdir"/$_pkghome/conf || return 1
	ln -s /etc/$pkgname/admin "$pkgdir"/$_pkghome/admin/conf || return 1
	find "$pkgdir"/etc/$pkgname -type f -print0 | xargs -0 chmod -x || return 1

	# install binary
	mv "$pkgdir"/$_pkghome/bin/$_pkgreal \
		"$pkgdir"/usr/sbin/lshttpd || return 1
	ln -sf /usr/sbin/lshttpd \
		"$pkgdir"/$_pkghome/bin/$pkgname || return 1

	# install modules
	for file in $(find "$pkgdir"/$_pkghome/modules -name "*.so"); do
		mv $file "$pkgdir"/usr/lib/$pkgname/${file##*/} || return 1
		ln -s /usr/lib/$pkgname/${file##*/} $file || return 1
	done

	# install logs
	mv "$pkgdir"/$_pkghome/logs "$pkgdir"/var/log/$pkgname || return 1
	mv "$pkgdir"/$_pkghome/admin/logs "$pkgdir"/var/log/$pkgname/admin || return 1
	mv "$pkgdir"/$_pkghome/Example/logs "$pkgdir"/var/log/$pkgname/Example || return 1
	ln -s /var/log/$pkgname "$pkgdir"/$_pkghome/logs || return 1
	ln -s /var/log/$pkgname/admin "$pkgdir"/$_pkghome/admin/logs || return 1
	ln -s /var/log/$pkgname/Example "$pkgdir"/$_pkghome/Example/logs || return 1

	# install backend
	ln -s /usr/bin/ls$_php "$pkgdir"/$_pkghome/fcgi-bin/ls$_php || return 1
	ln -s /etc/$_php/php.ini "$pkgdir"/etc/$pkgname/php.ini || return 1
	ln -s /etc/$_php/php.ini "$pkgdir"/etc/$pkgname/admin/php.ini || return 1
}

snmp() {
	pkgdesc="$pkgdesc (snmp monitoring add-on + cacti templates)"
	depends="$pkgname net-snmp"

	mkdir -p "$subpkgdir"/$_pkghome/add-ons || return 1
	mv "$pkgdir"/$_pkghome/add-ons/snmp_monitoring \
		"$subpkgdir"/$_pkghome/add-ons
}

sha512sums="ee31a178efc2b130529310d7ba78cd489758b57f44b427bdc075a5b6bd40d5a1678754158fcfd72b965b51a67a62a1f8e363f3f636b5f83e3303f231d3edbc11  openlitespeed-1.4.27.tgz
2b0299246aaeb885122d8f939437f0e4701f6a79ea976f725ba8765d8b295c2797c0cac30e639d5eda665b9589710ee55acc4d03b078c4b9cc1e564994ccb9f5  litespeed.initd
827425bb9f2e5daea8ef69f79747785a56c09a33837c381a961f798d1110f89629324531c028e0010a51aa0639ba5c6be81b80b10779a23ae7f1f84dd7b0b596  include.patch
ead0ba0fabfb7d76a087f202d134bf86d909898e5d96e1330716c9288f21386d8b72f9caed34c095994a7ea328d7f8c9ae6d9e51a24e89b209099401ce09f2c5  install.patch
2211e6c787700fc08eaee56f049c80690ef53d2b14cfcf17099ed0e5dfbd28b76a7b30f0c8814901e3c72bd4fc63732196b6fa0a8231cc10f86ba5130810b3d6  ls_lock.patch
c7775836ee13b082e5c2ce011673b1a30b5ca83765d6d81ff1359110ba970808de6a87cd6d61fd688c9d2037451598154b429d70ad25094b9e9f10938aea00fd  thread.patch"