mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] nginx
@ 2016-10-31 15:32 Clemens Gruber
  2016-10-31 21:23 ` Robert Schwebel
  0 siblings, 1 reply; 4+ messages in thread
From: Clemens Gruber @ 2016-10-31 15:32 UTC (permalink / raw)
  To: ptxdist

Hi,

did anyone ever look at cross compiling nginx?
Sadly no autotools... :/

But Buildroot has a nginx package and the necessary patches:
https://git.busybox.net/buildroot/tree/package/nginx?h=master

Can I take them and port them to PTXdist?

Buildroot is also GPLv2 and nginx has a 2-clause BSD license.

So should be OK, right?

Regards,
Clemens

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] nginx
  2016-10-31 15:32 [ptxdist] nginx Clemens Gruber
@ 2016-10-31 21:23 ` Robert Schwebel
  2016-10-31 21:27   ` [ptxdist] [PATCH] WIP: nginix Robert Schwebel
  2016-11-01 14:47   ` [ptxdist] nginx Clemens Gruber
  0 siblings, 2 replies; 4+ messages in thread
From: Robert Schwebel @ 2016-10-31 21:23 UTC (permalink / raw)
  To: ptxdist

On Mon, Oct 31, 2016 at 04:32:04PM +0100, Clemens Gruber wrote:
> did anyone ever look at cross compiling nginx?

I think we have patches around, but they probably need more work.
If you like, you can use them as a starting point for further actions.

rsc
-- 
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] 4+ messages in thread

* [ptxdist] [PATCH] WIP: nginix
  2016-10-31 21:23 ` Robert Schwebel
@ 2016-10-31 21:27   ` Robert Schwebel
  2016-11-01 14:47   ` [ptxdist] nginx Clemens Gruber
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Schwebel @ 2016-10-31 21:27 UTC (permalink / raw)
  To: ptxdist; +Cc: Robert Schwebel

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
---
 ...izeof-rework-autotest-to-be-cross-compila.patch |  85 ++++++++
 ...e-add-mechanism-allowing-to-force-feature.patch | 141 ++++++++++++++
 ...x_feature_run_force_result-for-each-featu.patch | 213 +++++++++++++++++++++
 ...bxslt-conf-allow-to-override-ngx_feature_.patch |  42 ++++
 ...nix-make-sys_nerr-guessing-cross-friendly.patch | 138 +++++++++++++
 ...ness-add-mechanism-allowing-to-force-resu.patch |  26 +++
 patches/nginx-1.9.14/series                        |   9 +
 rules/nginx.in                                     |  47 +++++
 rules/nginx.make                                   | 127 ++++++++++++
 9 files changed, 828 insertions(+)
 create mode 100644 patches/nginx-1.9.14/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch
 create mode 100644 patches/nginx-1.9.14/0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
 create mode 100644 patches/nginx-1.9.14/0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch
 create mode 100644 patches/nginx-1.9.14/0004-auto-lib-libxslt-conf-allow-to-override-ngx_feature_.patch
 create mode 100644 patches/nginx-1.9.14/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
 create mode 100644 patches/nginx-1.9.14/0006-auto-endianness-add-mechanism-allowing-to-force-resu.patch
 create mode 100644 patches/nginx-1.9.14/series
 create mode 100644 rules/nginx.in
 create mode 100644 rules/nginx.make

diff --git a/patches/nginx-1.9.14/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch b/patches/nginx-1.9.14/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch
new file mode 100644
index 0000000..9fc91b9
--- /dev/null
+++ b/patches/nginx-1.9.14/0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch
@@ -0,0 +1,85 @@
+From c11572973f5e6e3c38ea5207d1a6b3d196b4cd68 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 1/6] 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>
+---
+ auto/types/sizeof | 38 ++++++++++++++++++++++++++++----------
+ 1 file changed, 28 insertions(+), 10 deletions(-)
+
+diff --git a/auto/types/sizeof b/auto/types/sizeof
+index b5b71bb..8528490 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_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`
+ 
+-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+-
+-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
+ 
+-- 
+2.7.0
+
diff --git a/patches/nginx-1.9.14/0002-auto-feature-add-mechanism-allowing-to-force-feature.patch b/patches/nginx-1.9.14/0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
new file mode 100644
index 0000000..c1d4f8e
--- /dev/null
+++ b/patches/nginx-1.9.14/0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
@@ -0,0 +1,141 @@
+From 8be36eacdc7603273e5c759d1a95f6976ff530e9 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 2/6] 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 | 86 +++++++++++++++++++++++++++++++++++++++++++++---------------
+ 1 file changed, 65 insertions(+), 21 deletions(-)
+
+diff --git a/auto/feature b/auto/feature
+index 1145f28..21cade3 100644
+--- a/auto/feature
++++ b/auto/feature
+@@ -52,50 +52,94 @@ 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"
+-                ngx_found=yes
++            if test -n "$ngx_feature_run_force_result" ; then
++                if test "$ngx_feature_run_force_result" = "yes" ; then
++                    echo " found (cached)"
++                    ngx_found=yes
++                    if test -n "$ngx_feature_name" ; then
++                        have=$ngx_have_feature . auto/have
++                    fi
++                else
++                    echo " found but is not working (cached)"
++                fi
++            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 " found (cached)"
+                 ngx_found=yes
+ 
+                 cat << END >> $NGX_AUTO_CONFIG_H
+ 
+ #ifndef $ngx_feature_name
+-#define $ngx_feature_name  `$NGX_AUTOTEST`
++#define $ngx_feature_name  $ngx_feature_run_force_result
+ #endif
+ 
+ END
+             else
+-                echo " found but is not working"
++
++                # /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"
++                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"
+-
++            if test -n "$ngx_feature_run_force_result" ; then
++                if test "$ngx_feature_run_force_result" = "yes" ; then
++                    echo " found (cached)"
++                    ngx_found=yes
++                    if test -n "$ngx_feature_name"; then
++                        have=$ngx_have_feature . auto/have
++                    fi
++                else
++
++                    echo " not found (cached)"
++                fi
+             else
+-                echo " found"
+-                ngx_found=yes
+ 
+-                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
+         ;;
+ 
+-- 
+2.7.0
+
diff --git a/patches/nginx-1.9.14/0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch b/patches/nginx-1.9.14/0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch
new file mode 100644
index 0000000..1e67050
--- /dev/null
+++ b/patches/nginx-1.9.14/0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch
@@ -0,0 +1,213 @@
+From 09eaa1951381e9a3fe5a8e92da449f0d4c2a7980 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 3/6] 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 f2c25ed..9836776 100644
+--- a/auto/cc/conf
++++ b/auto/cc/conf
+@@ -181,6 +181,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=
+@@ -201,6 +202,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=
+@@ -215,6 +217,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 35d319e..87c6248 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 9b31b1f..575c669 100644
+--- a/auto/os/darwin
++++ b/auto/os/darwin
+@@ -30,6 +30,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=
+@@ -60,6 +61,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=
+@@ -90,6 +92,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 c932267..9ec8ed9 100644
+--- a/auto/os/linux
++++ b/auto/os/linux
+@@ -37,6 +37,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=
+@@ -94,6 +95,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=
+@@ -115,6 +117,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=
+@@ -133,6 +136,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 8c0e813..3b16db3 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=
+@@ -649,6 +650,7 @@ ngx_feature_test="char buf[1]; struct iovec vec[1]; ssize_t n;
+ 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=
+@@ -663,6 +665,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=
+@@ -678,6 +681,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>'
+@@ -736,6 +740,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=
+@@ -749,6 +754,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>"
+@@ -764,6 +770,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=
+@@ -778,6 +785,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=
+-- 
+2.7.0
+
diff --git a/patches/nginx-1.9.14/0004-auto-lib-libxslt-conf-allow-to-override-ngx_feature_.patch b/patches/nginx-1.9.14/0004-auto-lib-libxslt-conf-allow-to-override-ngx_feature_.patch
new file mode 100644
index 0000000..ba78451
--- /dev/null
+++ b/patches/nginx-1.9.14/0004-auto-lib-libxslt-conf-allow-to-override-ngx_feature_.patch
@@ -0,0 +1,42 @@
+From 7656e477ec8564bb6337b369e5f9ca0d6dcba3b8 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 4/6] auto/lib/libxslt/conf: allow to override ngx_feature_path
+ and ngx_feature_libs
+
+Because libxml2 headers are not in /usr/include by default, hardcoding the
+include directory to /usr/include/libxml2 does not play well when
+cross-compiling, or if libxml2 has been installed somewhere else.
+
+This patch allows to define/override the libxslt include directory, and
+the libxslt libs flags.
+
+Being able to override the include location is especially useful when
+cross-compiling to prevent gcc from complaining about unsafe include
+location for cross-compilation (-Wpoision-system-directories).
+
+So far, this warning is only triggered by libxslt.
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.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..d2784e6 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="${ngx_feature_path_libxslt:=/usr/include/libxml2}"
++    ngx_feature_libs="${ngx_feature_libs_libxslt:=-lxml2 -lxslt}"
+     ngx_feature_test="xmlParserCtxtPtr    ctxt = NULL;
+                       xsltStylesheetPtr   sheet = NULL;
+                       xmlDocPtr           doc;
+-- 
+2.7.0
+
diff --git a/patches/nginx-1.9.14/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch b/patches/nginx-1.9.14/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
new file mode 100644
index 0000000..0b1bfc4
--- /dev/null
+++ b/patches/nginx-1.9.14/0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
@@ -0,0 +1,138 @@
+From 1090157d615eacbf03f5f3e77827f00dd373bd36 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 5/6] 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 3b16db3..2595959 100755
+--- a/auto/unix
++++ b/auto/unix
+@@ -655,6 +655,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
+ 
+@@ -703,6 +707,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"
+-- 
+2.7.0
+
diff --git a/patches/nginx-1.9.14/0006-auto-endianness-add-mechanism-allowing-to-force-resu.patch b/patches/nginx-1.9.14/0006-auto-endianness-add-mechanism-allowing-to-force-resu.patch
new file mode 100644
index 0000000..4837f7e
--- /dev/null
+++ b/patches/nginx-1.9.14/0006-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 6/6] 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.9.14/series b/patches/nginx-1.9.14/series
new file mode 100644
index 0000000..546b4b9
--- /dev/null
+++ b/patches/nginx-1.9.14/series
@@ -0,0 +1,9 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+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-allow-to-override-ngx_feature_.patch
+0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
+0006-auto-endianness-add-mechanism-allowing-to-force-resu.patch
+# 62266cd237f73aed4a69a9cf5587a1f2  - git-ptx-patches magic
diff --git a/rules/nginx.in b/rules/nginx.in
new file mode 100644
index 0000000..af32610
--- /dev/null
+++ b/rules/nginx.in
@@ -0,0 +1,47 @@
+## SECTION=networking
+
+menuconfig NGINX
+	tristate
+	prompt "nginx                         "
+	select LIBPCRE
+	select OPENSSL
+	select ZLIB
+	select LIBXSLT
+	select LIBXSLT_LIBEXSLT
+	select LIBGD
+	select LIBC_DL
+	select LIBC_PTHREAD
+	select LIBC_CRYPT
+	select LIBXML2
+	select GCCLIBS_GCC_S
+	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
+	  back-end HTTP or mail servers.
+
+	  STANDARD HTTP MODULES: Core, Access, Auth Basic, Auto Index,
+	  Browser, Empty GIF, FastCGI, Geo, Limit Connections, Limit
+	  Requests, Map, Memcached, Proxy, Referer, Rewrite, SCGI,
+	  Split Clients, UWSGI.
+
+	  OPTIONAL HTTP MODULES: Addition, Auth Request, Charset,
+	  WebDAV, FLV, GeoIP, Gunzip, Gzip, Gzip Precompression,
+	  Headers, Image Filter, Index, Log, MP4, Embedded Perl,
+	  Random Index, Real IP, Secure Link, Spdy, SSI, SSL, Stream,
+	  Stub Status, Substitution, Thread Pool, Upstream, User ID,
+	  XSLT.
+
+	  MAIL MODULES: Mail Core, Auth HTTP, Proxy, SSL, IMAP, POP3,
+	  SMTP.
+
+if NGINX
+	config NGINX_DEBUG_VARIANT
+		bool
+		depends on GLOBAL_DEBUG_ON
+		prompt "install the development config"
+		help
+		  Installs a variant of the nginx's config file which is intended
+		  for development only.
+
+endif
diff --git a/rules/nginx.make b/rules/nginx.make
new file mode 100644
index 0000000..15b40d1
--- /dev/null
+++ b/rules/nginx.make
@@ -0,0 +1,127 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2015 by Marc Kleine-Budde <mkl@pengutronix.de>
+#
+# 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.9.14
+NGINX_MD5	:= a25818039f34b5d54b017d44c76321c4
+NGINX		:= nginx-$(NGINX_VERSION)
+NGINX_SUFFIX	:= tar.gz
+NGINX_URL	:= http://nginx.org/download/$(NGINX).$(NGINX_SUFFIX)
+NGINX_SOURCE	:= $(SRCDIR)/$(NGINX).$(NGINX_SUFFIX)
+NGINX_DIR	:= $(BUILDDIR)/$(NGINX)
+NGINX_LICENSE	:= BSD-2c
+
+# ----------------------------------------------------------------------------
+# 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\
+	\
+	ngx_feature_path_libxslt=$(PTXDIST_SYSROOT_TARGET)/usr/include/libxml2
+
+ifdef PTXCONF_ENDIAN_LITTLE
+NGINX_CONF_ENV += ngx_force_have_little_endian=yes
+endif
+
+#
+# autoconf
+#
+NGINX_CONF_TOOL := autoconf
+NGINX_CONF_OPT := \
+	--crossbuild=Linux::$(PTXCONF_ARCH_STRING) \
+	--with-cc=$(CROSS_CC) \
+	--with-cpp=$(CROSS_CC) \
+	--with-cc-opt=-O2 \
+	--with-ipv6 \
+	\
+	--prefix=/usr/share/nginx \
+	--conf-path=/etc/nginx/nginx.conf \
+	--sbin-path=/usr/sbin/nginx \
+	--pid-path=/run/nginx/nginx.pid \
+	--lock-path=/run/nginx/nginx.lock \
+	--user=www \
+	--group=www \
+	--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 \
+	\
+	--with-pcre-jit \
+	--with-ipv6 \
+	--with-http_ssl_module \
+	--with-http_stub_status_module \
+	--with-http_realip_module \
+	--with-http_auth_request_module \
+	\
+	--with-http_addition_module \
+	--with-http_dav_module \
+	--with-http_gunzip_module \
+	--with-http_gzip_static_module \
+	--with-http_image_filter_module \
+	--with-http_v2_module \
+	--with-http_sub_module \
+	--with-http_xslt_module \
+	--with-stream \
+	--with-stream_ssl_module \
+	--with-mail \
+	--with-mail_ssl_module \
+	--with-threads
+
+# ----------------------------------------------------------------------------
+# 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,"Marc Kleine-Budde <mkl@pengutronix.de>")
+	@$(call install_fixup, nginx,DESCRIPTION, "High Performance Webserver")
+
+	@$(call install_copy, nginx, 0, 0, 0755, -, /usr/sbin/nginx)
+	@$(call install_alternative, nginx, 0, 0, 0644, /usr/lib/tmpfiles.d/nginx.conf)
+	@$(call install_alternative, nginx, 0, 0, 0644, /lib/systemd/system/nginx.service)
+ifdef PTXCONF_NGINX_DEBUG_VARIANT
+	@$(call install_copy, nginx, 0, 0, 0644, ${PTXDIST_WORKSPACE}/projectroot/etc/nginx/nginx.conf.debug, /etc/nginx/nginx.conf)
+else
+	@$(call install_alternative, nginx, 0, 0, 0644, /etc/nginx/nginx.conf)
+endif
+	@$(call install_alternative, nginx, 0, 0, 0644, /etc/nginx/mime.types)
+
+	@$(call install_finish, nginx)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.10.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] nginx
  2016-10-31 21:23 ` Robert Schwebel
  2016-10-31 21:27   ` [ptxdist] [PATCH] WIP: nginix Robert Schwebel
@ 2016-11-01 14:47   ` Clemens Gruber
  1 sibling, 0 replies; 4+ messages in thread
From: Clemens Gruber @ 2016-11-01 14:47 UTC (permalink / raw)
  To: ptxdist

On Mon, Oct 31, 2016 at 10:23:20PM +0100, Robert Schwebel wrote:
> On Mon, Oct 31, 2016 at 04:32:04PM +0100, Clemens Gruber wrote:
> > did anyone ever look at cross compiling nginx?
> 
> I think we have patches around, but they probably need more work.
> If you like, you can use them as a starting point for further actions.

Thank you! I will use them as a starting point.

Regards,
Clemens

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

end of thread, other threads:[~2016-11-01 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-31 15:32 [ptxdist] nginx Clemens Gruber
2016-10-31 21:23 ` Robert Schwebel
2016-10-31 21:27   ` [ptxdist] [PATCH] WIP: nginix Robert Schwebel
2016-11-01 14:47   ` [ptxdist] nginx Clemens Gruber

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