mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] nginx: new package
@ 2016-11-06 19:12 Clemens Gruber
  2016-11-29  7:43 ` Juergen Borleis
  2016-11-29  9:10 ` Michael Olbrich
  0 siblings, 2 replies; 6+ messages in thread
From: Clemens Gruber @ 2016-11-06 19:12 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Add nginx package. Heavily inspired by Buildroot's nginx.mk, using their
revised patches for 1.10.x and the endian patch from Marc Kleine-Budde,
as well as the nginx.make from the patchset Robert sent, as a starting
point.

But instead of building the modules by default, each module is
selectable in PTXdist, to allow reducing the binary size.

Most popular modules are supported, systemd unit file and basic
configuration files are included as well.
Supports SSL, HTTP/2, HTTP Proxying, GZIP, Auth Basic, Rewrite, FastCGI,
SCGI, uWSGI, etc.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 ...izeof-rework-autotest-to-be-cross-compila.patch |  87 +++++++++
 ...e-add-mechanism-allowing-to-force-feature.patch | 135 +++++++++++++
 ...x_feature_run_force_result-for-each-featu.patch | 213 +++++++++++++++++++++
 ...0004-auto-lib-libxslt-conf-use-pkg-config.patch |  31 +++
 ...nix-make-sys_nerr-guessing-cross-friendly.patch | 138 +++++++++++++
 ...0006-auto-lib-openssl-conf-use-pkg-config.patch |  31 +++
 .../0007-auto-lib-libgd-conf-use-pkg-config.patch  |  31 +++
 ...-ngx_linux_config.h-only-include-dlfcn.h-.patch |  33 ++++
 ...ness-add-mechanism-allowing-to-force-resu.patch |  26 +++
 patches/nginx-1.10.2/series                        |  11 ++
 projectroot/etc/nginx/mime.types                   |  89 +++++++++
 projectroot/etc/nginx/nginx.conf                   |  39 ++++
 projectroot/lib/systemd/system/nginx.service       |  14 ++
 projectroot/usr/lib/tmpfiles.d/nginx.conf          |  10 +
 rules/nginx.in                                     | 170 ++++++++++++++++
 rules/nginx.make                                   | 209 ++++++++++++++++++++
 16 files changed, 1267 insertions(+)
 create mode 100644 patches/nginx-1.10.2/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch
 create mode 100644 patches/nginx-1.10.2/0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
 create mode 100644 patches/nginx-1.10.2/0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch
 create mode 100644 patches/nginx-1.10.2/0004-auto-lib-libxslt-conf-use-pkg-config.patch
 create mode 100644 patches/nginx-1.10.2/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
 create mode 100644 patches/nginx-1.10.2/0006-auto-lib-openssl-conf-use-pkg-config.patch
 create mode 100644 patches/nginx-1.10.2/0007-auto-lib-libgd-conf-use-pkg-config.patch
 create mode 100644 patches/nginx-1.10.2/0008-src-os-unix-ngx_linux_config.h-only-include-dlfcn.h-.patch
 create mode 100644 patches/nginx-1.10.2/0100-auto-endianness-add-mechanism-allowing-to-force-resu.patch
 create mode 100644 patches/nginx-1.10.2/series
 create mode 100644 projectroot/etc/nginx/mime.types
 create mode 100644 projectroot/etc/nginx/nginx.conf
 create mode 100644 projectroot/lib/systemd/system/nginx.service
 create mode 100644 projectroot/usr/lib/tmpfiles.d/nginx.conf
 create mode 100644 rules/nginx.in
 create mode 100644 rules/nginx.make

diff --git a/patches/nginx-1.10.2/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch b/patches/nginx-1.10.2/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch
new file mode 100644
index 0000000..603f729
--- /dev/null
+++ b/patches/nginx-1.10.2/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch
@@ -0,0 +1,87 @@
+From fe05ccf80afe5de33d4f9c5e5545390c450bcd2d Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Thu, 24 Apr 2014 23:27:32 +0200
+Subject: [PATCH] auto/type/sizeof: rework autotest to be cross-compilation
+ friendly
+
+Rework the sizeof test to do the checks at compile time instead of at
+runtime. This way, it does not break when cross-compiling for a
+different CPU architecture.
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+
+Refresh for 1.8.0.
+
+Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>
+[martin@barkynet.com: Updated for 1.10.0]
+Signed-off-by: Martin Bark <martin@barkynet.com>
+---
+ auto/types/sizeof | 42 ++++++++++++++++++++++++++++--------------
+ 1 file changed, 28 insertions(+), 14 deletions(-)
+
+diff --git a/auto/types/sizeof b/auto/types/sizeof
+index a5f66bb..c6f31ec 100644
+--- a/auto/types/sizeof
++++ b/auto/types/sizeof
+@@ -14,7 +14,7 @@ END
+ 
+ ngx_size=
+ 
+-cat << END > $NGX_AUTOTEST.c
++cat << _EOF > $NGX_AUTOTEST.c
+ 
+ #include <sys/types.h>
+ #include <sys/time.h>
+@@ -25,22 +25,40 @@ $NGX_INCLUDE_UNISTD_H
+ $NGX_INCLUDE_INTTYPES_H
+ $NGX_INCLUDE_AUTO_CONFIG_H
+ 
+-int main() {
+-    printf("%d", (int) sizeof($ngx_type));
++#if !defined( PASTE)
++#define PASTE2( x, y) x##y
++#define PASTE( x, y)  PASTE2( x, y)
++#endif /* PASTE */
++
++#define SAY_IF_SIZEOF( typename, type, size)   \\
++    static char PASTE( PASTE( PASTE( sizeof_, typename), _is_), size) \\
++    [(sizeof(type) == (size)) ? 1 : -1]
++
++SAY_IF_SIZEOF(TEST_TYPENAME, TEST_TYPE, TEST_SIZE);
++
++int main(void)
++{
+     return 0;
+ }
+ 
+-END
+-
++_EOF
+ 
+-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
++_ngx_typename=`echo "$ngx_type" | sed 's/ /_/g;s/\*/p/'`
++ngx_size="-1"
++ngx_size=`for i in 1 2 4 8 16 ; do \
++    $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
++    -DTEST_TYPENAME="$_ngx_typename" -DTEST_TYPE="$ngx_type" -DTEST_SIZE="$i" \
++    $NGX_AUTOTEST.c -o $NGX_AUTOTEST \
++    $NGX_LD_OPT $ngx_feature_libs >/dev/null 2>&1 || continue ;\
++    echo $i ; break ; done`
+ 
+-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
++rm -rf $NGX_AUTOTEST*
+ 
++if test -z $ngx_size ; then
++    ngx_size=-1
++fi
+ 
+-if [ -x $NGX_AUTOTEST ]; then
+-    ngx_size=`$NGX_AUTOTEST`
++if [ $ngx_size -gt 0 ]; then
+     echo " $ngx_size bytes"
+ fi
+ 
+-- 
+1.9.1
+
diff --git a/patches/nginx-1.10.2/0002-auto-feature-add-mechanism-allowing-to-force-feature.patch b/patches/nginx-1.10.2/0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
new file mode 100644
index 0000000..13bef5f
--- /dev/null
+++ b/patches/nginx-1.10.2/0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
@@ -0,0 +1,135 @@
+From ef72be22ad6d58e230f75553d80b470b80c3303a Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Sun, 4 May 2014 00:40:49 +0200
+Subject: [PATCH] auto/feature: add mechanism allowing to force feature run
+ test result
+
+Whenever a feature needs to run a test, the ngx_feature_run_force_result
+variable can be set to the desired test result, and thus skip the test.
+
+Therefore, the generated config.h file will honor these presets.
+
+This mechanism aims to make easier cross-compilation support.
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+---
+ auto/feature | 80 ++++++++++++++++++++++++++++++++++++++++++++----------------
+ 1 file changed, 59 insertions(+), 21 deletions(-)
+
+diff --git a/auto/feature b/auto/feature
+index 1145f28..a194b85 100644
+--- a/auto/feature
++++ b/auto/feature
+@@ -52,50 +52,88 @@ if [ -x $NGX_AUTOTEST ]; then
+     case "$ngx_feature_run" in
+ 
+         yes)
+-            # /bin/sh is used to intercept "Killed" or "Abort trap" messages
+-            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+-                echo " found"
++            if test -n "$ngx_feature_run_force_result" ; then
++                echo " not tested (maybe cross-compiling)"
++                if test -n "$ngx_feature_name" ; then
++                    if test "$ngx_feature_run_force_result" = "yes" ; then
++                        have=$ngx_have_feature . auto/have
++                    fi
++                fi
+                 ngx_found=yes
++            else
+ 
+-                if test -n "$ngx_feature_name"; then
+-                    have=$ngx_have_feature . auto/have
++                # /bin/sh is used to intercept "Killed" or "Abort trap" messages
++                if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
++                    echo " found"
++                    ngx_found=yes
++
++                    if test -n "$ngx_feature_name"; then
++                        have=$ngx_have_feature . auto/have
++                    fi
++
++                else
++                    echo " found but is not working"
+                 fi
+ 
+-            else
+-                echo " found but is not working"
+             fi
+         ;;
+ 
+         value)
+-            # /bin/sh is used to intercept "Killed" or "Abort trap" messages
+-            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+-                echo " found"
++            if test -n "$ngx_feature_run_force_result" ; then
++                echo " not tested (maybe cross-compiling)"
++                cat << END >> $NGX_AUTO_CONFIG_H
++
++#ifndef $ngx_feature_name
++#define $ngx_feature_name  $ngx_feature_run_force_result
++#endif
++
++END
+                 ngx_found=yes
++            else
+ 
+-                cat << END >> $NGX_AUTO_CONFIG_H
++                # /bin/sh is used to intercept "Killed" or "Abort trap" messages
++                if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
++                    echo " found"
++                    ngx_found=yes
++
++                    cat << END >> $NGX_AUTO_CONFIG_H
+ 
+ #ifndef $ngx_feature_name
+ #define $ngx_feature_name  `$NGX_AUTOTEST`
+ #endif
+ 
+ END
+-            else
+-                echo " found but is not working"
++                else
++                    echo " found but is not working"
++                fi
++
+             fi
+         ;;
+ 
+         bug)
+-            # /bin/sh is used to intercept "Killed" or "Abort trap" messages
+-            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+-                echo " not found"
+-
+-            else
+-                echo " found"
++            if test -n "$ngx_feature_run_force_result" ; then
++                echo " not tested (maybe cross-compiling)"
++                if test -n "$ngx_feature_name"; then
++                    if test "$ngx_feature_run_force_result" = "yes" ; then
++                        have=$ngx_have_feature . auto/have
++                    fi
++                fi
+                 ngx_found=yes
++            else
+ 
+-                if test -n "$ngx_feature_name"; then
+-                    have=$ngx_have_feature . auto/have
++                # /bin/sh is used to intercept "Killed" or "Abort trap" messages
++                if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
++                    echo " not found"
++
++                else
++                    echo " found"
++                    ngx_found=yes
++
++                    if test -n "$ngx_feature_name"; then
++                        have=$ngx_have_feature . auto/have
++                    fi
+                 fi
++
+             fi
+         ;;
+ 
+-- 
+1.9.2
+
diff --git a/patches/nginx-1.10.2/0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch b/patches/nginx-1.10.2/0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch
new file mode 100644
index 0000000..ed67a67
--- /dev/null
+++ b/patches/nginx-1.10.2/0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch
@@ -0,0 +1,213 @@
+From 71939b727a8fa9f722934700948a5b68960f6183 Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Thu, 29 May 2014 18:52:10 +0200
+Subject: [PATCH] auto/*: set ngx_feature_run_force_result for each feature
+ requiring run test
+
+Each feature requiring a run test has a matching preset variable (called
+ngx_force_*) used to set ngx_feature_run_force_result.
+
+These ngx_force_* variables are passed through the environment at configure
+time.
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+
+Refresh for 1.8.0.
+
+Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>
+---
+ auto/cc/conf            | 3 +++
+ auto/cc/name            | 1 +
+ auto/lib/libatomic/conf | 1 +
+ auto/os/darwin          | 3 +++
+ auto/os/linux           | 4 ++++
+ auto/unix               | 8 ++++++++
+ 6 files changed, 20 insertions(+)
+
+diff --git a/auto/cc/conf b/auto/cc/conf
+index edc6d74..a61ade4 100644
+--- a/auto/cc/conf
++++ b/auto/cc/conf
+@@ -159,6 +159,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
+     ngx_feature="gcc builtin atomic operations"
+     ngx_feature_name=NGX_HAVE_GCC_ATOMIC
+     ngx_feature_run=yes
++    ngx_feature_run_force_result="$ngx_force_gcc_have_atomic"
+     ngx_feature_incs=
+     ngx_feature_path=
+     ngx_feature_libs=
+@@ -179,6 +180,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
+         ngx_feature="C99 variadic macros"
+         ngx_feature_name="NGX_HAVE_C99_VARIADIC_MACROS"
+         ngx_feature_run=yes
++        ngx_feature_run_force_result="$ngx_force_c99_have_variadic_macros"
+         ngx_feature_incs="#include <stdio.h>
+ #define var(dummy, ...)  sprintf(__VA_ARGS__)"
+         ngx_feature_path=
+@@ -193,6 +195,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
+     ngx_feature="gcc variadic macros"
+     ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
+     ngx_feature_run=yes
++    ngx_feature_run_force_result="$ngx_force_gcc_have_variadic_macros"
+     ngx_feature_incs="#include <stdio.h>
+ #define var(dummy, args...)  sprintf(args)"
+     ngx_feature_path=
+diff --git a/auto/cc/name b/auto/cc/name
+index 51a7ed9..d237d47 100644
+--- a/auto/cc/name
++++ b/auto/cc/name
+@@ -8,6 +8,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
+     ngx_feature="C compiler"
+     ngx_feature_name=
+     ngx_feature_run=yes
++    ngx_feature_run_force_result="$ngx_force_c_compiler"
+     ngx_feature_incs=
+     ngx_feature_path=
+     ngx_feature_libs=
+diff --git a/auto/lib/libatomic/conf b/auto/lib/libatomic/conf
+index d1e484a..3724916 100644
+--- a/auto/lib/libatomic/conf
++++ b/auto/lib/libatomic/conf
+@@ -15,6 +15,7 @@ else
+     ngx_feature="atomic_ops library"
+     ngx_feature_name=NGX_HAVE_LIBATOMIC
+     ngx_feature_run=yes
++    ngx_feature_run_force_result="$ngx_force_have_libatomic"
+     ngx_feature_incs="#define AO_REQUIRE_CAS
+                       #include <atomic_ops.h>"
+     ngx_feature_path=
+diff --git a/auto/os/darwin b/auto/os/darwin
+index 1d3e3d3..11b7276 100644
+--- a/auto/os/darwin
++++ b/auto/os/darwin
+@@ -27,6 +27,7 @@ NGX_KQUEUE_CHECKED=YES
+ ngx_feature="kqueue's EVFILT_TIMER"
+ ngx_feature_name="NGX_HAVE_TIMER_EVENT"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_timer_event"
+ ngx_feature_incs="#include <sys/event.h>
+                   #include <sys/time.h>"
+ ngx_feature_path=
+@@ -57,6 +58,7 @@ ngx_feature_test="int      kq;
+ ngx_feature="Darwin 64-bit kqueue millisecond timeout bug"
+ ngx_feature_name=NGX_DARWIN_KEVENT_BUG
+ ngx_feature_run=bug
++ngx_feature_run_force_result="$ngx_force_kevent_bug"
+ ngx_feature_incs="#include <sys/event.h>
+                   #include <sys/time.h>"
+ ngx_feature_path=
+@@ -87,6 +89,7 @@ CC_AUX_FLAGS="$CC_AUX_FLAGS"
+ ngx_feature="sendfile()"
+ ngx_feature_name="NGX_HAVE_SENDFILE"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_sendfile"
+ ngx_feature_incs="#include <sys/types.h>
+                   #include <sys/socket.h>
+                   #include <sys/uio.h>
+diff --git a/auto/os/linux b/auto/os/linux
+index 19bf832..16848b2 100644
+--- a/auto/os/linux
++++ b/auto/os/linux
+@@ -49,6 +49,7 @@ fi
+ ngx_feature="epoll"
+ ngx_feature_name="NGX_HAVE_EPOLL"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_epoll"
+ ngx_feature_incs="#include <sys/epoll.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
+@@ -106,6 +107,7 @@ CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE"
+ ngx_feature="sendfile()"
+ ngx_feature_name="NGX_HAVE_SENDFILE"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_sendfile"
+ ngx_feature_incs="#include <sys/sendfile.h>
+                   #include <errno.h>"
+ ngx_feature_path=
+@@ -127,6 +129,7 @@ CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
+ ngx_feature="sendfile64()"
+ ngx_feature_name="NGX_HAVE_SENDFILE64"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_sendfile64"
+ ngx_feature_incs="#include <sys/sendfile.h>
+                   #include <errno.h>"
+ ngx_feature_path=
+@@ -145,6 +148,7 @@ ngx_include="sys/prctl.h"; . auto/include
+ ngx_feature="prctl(PR_SET_DUMPABLE)"
+ ngx_feature_name="NGX_HAVE_PR_SET_DUMPABLE"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_pr_set_dumpable"
+ ngx_feature_incs="#include <sys/prctl.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
+diff --git a/auto/unix b/auto/unix
+index 6e54531..7dbf9d1 100755
+--- a/auto/unix
++++ b/auto/unix
+@@ -99,6 +99,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
+         ngx_feature="kqueue's EVFILT_TIMER"
+         ngx_feature_name="NGX_HAVE_TIMER_EVENT"
+         ngx_feature_run=yes
++        ngx_feature_run_force_result="$ngx_force_have_timer_event"
+         ngx_feature_incs="#include <sys/event.h>
+                           #include <sys/time.h>"
+         ngx_feature_path=
+@@ -589,6 +590,7 @@ ngx_feature_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0);
+ ngx_feature="sys_nerr"
+ ngx_feature_name="NGX_SYS_NERR"
+ ngx_feature_run=value
++ngx_feature_run_force_result="$ngx_force_sys_nerr"
+ ngx_feature_incs='#include <errno.h>
+                   #include <stdio.h>'
+ ngx_feature_path=
+@@ -603,6 +605,7 @@ if [ $ngx_found = no ]; then
+     ngx_feature="_sys_nerr"
+     ngx_feature_name="NGX_SYS_NERR"
+     ngx_feature_run=value
++    ngx_feature_run_force_result="$ngx_force_sys_nerr"
+     ngx_feature_incs='#include <errno.h>
+                       #include <stdio.h>'
+     ngx_feature_path=
+@@ -618,6 +621,7 @@ if [ $ngx_found = no ]; then
+     ngx_feature='maximum errno'
+     ngx_feature_name=NGX_SYS_NERR
+     ngx_feature_run=value
++    ngx_feature_run_force_result="$ngx_force_sys_nerr"
+     ngx_feature_incs='#include <errno.h>
+                       #include <string.h>
+                       #include <stdio.h>'
+@@ -676,6 +680,7 @@ ngx_feature_test="void *p; p = memalign(4096, 4096);
+ ngx_feature="mmap(MAP_ANON|MAP_SHARED)"
+ ngx_feature_name="NGX_HAVE_MAP_ANON"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_map_anon"
+ ngx_feature_incs="#include <sys/mman.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
+@@ -689,6 +694,7 @@ ngx_feature_test="void *p;
+ ngx_feature='mmap("/dev/zero", MAP_SHARED)'
+ ngx_feature_name="NGX_HAVE_MAP_DEVZERO"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_map_devzero"
+ ngx_feature_incs="#include <sys/mman.h>
+                   #include <sys/stat.h>
+                   #include <fcntl.h>"
+@@ -704,6 +710,7 @@ ngx_feature_test='void *p; int  fd;
+ ngx_feature="System V shared memory"
+ ngx_feature_name="NGX_HAVE_SYSVSHM"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_sysvshm"
+ ngx_feature_incs="#include <sys/ipc.h>
+                   #include <sys/shm.h>"
+ ngx_feature_path=
+@@ -718,6 +725,7 @@ ngx_feature_test="int  id;
+ ngx_feature="POSIX semaphores"
+ ngx_feature_name="NGX_HAVE_POSIX_SEM"
+ ngx_feature_run=yes
++ngx_feature_run_force_result="$ngx_force_have_posix_sem"
+ ngx_feature_incs="#include <semaphore.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
+-- 
+1.9.1
+
diff --git a/patches/nginx-1.10.2/0004-auto-lib-libxslt-conf-use-pkg-config.patch b/patches/nginx-1.10.2/0004-auto-lib-libxslt-conf-use-pkg-config.patch
new file mode 100644
index 0000000..b315909
--- /dev/null
+++ b/patches/nginx-1.10.2/0004-auto-lib-libxslt-conf-use-pkg-config.patch
@@ -0,0 +1,31 @@
+From 211b9f19a3a62826fadef55d2f89d6f66fbf4aa6 Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Thu, 29 May 2014 19:22:27 +0200
+Subject: [PATCH] auto/lib/libxslt/conf: use pkg-config
+
+Change to using pkg-config to find the path to libxslt and its
+dependencies.
+
+Signed-off-by: Martin Bark <martin@barkynet.com>
+---
+ auto/lib/libxslt/conf | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/auto/lib/libxslt/conf b/auto/lib/libxslt/conf
+index 3a0f37b..3c2a60e 100644
+--- a/auto/lib/libxslt/conf
++++ b/auto/lib/libxslt/conf
+@@ -12,8 +12,8 @@
+                       #include <libxslt/xsltInternals.h>
+                       #include <libxslt/transform.h>
+                       #include <libxslt/xsltutils.h>"
+-    ngx_feature_path="/usr/include/libxml2"
+-    ngx_feature_libs="-lxml2 -lxslt"
++    ngx_feature_path="$(${PKG_CONFIG:=pkg-config} --cflags-only-I libxslt|sed 's/-I//g')"
++    ngx_feature_libs="$(${PKG_CONFIG:=pkg-config} --libs libxslt)"
+     ngx_feature_test="xmlParserCtxtPtr    ctxt = NULL;
+                       xsltStylesheetPtr   sheet = NULL;
+                       xmlDocPtr           doc;
+-- 
+2.8.2
+
diff --git a/patches/nginx-1.10.2/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch b/patches/nginx-1.10.2/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
new file mode 100644
index 0000000..2242d13
--- /dev/null
+++ b/patches/nginx-1.10.2/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
@@ -0,0 +1,138 @@
+From 08617a8d29ee22831175697555558fec8f52772c Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Sun, 1 Jun 2014 16:05:04 +0200
+Subject: [PATCH] auto/unix: make sys_nerr guessing cross-friendly
+
+This patch replaces the default sys_nerr runtest with a test done at
+buildtime.
+
+The idea behind this buildtime test is finding the value of the ERR_MAX
+macro if defined, or the EHWPOISON (which is currently the last errno)
+otherwise.
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+
+Refresh for 1.8.0.
+
+Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>
+---
+ auto/os/sys_nerr | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ auto/unix        | 10 ++++++++
+ 2 files changed, 88 insertions(+)
+ create mode 100644 auto/os/sys_nerr
+
+diff --git a/auto/os/sys_nerr b/auto/os/sys_nerr
+new file mode 100644
+index 0000000..8970f5f
+--- /dev/null
++++ b/auto/os/sys_nerr
+@@ -0,0 +1,78 @@
++
++# Copyright (C) Samuel Martin <s.martin49@gmail.com>
++
++
++echo $ngx_n "checking for sys_nerr value...$ngx_c"
++
++# sys_nerr guessing is done using a (very) poor (but working)
++# heuristics, by checking for the value of ERR_MAX if defined, or
++# EHWPOISON otherwise.
++
++cat << END >> $NGX_AUTOCONF_ERR
++
++----------------------------------------
++checking for sys_nerr value
++
++END
++
++ngx_sys_nerr=
++
++cat << _EOF > $NGX_AUTOTEST.c
++
++#include <stdio.h>
++#include <errno.h>
++
++static char sys_nerr_test[ERR_MAX];
++int main(void)
++{
++    return 0;
++}
++
++_EOF
++
++if $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
++        $NGX_AUTOTEST.c -o $NGX_AUTOTEST \
++        $NGX_LD_OPT $ngx_feature_libs >/dev/null 2>&1 ; then
++    _ngx_max_err_macro=ERR_MAX
++else
++    # the +2 has been empirically found!
++    _ngx_max_err_macro="EHWPOISON + 2"
++fi
++
++cat << _EOF > $NGX_AUTOTEST.c
++
++#include <stdio.h>
++#include <errno.h>
++
++static char sys_nerr_test[(TEST_ERR_MAX == $_ngx_max_err_macro) ? 1 : -1];
++int main(void)
++{
++    return 0;
++}
++
++_EOF
++
++
++ngx_sys_nerr=`for i in $(seq 0 2000) ; do \
++    $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
++    -DTEST_ERR_MAX="$i" \
++    $NGX_AUTOTEST.c -o $NGX_AUTOTEST \
++    $NGX_LD_OPT $ngx_feature_libs >/dev/null 2>&1 || continue ;\
++    echo $i ; break ; done`
++
++rm -rf $NGX_AUTOTEST*
++
++if test -z $ngx_sys_nerr ; then
++    ngx_size=0
++    ngx_sys_nerr=0
++fi
++
++cat << END >> $NGX_AUTO_CONFIG_H
++
++#ifndef $ngx_feature_name
++#define $ngx_feature_name $ngx_sys_nerr
++#endif
++
++END
++
++echo " $ngx_sys_nerr"
+diff --git a/auto/unix b/auto/unix
+index 7dbf9d1..00a7370 100755
+--- a/auto/unix
++++ b/auto/unix
+@@ -595,6 +595,10 @@ ngx_feature_incs='#include <errno.h>
+                   #include <stdio.h>'
+ ngx_feature_path=
+ ngx_feature_libs=
++
++if false ; then
++# Disabled because only valid for native build.
++
+ ngx_feature_test='printf("%d", sys_nerr);'
+ . auto/feature
+ 
+@@ -643,6 +647,12 @@ if [ $ngx_found = no ]; then
+     . auto/feature
+ fi
+ 
++else
++    # Cross-compilation support
++    . auto/os/sys_nerr
++
++fi
++
+ 
+ ngx_feature="localtime_r()"
+ ngx_feature_name="NGX_HAVE_LOCALTIME_R"
+-- 
+1.9.1
+
diff --git a/patches/nginx-1.10.2/0006-auto-lib-openssl-conf-use-pkg-config.patch b/patches/nginx-1.10.2/0006-auto-lib-openssl-conf-use-pkg-config.patch
new file mode 100644
index 0000000..b826a3c
--- /dev/null
+++ b/patches/nginx-1.10.2/0006-auto-lib-openssl-conf-use-pkg-config.patch
@@ -0,0 +1,31 @@
+From 756556d127da291cad8a2c007a89124a692aef7f Mon Sep 17 00:00:00 2001
+From: Martin Bark <martin@barkynet.com>
+Date: Fri, 6 May 2016 14:48:31 +0100
+Subject: [PATCH] auto/lib/openssl/conf: use pkg-config
+
+Change to using pkg-config to find the path to openssl and its
+dependencies.
+
+Signed-off-by: Martin Bark <martin@barkynet.com>
+---
+ auto/lib/openssl/conf | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/auto/lib/openssl/conf b/auto/lib/openssl/conf
+index 39d9602..995c6f3 100644
+--- a/auto/lib/openssl/conf
++++ b/auto/lib/openssl/conf
+@@ -50,8 +50,8 @@ else
+         ngx_feature_name="NGX_OPENSSL"
+         ngx_feature_run=no
+         ngx_feature_incs="#include <openssl/ssl.h>"
+-        ngx_feature_path=
+-        ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL"
++        ngx_feature_path="$(${PKG_CONFIG:=pkg-config} --cflags-only-I openssl|sed 's/-I//g')"
++        ngx_feature_libs="$(${PKG_CONFIG:=pkg-config} --libs openssl)"
+         ngx_feature_test="SSL_CTX_set_options(NULL, 0)"
+         . auto/feature
+ 
+-- 
+2.8.2
+
diff --git a/patches/nginx-1.10.2/0007-auto-lib-libgd-conf-use-pkg-config.patch b/patches/nginx-1.10.2/0007-auto-lib-libgd-conf-use-pkg-config.patch
new file mode 100644
index 0000000..34e7981
--- /dev/null
+++ b/patches/nginx-1.10.2/0007-auto-lib-libgd-conf-use-pkg-config.patch
@@ -0,0 +1,31 @@
+From fd9885fe5fef5826034547ca6be7299863f99769 Mon Sep 17 00:00:00 2001
+From: Martin Bark <martin@barkynet.com>
+Date: Fri, 6 May 2016 14:48:49 +0100
+Subject: [PATCH] auto/lib/libgd/conf: use pkg-config
+
+Change to using pkg-config to find the path to libgd and its
+dependencies.
+
+Signed-off-by: Martin Bark <martin@barkynet.com>
+---
+ auto/lib/libgd/conf | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/auto/lib/libgd/conf b/auto/lib/libgd/conf
+index 6e4e91c..1c536a2 100644
+--- a/auto/lib/libgd/conf
++++ b/auto/lib/libgd/conf
+@@ -7,8 +7,8 @@
+     ngx_feature_name=
+     ngx_feature_run=no
+     ngx_feature_incs="#include <gd.h>"
+-    ngx_feature_path=
+-    ngx_feature_libs="-lgd"
++    ngx_feature_path="$(${GDLIB_CONFIG:=gdlib-config} --includedir)"
++    ngx_feature_libs="$(${GDLIB_CONFIG:=gdlib-config} --libs)"
+     ngx_feature_test="gdImagePtr img = gdImageCreateFromGifPtr(1, NULL);"
+     . auto/feature
+ 
+-- 
+2.8.2
+
diff --git a/patches/nginx-1.10.2/0008-src-os-unix-ngx_linux_config.h-only-include-dlfcn.h-.patch b/patches/nginx-1.10.2/0008-src-os-unix-ngx_linux_config.h-only-include-dlfcn.h-.patch
new file mode 100644
index 0000000..c10fcd1
--- /dev/null
+++ b/patches/nginx-1.10.2/0008-src-os-unix-ngx_linux_config.h-only-include-dlfcn.h-.patch
@@ -0,0 +1,33 @@
+From 8dc9dffc1f99ac951865f3135dfb5061a08d1f85 Mon Sep 17 00:00:00 2001
+From: Martin Bark <martin@barkynet.com>
+Date: Fri, 6 May 2016 16:29:17 +0100
+Subject: [PATCH] src/os/unix/ngx_linux_config.h: only include dlfcn.h if
+ available
+
+Signed-off-by: Martin Bark <martin@barkynet.com>
+---
+ src/os/unix/ngx_linux_config.h | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h
+index 2f6129d..4244086 100644
+--- a/src/os/unix/ngx_linux_config.h
++++ b/src/os/unix/ngx_linux_config.h
+@@ -55,10 +55,12 @@
+ #include <crypt.h>
+ #include <sys/utsname.h>        /* uname() */
+ 
+-#include <dlfcn.h>
++#include <ngx_auto_config.h>
+ 
+ 
+-#include <ngx_auto_config.h>
++#if (NGX_HAVE_DLOPEN)
++#include <dlfcn.h>
++#endif
+ 
+ 
+ #if (NGX_HAVE_POSIX_SEM)
+-- 
+2.8.2
+
diff --git a/patches/nginx-1.10.2/0100-auto-endianness-add-mechanism-allowing-to-force-resu.patch b/patches/nginx-1.10.2/0100-auto-endianness-add-mechanism-allowing-to-force-resu.patch
new file mode 100644
index 0000000..646c9b4
--- /dev/null
+++ b/patches/nginx-1.10.2/0100-auto-endianness-add-mechanism-allowing-to-force-resu.patch
@@ -0,0 +1,26 @@
+From 9b9780c434c17baa78214d9d7b9f896fec5e7603 Mon Sep 17 00:00:00 2001
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+Date: Wed, 2 Sep 2015 18:20:10 +0200
+Subject: [PATCH] auto/endianness: add mechanism allowing to force result
+
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+---
+ auto/endianness | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/auto/endianness b/auto/endianness
+index 70b0a10..ab9d69a 100644
+--- a/auto/endianness
++++ b/auto/endianness
+@@ -32,7 +32,7 @@ ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+ 
+ if [ -x $NGX_AUTOTEST ]; then
+-    if $NGX_AUTOTEST >/dev/null 2>&1; then
++    if $NGX_AUTOTEST >/dev/null 2>&1 || test "$ngx_force_have_little_endian" = "yes"; then
+         echo " little endian"
+         have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+     else
+-- 
+2.7.0
+
diff --git a/patches/nginx-1.10.2/series b/patches/nginx-1.10.2/series
new file mode 100644
index 0000000..dc63f98
--- /dev/null
+++ b/patches/nginx-1.10.2/series
@@ -0,0 +1,11 @@
+# Buildroot
+0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch
+0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
+0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch
+0004-auto-lib-libxslt-conf-use-pkg-config.patch
+0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
+0006-auto-lib-openssl-conf-use-pkg-config.patch
+0007-auto-lib-libgd-conf-use-pkg-config.patch
+0008-src-os-unix-ngx_linux_config.h-only-include-dlfcn.h-.patch
+# PTXdist
+0100-auto-endianness-add-mechanism-allowing-to-force-resu.patch
diff --git a/projectroot/etc/nginx/mime.types b/projectroot/etc/nginx/mime.types
new file mode 100644
index 0000000..89be9a4
--- /dev/null
+++ b/projectroot/etc/nginx/mime.types
@@ -0,0 +1,89 @@
+
+types {
+    text/html                             html htm shtml;
+    text/css                              css;
+    text/xml                              xml;
+    image/gif                             gif;
+    image/jpeg                            jpeg jpg;
+    application/javascript                js;
+    application/atom+xml                  atom;
+    application/rss+xml                   rss;
+
+    text/mathml                           mml;
+    text/plain                            txt;
+    text/vnd.sun.j2me.app-descriptor      jad;
+    text/vnd.wap.wml                      wml;
+    text/x-component                      htc;
+
+    image/png                             png;
+    image/tiff                            tif tiff;
+    image/vnd.wap.wbmp                    wbmp;
+    image/x-icon                          ico;
+    image/x-jng                           jng;
+    image/x-ms-bmp                        bmp;
+    image/svg+xml                         svg svgz;
+    image/webp                            webp;
+
+    application/font-woff                 woff;
+    application/java-archive              jar war ear;
+    application/json                      json;
+    application/mac-binhex40              hqx;
+    application/msword                    doc;
+    application/pdf                       pdf;
+    application/postscript                ps eps ai;
+    application/rtf                       rtf;
+    application/vnd.apple.mpegurl         m3u8;
+    application/vnd.ms-excel              xls;
+    application/vnd.ms-fontobject         eot;
+    application/vnd.ms-powerpoint         ppt;
+    application/vnd.wap.wmlc              wmlc;
+    application/vnd.google-earth.kml+xml  kml;
+    application/vnd.google-earth.kmz      kmz;
+    application/x-7z-compressed           7z;
+    application/x-cocoa                   cco;
+    application/x-java-archive-diff       jardiff;
+    application/x-java-jnlp-file          jnlp;
+    application/x-makeself                run;
+    application/x-perl                    pl pm;
+    application/x-pilot                   prc pdb;
+    application/x-rar-compressed          rar;
+    application/x-redhat-package-manager  rpm;
+    application/x-sea                     sea;
+    application/x-shockwave-flash         swf;
+    application/x-stuffit                 sit;
+    application/x-tcl                     tcl tk;
+    application/x-x509-ca-cert            der pem crt;
+    application/x-xpinstall               xpi;
+    application/xhtml+xml                 xhtml;
+    application/xspf+xml                  xspf;
+    application/zip                       zip;
+
+    application/octet-stream              bin exe dll;
+    application/octet-stream              deb;
+    application/octet-stream              dmg;
+    application/octet-stream              iso img;
+    application/octet-stream              msi msp msm;
+
+    application/vnd.openxmlformats-officedocument.wordprocessingml.document    docx;
+    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet          xlsx;
+    application/vnd.openxmlformats-officedocument.presentationml.presentation  pptx;
+
+    audio/midi                            mid midi kar;
+    audio/mpeg                            mp3;
+    audio/ogg                             ogg;
+    audio/x-m4a                           m4a;
+    audio/x-realaudio                     ra;
+
+    video/3gpp                            3gpp 3gp;
+    video/mp2t                            ts;
+    video/mp4                             mp4;
+    video/mpeg                            mpeg mpg;
+    video/quicktime                       mov;
+    video/webm                            webm;
+    video/x-flv                           flv;
+    video/x-m4v                           m4v;
+    video/x-mng                           mng;
+    video/x-ms-asf                        asx asf;
+    video/x-ms-wmv                        wmv;
+    video/x-msvideo                       avi;
+}
diff --git a/projectroot/etc/nginx/nginx.conf b/projectroot/etc/nginx/nginx.conf
new file mode 100644
index 0000000..5801e12
--- /dev/null
+++ b/projectroot/etc/nginx/nginx.conf
@@ -0,0 +1,39 @@
+worker_processes 1;	# Enough for most webservers and incurs less latency
+#worker_processes auto;	# Auto-detect based on CPU count
+
+events {
+	use epoll;
+	worker_connections 1024;
+	#multi_accept on;	# Should be enabled if worker_processes > 1
+}
+
+http {
+	server_tokens off;
+
+	sendfile on;
+
+	include /etc/nginx/mime.types;
+	default_type application/octet-stream;
+
+	access_log off;
+	error_log stderr;
+
+	gzip on;
+	gzip_disable "msie6";
+
+	server {
+		listen 80;
+		listen [::]:80;
+		server_name _;
+
+		index index.html;
+		root /var/www;
+
+		location / {
+			# First attempt to serve request as file, then
+			# as directory, then fall back to displaying a 404.
+			try_files $uri $uri/ =404;
+		}
+	}
+}
+
diff --git a/projectroot/lib/systemd/system/nginx.service b/projectroot/lib/systemd/system/nginx.service
new file mode 100644
index 0000000..a6a1a4d
--- /dev/null
+++ b/projectroot/lib/systemd/system/nginx.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=NGINX HTTP and reverse proxy server
+After=syslog.target network.target nss-lookup.target
+
+[Service]
+Type=forking
+PIDFile=/run/nginx.pid
+ExecStartPre=/usr/sbin/nginx -t
+ExecStart=/usr/sbin/nginx
+ExecReload=/bin/kill -s HUP $MAINPID
+ExecStop=/bin/kill -s QUIT $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/projectroot/usr/lib/tmpfiles.d/nginx.conf b/projectroot/usr/lib/tmpfiles.d/nginx.conf
new file mode 100644
index 0000000..138b675
--- /dev/null
+++ b/projectroot/usr/lib/tmpfiles.d/nginx.conf
@@ -0,0 +1,10 @@
+# systemd tmpfile settings for nginx
+# See tmpfiles.d(5) for details
+
+d /var/log/nginx 0755 root root -
+d /var/tmp/nginx 0755 www www
+d /var/tmp/nginx/client 0755 www www
+d /var/tmp/nginx/proxy 0755 www www
+d /var/tmp/nginx/fastcgi 0755 www www
+d /var/tmp/nginx/scgi 0755 www www
+d /var/tmp/nginx/uwsgi 0755 www www
diff --git a/rules/nginx.in b/rules/nginx.in
new file mode 100644
index 0000000..00aa202
--- /dev/null
+++ b/rules/nginx.in
@@ -0,0 +1,170 @@
+## SECTION=networking
+menuconfig NGINX
+	tristate
+	prompt "nginx                         "
+	select GCCLIBS_GCC_S
+	select LIBC_DL
+	select LIBC_PTHREAD
+	select LIBC_CRYPT
+	select LIBPCRE			if NGINX_PCRE
+	select OPENSSL			if NGINX_OPENSSL
+	select ZLIB			if NGINX_HTTP_GZIP_MODULE || NGINX_HTTP_GZIP_STATIC_MODULE
+	help
+	  nginx ("engine X") is a high-performance web and reverse
+	  proxy server created by Igor Sysoev. It can be used both as
+	  a standalone web server and as a proxy to reduce the load on
+	  backend servers.
+
+if NGINX
+
+menu "Base settings                 "
+
+config NGINX_OPENSSL
+	bool
+	prompt "OpenSSL support"
+	help
+	  Include OpenSSL support, which is required for the
+	  ngx_http_ssl_module.
+
+config NGINX_PCRE
+	bool
+	select LIBPCRE
+	prompt "PCRE support"
+	help
+	  Include pcre support, which is required for regular
+	  expressions support in the location directive and for the
+	  ngx_http_rewrite_module module.
+
+if NGINX_PCRE
+
+config NGINX_PCRE_JIT
+	bool
+	prompt "Enable PCRE JIT"
+	help
+	  Enables the use of just-in-time compilation for regular
+	  expressions known by the time of configuration parsing.
+	  PCRE JIT can significantly speed up processing of regular
+	  expressions.
+
+endif
+
+config NGINX_THREADS
+	bool
+	prompt "Threads support"
+	help
+	  Enable multi-threading. Files can be read and sent without
+	  blocking a worker process. Requires epoll as connection
+	  processing method.
+
+endmenu
+
+menu "Modules                       "
+
+config NGINX_HTTP_ACCESS_MODULE
+	bool
+	prompt "ngx_http_access_module"
+	help
+	  ngx_http_access_module allows limiting access to certain
+	  client addresses.
+
+config NGINX_HTTP_AUTH_BASIC_MODULE
+	bool
+	prompt "ngx_http_auth_basic_module"
+	help
+	  ngx_http_auth_basic_module allows limiting access to
+	  resources by validating the user name and password using the
+	  HTTP Basic Authentication protocol.
+
+config NGINX_HTTP_AUTOINDEX_MODULE
+	bool
+	prompt "ngx_http_autoindex_module"
+	help
+	  ngx_http_autoindex_module processes requests ending with the
+	  slash character and produces a directory listing.
+
+config NGINX_HTTP_FASTCGI_MODULE
+	bool
+	prompt "ngx_http_fastcgi_module"
+	help
+	  ngx_http_fastcgi_module allows passing requests to a FastCGI
+	  server.
+
+config NGINX_HTTP_GZIP_MODULE
+	bool
+	prompt "ngx_http_gzip_module"
+	help
+	  ngx_http_gzip_module is a filter that compresses responses
+	  using gzip.
+
+config NGINX_HTTP_GZIP_STATIC_MODULE
+	bool
+	prompt "ngx_http_gzip_static_module"
+	help
+	  ngx_http_gzip_static_module allows sending precompressed files
+	  with the .gz filename extension instead of regular files.
+
+config NGINX_HTTP_PROXY_MODULE
+	bool
+	prompt "ngx_http_proxy_module"
+	help
+	  ngx_http_proxy_module allows passing requests to another
+	  server.
+
+config NGINX_HTTP_REWRITE_MODULE
+	bool
+	select NGINX_PCRE
+	prompt "ngx_http_rewrite_module"
+	help
+	  ngx_http_rewrite_module module is used to change request URI
+	  using PCRE regular expressions, return redirects, and
+	  conditionally select configurations.
+
+config NGINX_HTTP_SCGI_MODULE
+	bool
+	prompt "ngx_http_scgi_module"
+	help
+	  ngx_http_scgi_module allows passing requests to a SCGI
+	  server.
+
+config NGINX_HTTP_SSL_MODULE
+	bool
+	select NGINX_OPENSSL
+	prompt "ngx_http_ssl_module"
+	help
+	  ngx_http_ssl_module provides the necessary support for HTTPS.
+
+config NGINX_HTTP_UWSGI_MODULE
+	bool
+	prompt "ngx_http_uwsgi_module"
+	help
+	  ngx_http_uwsgi_module allows passing requests to a uWSGI
+	  server.
+
+config NGINX_HTTP_V2_MODULE
+	bool
+	select NGINX_OPENSSL
+	prompt "ngx_http_v2_module"
+	help
+	  ngx_http_v2_module provides support for HTTP/2.
+
+endmenu
+
+menu "Startup                       "
+
+config NGINX_SYSTEMD_UNIT
+	bool
+	default y
+	depends on SYSTEMD
+	prompt "Install systemd unit files for nginx"
+
+endmenu
+
+config NGINX_POPULATE_TEST_WEBSITE
+	bool
+	default y
+	prompt "Populate a generic test website"
+	help
+	  This install a generic website into /var/www/index.html
+	  from <ptxdist-install>/projectroot/var/www/httpd.html.
+
+endif
diff --git a/rules/nginx.make b/rules/nginx.make
new file mode 100644
index 0000000..4cc0dd2
--- /dev/null
+++ b/rules/nginx.make
@@ -0,0 +1,209 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2015 by Marc Kleine-Budde <mkl@pengutronix.de>
+# Copyright (C) 2016 by Clemens Gruber <clemens.gruber@pqgruber.com>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_NGINX) += nginx
+
+#
+# Paths and names
+#
+NGINX_VERSION	:= 1.10.2
+NGINX_MD5	:= e8f5f4beed041e63eb97f9f4f55f3085
+NGINX		:= nginx-$(NGINX_VERSION)
+NGINX_SUFFIX	:= tar.gz
+NGINX_URL	:= https://nginx.org/download/$(NGINX).$(NGINX_SUFFIX)
+NGINX_SOURCE	:= $(SRCDIR)/$(NGINX).$(NGINX_SUFFIX)
+NGINX_DIR	:= $(BUILDDIR)/$(NGINX)
+NGINX_LICENSE	:= BSD-2-Clause
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+NGINX_CONF_ENV := \
+	ngx_force_c_compiler=yes \
+	ngx_force_c99_have_variadic_macros=yes \
+	ngx_force_gcc_have_variadic_macros=yes \
+	ngx_force_gcc_have_atomic=yes \
+	ngx_force_have_libatomic=no \
+	ngx_force_have_epoll=yes \
+	ngx_force_have_sendfile=yes \
+	ngx_force_have_sendfile64=yes \
+	ngx_force_have_pr_set_dumpable=yes \
+	ngx_force_have_timer_event=yes \
+	ngx_force_have_map_anon=yes \
+	ngx_force_have_map_devzero=yes \
+	ngx_force_have_sysvshm=yes \
+	ngx_force_have_posix_sem=yes
+
+ifdef PTXCONF_ENDIAN_LITTLE
+NGINX_CONF_ENV += ngx_force_have_little_endian=yes
+endif
+
+NGINX_CONF_TOOL := autoconf
+NGINX_CONF_OPT := \
+	--crossbuild=Linux::$(PTXCONF_ARCH_STRING) \
+	--with-cc=$(CROSS_CC) \
+	--with-cpp=$(CROSS_CC) \
+	--with-cc-opt=-O2 \
+	--prefix=/usr/share/nginx \
+	--conf-path=/etc/nginx/nginx.conf \
+	--sbin-path=/usr/sbin/nginx \
+	--pid-path=/run/nginx.pid \
+	--lock-path=/var/lock/nginx.lock \
+	--user=www \
+	--group=www \
+	--http-log-path=off \
+	--error-log-path=stderr \
+	--http-client-body-temp-path=/var/tmp/nginx/client-body \
+	--http-proxy-temp-path=/var/tmp/nginx/proxy \
+	--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
+	--http-scgi-temp-path=/var/tmp/nginx/scgi \
+	--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
+	--$(call ptx/wwo, PTXCONF_NGINX_PCRE)-pcre \
+	--without-http_browser_module \
+	--without-http_charset_module \
+	--without-http_empty_gif_module \
+	--without-http_geo_module \
+	--without-http_limit_conn_module \
+	--without-http_limit_req_module \
+	--without-http_map_module \
+	--without-http_memcached_module \
+	--without-http_referer_module \
+	--without-http_split_clients_module \
+	--without-http_ssi_module \
+	--without-http_upstream_hash_module \
+	--without-http_upstream_ip_hash_module \
+	--without-http_upstream_keepalive_module \
+	--without-http_upstream_least_conn_module \
+	--without-http_upstream_zone_module \
+	--without-http_userid_module \
+	--without-mail_imap_module \
+	--without-mail_pop3_module \
+	--without-mail_smtp_module \
+	--without-stream_access_module \
+	--without-stream_limit_conn_module \
+	--without-stream_upstream_hash_module \
+	--without-stream_upstream_least_conn_module \
+	--without-stream_upstream_zone_module
+
+# Note: Settings and module options are *not* symmetric.
+#       If a module is on by default, a without option exists.
+#       If it is off by default, a with option exists.
+
+# Opt-in settings
+
+ifdef PTXCONF_GLOBAL_IPV6
+NGINX_CONF_OPT += --with-ipv6
+endif
+
+ifdef PTXCONF_NGINX_PCRE_JIT
+NGINX_CONF_OPT += --with-pcre-jit
+endif
+
+ifdef PTXCONF_NGINX_THREADS
+NGINX_CONF_OPT += --with-threads
+endif
+
+# Opt-in modules
+
+ifdef PTXCONF_NGINX_HTTP_GZIP_STATIC_MODULE
+NGINX_CONF_OPT += --with-http_gzip_static_module
+endif
+
+ifdef PTXCONF_NGINX_HTTP_SSL_MODULE
+NGINX_CONF_OPT += --with-http_ssl_module
+endif
+
+ifdef PTXCONF_NGINX_HTTP_V2_MODULE
+NGINX_CONF_OPT += --with-http_v2_module
+endif
+
+# Opt-out modules
+
+ifndef PTXCONF_NGINX_HTTP_ACCESS_MODULE
+NGINX_CONF_OPT += --without-http_access_module
+endif
+
+ifndef PTXCONF_NGINX_HTTP_AUTH_BASIC_MODULE
+NGINX_CONF_OPT += --without-http_auth_basic_module
+endif
+
+ifndef PTXCONF_NGINX_HTTP_AUTOINDEX_MODULE
+NGINX_CONF_OPT += --without-http_autoindex_module
+endif
+
+ifndef PTXCONF_NGINX_HTTP_FASTCGI_MODULE
+NGINX_CONF_OPT += --without-http_fastcgi_module
+endif
+
+ifndef PTXCONF_NGINX_HTTP_GZIP_MODULE
+NGINX_CONF_OPT += --without-http_gzip_module
+endif
+
+ifndef PTXCONF_NGINX_HTTP_PROXY_MODULE
+NGINX_CONF_OPT += --without-http_proxy_module
+endif
+
+ifndef PTXCONF_NGINX_HTTP_REWRITE_MODULE
+NGINX_CONF_OPT += --without-http_rewrite_module
+endif
+
+ifndef PTXCONF_NGINX_HTTP_SCGI_MODULE
+NGINX_CONF_OPT += --without-http_scgi_module
+endif
+
+ifndef PTXCONF_NGINX_HTTP_UWSGI_MODULE
+NGINX_CONF_OPT += --without-http_uwsgi_module
+endif
+
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/nginx.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, nginx)
+	@$(call install_fixup, nginx,PRIORITY,optional)
+	@$(call install_fixup, nginx,SECTION,base)
+	@$(call install_fixup, nginx,AUTHOR,"Clemens Gruber <clemens.gruber@pqgruber.com>")
+	@$(call install_fixup, nginx,DESCRIPTION,missing)
+
+	@$(call install_copy, nginx, 0, 0, 0755, -, /usr/sbin/nginx)
+
+	@$(call install_alternative, nginx, 0, 0, 0644, /etc/nginx/nginx.conf)
+	@$(call install_alternative, nginx, 0, 0, 0644, /etc/nginx/mime.types)
+
+ifdef PTXCONF_NGINX_POPULATE_TEST_WEBSITE
+	@$(call install_copy, nginx, 12, 102, 0644, \
+		$(PTXDIST_TOPDIR)/projectroot/var/www/httpd.html, \
+		/var/www/index.html)
+endif
+
+ifdef PTXCONF_NGINX_SYSTEMD_UNIT
+	@$(call install_alternative, nginx, 0, 0, 0644, /lib/systemd/system/nginx.service)
+	@$(call install_link, nginx, ../nginx.service, \
+		/lib/systemd/system/multi-user.target.wants/nginx.service)
+endif
+
+ifdef PTXCONF_SYSTEMD
+	@$(call install_alternative, nginx, 0, 0, 0644, /usr/lib/tmpfiles.d/nginx.conf)
+endif
+
+	@$(call install_finish, nginx)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.10.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] nginx: new package
  2016-11-06 19:12 [ptxdist] [PATCH] nginx: new package Clemens Gruber
@ 2016-11-29  7:43 ` Juergen Borleis
  2016-11-29  9:10 ` Michael Olbrich
  1 sibling, 0 replies; 6+ messages in thread
From: Juergen Borleis @ 2016-11-29  7:43 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Hi Clemens,

just one comment for now:

On Sunday 06 November 2016 20:12:18 Clemens Gruber wrote:
> [...]
> +if NGINX
> +
> +menu "Base settings                 "
> +
> +config NGINX_OPENSSL
> +	bool
> +	prompt "OpenSSL support"
> +	help
> +	  Include OpenSSL support, which is required for the
> +	  ngx_http_ssl_module.
> +
> +config NGINX_PCRE
> +	bool
> +	select LIBPCRE

You already select it in the header.

Cheers,
Jürgen

-- 
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] nginx: new package
  2016-11-06 19:12 [ptxdist] [PATCH] nginx: new package Clemens Gruber
  2016-11-29  7:43 ` Juergen Borleis
@ 2016-11-29  9:10 ` Michael Olbrich
  2016-11-29 14:03   ` Clemens Gruber
  2016-11-29 16:24   ` Clemens Gruber
  1 sibling, 2 replies; 6+ messages in thread
From: Michael Olbrich @ 2016-11-29  9:10 UTC (permalink / raw)
  To: ptxdist

On Sun, Nov 06, 2016 at 08:12:18PM +0100, Clemens Gruber wrote:
> Add nginx package. Heavily inspired by Buildroot's nginx.mk, using their
> revised patches for 1.10.x and the endian patch from Marc Kleine-Budde,
> as well as the nginx.make from the patchset Robert sent, as a starting
> point.

Do you know if anyone has tried to upstream the cross-compile patches?

> But instead of building the modules by default, each module is
> selectable in PTXdist, to allow reducing the binary size.
> 
> Most popular modules are supported, systemd unit file and basic
> configuration files are included as well.
> Supports SSL, HTTP/2, HTTP Proxying, GZIP, Auth Basic, Rewrite, FastCGI,
> SCGI, uWSGI, etc.
> 
> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> ---
>  ...izeof-rework-autotest-to-be-cross-compila.patch |  87 +++++++++
>  ...e-add-mechanism-allowing-to-force-feature.patch | 135 +++++++++++++
>  ...x_feature_run_force_result-for-each-featu.patch | 213 +++++++++++++++++++++
>  ...0004-auto-lib-libxslt-conf-use-pkg-config.patch |  31 +++
>  ...nix-make-sys_nerr-guessing-cross-friendly.patch | 138 +++++++++++++
>  ...0006-auto-lib-openssl-conf-use-pkg-config.patch |  31 +++
>  .../0007-auto-lib-libgd-conf-use-pkg-config.patch  |  31 +++
>  ...-ngx_linux_config.h-only-include-dlfcn.h-.patch |  33 ++++
>  ...ness-add-mechanism-allowing-to-force-resu.patch |  26 +++
>  patches/nginx-1.10.2/series                        |  11 ++
>  projectroot/etc/nginx/mime.types                   |  89 +++++++++

Why did you add this file? nginx installs it into pkgdir and
install_alternative will use that as a fallback.

>  projectroot/etc/nginx/nginx.conf                   |  39 ++++
>  projectroot/lib/systemd/system/nginx.service       |  14 ++
>  projectroot/usr/lib/tmpfiles.d/nginx.conf          |  10 +
>  rules/nginx.in                                     | 170 ++++++++++++++++
>  rules/nginx.make                                   | 209 ++++++++++++++++++++
>  16 files changed, 1267 insertions(+)
>  create mode 100644 patches/nginx-1.10.2/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch
>  create mode 100644 patches/nginx-1.10.2/0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
>  create mode 100644 patches/nginx-1.10.2/0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch
>  create mode 100644 patches/nginx-1.10.2/0004-auto-lib-libxslt-conf-use-pkg-config.patch
>  create mode 100644 patches/nginx-1.10.2/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
>  create mode 100644 patches/nginx-1.10.2/0006-auto-lib-openssl-conf-use-pkg-config.patch
>  create mode 100644 patches/nginx-1.10.2/0007-auto-lib-libgd-conf-use-pkg-config.patch
>  create mode 100644 patches/nginx-1.10.2/0008-src-os-unix-ngx_linux_config.h-only-include-dlfcn.h-.patch
>  create mode 100644 patches/nginx-1.10.2/0100-auto-endianness-add-mechanism-allowing-to-force-resu.patch
>  create mode 100644 patches/nginx-1.10.2/series
>  create mode 100644 projectroot/etc/nginx/mime.types
>  create mode 100644 projectroot/etc/nginx/nginx.conf
>  create mode 100644 projectroot/lib/systemd/system/nginx.service
>  create mode 100644 projectroot/usr/lib/tmpfiles.d/nginx.conf
>  create mode 100644 rules/nginx.in
>  create mode 100644 rules/nginx.make
> 
[...]
> diff --git a/projectroot/etc/nginx/nginx.conf b/projectroot/etc/nginx/nginx.conf
> new file mode 100644
> index 0000000..5801e12
> --- /dev/null
> +++ b/projectroot/etc/nginx/nginx.conf
> @@ -0,0 +1,39 @@
> +worker_processes 1;	# Enough for most webservers and incurs less latency
> +#worker_processes auto;	# Auto-detect based on CPU count
> +
> +events {
> +	use epoll;
> +	worker_connections 1024;
> +	#multi_accept on;	# Should be enabled if worker_processes > 1
> +}
> +
> +http {
> +	server_tokens off;
> +
> +	sendfile on;
> +
> +	include /etc/nginx/mime.types;
> +	default_type application/octet-stream;
> +
> +	access_log off;
> +	error_log stderr;
> +
> +	gzip on;
> +	gzip_disable "msie6";
> +
> +	server {
> +		listen 80;
> +		listen [::]:80;
> +		server_name _;
> +
> +		index index.html;
> +		root /var/www;
> +
> +		location / {
> +			# First attempt to serve request as file, then
> +			# as directory, then fall back to displaying a 404.
> +			try_files $uri $uri/ =404;
> +		}
> +	}
> +}
> +
> diff --git a/projectroot/lib/systemd/system/nginx.service b/projectroot/lib/systemd/system/nginx.service
> new file mode 100644
> index 0000000..a6a1a4d
> --- /dev/null
> +++ b/projectroot/lib/systemd/system/nginx.service
> @@ -0,0 +1,14 @@
> +[Unit]
> +Description=NGINX HTTP and reverse proxy server
> +After=syslog.target network.target nss-lookup.target
> +
> +[Service]
> +Type=forking
> +PIDFile=/run/nginx.pid
> +ExecStartPre=/usr/sbin/nginx -t
> +ExecStart=/usr/sbin/nginx
> +ExecReload=/bin/kill -s HUP $MAINPID
> +ExecStop=/bin/kill -s QUIT $MAINPID
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/projectroot/usr/lib/tmpfiles.d/nginx.conf b/projectroot/usr/lib/tmpfiles.d/nginx.conf
> new file mode 100644
> index 0000000..138b675
> --- /dev/null
> +++ b/projectroot/usr/lib/tmpfiles.d/nginx.conf
> @@ -0,0 +1,10 @@
> +# systemd tmpfile settings for nginx
> +# See tmpfiles.d(5) for details
> +
> +d /var/log/nginx 0755 root root -
> +d /var/tmp/nginx 0755 www www
> +d /var/tmp/nginx/client 0755 www www
> +d /var/tmp/nginx/proxy 0755 www www
> +d /var/tmp/nginx/fastcgi 0755 www www
> +d /var/tmp/nginx/scgi 0755 www www
> +d /var/tmp/nginx/uwsgi 0755 www www
> diff --git a/rules/nginx.in b/rules/nginx.in
> new file mode 100644
> index 0000000..00aa202
> --- /dev/null
> +++ b/rules/nginx.in
> @@ -0,0 +1,170 @@
> +## SECTION=networking
> +menuconfig NGINX
> +	tristate
> +	prompt "nginx                         "
> +	select GCCLIBS_GCC_S
> +	select LIBC_DL
> +	select LIBC_PTHREAD
> +	select LIBC_CRYPT
> +	select LIBPCRE			if NGINX_PCRE
> +	select OPENSSL			if NGINX_OPENSSL
> +	select ZLIB			if NGINX_HTTP_GZIP_MODULE || NGINX_HTTP_GZIP_STATIC_MODULE
> +	help
> +	  nginx ("engine X") is a high-performance web and reverse
> +	  proxy server created by Igor Sysoev. It can be used both as
> +	  a standalone web server and as a proxy to reduce the load on
> +	  backend servers.
> +
> +if NGINX
> +
> +menu "Base settings                 "
> +
> +config NGINX_OPENSSL
> +	bool
> +	prompt "OpenSSL support"
> +	help
> +	  Include OpenSSL support, which is required for the
> +	  ngx_http_ssl_module.
> +
> +config NGINX_PCRE
> +	bool
> +	select LIBPCRE

remove.

> +	prompt "PCRE support"
> +	help
> +	  Include pcre support, which is required for regular
> +	  expressions support in the location directive and for the
> +	  ngx_http_rewrite_module module.
> +
> +if NGINX_PCRE
> +
> +config NGINX_PCRE_JIT
> +	bool
> +	prompt "Enable PCRE JIT"
> +	help
> +	  Enables the use of just-in-time compilation for regular
> +	  expressions known by the time of configuration parsing.
> +	  PCRE JIT can significantly speed up processing of regular
> +	  expressions.
> +
> +endif
> +
> +config NGINX_THREADS
> +	bool
> +	prompt "Threads support"
> +	help
> +	  Enable multi-threading. Files can be read and sent without
> +	  blocking a worker process. Requires epoll as connection
> +	  processing method.
> +
> +endmenu
> +
> +menu "Modules                       "
> +
> +config NGINX_HTTP_ACCESS_MODULE
> +	bool
> +	prompt "ngx_http_access_module"
> +	help
> +	  ngx_http_access_module allows limiting access to certain
> +	  client addresses.
> +
> +config NGINX_HTTP_AUTH_BASIC_MODULE
> +	bool
> +	prompt "ngx_http_auth_basic_module"
> +	help
> +	  ngx_http_auth_basic_module allows limiting access to
> +	  resources by validating the user name and password using the
> +	  HTTP Basic Authentication protocol.
> +
> +config NGINX_HTTP_AUTOINDEX_MODULE
> +	bool
> +	prompt "ngx_http_autoindex_module"
> +	help
> +	  ngx_http_autoindex_module processes requests ending with the
> +	  slash character and produces a directory listing.
> +
> +config NGINX_HTTP_FASTCGI_MODULE
> +	bool
> +	prompt "ngx_http_fastcgi_module"
> +	help
> +	  ngx_http_fastcgi_module allows passing requests to a FastCGI
> +	  server.
> +
> +config NGINX_HTTP_GZIP_MODULE
> +	bool
> +	prompt "ngx_http_gzip_module"
> +	help
> +	  ngx_http_gzip_module is a filter that compresses responses
> +	  using gzip.
> +
> +config NGINX_HTTP_GZIP_STATIC_MODULE
> +	bool
> +	prompt "ngx_http_gzip_static_module"
> +	help
> +	  ngx_http_gzip_static_module allows sending precompressed files
> +	  with the .gz filename extension instead of regular files.
> +
> +config NGINX_HTTP_PROXY_MODULE
> +	bool
> +	prompt "ngx_http_proxy_module"
> +	help
> +	  ngx_http_proxy_module allows passing requests to another
> +	  server.
> +
> +config NGINX_HTTP_REWRITE_MODULE
> +	bool
> +	select NGINX_PCRE
> +	prompt "ngx_http_rewrite_module"
> +	help
> +	  ngx_http_rewrite_module module is used to change request URI
> +	  using PCRE regular expressions, return redirects, and
> +	  conditionally select configurations.
> +
> +config NGINX_HTTP_SCGI_MODULE
> +	bool
> +	prompt "ngx_http_scgi_module"
> +	help
> +	  ngx_http_scgi_module allows passing requests to a SCGI
> +	  server.
> +
> +config NGINX_HTTP_SSL_MODULE
> +	bool
> +	select NGINX_OPENSSL
> +	prompt "ngx_http_ssl_module"
> +	help
> +	  ngx_http_ssl_module provides the necessary support for HTTPS.
> +
> +config NGINX_HTTP_UWSGI_MODULE
> +	bool
> +	prompt "ngx_http_uwsgi_module"
> +	help
> +	  ngx_http_uwsgi_module allows passing requests to a uWSGI
> +	  server.
> +
> +config NGINX_HTTP_V2_MODULE
> +	bool
> +	select NGINX_OPENSSL
> +	prompt "ngx_http_v2_module"
> +	help
> +	  ngx_http_v2_module provides support for HTTP/2.
> +
> +endmenu
> +
> +menu "Startup                       "
> +
> +config NGINX_SYSTEMD_UNIT
> +	bool
> +	default y
> +	depends on SYSTEMD
> +	prompt "Install systemd unit files for nginx"
> +
> +endmenu
> +
> +config NGINX_POPULATE_TEST_WEBSITE
> +	bool
> +	default y
> +	prompt "Populate a generic test website"
> +	help
> +	  This install a generic website into /var/www/index.html
> +	  from <ptxdist-install>/projectroot/var/www/httpd.html.
> +
> +endif
> diff --git a/rules/nginx.make b/rules/nginx.make
> new file mode 100644
> index 0000000..4cc0dd2
> --- /dev/null
> +++ b/rules/nginx.make
> @@ -0,0 +1,209 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2015 by Marc Kleine-Budde <mkl@pengutronix.de>
> +# Copyright (C) 2016 by Clemens Gruber <clemens.gruber@pqgruber.com>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_NGINX) += nginx
> +
> +#
> +# Paths and names
> +#
> +NGINX_VERSION	:= 1.10.2
> +NGINX_MD5	:= e8f5f4beed041e63eb97f9f4f55f3085
> +NGINX		:= nginx-$(NGINX_VERSION)
> +NGINX_SUFFIX	:= tar.gz
> +NGINX_URL	:= https://nginx.org/download/$(NGINX).$(NGINX_SUFFIX)
> +NGINX_SOURCE	:= $(SRCDIR)/$(NGINX).$(NGINX_SUFFIX)
> +NGINX_DIR	:= $(BUILDDIR)/$(NGINX)
> +NGINX_LICENSE	:= BSD-2-Clause
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +NGINX_CONF_ENV := \
> +	ngx_force_c_compiler=yes \
> +	ngx_force_c99_have_variadic_macros=yes \
> +	ngx_force_gcc_have_variadic_macros=yes \
> +	ngx_force_gcc_have_atomic=yes \
> +	ngx_force_have_libatomic=no \
> +	ngx_force_have_epoll=yes \
> +	ngx_force_have_sendfile=yes \
> +	ngx_force_have_sendfile64=yes \
> +	ngx_force_have_pr_set_dumpable=yes \
> +	ngx_force_have_timer_event=yes \
> +	ngx_force_have_map_anon=yes \
> +	ngx_force_have_map_devzero=yes \
> +	ngx_force_have_sysvshm=yes \
> +	ngx_force_have_posix_sem=yes
> +
> +ifdef PTXCONF_ENDIAN_LITTLE
> +NGINX_CONF_ENV += ngx_force_have_little_endian=yes
> +endif
> +
> +NGINX_CONF_TOOL := autoconf
> +NGINX_CONF_OPT := \
> +	--crossbuild=Linux::$(PTXCONF_ARCH_STRING) \
> +	--with-cc=$(CROSS_CC) \
> +	--with-cpp=$(CROSS_CC) \
> +	--with-cc-opt=-O2 \
> +	--prefix=/usr/share/nginx \
> +	--conf-path=/etc/nginx/nginx.conf \
> +	--sbin-path=/usr/sbin/nginx \
> +	--pid-path=/run/nginx.pid \
> +	--lock-path=/var/lock/nginx.lock \
> +	--user=www \
> +	--group=www \
> +	--http-log-path=off \
> +	--error-log-path=stderr \
> +	--http-client-body-temp-path=/var/tmp/nginx/client-body \
> +	--http-proxy-temp-path=/var/tmp/nginx/proxy \
> +	--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
> +	--http-scgi-temp-path=/var/tmp/nginx/scgi \
> +	--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
> +	--$(call ptx/wwo, PTXCONF_NGINX_PCRE)-pcre \
> +	--without-http_browser_module \
> +	--without-http_charset_module \
> +	--without-http_empty_gif_module \
> +	--without-http_geo_module \
> +	--without-http_limit_conn_module \
> +	--without-http_limit_req_module \
> +	--without-http_map_module \
> +	--without-http_memcached_module \
> +	--without-http_referer_module \
> +	--without-http_split_clients_module \
> +	--without-http_ssi_module \
> +	--without-http_upstream_hash_module \
> +	--without-http_upstream_ip_hash_module \
> +	--without-http_upstream_keepalive_module \
> +	--without-http_upstream_least_conn_module \
> +	--without-http_upstream_zone_module \
> +	--without-http_userid_module \
> +	--without-mail_imap_module \
> +	--without-mail_pop3_module \
> +	--without-mail_smtp_module \
> +	--without-stream_access_module \
> +	--without-stream_limit_conn_module \
> +	--without-stream_upstream_hash_module \
> +	--without-stream_upstream_least_conn_module \
> +	--without-stream_upstream_zone_module
> +
> +# Note: Settings and module options are *not* symmetric.
> +#       If a module is on by default, a without option exists.
> +#       If it is off by default, a with option exists.
> +
> +# Opt-in settings
> +

NGINX_CONF_OPT += \
	$(call ptx/ifdef, PTXCONF_*,--with-*) \
	[...]

For each Opt-in/Opt-out etc. group. Or just one block with all modules. Or
make list + foreach magic like I handled the gstreamer plugins. Either way
is fine, I just want this to be more compact.

> +ifdef PTXCONF_GLOBAL_IPV6
> +NGINX_CONF_OPT += --with-ipv6
> +endif
> +
> +ifdef PTXCONF_NGINX_PCRE_JIT
> +NGINX_CONF_OPT += --with-pcre-jit
> +endif
> +
> +ifdef PTXCONF_NGINX_THREADS
> +NGINX_CONF_OPT += --with-threads
> +endif
> +
> +# Opt-in modules
> +
> +ifdef PTXCONF_NGINX_HTTP_GZIP_STATIC_MODULE
> +NGINX_CONF_OPT += --with-http_gzip_static_module
> +endif
> +
> +ifdef PTXCONF_NGINX_HTTP_SSL_MODULE
> +NGINX_CONF_OPT += --with-http_ssl_module
> +endif
> +
> +ifdef PTXCONF_NGINX_HTTP_V2_MODULE
> +NGINX_CONF_OPT += --with-http_v2_module
> +endif
> +
> +# Opt-out modules
> +
> +ifndef PTXCONF_NGINX_HTTP_ACCESS_MODULE
> +NGINX_CONF_OPT += --without-http_access_module
> +endif
> +
> +ifndef PTXCONF_NGINX_HTTP_AUTH_BASIC_MODULE
> +NGINX_CONF_OPT += --without-http_auth_basic_module
> +endif
> +
> +ifndef PTXCONF_NGINX_HTTP_AUTOINDEX_MODULE
> +NGINX_CONF_OPT += --without-http_autoindex_module
> +endif
> +
> +ifndef PTXCONF_NGINX_HTTP_FASTCGI_MODULE
> +NGINX_CONF_OPT += --without-http_fastcgi_module
> +endif
> +
> +ifndef PTXCONF_NGINX_HTTP_GZIP_MODULE
> +NGINX_CONF_OPT += --without-http_gzip_module
> +endif
> +
> +ifndef PTXCONF_NGINX_HTTP_PROXY_MODULE
> +NGINX_CONF_OPT += --without-http_proxy_module
> +endif
> +
> +ifndef PTXCONF_NGINX_HTTP_REWRITE_MODULE
> +NGINX_CONF_OPT += --without-http_rewrite_module
> +endif
> +
> +ifndef PTXCONF_NGINX_HTTP_SCGI_MODULE
> +NGINX_CONF_OPT += --without-http_scgi_module
> +endif
> +
> +ifndef PTXCONF_NGINX_HTTP_UWSGI_MODULE
> +NGINX_CONF_OPT += --without-http_uwsgi_module
> +endif
> +
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/nginx.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, nginx)
> +	@$(call install_fixup, nginx,PRIORITY,optional)
> +	@$(call install_fixup, nginx,SECTION,base)
> +	@$(call install_fixup, nginx,AUTHOR,"Clemens Gruber <clemens.gruber@pqgruber.com>")
> +	@$(call install_fixup, nginx,DESCRIPTION,missing)
> +
> +	@$(call install_copy, nginx, 0, 0, 0755, -, /usr/sbin/nginx)
> +
> +	@$(call install_alternative, nginx, 0, 0, 0644, /etc/nginx/nginx.conf)
> +	@$(call install_alternative, nginx, 0, 0, 0644, /etc/nginx/mime.types)
> +
> +ifdef PTXCONF_NGINX_POPULATE_TEST_WEBSITE
> +	@$(call install_copy, nginx, 12, 102, 0644, \

use user/group names, not numbers.

> +		$(PTXDIST_TOPDIR)/projectroot/var/www/httpd.html, \
> +		/var/www/index.html)

Use install_alternative here (untested):

	@$(call install_alternatice, nginx, www, www, 0644, \
		/projectroot/var/www/httpd.html, n, \
		/var/www/index.html)

> +endif
> +
> +ifdef PTXCONF_NGINX_SYSTEMD_UNIT
> +	@$(call install_alternative, nginx, 0, 0, 0644, /lib/systemd/system/nginx.service)
> +	@$(call install_link, nginx, ../nginx.service, \
> +		/lib/systemd/system/multi-user.target.wants/nginx.service)
> +endif
> +
> +ifdef PTXCONF_SYSTEMD

No, never use an option from a different package directly. Either install
this unconditionally (I'd prefer that) or add an options without prompt
that defaults to SYSTEMD.

Michael

> +	@$(call install_alternative, nginx, 0, 0, 0644, /usr/lib/tmpfiles.d/nginx.conf)
> +endif
> +
> +	@$(call install_finish, nginx)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.10.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] nginx: new package
  2016-11-29  9:10 ` Michael Olbrich
@ 2016-11-29 14:03   ` Clemens Gruber
  2016-11-29 16:24   ` Clemens Gruber
  1 sibling, 0 replies; 6+ messages in thread
From: Clemens Gruber @ 2016-11-29 14:03 UTC (permalink / raw)
  To: ptxdist

Hi Michael, Hi Jürgen,

thanks for the comments!

On Tue, Nov 29, 2016 at 10:10:01AM +0100, Michael Olbrich wrote:
> On Sun, Nov 06, 2016 at 08:12:18PM +0100, Clemens Gruber wrote:
> > Add nginx package. Heavily inspired by Buildroot's nginx.mk, using their
> > revised patches for 1.10.x and the endian patch from Marc Kleine-Budde,
> > as well as the nginx.make from the patchset Robert sent, as a starting
> > point.
> 
> Do you know if anyone has tried to upstream the cross-compile patches?

Yes, but they were not accepted:
http://mailman.nginx.org/pipermail/nginx-devel/2014-May/005318.html
http://mailman.nginx.org/pipermail/nginx-devel/2014-September/006013.html
They want them to be less intrusive, more portable (+MSVC), without
deactivating all tests. They seem to be pretty strict in what they
accept. Looks like the author of the patch series gave up and is afaik
now maintaining them out of tree in the Buildroot repo.

> 
> > But instead of building the modules by default, each module is
> > selectable in PTXdist, to allow reducing the binary size.
> > 
> > Most popular modules are supported, systemd unit file and basic
> > configuration files are included as well.
> > Supports SSL, HTTP/2, HTTP Proxying, GZIP, Auth Basic, Rewrite, FastCGI,
> > SCGI, uWSGI, etc.
> > 
> > Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> > ---
> >  ...izeof-rework-autotest-to-be-cross-compila.patch |  87 +++++++++
> >  ...e-add-mechanism-allowing-to-force-feature.patch | 135 +++++++++++++
> >  ...x_feature_run_force_result-for-each-featu.patch | 213 +++++++++++++++++++++
> >  ...0004-auto-lib-libxslt-conf-use-pkg-config.patch |  31 +++
> >  ...nix-make-sys_nerr-guessing-cross-friendly.patch | 138 +++++++++++++
> >  ...0006-auto-lib-openssl-conf-use-pkg-config.patch |  31 +++
> >  .../0007-auto-lib-libgd-conf-use-pkg-config.patch  |  31 +++
> >  ...-ngx_linux_config.h-only-include-dlfcn.h-.patch |  33 ++++
> >  ...ness-add-mechanism-allowing-to-force-resu.patch |  26 +++
> >  patches/nginx-1.10.2/series                        |  11 ++
> >  projectroot/etc/nginx/mime.types                   |  89 +++++++++
> 
> Why did you add this file? nginx installs it into pkgdir and
> install_alternative will use that as a fallback.

Right, I'll remove it.

(snip)

> > +# Note: Settings and module options are *not* symmetric.
> > +#       If a module is on by default, a without option exists.
> > +#       If it is off by default, a with option exists.
> > +
> > +# Opt-in settings
> > +
> 
> NGINX_CONF_OPT += \
> 	$(call ptx/ifdef, PTXCONF_*,--with-*) \
> 	[...]
> 
> For each Opt-in/Opt-out etc. group. Or just one block with all modules. Or
> make list + foreach magic like I handled the gstreamer plugins. Either way
> is fine, I just want this to be more compact.

Will do.

(snip)

> > +
> > +ifdef PTXCONF_SYSTEMD
> 
> No, never use an option from a different package directly. Either install
> this unconditionally (I'd prefer that) or add an options without prompt
> that defaults to SYSTEMD.

OK.

I'd also remove the NGINX_OPENSSL setting from the "Base settings"
menu, because the http_ssl and http_v2 modules select it anyway and we
could select OPENSSL at the top if those modules are enabled.
Or would you prefer that I keep NGINX_OPENSSL but remove its prompt?

Thanks,
Clemens

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] nginx: new package
  2016-11-29  9:10 ` Michael Olbrich
  2016-11-29 14:03   ` Clemens Gruber
@ 2016-11-29 16:24   ` Clemens Gruber
  2016-11-30 13:15     ` Michael Olbrich
  1 sibling, 1 reply; 6+ messages in thread
From: Clemens Gruber @ 2016-11-29 16:24 UTC (permalink / raw)
  To: ptxdist

On Tue, Nov 29, 2016 at 10:10:01AM +0100, Michael Olbrich wrote:
> Use install_alternative here (untested):
> 
> 	@$(call install_alternatice, nginx, www, www, 0644, \
> 		/projectroot/var/www/httpd.html, n, \
> 		/var/www/index.html)

This did not work. It searched for an index.html in "../httpd.html/"
folders.
In the v2 of the patch I am sending, I use install_copy for populating
this httpd.html file to index.html. (same as in lighttpd.make)
Would this be OK?

Thanks,
Clemens

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] nginx: new package
  2016-11-29 16:24   ` Clemens Gruber
@ 2016-11-30 13:15     ` Michael Olbrich
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2016-11-30 13:15 UTC (permalink / raw)
  To: ptxdist

Hi,

On Tue, Nov 29, 2016 at 05:24:42PM +0100, Clemens Gruber wrote:
> On Tue, Nov 29, 2016 at 10:10:01AM +0100, Michael Olbrich wrote:
> > Use install_alternative here (untested):
> > 
> > 	@$(call install_alternatice, nginx, www, www, 0644, \
> > 		/projectroot/var/www/httpd.html, n, \
> > 		/var/www/index.html)
> 
> This did not work. It searched for an index.html in "../httpd.html/"
> folders.
> In the v2 of the patch I am sending, I use install_copy for populating
> this httpd.html file to index.html. (same as in lighttpd.make)
> Would this be OK?

It works if done correctly (the stuff above is bogus). I've fixed this
while appying the patch.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-30 13:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-06 19:12 [ptxdist] [PATCH] nginx: new package Clemens Gruber
2016-11-29  7:43 ` Juergen Borleis
2016-11-29  9:10 ` Michael Olbrich
2016-11-29 14:03   ` Clemens Gruber
2016-11-29 16:24   ` Clemens Gruber
2016-11-30 13:15     ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox