aboutsummaryrefslogtreecommitdiffstats
path: root/main/nginx/APKBUILD
blob: e325eafdb4ee777607487cdd5b85bfc5cdf0f47d (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# Maintainer: Cameron Banta <cbanta@gmail.com>
# Contributor: Jeff Bilyk <jbilyk@gmail.com>
# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Valery Kartel <valery.kartel@gmail.com>

pkgname=nginx
pkgver=1.10.3
pkgrel=1
pkgdesc="HTTP and reverse proxy server"
url="http://www.nginx.org/en"
arch="all"
options="!check"
license="custom"
depends=""
[ "$CARCH" = "s390x" ] && _lua_dep="lua5.1-dev" || _lua_dep="luajit-dev"
makedepends="linux-headers gd-dev geoip-dev libxml2-dev libxslt-dev $_lua_dep
	libressl-dev paxmark pcre-dev perl-dev pkgconf zlib-dev"
pkgusers="$pkgname"
pkggroups="$pkgname www-data"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-vim::noarch $pkgname-mod-http-perl:_perl"

# Modules with external sources
_dkmod=ngx_devel_kit
_dkver=0.3.0
_modsub="$_modsub devel-kit:ndk_http_module"
_modcfg="$_modcfg --add-dynamic-module=${_dksrc:=$srcdir/$_dkmod-$_dkver}"
_modsrc="$_modsrc $_dkmod-$_dkver.tar.gz::https://github.com/simpl/$_dkmod/archive/v$_dkver.tar.gz"

_ecmod=echo-nginx-module
_ecver=0.60
_modsub="$_modsub http-echo"
_modcfg="$_modcfg --add-dynamic-module=${_ecsrc:=$srcdir/$_ecmod-$_ecver}"
_modsrc="$_modsrc $_ecmod-$_ecver.tar.gz::https://github.com/openresty/$_ecmod/archive/v$_ecver.tar.gz"

_fimod=ngx-fancyindex
_fiver=0.4.1
_modsub="$_modsub http-fancyindex"
_modcfg="$_modcfg --add-dynamic-module=${_fisrc:=$srcdir/$_fimod-$_fiver}"
_modsrc="$_modsrc $_fimod-$_fiver.tar.gz::https://github.com/aperezdc/$_fimod/archive/v$_fiver.tar.gz"

_hmmod=headers-more-nginx-module
_hmver=0.32
_modsub="$_modsub http-headers-more:ngx_http_headers_more_filter_module"
_modcfg="$_modcfg --add-dynamic-module=${_hmsrc:=$srcdir/$_hmmod-$_hmver}"
_modsrc="$_modsrc $_hmmod-$_hmver.tar.gz::https://github.com/openresty/$_hmmod/archive/v$_hmver.tar.gz"

_lumod=lua-nginx-module
_luver=0.10.7
_modsub="$_modsub http-lua"
_modcfg="$_modcfg --add-dynamic-module=${_lusrc:=$srcdir/$_lumod-$_luver}"
_modsrc="$_modsrc $_lumod-$_luver.tar.gz::https://github.com/openresty/$_lumod/archive/v$_luver.tar.gz"
_http_lua_depends="$pkgname-mod-devel-kit"

_ncmod=nchan
_ncver=1.1.2
_modsub="$_modsub http-nchan:ngx_nchan_module"
_modcfg="$_modcfg --add-dynamic-module=${_ncsrc:=$srcdir/$_ncmod-$_ncver}"
_modsrc="$_modsrc $_ncmod-$_ncver.tar.gz::https://github.com/slact/$_ncmod/archive/v$_ncver.tar.gz"

_upmod=nginx-upload-progress-module
_upver=0.9.2
_modsub="$_modsub http-upload-progress:ngx_http_uploadprogress_module"
_modcfg="$_modcfg --add-dynamic-module=${_upsrc:=$srcdir/$_upmod-$_upver}"
_modsrc="$_modsrc $_upmod-$_upver.tar.gz::https://github.com/masterzen/$_upmod/archive/v$_upver.tar.gz"

_rtmod=nginx-rtmp-module
_rtver=1.1.11
_modsub="$_modsub rtmp"
_modcfg="$_modcfg --add-dynamic-module=${_rtsrc:=$srcdir/$_rtmod-$_rtver}"
_modsrc="$_modsrc $_rtmod-$_rtver.tar.gz::https://github.com/arut/$_rtmod/archive/v$_rtver.tar.gz"

_nxmod=naxsi
_nxver=0.55.3
_modsub="$_modsub http-naxsi"
_modcfg="$_modcfg --add-dynamic-module=${_nxsrc:=$srcdir/$_nxmod-$_nxver/naxsi_src}"
_modsrc="$_modsrc $_nxmod-$_nxver.tar.gz::https://github.com/nbs-system/$_nxmod/archive/$_nxver.tar.gz
	$_nxmod.conf"
_http_naxsi_conf="$srcdir/$_nxmod.conf:/etc/$pkgname/conf.d/$_nxmod.conf
	$srcdir/$_nxmod-$_nxver/naxsi_config/naxsi_core.rules:/etc/$pkgname/naxsi_core.rules"

_cpmod=ngx_cache_purge
_cpver=2.3.0.1
_modsub="$_modsub http-cache-purge"
_modcfg="$_modcfg --add-dynamic-module=${_cpsrc:=$srcdir/$_cpmod-$_cpver}"
_modsrc="$_modsrc $_cpmod-$_cpver.tar.gz::https://github.com/itoffshore/$_cpmod/archive/v$_cpver.tar.gz"

_ufmod=nginx-upstream-fair
_ufver=0.1.1
_modsub="$_modsub http-upstream-fair"
_modcfg="$_modcfg --add-dynamic-module=${_ufsrc:=$srcdir/$_ufmod-$_ufver}"
_modsrc="$_modsrc $_ufmod-$_ufver.tar.gz::https://github.com/itoffshore/$_ufmod/archive/v$_ufver.tar.gz"

_sgmod=tengine-http-sysguard
_sgver=2.2.0
_modsub="$_modsub http-sysguard"
_modcfg="$_modcfg --add-dynamic-module=${_sgsrc:=$srcdir/$_sgmod-$_sgver}"
_modsrc="$_modsrc $_sgmod-$_sgver.tar.gz::https://github.com/itoffshore/$_sgmod/archive/v$_sgver.tar.gz
	sysguard.patch"

source="http://nginx.org/download/$pkgname-$pkgver.tar.gz
	nginx.conf
	default.conf
	$pkgname.logrotate
	$pkgname.initd
	ipv6.patch
	$_modsrc
	"
_module_dir=usr/lib/$pkgname
_module_conf=/etc/$pkgname/modules
for _module in http-geoip http-image-filter http-xslt-filter mail stream $_modsub; do
	_modvar=${_module//-/_}
	[ -z "${_module##*:*}" ] && eval _so_${_modvar%:*}=${_module#*:}
	subpackages="$subpackages $pkgname-mod-${_module%:*}:_module"
done
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"

	export LUAJIT_LIB="$(pkgconf --variable=libdir luajit)"
	export LUAJIT_INC="$(pkgconf --variable=includedir luajit)"
	./configure \
		--prefix=/var/lib/$pkgname \
		--sbin-path=/usr/sbin/$pkgname \
		--modules-path=/$_module_dir \
		--conf-path=/etc/$pkgname/$pkgname.conf \
		--pid-path=/run/$pkgname/$pkgname.pid \
		--lock-path=/run/$pkgname/$pkgname.lock \
		--http-client-body-temp-path=/var/lib/$pkgname/tmp/client_body \
		--http-proxy-temp-path=/var/lib/$pkgname/tmp/proxy \
		--http-fastcgi-temp-path=/var/lib/$pkgname/tmp/fastcgi \
		--http-uwsgi-temp-path=/var/lib/$pkgname/tmp/uwsgi \
		--http-scgi-temp-path=/var/lib/$pkgname/tmp/scgi \
		--with-perl_modules_path=/usr/lib/perl5/vendor_perl \
		\
		--user=$pkgname \
		--group=$pkgname \
		--with-threads \
		--with-file-aio \
		--with-ipv6 \
		\
		--with-http_ssl_module \
		--with-http_v2_module \
		--with-http_realip_module \
		--with-http_addition_module \
		--with-http_xslt_module=dynamic \
		--with-http_image_filter_module=dynamic \
		--with-http_geoip_module=dynamic \
		--with-http_sub_module \
		--with-http_dav_module \
		--with-http_flv_module \
		--with-http_mp4_module \
		--with-http_gunzip_module \
		--with-http_gzip_static_module \
		--with-http_auth_request_module \
		--with-http_random_index_module \
		--with-http_secure_link_module \
		--with-http_slice_module \
		--with-http_stub_status_module \
		--with-http_perl_module=dynamic \
		--with-http_realip_module \
		--with-mail=dynamic \
		--with-mail_ssl_module \
		--with-stream=dynamic \
		--with-stream_ssl_module \
		$_modcfg || return 1
	make
}

package() {
	make -C "$builddir" DESTDIR="$pkgdir" install || return 1

	# Disable some PaX protections; this is needed for Lua module.
	local paxflags="-m"
	[ "$CARCH" = "x86" ] && paxflags="-msp"
	paxmark $paxflags "$pkgdir"/usr/sbin/nginx || return 1

	install -Dm644 "$builddir"/LICENSE \
		"$pkgdir"/usr/share/licenses/$pkgname/LICENSE || return 1
	install -Dm644 "$builddir"/README \
		"$pkgdir"/usr/share/doc/$pkgname/README || return 1
	install -Dm644 "$builddir"/objs/$pkgname.8 \
		"$pkgdir"/usr/share/man/man8/$pkgname.8 || return 1

	cp -r "$_dksrc"/docs \
		"$pkgdir"/usr/share/doc/$pkgname/$_dkmod || return 1
	cp -r "$_lusrc"/doc \
		"$pkgdir"/usr/share/doc/$pkgname/$_lumod || return 1
	cp -r "$_rtsrc"/doc \
		"$pkgdir"/usr/share/doc/$pkgname/$_rtmod || return 1

	mkdir -p "$pkgdir"/var/log \
		"$pkgdir"/$_module_conf || return 1

	install -Dm644 "$srcdir"/nginx.conf "$pkgdir"/etc/$pkgname/nginx.conf
	install -Dm644 "$srcdir"/default.conf \
		"$pkgdir"/etc/$pkgname/conf.d/default.conf || return 1
	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname || return 1
	install -Dm644 "$srcdir"/$pkgname.logrotate \
		"$pkgdir"/etc/logrotate.d/$pkgname || return 1

	install -dm750 -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname || return 1
	install -dm700 -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname/tmp || return 1
	install -dm755 -g www-data "$pkgdir"/var/www/localhost/htdocs || return 1

	mv "$pkgdir"/var/lib/$pkgname/logs \
		"$pkgdir"/var/log/$pkgname || return 1

	ln -sf /$_module_dir "$pkgdir"/var/lib/$pkgname/modules
	ln -sf /var/log/$pkgname "$pkgdir"/var/lib/$pkgname/logs
	ln -sf /run/$pkgname "$pkgdir"/var/lib/$pkgname/run

	rm -rf "$pkgdir"/run "$pkgdir"/etc/$pkgname/*.default
}

vim() {
	pkgdesc="$pkgdesc (vim syntax)"
	mkdir -p "$subpkgdir"/usr/share || return 1
	cp -r "$builddir"/contrib/vim "$subpkgdir"/usr/share/vim
}

_module() {
	local name=${subpkgname#$pkgname-mod-}
	name=${name//-/_}
	local soname=$(eval echo \$_so_$name)
	soname="${soname:-ngx_${name}_module}.so"
	pkgdesc="$pkgdesc (module $name)"
	depends="$pkgname $(eval echo \$_${name}_depends)"
	provides="$(eval echo \$_${name}_provides)"

	mkdir -p "$subpkgdir"/$_module_dir \
		"$subpkgdir"/$_module_conf || return 1

	mv "$pkgdir"/$_module_dir/$soname \
		"$subpkgdir"/$_module_dir/$soname || return 1
	echo "load_module \"modules/$soname\";" > "$subpkgdir"/$_module_conf/$name.conf

	local conf;
	for conf in $(eval echo \$_${name}_conf); do
		install -Dm644 ${conf%:*} "$subpkgdir"/${conf#*:}
	done
}

_perl() {
	_module || return 1
	mv "$pkgdir"/usr/lib/perl5 "$subpkgdir"/usr/lib/
}

sha512sums="25cddbe5c419700aeca41bff3be5b7c3accfb38ad846ec8d91d81ab7c15f10db719f02d9263edf1fa12f59805ff7001b62864dc2885370b24afeea1d7d2afbbf  nginx-1.10.3.tar.gz
ac7e3153ab698b4cde077f0d5d7ac0a58897927eb36cf3b58cb01268ca0296f1d589c0a5b4f889b96b5b4a57bef05b17c59be59a9d7c4d7a3d3be58f101f7f41  nginx.conf
0907f69dc2d3dc1bad3a04fb6673f741f1a8be964e22b306ef9ae2f8e736e1f5733a8884bfe54f3553fff5132a0e5336716250f54272c3fec2177d6ba16986f3  default.conf
09b110693e3f4377349ccea3c43cb8199c8579ee351eae34283299be99fdf764b0c1bddd552e13e4d671b194501618b29c822e1ad53b34101a73a63954363dbb  nginx.logrotate
e325d30d431a45801c4072f87f7bce27765e96de27c8f7821b5b0ce0716e1a8657435c93a2e9174c4b8d353fb468e65a8bc20119525e04d3d46ae5ff08cb6f5d  nginx.initd
68d64a84568ec2df0366925ab282a05ebe21a85044b6c7844a47573cfd8cc8ed119cc772358bc3fff36e2d4fdf583a730592825f5f98632993ca86d1f8438d5f  ipv6.patch
558764c9be913a4f61d0e277d07bf3c272e1ce086b3fadb85b693a7e92805cd9fca4da7a8d29c96e53fc0d23b331327d3b2561ff61f19d2330e7d5d35ac7d614  ngx_devel_kit-0.3.0.tar.gz
c455bee73cebd0752449472452d15614b9587ddd199263d366484ede890c4d108eacbbeaef31adc9dc7732b56ef2bfc73c0fef3366366db03a8ec3fdc27a985c  echo-nginx-module-0.60.tar.gz
ce0043ad4a2b638c5d99244d6caaa65ad142cea78884084a9aeca5a9593c68dbe508c9e4dd85dc5722eb63ef386612bffc48d4b6fc1487df244fbcb7a73bffe1  ngx-fancyindex-0.4.1.tar.gz
e42582b45c3111de3940bbeb67ce161aca2d55adcfb00c61c12256fa0e36221d38723013f36edbcf6d1b520f8dfb49d4657df8a956e66d36e68425afad382bd1  headers-more-nginx-module-0.32.tar.gz
d060a13de4d01d77e6d6cd1635ecbb405330e4326b71b89341c1c128ee4182978a51d53355bc07c350e3c3a7df15325e3df380d9c3a98b2ff7d7efa18fa09b32  lua-nginx-module-0.10.7.tar.gz
14af65d57325afa961bc6606f2c938acff0206914248b8ca810293113fdab859c1db9c9abce9263b9da5c2371b299770682d9ec49fbf7a356da9fbfb3e15c3c7  nchan-1.1.2.tar.gz
c31c46344d49704389722325a041b9cd170fa290acefe92cfc572c07f711cd3039de78f28df48ca7dcb79b2e4bbe442580aaaf4d92883fd3a14bf41d66dd9d8c  nginx-upload-progress-module-0.9.2.tar.gz
e7c897265d1e93b06f7e46a653b113e24d2451e2112a7a6da415f130928437444a0346832fd9c10042397fea6120e4e44acc2bccf649ec30ca5bffbf985672e2  nginx-rtmp-module-1.1.11.tar.gz
9e8f41a5cd1342cc9b8aa334a603842d14a256aab1f4a21205bb1278aecbb0c49e39c889d8113a5b41aad2efeaa2ed9f11cba6929173f50add91f54c4c59c8a0  naxsi-0.55.3.tar.gz
3f6cb5ae900d0d9938f0da9788efde5c1ff80522313dd91a7e170811976facb647a734a8a58924993d95f069ec5fadfde728655ac9b37a965cd7200a9785055d  naxsi.conf
c49c81dbdb8bd507fccf31295e603cea8f0a964867c27eff0436dcea3b4a547c8ae2f11ecf49c4d82c693cf8138c17ebbed395738539d0d61254951e5f0db7e3  ngx_cache_purge-2.3.0.1.tar.gz
fd305b859c868ef55171b05f64071a2836c12073bcd89d6197af4946a3d1177f77c6708d4d589d460c84967273dee87ca9de97ab0f0d47e6d65f86b465d70316  nginx-upstream-fair-0.1.1.tar.gz
2743d9aea60bd4984b650213e571cf27e6ff5b3db708242ccb53b8fc669d1cc82ee224ba79aee2f6969b6e13821cfdd3df7b412541e1fdbb867ecc95326e07e1  tengine-http-sysguard-2.2.0.tar.gz
2dca2ac74fb92e330fde7b6b6120b2fd2565c377a629c9536cf77beebe41aa4b092d4229d5b487b0fb02be4f2cc5b897c429c87bbbbc7b0d31e1cbb94231ddce  sysguard.patch"