APKBUILD 12.1 KB
Newer Older
1
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
Cameron Banta's avatar
Cameron Banta committed
2 3
# Contributor: Jeff Bilyk <jbilyk@gmail.com>
# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
4
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
5 6 7 8 9
#
# secfixes:
#   1.12.1-r0:
#     - CVE-2017-7529
#
Cameron Banta's avatar
Cameron Banta committed
10
pkgname=nginx
11 12
# NOTE: Upgrade only to even-numbered versions (e.g. 1.14.z, 1.16.z)!
# Odd-numbered versions are mainline (development) versions.
Andy Postnikov's avatar
Andy Postnikov committed
13
pkgver=1.14.0
14
pkgrel=1
Jakub Jirutka's avatar
Jakub Jirutka committed
15
# Revision of nginx-tests to use for check().
Andy Postnikov's avatar
Andy Postnikov committed
16
_tests_hgrev=d6daf03478ad
Jakub Jirutka's avatar
Jakub Jirutka committed
17
_njs_ver=0.2.0
18
pkgdesc="HTTP and reverse proxy server (stable version)"
19
url="http://www.nginx.org/en"
20
arch="all"
Jakub Jirutka's avatar
Jakub Jirutka committed
21
license="BSD-2-Clause"
22
depends=""
23
makedepends="linux-headers gd-dev geoip-dev libxml2-dev libxslt-dev
24
	libressl-dev paxmark pcre-dev perl-dev pkgconf zlib-dev"
Jakub Jirutka's avatar
Jakub Jirutka committed
25 26
checkdepends="gd perl perl-fcgi perl-io-socket-ssl perl-net-ssleay
	perl-protocol-websocket tzdata uwsgi-python"
27 28 29 30
pkgusers="nginx"
_grp_ngx="nginx"
_grp_www="www-data"
pkggroups="$_grp_ngx $_grp_www"
31
install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade"
32 33
subpackages="$pkgname-doc $pkgname-vim::noarch"
replaces="$pkgname-common $pkgname-initscripts $pkgname-lua $pkgname-rtmp"
Cameron Banta's avatar
Cameron Banta committed
34
source="http://nginx.org/download/$pkgname-$pkgver.tar.gz
35
	$pkgname-tests-$_tests_hgrev.tar.gz::http://hg.nginx.org/nginx-tests/archive/$_tests_hgrev.tar.gz
Jakub Jirutka's avatar
Jakub Jirutka committed
36 37
	$pkgname-njs-$_njs_ver.tar.gz::https://hg.nginx.org/njs/archive/$_njs_ver.tar.gz
	njs~fix-test-exit-code.patch
38 39
	nginx.conf
	default.conf
40 41
	$pkgname.logrotate
	$pkgname.initd
Cameron Banta's avatar
Cameron Banta committed
42
	"
43
builddir="$srcdir/$pkgname-$pkgver"
44

Jakub Jirutka's avatar
Jakub Jirutka committed
45
_modules_dir="usr/lib/$pkgname/modules"
Jakub Jirutka's avatar
Jakub Jirutka committed
46
_stream_js_depends="$pkgname-mod-stream"
Jakub Jirutka's avatar
Jakub Jirutka committed
47

48
# luajit is not available for s390x.
49
case "$CARCH" in
50
	s390x) makedepends="$makedepends lua5.1-dev";;
51 52 53
	*) makedepends="$makedepends luajit-dev";;
esac

Jakub Jirutka's avatar
Jakub Jirutka committed
54 55 56 57
# Built-in dynamic modules
for _mod in \
	http-geoip \
	http-image-filter \
Jakub Jirutka's avatar
Jakub Jirutka committed
58
	http-js \
Jakub Jirutka's avatar
Jakub Jirutka committed
59 60 61 62
	http-perl \
	http-xslt-filter \
	mail \
	stream \
Jakub Jirutka's avatar
Jakub Jirutka committed
63 64
	stream-geoip \
	stream-js
Jakub Jirutka's avatar
Jakub Jirutka committed
65 66
do
	subpackages="$subpackages $pkgname-mod-$_mod:_module"
67 68
done

Jakub Jirutka's avatar
Jakub Jirutka committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
# Third-party dynamic modules

# For simplicity we assume that module is hosted on GitHub.
_add_module() {
	local name="$1" ver="$2" url="$3"
	local dirname="${url##*/}-${ver#v}"

	subpackages="$subpackages $pkgname-mod-$name:_module"
	source="$source $dirname.tar.gz::$url/archive/$ver.tar.gz"
	_extra_flags="$_extra_flags --add-dynamic-module=$srcdir/$dirname"
}

_add_module "devel-kit" "v0.3.0" "https://github.com/simpl/ngx_devel_kit"
_devel_kit_so="ndk_http_module.so"

84
_add_module "http-cache-purge" "2.4.2" "https://github.com/nginx-modules/ngx_cache_purge"
85

86
_add_module "http-echo" "v0.61" "https://github.com/openresty/echo-nginx-module"
Jakub Jirutka's avatar
Jakub Jirutka committed
87

88
_add_module "http-fancyindex" "v0.4.2" "https://github.com/aperezdc/ngx-fancyindex"
Jakub Jirutka's avatar
Jakub Jirutka committed
89

Andy Postnikov's avatar
Andy Postnikov committed
90
_add_module "http-headers-more" "v0.33" "https://github.com/openresty/headers-more-nginx-module"
Jakub Jirutka's avatar
Jakub Jirutka committed
91 92
_http_headers_more_so="ngx_http_headers_more_filter_module.so"

Andy Postnikov's avatar
Andy Postnikov committed
93
_add_module "http-lua" "v0.10.12" "https://github.com/openresty/lua-nginx-module"
Jakub Jirutka's avatar
Jakub Jirutka committed
94 95 96
_http_lua_depends="$pkgname-mod-devel-kit"
_http_lua_provides="$pkgname-lua"  # for backward compatibility

97
_add_module "http-lua-upstream" "v0.07" "https://github.com/openresty/lua-upstream-nginx-module"
98 99
_http_lua_upstream_depends="$pkgname-mod-http-lua"

Andy Postnikov's avatar
Andy Postnikov committed
100
_add_module "http-nchan" "v1.1.14" "https://github.com/slact/nchan"
Jakub Jirutka's avatar
Jakub Jirutka committed
101 102
_http_nchan_so="ngx_nchan_module.so"

103 104
_add_module "http-shibboleth" "v2.0.1" "https://github.com/nginx-shib/nginx-http-shibboleth"

Andy Postnikov's avatar
Andy Postnikov committed
105
_add_module "http-redis2" "v0.15" "https://github.com/openresty/redis2-nginx-module"
106

Andy Postnikov's avatar
Andy Postnikov committed
107
_add_module "http-set-misc" "v0.32" "https://github.com/openresty/set-misc-nginx-module"
108 109
_http_set_misc_depends="$pkgname-mod-devel-kit"

Jakub Jirutka's avatar
Jakub Jirutka committed
110 111 112
_add_module "http-upload-progress" "v0.9.2" "https://github.com/masterzen/nginx-upload-progress-module"
_http_upload_progress_so="ngx_http_uploadprogress_module.so"

113
_add_module "http-upstream-fair" "0.1.3" "https://github.com/itoffshore/nginx-upstream-fair"
114

Andy Postnikov's avatar
Andy Postnikov committed
115
_add_module "rtmp" "v1.2.1" "https://github.com/arut/nginx-rtmp-module"
Jakub Jirutka's avatar
Jakub Jirutka committed
116 117
_rtmp_provides="$pkgname-rtmp"  # for backward compatibility

118
_add_module "http-vod" "1.22" "https://github.com/kaltura/nginx-vod-module"
119

Jakub Jirutka's avatar
Jakub Jirutka committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
prepare() {
	local file; for file in $source; do
		case $file in
		*~*.patch)
			msg $file
			cd "$srcdir"/${file%%~*}-*
			patch -p 1 -i "$srcdir/$file"
			;;
		*.patch)
			msg $file
			cd "$builddir"
			patch -p 1 -i "$srcdir/$file"
			;;
		esac
	done
135 136 137

	# This test requires superuser privileges and CAP_NET_ADMIN.
	rm "$srcdir"/nginx-tests-*/proxy_bind_transparent.t
Andy Postnikov's avatar
Andy Postnikov committed
138
	rm "$srcdir"/nginx-tests-*/proxy_bind_transparent_capability.t
Jakub Jirutka's avatar
Jakub Jirutka committed
139 140
}

141 142
build() {
	cd "$builddir"
143

144 145
	export LUAJIT_LIB="$(pkgconf --variable=libdir luajit)"
	export LUAJIT_INC="$(pkgconf --variable=includedir luajit)"
146
	./configure \
147
		--prefix=/var/lib/$pkgname \
Natanael Copa's avatar
Natanael Copa committed
148
		--sbin-path=/usr/sbin/$pkgname \
149
		--modules-path=/$_modules_dir \
150 151 152
		--conf-path=/etc/$pkgname/$pkgname.conf \
		--pid-path=/run/$pkgname/$pkgname.pid \
		--lock-path=/run/$pkgname/$pkgname.lock \
153 154 155 156 157
		--http-client-body-temp-path=/var/tmp/$pkgname/client_body \
		--http-proxy-temp-path=/var/tmp/$pkgname/proxy \
		--http-fastcgi-temp-path=/var/tmp/$pkgname/fastcgi \
		--http-uwsgi-temp-path=/var/tmp/$pkgname/uwsgi \
		--http-scgi-temp-path=/var/tmp/$pkgname/scgi \
158
		--with-perl_modules_path=/usr/lib/perl5/vendor_perl \
159
		\
160 161
		--user=$pkgusers \
		--group=$_grp_ngx \
162 163 164
		--with-threads \
		--with-file-aio \
		\
165
		--with-http_ssl_module \
166
		--with-http_v2_module \
167 168
		--with-http_realip_module \
		--with-http_addition_module \
169 170 171
		--with-http_xslt_module=dynamic \
		--with-http_image_filter_module=dynamic \
		--with-http_geoip_module=dynamic \
172 173 174 175 176
		--with-http_sub_module \
		--with-http_dav_module \
		--with-http_flv_module \
		--with-http_mp4_module \
		--with-http_gunzip_module \
177
		--with-http_gzip_static_module \
178
		--with-http_auth_request_module \
179 180
		--with-http_random_index_module \
		--with-http_secure_link_module \
Jakub Jirutka's avatar
Jakub Jirutka committed
181
		--with-http_degradation_module \
182
		--with-http_slice_module \
183
		--with-http_stub_status_module \
184 185
		--with-http_perl_module=dynamic \
		--with-mail=dynamic \
186
		--with-mail_ssl_module \
187
		--with-stream=dynamic \
188
		--with-stream_ssl_module \
Jakub Jirutka's avatar
Jakub Jirutka committed
189 190 191
		--with-stream_realip_module \
		--with-stream_geoip_module=dynamic \
		--with-stream_ssl_preread_module \
192
		\
Jakub Jirutka's avatar
Jakub Jirutka committed
193
		--add-dynamic-module="$srcdir/njs-$_njs_ver/nginx" \
194
		$_extra_flags
195

196
	make
Cameron Banta's avatar
Cameron Banta committed
197 198
}

199
check() {
Jakub Jirutka's avatar
Jakub Jirutka committed
200
	msg "Running nginx tests..."
Jakub Jirutka's avatar
Jakub Jirutka committed
201
	cd "$srcdir"/nginx-tests-*
202
	TEST_NGINX_BINARY="$builddir/objs/nginx" prove .
Jakub Jirutka's avatar
Jakub Jirutka committed
203 204 205 206

	msg "Running njs tests..."
	cd "$srcdir"/njs-*
	make test
207 208
}

Cameron Banta's avatar
Cameron Banta committed
209
package() {
210 211
	cd "$builddir"

212
	make DESTDIR="$pkgdir" install
213

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

219 220 221
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
	install -Dm644 README "$pkgdir"/usr/share/doc/$pkgname/README

222
	install -Dm644 objs/$pkgname.8 "$pkgdir"/usr/share/man/man8/$pkgname.8
223

Jakub Jirutka's avatar
Jakub Jirutka committed
224
	local name; for name in ngx_devel_kit lua-nginx-module nginx-rtmp-module; do
225
		cp -r "$srcdir"/$name-*/doc* "$pkgdir"/usr/share/doc/$pkgname/$name
Jakub Jirutka's avatar
Jakub Jirutka committed
226
	done
227

228
	cd "$pkgdir"
229

230 231 232 233
	install -Dm644 "$srcdir"/nginx.conf ./etc/$pkgname/nginx.conf
	install -Dm644 "$srcdir"/default.conf ./etc/$pkgname/conf.d/default.conf
	install -Dm755 "$srcdir"/$pkgname.initd ./etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.logrotate ./etc/logrotate.d/$pkgname
Cameron Banta's avatar
Cameron Banta committed
234

235 236
	install -dm755 ./etc/$pkgname/modules
	install -dm750 -o $pkgusers -g $_grp_ngx ./var/lib/$pkgname
237
	install -dm700 -o $pkgusers -g $_grp_ngx ./var/tmp/$pkgname
238
	chmod 1777 "$pkgdir"/var/tmp
239
	install -dm755 -g $_grp_www ./var/www/localhost/htdocs
240

241
	install -dm755 ./var/log
242
	mv ./var/lib/$pkgname/logs ./var/log/$pkgname
Natanael Copa's avatar
Natanael Copa committed
243

244 245
	ln -sf /$_modules_dir ./var/lib/$pkgname/modules
	ln -sf /var/log/$pkgname ./var/lib/$pkgname/logs
246
	ln -sf /var/tmp/$pkgname ./var/lib/$pkgname/tmp
247
	ln -sf /run/$pkgname ./var/lib/$pkgname/run
248

249 250 251
	# Remove archaic charset maps.
	rm ./etc/$pkgname/koi-* ./etc/$pkgname/win-utf

252
	rm -rf ./run ./etc/$pkgname/*.default
253 254
}

255 256
vim() {
	pkgdesc="$pkgdesc (vim syntax)"
257 258 259 260
	depends=

	mkdir -p "$subpkgdir"/usr/share/vim
	cp -r "$builddir"/contrib/vim "$subpkgdir"/usr/share/vim/vimfiles
261
}
262

263
_module() {
264 265 266 267 268
	local name="${subpkgname#$pkgname-mod-}"
	name="${name//-/_}"
	local soname="$(eval "echo \$_${name}_so")";
	soname="${soname:-"ngx_${name}_module.so"}"

269
	pkgdesc="$pkgdesc (module $name)"
270 271
	depends="$pkgname $(eval "echo \$_${name}_depends")"
	provides="$(eval "echo \$_${name}_provides")"
272

273 274
	mkdir -p "$subpkgdir"/$_modules_dir
	cd "$subpkgdir"
275

276
	mv "$pkgdir"/$_modules_dir/$soname ./$_modules_dir/$soname
277

278 279
	mkdir -p "$subpkgdir"/etc/nginx/modules
	echo "load_module \"modules/$soname\";" > ./etc/nginx/modules/$name.conf
Cameron Banta's avatar
Cameron Banta committed
280 281
}

Andy Postnikov's avatar
Andy Postnikov committed
282 283
sha512sums="40f086c9f741727e6f55802b6c3a66f081f7c49c38646dc1491aa3e3c35bae12b65ea6594386609fc849bcd99a60d7cd8ecb3f8d519e0e9ab8db01d653e930e9  nginx-1.14.0.tar.gz
775f8fcc55e0e670f7b509974cc9e9cfb56e4bd2a88d1c7716c96b63ad87c14fd6d07f293545639972e798fb20f81414ef6483451d00ae5a4eaa262ccf2cbc98  nginx-tests-d6daf03478ad.tar.gz
Jakub Jirutka's avatar
Jakub Jirutka committed
284 285
be07e635f5e0e50a28366b28180344568b5cca9d67c79bc80d0c6758d8d4097ff9428393fb6951ed239c6e9c9e3f84b46f9c92a6e2c313f1f35e677b3662512f  nginx-njs-0.2.0.tar.gz
cd6983c164383100e0239be85dfeddc7879ab9c29589aecdd9bb4b6772d1f0a5d4cd70bf728d0fb5181765cbed77b7e4c99fd85c0ec59c55826c52e923510017  njs~fix-test-exit-code.patch
286 287 288
ac7e3153ab698b4cde077f0d5d7ac0a58897927eb36cf3b58cb01268ca0296f1d589c0a5b4f889b96b5b4a57bef05b17c59be59a9d7c4d7a3d3be58f101f7f41  nginx.conf
0907f69dc2d3dc1bad3a04fb6673f741f1a8be964e22b306ef9ae2f8e736e1f5733a8884bfe54f3553fff5132a0e5336716250f54272c3fec2177d6ba16986f3  default.conf
09b110693e3f4377349ccea3c43cb8199c8579ee351eae34283299be99fdf764b0c1bddd552e13e4d671b194501618b29c822e1ad53b34101a73a63954363dbb  nginx.logrotate
289
eb183860cd511361346e4079c1fcf470985e1c3b2a034a57f8b2a92ba851fed99256261f9b779770a5f57e3750e9e71bd1550a9d19ad9bf3a4d288864f0374a2  nginx.initd
290
558764c9be913a4f61d0e277d07bf3c272e1ce086b3fadb85b693a7e92805cd9fca4da7a8d29c96e53fc0d23b331327d3b2561ff61f19d2330e7d5d35ac7d614  ngx_devel_kit-0.3.0.tar.gz
291 292 293
1c2e6f5026becbd7bdf9feb920f10c19c6c5487600008161b045e9d6b5ea0269af68a2869e57b528bc921d549c541e6dbb02eb2ef26416a22d5d5a7f3ffc552b  ngx_cache_purge-2.4.2.tar.gz
c90b81a4e85a8e9beeb5ff591dc91adb25fa4e0b6cb47086b577e5fa36db2368442dd011187675e358781956c364b949bc4d920ca2b534481b21c9987d2a9a3b  echo-nginx-module-0.61.tar.gz
aee121e4d25872f0eee6c8150c8c732767ab24c61dc4f6e3f86bd6edc53ad715f3c23045362954a1ad2086ff1002bca821b2e9a53b58b077cbda91a95077ef76  ngx-fancyindex-0.4.2.tar.gz
Andy Postnikov's avatar
Andy Postnikov committed
294 295
13165b1b8d4be281b8bd2404fa48d456013d560bace094c81da08a35dc6a4f025a809a3ae3a42be6bbf67abbcbe41e0730aba06f905220f3baeb01e1192a7d37  headers-more-nginx-module-0.33.tar.gz
f2a0fb30844c5c406a0e0e6cc4ef2ebb9a1ca5c157a93e76ce142ae7b776d98cde32e6150ea76bed6c2ed82a2ca21642c3d673a0249c44126266df69bcc95fb8  lua-nginx-module-0.10.12.tar.gz
296
72887c4490854b099cb26bb3f840073a36b0d812bde4486f04dc1be182ca74f0d1e3fd709e77c240c2dcf37665f74cf04e188ea9efe8e127c6789b27b487d0cd  lua-upstream-nginx-module-0.07.tar.gz
Andy Postnikov's avatar
Andy Postnikov committed
297
f07f39923b89e67eb0dd98938ce3ecd991d13df456ec9937323550a6d3c25a99f22b829f9f779c9104abe5af89487636d46ab73ff7c08de63749fc65049218ec  nchan-1.1.14.tar.gz
298
1730845ea2e52be8c2f6cfceb2894304c5a07959a96940bb1617ee0e7cf81d22283304f411d9a219ddb71e4d9a66012bba0f6f5574d101aeb3c406f26c5d6a4e  nginx-http-shibboleth-2.0.1.tar.gz
Andy Postnikov's avatar
Andy Postnikov committed
299 300
d6ca250db8de93edbd7875afca35e73cecdaf82132d1a7ee933cf94c6b8afa8e629e9e647a9321f2bc1fbb92137ec0d32dcd89b82ac5fae31e342537fb7e0431  redis2-nginx-module-0.15.tar.gz
5590526f60c99630f99a49bfa9e3455baee6d58cd2a1419eab1367a838dafb87a50f5e2607aa8ac557b90dbf633dcf61069c997b3526cddc8f2fc45820a7bc3b  set-misc-nginx-module-0.32.tar.gz
301
c31c46344d49704389722325a041b9cd170fa290acefe92cfc572c07f711cd3039de78f28df48ca7dcb79b2e4bbe442580aaaf4d92883fd3a14bf41d66dd9d8c  nginx-upload-progress-module-0.9.2.tar.gz
302
8adb7453c27748f4e685e3352e9b318b408da818754dc5b6244e908423941a8ba337561104f6e481f2553cbc0e334dcea73b57f8e810a9d6e974bb69ff8859e5  nginx-upstream-fair-0.1.3.tar.gz
Andy Postnikov's avatar
Andy Postnikov committed
303
4a0af5e9afa4deb0b53de8de7ddb2cfa6430d372e1ef9e421f01b509548bd134d427345442ac1ce667338cc2a1484dc2ab732e316e878ac7d3537dc527d5f922  nginx-rtmp-module-1.2.1.tar.gz
304
ee1d55c406ff7c0943ec3c6069d087a238021b5be7839c9fa7e61bd8d324dc1a831d9ee1ec9ee6f6b7b0e0514cd87ff3690ac4183525a0980537d46175c430ad  nginx-vod-module-1.22.tar.gz"