diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-28 02:22:23 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-28 02:45:25 +0200 |
commit | c80938f822749c11ea44aef23fb7a9a56faa1c18 (patch) | |
tree | 89f28d47ae31aa6906e7c7eebfa4a16dfe77a638 /main | |
parent | d6d624a149ca62af8679baf9cc99ce1354c190f0 (diff) | |
download | aports-c80938f822749c11ea44aef23fb7a9a56faa1c18.tar.bz2 aports-c80938f822749c11ea44aef23fb7a9a56faa1c18.tar.xz |
main/nginx: DRY abuild
Diffstat (limited to 'main')
-rw-r--r-- | main/nginx/APKBUILD | 156 |
1 files changed, 58 insertions, 98 deletions
diff --git a/main/nginx/APKBUILD b/main/nginx/APKBUILD index c4ce2e3d7c..14679a8c7d 100644 --- a/main/nginx/APKBUILD +++ b/main/nginx/APKBUILD @@ -2,67 +2,15 @@ # Contributor: Jeff Bilyk <jbilyk@gmail.com> # Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl> # Contributor: Jakub Jirutka <jakub@jirutka.cz> - pkgname=nginx pkgver=1.12.0 pkgrel=1 +# Revision of nginx-tests to use for check(). +_tests_hgrev=cdd44ff602db pkgdesc="HTTP and reverse proxy server (stable version)" url="http://www.nginx.org/en" arch="all" license="custom" - -# Revision of nginx-tests to use for check(). -_tests_hgrev=cdd44ff602db -_tests_dir="$srcdir/nginx-tests-$_tests_hgrev" - -# Modules -_devel_kit_name=ngx_devel_kit -_devel_kit_ver=0.3.0 -_devel_kit_url="https://github.com/simpl/ngx_devel_kit" -_devel_kit_dir="$srcdir/$_devel_kit_name-$_devel_kit_ver" -_devel_kit_so="ndk_http_module.so" - -_http_echo_name=echo-nginx-module -_http_echo_ver=0.60 -_http_echo_url="https://github.com/openresty/echo-nginx-module" -_http_echo_dir="$srcdir/$_http_echo_name-$_http_echo_ver" - -_http_fancyindex_name=ngx-fancyindex -_http_fancyindex_ver=0.4.1 -_http_fancyindex_url="https://github.com/aperezdc/ngx-fancyindex" -_http_fancyindex_dir="$srcdir/$_http_fancyindex_name-$_http_fancyindex_ver" - -_http_headers_more_name=headers-more-nginx-module -_http_headers_more_ver=0.32 -_http_headers_more_url="https://github.com/openresty/headers-more-nginx-module" -_http_headers_more_dir="$srcdir/$_http_headers_more_name-$_http_headers_more_ver" -_http_headers_more_so="ngx_http_headers_more_filter_module.so" - -_http_lua_name=lua-nginx-module -_http_lua_ver=0.10.8 -_http_lua_url="https://github.com/openresty/lua-nginx-module" -_http_lua_dir="$srcdir/$_http_lua_name-$_http_lua_ver" -_http_lua_depends="$pkgname-mod-devel-kit" -_http_lua_provides="$pkgname-lua" # for backward compatibility - -_http_nchan_name=nchan -_http_nchan_ver=1.1.4 -_http_nchan_url="https://github.com/slact/nchan" -_http_nchan_dir="$srcdir/$_http_nchan_name-$_http_nchan_ver" -_http_nchan_so="ngx_nchan_module.so" - -_http_upload_progress_name=nginx-upload-progress-module -_http_upload_progress_ver=0.9.2 -_http_upload_progress_url="https://github.com/masterzen/nginx-upload-progress-module" -_http_upload_progress_dir="$srcdir/$_http_upload_progress_name-$_http_upload_progress_ver" -_http_upload_progress_so="ngx_http_uploadprogress_module.so" - -_rtmp_name=nginx-rtmp-module -_rtmp_ver=1.1.11 -_rtmp_url="https://github.com/arut/nginx-rtmp-module" -_rtmp_dir="$srcdir/$_rtmp_name-$_rtmp_ver" -_rtmp_provides="$pkgname-rtmp" # for backward compatibility - depends="" makedepends="linux-headers gd-dev geoip-dev libxml2-dev libxslt-dev libressl-dev paxmark pcre-dev perl-dev pkgconf zlib-dev" @@ -77,17 +25,9 @@ subpackages="$pkgname-doc $pkgname-vim::noarch" replaces="$pkgname-common $pkgname-initscripts $pkgname-lua $pkgname-rtmp" source="http://nginx.org/download/$pkgname-$pkgver.tar.gz $pkgname-tests-$_tests_hgrev.tar.gz::http://hg.nginx.org/nginx-tests/archive/$_tests_hgrev.tar.gz - $_devel_kit_name-$_devel_kit_ver.tar.gz::$_devel_kit_url/archive/v$_devel_kit_ver.tar.gz - $_http_echo_name-$_http_echo_ver.tar.gz::$_http_echo_url/archive/v$_http_echo_ver.tar.gz - $_http_fancyindex_name-$_http_fancyindex_ver.tar.gz::$_http_fancyindex_url/archive/v$_http_fancyindex_ver.tar.gz - $_http_headers_more_name-$_http_headers_more_ver.tar.gz::$_http_headers_more_url/archive/v$_http_headers_more_ver.tar.gz - $_http_lua_name-$_http_lua_ver.tar.gz::$_http_lua_url/archive/v$_http_lua_ver.tar.gz - $_http_nchan_name-$_http_nchan_ver.tar.gz::$_http_nchan_url/archive/v$_http_nchan_ver.tar.gz - $_http_upload_progress_name-$_http_upload_progress_ver.tar.gz::$_http_upload_progress_url/archive/v$_http_upload_progress_ver.tar.gz - $_rtmp_name-$_rtmp_ver.tar.gz::$_rtmp_url/archive/v$_rtmp_ver.tar.gz - $_http_echo_name~fix-nginx-1.12.patch - $_http_lua_name~fix-nginx-1.12.patch - $_http_lua_name~fix-libressl.patch + echo-nginx-module~fix-nginx-1.12.patch + lua-nginx-module~fix-nginx-1.12.patch + lua-nginx-module~fix-libressl.patch nginx.conf default.conf $pkgname.logrotate @@ -95,33 +35,62 @@ source="http://nginx.org/download/$pkgname-$pkgver.tar.gz " builddir="$srcdir/$pkgname-$pkgver" +_modules_dir="usr/lib/$pkgname/modules" + # luajit is not available for s390x and ppc64le case "$CARCH" in ppc64le | s390x) makedepends="$makedepends lua5.1-dev";; *) makedepends="$makedepends luajit-dev";; esac -_modules_dir="usr/lib/$pkgname/modules" -_modules=" - http-geoip - http-image-filter - http-perl - http-xslt-filter - mail - stream +# Built-in dynamic modules +for _mod in \ + http-geoip \ + http-image-filter \ + http-perl \ + http-xslt-filter \ + mail \ + stream \ stream-geoip - devel-kit - http-echo - http-fancyindex - http-headers-more - http-lua - http-nchan - http-upload-progress - rtmp" -for _m in $_modules; do - subpackages="$subpackages $pkgname-mod-$_m:_module" +do + subpackages="$subpackages $pkgname-mod-$_mod:_module" done +# 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" + +_add_module "http-echo" "v0.60" "https://github.com/openresty/echo-nginx-module" + +_add_module "http-fancyindex" "v0.4.1" "https://github.com/aperezdc/ngx-fancyindex" + +_add_module "http-headers-more" "v0.32" "https://github.com/openresty/headers-more-nginx-module" +_http_headers_more_so="ngx_http_headers_more_filter_module.so" + +_add_module "http-lua" "v0.10.8" "https://github.com/openresty/lua-nginx-module" +_http_lua_depends="$pkgname-mod-devel-kit" +_http_lua_provides="$pkgname-lua" # for backward compatibility + +_add_module "http-nchan" "v1.1.4" "https://github.com/slact/nchan" +_http_nchan_so="ngx_nchan_module.so" + +_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" + +_add_module "rtmp" "v1.1.11" "https://github.com/arut/nginx-rtmp-module" +_rtmp_provides="$pkgname-rtmp" # for backward compatibility + prepare() { local file; for file in $source; do @@ -195,21 +164,14 @@ build() { --with-stream_geoip_module=dynamic \ --with-stream_ssl_preread_module \ \ - --add-dynamic-module="$_devel_kit_dir" \ - --add-dynamic-module="$_http_echo_dir" \ - --add-dynamic-module="$_http_fancyindex_dir" \ - --add-dynamic-module="$_http_headers_more_dir" \ - --add-dynamic-module="$_http_lua_dir" \ - --add-dynamic-module="$_http_nchan_dir" \ - --add-dynamic-module="$_http_upload_progress_dir" \ - --add-dynamic-module="$_rtmp_dir" \ + $_extra_flags \ || return 1 make || return 1 } check() { - cd "$_tests_dir" + cd "$srcdir"/nginx-tests-* TEST_NGINX_BINARY="$builddir/objs/nginx" prove . } @@ -230,12 +192,10 @@ package() { install -Dm644 objs/$pkgname.8 \ "$pkgdir"/usr/share/man/man8/$pkgname.8 || return 1 - cp -r "$_devel_kit_dir"/docs \ - "$pkgdir"/usr/share/doc/$pkgname/$_devel_kit_name || return 1 - cp -r "$_http_lua_dir"/doc \ - "$pkgdir"/usr/share/doc/$pkgname/$_http_lua_name || return 1 - cp -r "$_rtmp_dir"/doc \ - "$pkgdir"/usr/share/doc/$pkgname/$_rtmp_name || return 1 + local name; for name in ngx_devel_kit lua-nginx-module nginx-rtmp-module; do + cp -r "$srcdir"/$name-*/doc* \ + "$pkgdir"/usr/share/doc/$pkgname/$name || return 1 + done cd "$pkgdir" |