summaryrefslogtreecommitdiffstats
path: root/package/nginx/nginx-0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
diff options
context:
space:
mode:
authorSamuel Martin <s.martin49@gmail.com>2014-10-05 12:46:22 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-10-05 14:24:27 +0200
commit390a1449036e72436742d4529ccafb0cf8f64db5 (patch)
treea7fdb20ffb40992b0d021d25dfca0117882c0d33 /package/nginx/nginx-0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
parenta8f986c449a3e08aff7fff531d7b26a1907a9d09 (diff)
downloadbuildroot-390a1449036e72436742d4529ccafb0cf8f64db5.tar.gz
buildroot-390a1449036e72436742d4529ccafb0cf8f64db5.zip
package/nginx: new package
nginx module selection is, by default, the same as the one sets by the upstream configure script. Patches improving the cross-compilation support have already been sent upstream for integration [1-5]. All these patches are needed because nginx uses its own handwritten build-system, which is cross-platform, but does not properly support cross-compilation. Fixes bug: #3427 [6] [1] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005722.html [2] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005724.html [3] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005725.html [4] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005723.html [5] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005726.html [6] https://bugs.uclibc.org/show_bug.cgi?id=3427 Signed-off-by: Samuel Martin <s.martin49@gmail.com> Cc: Daniele Salvatore Albano <info@daccii.it> Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Cc: Johan Oudinet <johan.oudinet@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/nginx/nginx-0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch')
-rw-r--r--package/nginx/nginx-0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch133
1 files changed, 133 insertions, 0 deletions
diff --git a/package/nginx/nginx-0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch b/package/nginx/nginx-0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
new file mode 100644
index 0000000000..4c00755b3e
--- /dev/null
+++ b/package/nginx/nginx-0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
@@ -0,0 +1,133 @@
+From 8c19cea5e667f325ececdc1678bfddf063af0da2 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/5] 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>
+---
+ auto/os/sys_nerr | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ auto/unix | 10 ++++++++
+ 2 files changed, 87 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..25e7c22
+--- /dev/null
++++ b/auto/os/sys_nerr
+@@ -0,0 +1,77 @@
++
++# 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
++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 b7cc9cb..1a49ba3 100755
+--- a/auto/unix
++++ b/auto/unix
+@@ -550,6 +550,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
+
+@@ -598,6 +602,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.2
+
OpenPOWER on IntegriCloud