nginx: add package (#859)

This commit is contained in:
Vishal Biswas 2017-03-21 01:30:48 +05:30 committed by Fredrik Fornwall
parent d8a7fd1e31
commit 0a5412793e
5 changed files with 252 additions and 0 deletions

View File

@ -0,0 +1,14 @@
--- /dev/null 2017-02-12 08:53:37.916801006 +0530
+++ ./auto/cross/Android 2017-02-12 10:05:45.391652407 +0530
@@ -0,0 +1,11 @@
+feature_NGX_SYS_NERR_CROSS=41
+sizeof_int_CROSS=4
+sizeof_long_CROSS=4
+sizeof_long_long_CROSS=8
+sizeof_void_ptr_CROSS=4
+sizeof_sig_atomic_t_CROSS=4
+sizeof_size_t_CROSS=4
+sizeof_off_t_CROSS=4
+sizeof_time_t_CROSS=4
+endianness_CROSS=little
+

View File

@ -0,0 +1,14 @@
--- /dev/null 2017-02-12 08:53:37.916801006 +0530
+++ ./auto/cross/Android 2017-02-12 10:05:45.391652407 +0530
@@ -0,0 +1,11 @@
+feature_NGX_SYS_NERR_CROSS=41
+sizeof_int_CROSS=4
+sizeof_long_CROSS=8
+sizeof_long_long_CROSS=8
+sizeof_void_ptr_CROSS=8
+sizeof_sig_atomic_t_CROSS=4
+sizeof_size_t_CROSS=8
+sizeof_off_t_CROSS=8
+sizeof_time_t_CROSS=8
+endianness_CROSS=little
+

View File

@ -0,0 +1,8 @@
--- ./auto/threads 2017-01-31 20:31:11.000000000 +0530
+++ ../threads 2017-03-18 21:24:15.697120228 +0530
@@ -16,5 +16,4 @@
have=NGX_THREADS . auto/have
CORE_DEPS="$CORE_DEPS $THREAD_POOL_DEPS"
CORE_SRCS="$CORE_SRCS $THREAD_POOL_SRCS"
- CORE_LIBS="$CORE_LIBS -lpthread"
fi

90
packages/nginx/build.sh Normal file
View File

@ -0,0 +1,90 @@
TERMUX_PKG_VERSION=1.10.3
TERMUX_PKG_HOMEPAGE=https://www.nginx.org
TERMUX_PKG_DESCRIPTION="Lightweight HTTP server"
TERMUX_PKG_SRCURL=http://nginx.org/download/nginx-$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=75020f1364cac459cb733c4e1caed2d00376e40ea05588fb8793076a4c69dd90
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_DEPENDS="libandroid-glob, libcrypt, pcre, openssl"
TERMUX_PKG_CONFFILES="etc/nginx/fastcgi.conf etc/nginx/fastcgi_params etc/nginx/koi-win etc/nginx/koi-utf
etc/nginx/mime.types etc/nginx/nginx.conf etc/nginx/scgi_params etc/nginx/uwsgi_params etc/nginx/win-utf"
TERMUX_PKG_MAINTAINER="Vishal Biswas @vishalbiswas"
termux_step_pre_configure () {
CPPFLAGS="$CPPFLAGS -DIOV_MAX=1024"
LDFLAGS="$LDFLAGS -landroid-glob"
# remove config from previouse installs
rm -rf "$TERMUX_PREFIX/etc/nginx"
}
termux_step_configure () {
DEBUG_FLAG=""
test -n "$TERMUX_DEBUG" && DEBUG_FLAG="--debug"
./configure \
--prefix=$TERMUX_PREFIX \
--crossbuild="Linux:3.16.1:$TERMUX_ARCH" \
--crossfile="$TERMUX_PKG_SRCDIR/auto/cross/Android" \
--with-cc=$CC \
--with-cpp=$CPP \
--with-cc-opt="$CPPFLAGS $CFLAGS" \
--with-ld-opt="$LDFLAGS" \
--with-pcre \
--with-pcre-jit \
--with-file-aio \
--with-threads \
--with-ipv6 \
--sbin-path="$TERMUX_PREFIX/bin/nginx" \
--conf-path="$TERMUX_PREFIX/etc/nginx/nginx.conf" \
--http-log-path="$TERMUX_PREFIX/var/log/nginx/access.log" \
--pid-path="$TERMUX_PREFIX/tmp/nginx.pid" \
--lock-path="$TERMUX_PREFIX/tmp/nginx.lock" \
--error-log-path="$TERMUX_PREFIX/var/log/nginx/error.log" \
--http-client-body-temp-path="$TERMUX_PREFIX/var/lib/nginx/client-body" \
--http-proxy-temp-path="$TERMUX_PREFIX/var/lib/nginx/proxy" \
--http-fastcgi-temp-path="$TERMUX_PREFIX/var/lib/nginx/fastcgi" \
--http-scgi-temp-path="$TERMUX_PREFIX/var/lib/nginx/scgi" \
--http-uwsgi-temp-path="$TERMUX_PREFIX/var/lib/nginx/uwsgi" \
--with-http_auth_request_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_gunzip_module \
$DEBUG_FLAG
}
termux_step_post_make_install () {
# many parts are taken directly from Arch PKGBUILD
# https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/nginx
# set default port to 8080
sed -i "s| 80;| 8080;|" "$TERMUX_PREFIX/etc/nginx/nginx.conf"
cp conf/mime.types "$TERMUX_PREFIX/etc/nginx/"
rm "$TERMUX_PREFIX"/etc/nginx/*.default
# move default html dir
sed -e "44s|html|$TERMUX_PREFIX/share/nginx/html|" \
-e "54s|html|$TERMUX_PREFIX/share/nginx/html|" \
-i "$TERMUX_PREFIX/etc/nginx/nginx.conf"
rm -rf "$TERMUX_PREFIX/share/nginx"
mkdir -p "$TERMUX_PREFIX/share/nginx"
mv "$TERMUX_PREFIX/html/" "$TERMUX_PREFIX/share/nginx"
# install vim contrib
for i in ftdetect indent syntax; do
install -Dm644 "$TERMUX_PKG_SRCDIR/contrib/vim/${i}/nginx.vim" \
"$TERMUX_PREFIX/share/vim/vimfiles/${i}/nginx.vim"
done
# install man pages
mkdir -p "$TERMUX_PREFIX/share/man/man8"
cp "$TERMUX_PKG_SRCDIR/man/nginx.8" "$TERMUX_PREFIX/share/man/man8/"
}
termux_step_post_massage () {
# keep empty dirs which were deleted in massage
mkdir -p "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/var/log/nginx"
for dir in client-body proxy fastcgi scgi uwsgi; do
mkdir -p "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/var/lib/nginx/$dir"
done
}

View File

@ -0,0 +1,126 @@
--- ./auto/options 2017-01-24 19:32:19.000000000 +0530
+++ ../options 2017-02-12 10:01:42.063174903 +0530
@@ -34,6 +34,8 @@
NGX_TEST_BUILD_SOLARIS_SENDFILEV=NO
NGX_PLATFORM=
+NGX_CROSS=NO
+NGX_CROSSFILE=
NGX_WINE=
EVENT_FOUND=NO
@@ -190,7 +192,9 @@
--user=*) NGX_USER="$value" ;;
--group=*) NGX_GROUP="$value" ;;
- --crossbuild=*) NGX_PLATFORM="$value" ;;
+ --crossbuild=*) NGX_PLATFORM="$value" ;
+ NGX_CROSS=YES ;;
+ --crossfile=*) NGX_CROSSFILE="$value" ;;
--build=*) NGX_BUILD="$value" ;;
--builddir=*) NGX_OBJS="$value" ;;
@@ -416,6 +420,10 @@
--group=GROUP set non-privileged group for
worker processes
+ --crossbuild=PLAT:VER:ARCH crossbuild for specified
+ NGX_PLATFORM
+ --crossfile=NAME file name in auto/cross
+
--build=NAME set build name
--builddir=DIR set build directory
--- ./auto/os/linux 2017-01-24 19:32:19.000000000 +0530
+++ ../linux 2017-03-17 09:46:36.557329915 +0530
@@ -18,7 +18,13 @@
# Linux kernel version
-version=$((`uname -r \
+if [ "$NGX_CROSS" = "YES" ]; then
+ kern_version=`echo $NGX_PLATFORM | cut -d ':' -f 2`
+else
+ kern_version=`uname -r`
+fi
+
+version=$((`echo $kern_version \
| sed -n -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/ \
\1*256*256+\2*256+\3/p' \
-e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1*256*256+\2*256/p'`))
--- ./auto/types/sizeof 2017-01-24 19:32:19.000000000 +0530
+++ ../sizeof 2017-03-17 10:11:46.379342795 +0530
@@ -40,7 +40,13 @@
if [ -x $NGX_AUTOTEST ]; then
- ngx_size=`$NGX_AUTOTEST`
+ if [ "$NGX_CROSS" = "YES" ]; then
+ crossvar=`echo "sizeof_${ngx_type}_CROSS" | sed -e 's| |_|g' -e 's|\*|ptr|g'`
+ . $NGX_CROSSFILE
+ eval ngx_size=\"\${$crossvar}\"
+ else
+ ngx_size=`$NGX_AUTOTEST`
+ fi
echo " $ngx_size bytes"
fi
--- ./auto/feature 2017-01-24 19:32:19.000000000 +0530
+++ ../feature 2017-02-12 10:18:38.010242484 +0530
@@ -53,7 +53,7 @@
yes)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+ if [ "$NGX_CROSS" = "YES" ] || bash -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1 ; then
echo " found"
ngx_found=yes
@@ -68,7 +68,24 @@
value)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+ if [ "$NGX_CROSS" = "YES" ]; then
+ eval crossval=\"\${`echo "feature_${ngx_feature_name}_CROSS" | sed 's| |_|g'`}\"
+ . $NGX_CROSSFILE
+ if [ -n "$crossval" ]; then
+ echo " found"
+ ngx_found=yes
+
+ cat << END >> $NGX_AUTO_CONFIG_H
+
+#ifndef $ngx_feature_name
+#define $ngx_feature_name `echo $crossval`
+#endif
+
+END
+ else
+ echo " found but is not working"
+ fi
+ elif /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " found"
ngx_found=yes
--- ./auto/endianness 2017-01-31 20:31:10.000000000 +0530
+++ ../endianness 2017-03-19 12:00:55.871579412 +0530
@@ -31,7 +31,18 @@
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
-if [ -x $NGX_AUTOTEST ]; then
+if [ "$NGX_CROSS" = "YES" ]; then
+ . $NGX_CROSSFILE
+ if [ "$endianness_CROSS" = "little" ]; then
+ echo " little endian"
+ have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+ else
+ echo " big endian"
+ fi
+
+ rm -rf $NGX_AUTOTEST*
+
+elif [ -x $NGX_AUTOTEST ]; then
if $NGX_AUTOTEST >/dev/null 2>&1; then
echo " little endian"
have=NGX_HAVE_LITTLE_ENDIAN . auto/have