Added initial support for Alpine Linux.
diff --git a/alpine/APKBUILD-base.in b/alpine/APKBUILD-base.in
new file mode 100644
index 0000000..29cf39f
--- /dev/null
+++ b/alpine/APKBUILD-base.in
@@ -0,0 +1,101 @@
+# Maintainer: Andrei Belov <defan@nginx.com>
+# Contributor: Andrei Belov <defan@nginx.com>
+#
+
+_main_version=%%MAIN_VERSION%%
+_main_release=%%MAIN_RELEASE%%
+
+pkgname=nginx
+pkgver=$_main_version
+pkgrel=$_main_release
+pkgdesc="High performance web server"
+url="http://nginx.org/"
+arch="all"
+license="2-clause BSD-like license"
+provides=""
+depends=""
+makedepends="linux-headers openssl-dev pcre-dev zlib-dev"
+
+options="!check"
+
+pkgusers=""
+pkggroups=""
+install="$pkgname.pre-install $pkgname.post-install $pkgname.pre-deinstall $pkgname.post-upgrade"
+
+# we would like to ship all docs/licenses in the base package
+#subpackages="$pkgname-doc"
+
+replaces="nginx-common nginx-initscripts nginx-lua nginx-rtmp"
+source="nginx-$_main_version.tar.gz
+	nginx.conf
+	default.conf
+	nginx.logrotate
+	nginx.initd
+	nginx-debug.initd
+	COPYRIGHT
+	"
+builddir="$srcdir/nginx-$_main_version"
+
+_modules_dir="usr/lib/nginx/modules"
+
+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
+}
+
+build() {
+	cd "$builddir"
+
+	_nproc=`getconf _NPROCESSORS_ONLN`
+	if [ $_nproc -gt 1 ]; then
+		_make_opts="-j$_nproc"
+	fi
+
+	CFLAGS= ./configure %%BASE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS" --with-ld-opt="$LDFLAGS" --with-debug
+	make $_make_opts
+	mv objs/nginx objs/nginx-debug
+	CFLAGS= ./configure %%BASE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS" --with-ld-opt="$LDFLAGS"
+	make $_make_opts
+}
+
+package() {
+	cd "$builddir"
+
+	make DESTDIR="$pkgdir" install
+	install -m755 objs/nginx-debug "$pkgdir"/usr/sbin/nginx-debug
+
+	install -Dm644 objs/nginx.8 "$pkgdir"/usr/share/man/man8/nginx.8
+	if [ -z "`echo $subpackages | grep -- -doc`" ]; then
+		gzip "$pkgdir"/usr/share/man/man8/nginx.8
+	fi
+
+	cd "$pkgdir"
+
+	install -Dm644 "$srcdir"/nginx.conf ./etc/nginx/nginx.conf
+	install -Dm644 "$srcdir"/default.conf ./etc/nginx/conf.d/default.conf
+	install -Dm755 "$srcdir"/$pkgname.initd ./etc/init.d/nginx
+	install -Dm755 "$srcdir"/$pkgname-debug.initd ./etc/init.d/nginx-debug
+	install -Dm644 "$srcdir"/$pkgname.logrotate ./etc/logrotate.d/nginx
+
+	install -Dm644 "$srcdir"/COPYRIGHT ./usr/share/licenses/$pkgname/COPYRIGHT
+
+	mkdir -p ./usr/share/nginx
+	mv ./etc/nginx/html ./usr/share/nginx/
+
+	mkdir -p ./$_modules_dir
+	ln -sf /$_modules_dir ./etc/nginx/modules
+
+	rm -rf ./etc/nginx/*.default
+}
diff --git a/alpine/APKBUILD-module.in b/alpine/APKBUILD-module.in
new file mode 100644
index 0000000..0c111e3
--- /dev/null
+++ b/alpine/APKBUILD-module.in
@@ -0,0 +1,94 @@
+# Maintainer: Andrei Belov <defan@nginx.com>
+# Contributor: Andrei Belov <defan@nginx.com>
+#
+
+_main_version=%%MAIN_VERSION%%
+_main_release=%%MAIN_RELEASE%%
+
+pkgname=nginx-module-%%MODULE%%
+pkgver=%%MODULE_VERSION_PREFIX%%%%MODULE_VERSION%%
+pkgrel=%%MODULE_RELEASE%%
+pkgdesc="%%SUMMARY%%"
+url="http://nginx.org/"
+arch="all"
+license="2-clause BSD-like license"
+depends="nginx=$_main_version-r$_main_release %%MODULE_DEPENDS%%"
+makedepends="linux-headers openssl-dev pcre-dev zlib-dev %%MODULE_BUILD_DEPENDS%%"
+provides=""
+%%ADD_CONTROL_TAGS%%
+
+options="!check"
+
+pkgusers=""
+pkggroups=""
+install="$pkgname.post-install"
+
+# we would like to ship all docs/licenses in the base package
+#subpackages="$pkgname-doc"
+
+source="nginx-module-%%MODULE%%-$_main_version.tar.gz
+	%%MODULE_SOURCES%%
+	COPYRIGHT
+	"
+builddir="$srcdir/%%MODULE_SRCDIR%%"
+
+_modules_dir="usr/lib/nginx/modules"
+
+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"
+			;;
+		extra-patch*)
+			msg $file
+			cd "$builddir/../"
+			patch -p 1 -i "$srcdir/$file"
+			;;
+		esac
+	done
+}
+
+build() {
+	cd "$builddir"
+
+	_nproc=`getconf _NPROCESSORS_ONLN`
+	if [ $_nproc -gt 1 ]; then
+		_make_opts="-j$_nproc"
+	fi
+
+	%%MODULE_PREBUILD%%
+
+	cd "$builddir"
+
+	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_MODULE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT_DEBUG%%" --with-ld-opt="$LDFLAGS" --with-debug
+	make $_make_opts modules
+	for so in `find objs/ -maxdepth 1 -type f -name "*.so"`; do \
+		debugso=`echo ${so} | sed -e "s|.so|-debug.so|"` ; \
+		mv ${so} ${debugso} ; \
+        done
+	CFLAGS= %%MODULE_ENV%% ./configure %%BASE_MODULE_CONFIGURE_ARGS%% %%MODULE_CONFIGURE_ARGS%% --with-cc-opt="$CFLAGS %%MODULE_CC_OPT_NODEBUG%%" --with-ld-opt="$LDFLAGS"
+	make $_make_opts modules
+}
+
+package() {
+	cd "$builddir"
+
+	%%MODULE_PREINSTALL%%
+
+	mkdir -p "$pkgdir"/usr/lib/nginx/modules
+	for so in `find objs/ -maxdepth 1 -type f -name "*.so"`; do \
+		install -m755 ${so} "$pkgdir"/usr/lib/nginx/modules/ ; \
+	done
+
+	cd "$pkgdir"
+
+	install -Dm644 "$srcdir"/COPYRIGHT ./usr/share/licenses/$pkgname/COPYRIGHT
+}
diff --git a/alpine/COPYRIGHT b/alpine/COPYRIGHT
new file mode 100644
index 0000000..af51e2f
--- /dev/null
+++ b/alpine/COPYRIGHT
@@ -0,0 +1,26 @@
+/* 
+ * Copyright (C) Igor Sysoev
+ * Copyright (C) Nginx, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
diff --git a/alpine/Makefile b/alpine/Makefile
new file mode 100644
index 0000000..a6826dc
--- /dev/null
+++ b/alpine/Makefile
@@ -0,0 +1,406 @@
+SHELL=		/bin/bash
+
+BASE_VERSION=	1.15.8
+BASE_RELEASE=	1
+PLUS_VERSION=	17
+PLUS_RELEASE=	${BASE_RELEASE}
+BASE_SRC=	nginx-$(BASE_VERSION).tar.gz
+SRCDIR=		nginx-$(BASE_VERSION)
+MODULE_SRCDIR=	$(SRCDIR)
+SRCPATH?=	../..
+MODSRC_PREFIX=	../
+
+ARCH=		$(shell uname -m)
+
+default:
+	@echo "valid targets: all base $(addprefix module-, $(MODULES)) test test-debug"
+
+MODULES=	geoip image-filter njs perl xslt
+
+MODULE_SUMMARY_geoip=		GeoIP dynamic modules
+MODULE_SUMMARY_image_filter=	image filter dynamic module
+MODULE_SUMMARY_njs=		njs dynamic modules
+MODULE_SUMMARY_perl=		Perl dynamic module
+MODULE_SUMMARY_xslt=		xslt dynamic module
+
+MODULE_VERSION_geoip=		$(BASE_VERSION)
+MODULE_RELEASE_geoip=		1
+MODULE_VERSION_image_filter=	$(BASE_VERSION)
+MODULE_RELEASE_image_filter=	1
+MODULE_VERSION_njs=		0.2.7
+MODULE_RELEASE_njs=		1
+MODULE_VERSION_perl=		$(BASE_VERSION)
+MODULE_RELEASE_perl=		1
+MODULE_VERSION_xslt=		$(BASE_VERSION)
+MODULE_RELEASE_xslt=		1
+
+MODULE_SOURCES_njs=		njs-$(MODULE_VERSION_njs).tar.gz
+MODULE_CONFARGS_geoip=		--with-stream \
+				--with-http_geoip_module=dynamic \
+				--with-stream_geoip_module=dynamic
+MODULE_CONFARGS_image_filter=	--with-http_image_filter_module=dynamic
+MODULE_CONFARGS_njs=		--with-stream \
+				--add-dynamic-module=$(MODSRC_PREFIX)njs-$(MODULE_VERSION_njs)/nginx
+MODULE_CONFARGS_perl=		--with-http_perl_module=dynamic
+MODULE_CONFARGS_xslt=		--with-http_xslt_module=dynamic
+
+# geoip
+
+MODULE_BUILD_DEPENDS_geoip=geoip-dev
+MODULE_DEPENDS_geoip=geoip
+
+define MODULE_ADD_CONTROL_TAGS_geoip
+replaces="nginx-mod-http-geoip"
+endef
+export MODULE_ADD_CONTROL_TAGS_geoip
+
+define MODULE_POST_geoip
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_geoip) for NGINX have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_geoip_module.so;
+    load_module modules/ngx_stream_geoip_module.so;
+
+Please refer to the modules documentation for further details:
+http://nginx.org/en/docs/http/ngx_http_geoip_module.html
+http://nginx.org/en/docs/stream/ngx_stream_geoip_module.html
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_geoip
+
+# image-filter
+
+MODULE_DEPENDS_image_filter=gd
+MODULE_BUILD_DEPENDS_image_filter=gd-dev
+
+define MODULE_ADD_CONTROL_TAGS_image_filter
+replaces="nginx-mod-http-image-filter"
+endef
+export MODULE_ADD_CONTROL_TAGS_image_filter
+
+define MODULE_POST_image_filter
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_image_filter) for NGINX has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_image_filter_module.so;
+
+Please refer to the module documentation for further details:
+http://nginx.org/en/docs/http/ngx_http_image_filter_module.html
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_image_filter
+
+# njs
+
+MODULE_VERSION_PREFIX_njs=$(BASE_VERSION).
+MODULE_BUILD_DEPENDS_njs=libedit-dev
+
+define MODULE_ADD_CONTROL_TAGS_njs
+replaces="nginx-mod-http-js"
+endef
+export MODULE_ADD_CONTROL_TAGS_njs
+
+define MODULE_PREBUILD_njs
+	cd ../njs-$(MODULE_VERSION_njs) \&\& ./configure \&\& make njs
+endef
+export MODULE_PREBUILD_njs
+
+define MODULE_PREINSTALL_njs
+	mkdir -p "$$pkgdir"/usr/share/doc/nginx-module-njs
+	install -m644 ../njs-$(MODULE_VERSION_njs)/CHANGES "$$pkgdir"/usr/share/doc/nginx-module-njs/
+	mkdir -p "$$pkgdir"/usr/bin
+	install -m755 -s ../njs-$(MODULE_VERSION_njs)/build/njs "$$pkgdir"/usr/bin/
+endef
+export MODULE_PREINSTALL_njs
+
+define MODULE_POST_njs
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_njs) for NGINX have been installed.
+To enable these modules, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_js_module.so;
+    load_module modules/ngx_stream_js_module.so;
+
+Please refer to the modules documentation for further details:
+http://nginx.org/en/docs/njs/
+http://nginx.org/en/docs/http/ngx_http_js_module.html
+http://nginx.org/en/docs/stream/ngx_stream_js_module.html
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_njs
+
+# perl
+
+MODULE_BUILD_DEPENDS_perl=perl-dev findutils
+
+define MODULE_ADD_CONTROL_TAGS_perl
+replaces="nginx-mod-http-perl"
+endef
+export MODULE_ADD_CONTROL_TAGS_perl
+
+define MODULE_PREINSTALL_perl
+	make DESTDIR=$$pkgdir INSTALLDIRS=vendor -f objs/Makefile install_perl_modules
+	find $$pkgdir/ -type f -name .packlist -exec rm -f '{}' \\;
+	find $$pkgdir/ -type f -name perllocal.pod -exec rm -f '{}' \\;
+	find $$pkgdir/ -type f -empty -exec rm -f '{}' \\;
+	find $$pkgdir/ -type f -iname '*.so' -exec chmod 0755 '{}' \\;
+endef
+export MODULE_PREINSTALL_perl
+
+define MODULE_POST_perl
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_perl) for NGINX has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_perl_module.so;
+
+Please refer to the module documentation for further details:
+http://nginx.org/en/docs/http/ngx_http_perl_module.html
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_perl
+
+# xslt
+
+MODULE_DEPENDS_xslt=libxslt
+MODULE_BUILD_DEPENDS_xslt=libxslt-dev
+
+define MODULE_ADD_CONTROL_TAGS_xslt
+replaces="nginx-mod-http-xslt-filter"
+endef
+export MODULE_ADD_CONTROL_TAGS_xslt
+
+define MODULE_POST_xslt
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_xslt) for NGINX has been installed.
+To enable this module, add the following to /etc/nginx/nginx.conf
+and reload nginx:
+
+    load_module modules/ngx_http_xslt_filter_module.so;
+
+Please refer to the module documentation for further details:
+http://nginx.org/en/docs/http/ngx_http_xslt_module.html
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_xslt
+
+
+BASE_CONFIGURE_ARGS=\
+	--prefix=/etc/nginx \
+	--sbin-path=/usr/sbin/nginx \
+	--modules-path=/usr/lib/nginx/modules \
+	--conf-path=/etc/nginx/nginx.conf \
+	--error-log-path=/var/log/nginx/error.log \
+	--http-log-path=/var/log/nginx/access.log \
+	--pid-path=/var/run/nginx.pid \
+	--lock-path=/var/run/nginx.lock \
+	--http-client-body-temp-path=/var/cache/nginx/client_temp \
+	--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
+	--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
+	--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
+	--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
+	--with-perl_modules_path=/usr/lib/perl5/vendor_perl \
+	--user=nginx \
+	--group=nginx \
+	--with-compat \
+	--with-file-aio \
+	--with-threads \
+	--with-http_addition_module \
+	--with-http_auth_request_module \
+	--with-http_dav_module \
+	--with-http_flv_module \
+	--with-http_gunzip_module \
+	--with-http_gzip_static_module \
+	--with-http_mp4_module \
+	--with-http_random_index_module \
+	--with-http_realip_module \
+	--with-http_secure_link_module \
+	--with-http_slice_module \
+	--with-http_ssl_module \
+	--with-http_stub_status_module \
+	--with-http_sub_module \
+	--with-http_v2_module \
+	--with-mail \
+	--with-mail_ssl_module \
+	--with-stream \
+	--with-stream_realip_module \
+	--with-stream_ssl_module \
+	--with-stream_ssl_preread_module
+
+BASE_MODULE_CONFIGURE_ARGS=\
+	--with-compat
+
+export CR=\\n
+
+modname = $(shell echo $1 | cut -d '-' -f 3- | tr '-' '_')
+
+${HOME}/.abuild:
+	mkdir -p ${HOME}/.abuild
+
+${HOME}/.abuild/abuild-key.rsa: | ${HOME}/.abuild
+	cd ${HOME}/.abuild && umask 0007 && openssl genrsa -out abuild-key.rsa 2048
+	openssl rsa -in ${HOME}/.abuild/abuild-key.rsa -pubout -out ${HOME}/.abuild/abuild-key.rsa.pub
+
+${HOME}/.abuild/abuild.conf: ${HOME}/.abuild/abuild-key.rsa | ${HOME}/.abuild
+	echo PACKAGER_PRIVKEY=\"${HOME}/.abuild/abuild-key.rsa\" > ${HOME}/.abuild/abuild.conf
+
+all:	base modules
+	@echo "===> all done"
+
+modules:	base $(addprefix module-, $(MODULES))
+
+abuild:	abuild-base $(addprefix abuild-module-, $(MODULES))
+
+base:	${HOME}/.abuild/abuild.conf abuild-base
+	@echo "===> Building base package" ; \
+	/usr/bin/time -p $(SHELL) -c "cd abuild-base/ && abuild checksum && abuild unpack && abuild prepare && abuild -K build && abuild rootpkg" && \
+	ln -s abuild-base/pkg/nginx/usr/sbin base
+
+$(BASE_SRC):
+	wget http://nginx.org/download/$(BASE_SRC)
+
+abuild-base: $(BASE_SRC)
+	@echo "===> Creating $@"
+	@{ \
+	set -e ; \
+	mkdir -p abuild-base ; \
+	cp $(BASE_SRC) abuild-base/ ; \
+	cp nginx.* default.conf COPYRIGHT abuild-base/ ; \
+	cat nginx.initd.in | sed -e 's#%%DAEMON%%#nginx#g' > abuild-base/nginx.initd ; \
+	cat nginx.initd.in | sed -e 's#%%DAEMON%%#nginx-debug#g' > abuild-base/nginx-debug.initd ; \
+	cat APKBUILD-base.in | sed \
+		-e 's#%%MAIN_VERSION%%#$(BASE_VERSION)#g' \
+		-e 's#%%MAIN_RELEASE%%#$(BASE_RELEASE)#g' \
+		-e 's#%%BASE_CONFIGURE_ARGS%%#$(BASE_CONFIGURE_ARGS)#g' \
+		> abuild-base/APKBUILD ; \
+	}
+
+module-%: ${HOME}/.abuild/abuild.conf abuild-module-%
+	@echo "===> Building nginx-$@ package" ; \
+	/usr/bin/time -p $(SHELL) -c "cd abuild-$@/ && abuild checksum && abuild unpack && abuild prepare && abuild -K build && abuild rootpkg" && \
+	ln -s abuild-$@/pkg/nginx-module-$*/usr/lib/nginx/modules $@
+
+abuild-module-%: $(BASE_SRC)
+	@echo "===> Creating $@"
+	@{ \
+	set -e ; \
+	curdir=`pwd` ; \
+	module_asis=`echo $@ | cut -d '-' -f 3-` ; \
+	builddir=`echo abuild-module-$${module_asis}` ; \
+	mkdir -p $${builddir} ; \
+	cp $(BASE_SRC) $${builddir}/nginx-module-$${module_asis}-$(BASE_VERSION).tar.gz ; \
+	sources= ; \
+	for src in $(MODULE_SOURCES_$(call modname, $@)); do \
+		cp src/$${src} $${builddir}/ ; \
+		sources="$${sources} $${src}" ; \
+	done ; \
+	for p in $(MODULE_PATCHES_$(call modname, $@)); do \
+		cp src/$${p} $${builddir}/ ; \
+		sources="$${sources} $${p}" ; \
+	done ; \
+	cp COPYRIGHT $${builddir}/ ; \
+	definitions=`echo "$$MODULE_DEFINITIONS_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	addcontroltags=`echo "$$MODULE_ADD_CONTROL_TAGS_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	prebuild=`echo "$$MODULE_PREBUILD_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	buildenv=`echo "$$MODULE_ENV_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	preinstall=`echo "$$MODULE_PREINSTALL_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	post=`echo "$$MODULE_POST_$(call modname, $@)" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+	cat APKBUILD-module.in | sed \
+		-e "s#%%MODULE%%#$${module_asis}#g" \
+		-e "s#%%SUMMARY%%#nginx $(MODULE_SUMMARY_$(call modname, $@))#g" \
+		-e "s#%%SHORT_SUMMARY%%#$(MODULE_SUMMARY_$(call modname, $@))#g" \
+		-e "s#%%MAIN_VERSION%%#$(BASE_VERSION)#g" \
+		-e "s#%%MAIN_RELEASE%%#$(BASE_RELEASE)#g" \
+		-e "s#%%PLUS_VERSION%%#$(PLUS_VERSION)#g" \
+		-e "s#%%MODULE_VERSION%%#$(MODULE_VERSION_$(call modname, $@))#g" \
+		-e "s#%%MODULE_RELEASE%%#$(MODULE_RELEASE_$(call modname, $@))#g" \
+		-e "s#%%MODULE_VERSION_PREFIX%%#$(MODULE_VERSION_PREFIX_$(call modname, $@))#g" \
+		-e 's#%%BASE_MODULE_CONFIGURE_ARGS%%#$(BASE_MODULE_CONFIGURE_ARGS)#g' \
+		-e "s#%%MODULE_CONFIGURE_ARGS%%#$(MODULE_CONFARGS_$(call modname, $@))#g" \
+		-e "s#%%MODULE_SOURCES%%#$${sources}#g" \
+		-e "s#%%MODULE_BUILD_DEPENDS%%#$(MODULE_BUILD_DEPENDS_$(call modname, $@))#g" \
+		-e "s#%%MODULE_DEPENDS%%#$(MODULE_DEPENDS_$(call modname, $@))#g" \
+		-e "s#%%MODULE_PREBUILD%%#$${prebuild}#g" \
+		-e "s#%%MODULE_PREINSTALL%%#$${preinstall}#g" \
+		-e "s#%%MODULE_CC_OPT_DEBUG%%#$(MODULE_CC_OPT_DEBUG_$(call modname, $@))#g" \
+		-e "s#%%MODULE_CC_OPT_NODEBUG%%#$(MODULE_CC_OPT_NODEBUG_$(call modname, $@))#g" \
+		-e "s#%%ADD_CONTROL_TAGS%%#$${addcontroltags}#g" \
+		-e "s#%%MODULE_ENV%%#$${buildenv}#g" \
+		-e "s#%%MODULE_SRCDIR%%#$(MODULE_SRCDIR)#g" \
+	> $${builddir}/APKBUILD ; \
+	cat nginx-module.post-install.in | sed \
+		-e "s#%%MODULE_POST%%#$$post#g" \
+	> $${builddir}/nginx-module-$${module_asis}.post-install ; \
+	}
+
+nginx-tests:
+	@{ \
+	if [ -d "$(SRCPATH)/nginx-tests" ]; then \
+		echo "===> Copying tests from $(SRCPATH)/nginx-tests" ; \
+		cp -rP $(SRCPATH)/nginx-tests nginx-tests ; \
+	else \
+		echo "===> Cloning tests" ; \
+		hg clone http://hg.nginx.org/nginx-tests ; \
+	fi ; \
+	}
+
+test: base nginx-tests
+	@echo "===> Running tests with regular binary/modules"
+	@{ \
+	pwd=`pwd` ; \
+	globals= ; \
+	for so in `find module-*/ -maxdepth 1 -type f -name "*module.so" | sort -t / -k 2`; do \
+		globals="$$globals load_module $$pwd/$$so;" ; \
+	done ; \
+	if [ -d $$pwd/abuild-module-perl ]; then \
+		globals="$$globals env PERL5LIB=$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl:$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl/blib/arch;" ; \
+	fi ; \
+	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \
+	}
+
+test-debug: base nginx-tests
+	@echo "===> Running tests with debug binary/modules"
+	@{ \
+	pwd=`pwd` ; \
+	globals= ; \
+	for so in `find module-*/ -maxdepth 1 -type f -name "*module-debug.so" | sort -t / -k 2`; do \
+		globals="$$globals load_module $$pwd/$$so;" ; \
+	done ; \
+	if [ -d $$pwd/abuild-module-perl ]; then \
+		globals="$$globals env PERL5LIB=$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl:$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl/blib/arch;" ; \
+	fi ; \
+	cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \
+	}
+
+clean:
+	@rm -rf base abuild-base abuild-module-* module-* $(BASE_SRC) nginx-tests
+
+.PHONY:	default all modules abuild test test-debug clean
+
+.SECONDARY:
diff --git a/alpine/default.conf b/alpine/default.conf
new file mode 100644
index 0000000..299c622
--- /dev/null
+++ b/alpine/default.conf
@@ -0,0 +1,45 @@
+server {
+    listen       80;
+    server_name  localhost;
+
+    #charset koi8-r;
+    #access_log  /var/log/nginx/host.access.log  main;
+
+    location / {
+        root   /usr/share/nginx/html;
+        index  index.html index.htm;
+    }
+
+    #error_page  404              /404.html;
+
+    # redirect server error pages to the static page /50x.html
+    #
+    error_page   500 502 503 504  /50x.html;
+    location = /50x.html {
+        root   /usr/share/nginx/html;
+    }
+
+    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+    #
+    #location ~ \.php$ {
+    #    proxy_pass   http://127.0.0.1;
+    #}
+
+    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+    #
+    #location ~ \.php$ {
+    #    root           html;
+    #    fastcgi_pass   127.0.0.1:9000;
+    #    fastcgi_index  index.php;
+    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
+    #    include        fastcgi_params;
+    #}
+
+    # deny access to .htaccess files, if Apache's document root
+    # concurs with nginx's one
+    #
+    #location ~ /\.ht {
+    #    deny  all;
+    #}
+}
+
diff --git a/alpine/nginx-module.post-install.in b/alpine/nginx-module.post-install.in
new file mode 100644
index 0000000..3461315
--- /dev/null
+++ b/alpine/nginx-module.post-install.in
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+%%MODULE_POST%%
+
+exit 0
diff --git a/alpine/nginx.conf b/alpine/nginx.conf
new file mode 100644
index 0000000..b78822c
--- /dev/null
+++ b/alpine/nginx.conf
@@ -0,0 +1,32 @@
+
+user  nginx;
+worker_processes  auto;
+
+error_log  /var/log/nginx/error.log warn;
+pid        /var/run/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+    include       /etc/nginx/mime.types;
+    default_type  application/octet-stream;
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    access_log  /var/log/nginx/access.log  main;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    keepalive_timeout  65;
+
+    #gzip  on;
+
+    include /etc/nginx/conf.d/*.conf;
+}
diff --git a/alpine/nginx.initd.in b/alpine/nginx.initd.in
new file mode 100644
index 0000000..19216ea
--- /dev/null
+++ b/alpine/nginx.initd.in
@@ -0,0 +1,70 @@
+#!/sbin/openrc-run
+
+description="Nginx http and reverse proxy server"
+extra_commands="checkconfig"
+extra_started_commands="reload reopen upgrade"
+
+cfgfile=${cfgfile:-/etc/nginx/nginx.conf}
+pidfile=/var/run/nginx.pid
+command=/usr/sbin/%%DAEMON%%
+command_args="-c $cfgfile"
+required_files="$cfgfile"
+
+depend() {
+	need net
+	use dns logger netmount
+}
+
+start_pre() {
+	$command $command_args -t -q
+}
+
+checkconfig() {
+	ebegin "Checking $RC_SVCNAME configuration"
+	start_pre
+	eend $?
+}
+
+reload() {
+	ebegin "Reloading $RC_SVCNAME configuration"
+	start_pre && start-stop-daemon --signal HUP --pidfile $pidfile
+	eend $?
+}
+
+reopen() {
+	ebegin "Reopening $RC_SVCNAME log files"
+	start-stop-daemon --signal USR1 --pidfile $pidfile
+	eend $?
+}
+
+upgrade() {
+	start_pre || return 1
+
+	ebegin "Upgrading $RC_SVCNAME binary"
+
+	einfo "Sending USR2 to old binary"
+	start-stop-daemon --signal USR2 --pidfile $pidfile
+
+	einfo "Sleeping 3 seconds before pid-files checking"
+	sleep 3
+
+	if [ ! -f $pidfile.oldbin ]; then
+		eerror "File with old pid ($pidfile.oldbin) not found"
+		return 1
+	fi
+
+	if [ ! -f $pidfile ]; then
+		eerror "New binary failed to start"
+		return 1
+	fi
+
+	einfo "Sleeping 3 seconds before WINCH"
+	sleep 3 ; start-stop-daemon --signal 28 --pidfile $pidfile.oldbin
+
+	einfo "Sending QUIT to old binary"
+	start-stop-daemon --signal QUIT --pidfile $pidfile.oldbin
+
+	einfo "Upgrade completed"
+
+	eend $? "Upgrade failed"
+}
diff --git a/alpine/nginx.logrotate b/alpine/nginx.logrotate
new file mode 100644
index 0000000..584335a
--- /dev/null
+++ b/alpine/nginx.logrotate
@@ -0,0 +1,15 @@
+/var/log/nginx/*.log {
+	daily
+	missingok
+	rotate 52
+	compress
+	delaycompress
+	notifempty
+	create 640 nginx adm
+	sharedscripts
+	postrotate
+		if [ -f /var/run/nginx.pid ]; then
+			kill -USR1 `cat /var/run/nginx.pid`
+		fi
+	endscript
+}
diff --git a/alpine/nginx.post-install b/alpine/nginx.post-install
new file mode 100644
index 0000000..13e7299
--- /dev/null
+++ b/alpine/nginx.post-install
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cat <<BANNER
+----------------------------------------------------------------------
+
+Thanks for using nginx!
+
+Please find the official documentation for nginx here:
+* http://nginx.org/en/docs/
+
+Please subscribe to nginx-announce mailing list to get
+the most important news about nginx:
+* http://nginx.org/en/support.html
+
+Commercial subscriptions for nginx are available on:
+* http://nginx.com/products/
+
+----------------------------------------------------------------------
+BANNER
+
+if [ ! -d /var/cache/nginx ]; then
+	mkdir -p /var/cache/nginx
+fi
+
+exit 0
diff --git a/alpine/nginx.post-upgrade b/alpine/nginx.post-upgrade
new file mode 100644
index 0000000..85c030a
--- /dev/null
+++ b/alpine/nginx.post-upgrade
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ -x /etc/init.d/nginx ]; then
+    if [ -f /var/run/nginx.pid ]; then
+        NGX_PID=`cat /var/run/nginx.pid`
+        if kill -s 0 $NGX_PID 2>/dev/null; then
+            service nginx upgrade || true
+        fi
+    fi
+fi
diff --git a/alpine/nginx.pre-deinstall b/alpine/nginx.pre-deinstall
new file mode 100644
index 0000000..c915841
--- /dev/null
+++ b/alpine/nginx.pre-deinstall
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if [ -x /etc/init.d/nginx -a -e /var/run/nginx.pid ]; then
+    service nginx stop
+fi
+
+exit 0
diff --git a/alpine/nginx.pre-install b/alpine/nginx.pre-install
new file mode 100644
index 0000000..cbb627d
--- /dev/null
+++ b/alpine/nginx.pre-install
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+if ! getent group nginx >/dev/null; then
+    addgroup -S nginx 2>/dev/null
+fi
+
+if ! getent group www-data >/dev/null; then
+    addgroup -Sg 82 www-data 2>/dev/null
+fi
+
+if ! getent passwd nginx >/dev/null; then
+    adduser -SDH \
+	-h /var/lib/nginx \
+	-s /sbin/nologin \
+	-G nginx \
+	-g nginx \
+	nginx 2>/dev/null
+
+    addgroup nginx www-data 2>/dev/null
+fi
+
+exit 0
diff --git a/alpine/src/njs-0.2.7.tar.gz b/alpine/src/njs-0.2.7.tar.gz
new file mode 100644
index 0000000..1282aca
--- /dev/null
+++ b/alpine/src/njs-0.2.7.tar.gz
Binary files differ