xref: /openbmc/openbmc/meta-openembedded/meta-webserver/recipes-httpd/nginx/files/nginx-cross.patch (revision eb8dc40360f0cfef56fb6947cc817a547d6d9bc6)
1We do not have capability to run binaries when cross compiling
2
3Upstream-Status: Pending
4
5
6Index: nginx-1.12.2/auto/feature
7===================================================================
8--- nginx-1.12.2.orig/auto/feature
9+++ nginx-1.12.2/auto/feature
10@@ -49,12 +49,20 @@ eval "/bin/sh -c \"$ngx_test\" >> $NGX_A
11
12 if [ -x $NGX_AUTOTEST ]; then
13
14+    if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
15+        NGX_AUTOTEST_EXEC="true"
16+	NGX_FOUND_MSG=" (not tested, cross compiling)"
17+    else
18+        NGX_AUTOTEST_EXEC="$NGX_AUTOTEST"
19+	NGX_FOUND_MSG=""
20+    fi
21+
22     case "$ngx_feature_run" in
23
24         yes)
25             # /bin/sh is used to intercept "Killed" or "Abort trap" messages
26-            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
27-                echo " found"
28+            if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
29+                echo " found$NGX_FOUND_MSG"
30                 ngx_found=yes
31
32                 if test -n "$ngx_feature_name"; then
33@@ -68,17 +76,27 @@ if [ -x $NGX_AUTOTEST ]; then
34
35         value)
36             # /bin/sh is used to intercept "Killed" or "Abort trap" messages
37-            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
38-                echo " found"
39+            if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
40+                echo " found$NGX_FOUND_MSG"
41                 ngx_found=yes
42
43-                cat << END >> $NGX_AUTO_CONFIG_H
44+                if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
45+                    cat << END >> $NGX_AUTO_CONFIG_H
46
47 #ifndef $ngx_feature_name
48-#define $ngx_feature_name  `$NGX_AUTOTEST`
49+#define $ngx_feature_name  $(eval "echo \$NGX_WITH_${ngx_feature_name}")
50 #endif
51
52 END
53+		else
54+                    cat << END >> $NGX_AUTO_CONFIG_H
55+
56+#ifndef $ngx_feature_name
57+#define $ngx_feature_name  `$NGX_AUTOTEST_EXEC`
58+#endif
59+
60+END
61+                fi
62             else
63                 echo " found but is not working"
64             fi
65@@ -86,7 +104,7 @@ END
66
67         bug)
68             # /bin/sh is used to intercept "Killed" or "Abort trap" messages
69-            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
70+            if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
71                 echo " not found"
72
73             else
74Index: nginx-1.12.2/auto/options
75===================================================================
76--- nginx-1.12.2.orig/auto/options
77+++ nginx-1.12.2/auto/options
78@@ -386,6 +386,18 @@ $0: warning: the \"--with-sha1-asm\" opt
79         --test-build-epoll)              NGX_TEST_BUILD_EPOLL=YES   ;;
80         --test-build-solaris-sendfilev)  NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;;
81
82+        # cross compile support
83+        --with-int=*)                    NGX_WITH_INT="$value"          ;;
84+        --with-long=*)                   NGX_WITH_LONG="$value"         ;;
85+        --with-long-long=*)              NGX_WITH_LONG_LONG="$value"    ;;
86+        --with-ptr-size=*)               NGX_WITH_PTR_SIZE="$value"     ;;
87+        --with-sig-atomic-t=*)           NGX_WITH_SIG_ATOMIC_T="$value" ;;
88+        --with-size-t=*)                 NGX_WITH_SIZE_T="$value"       ;;
89+        --with-off-t=*)                  NGX_WITH_OFF_T="$value"        ;;
90+        --with-time-t=*)                 NGX_WITH_TIME_T="$value"       ;;
91+        --with-sys-nerr=*)               NGX_WITH_NGX_SYS_NERR="$value" ;;
92+        --with-endian=*)                 NGX_WITH_ENDIAN="$value"       ;;
93+
94         *)
95             echo "$0: error: invalid option \"$option\""
96             exit 1
97@@ -568,6 +580,17 @@ cat << END
98
99   --with-debug                       enable debug logging
100
101+  --with-int=VALUE                   force int size
102+  --with-long=VALUE                  force long size
103+  --with-long-long=VALUE             force long long size
104+  --with-ptr-size=VALUE              force pointer size
105+  --with-sig-atomic-t=VALUE          force sig_atomic_t size
106+  --with-size-t=VALUE                force size_t size
107+  --with-off-t=VALUE                 force off_t size
108+  --with-time-t=VALUE                force time_t size
109+  --with-sys-nerr=VALUE              force sys_nerr value
110+  --with-endian=VALUE                force system endianess
111+
112 END
113
114     exit 1
115@@ -576,6 +599,8 @@ fi
116
117 if [ ".$NGX_PLATFORM" = ".win32" ]; then
118     NGX_WINE=$WINE
119+elif [ ! -z "$NGX_PLATFORM" ]; then
120+    NGX_CROSS_COMPILE="yes"
121 fi
122
123
124Index: nginx-1.12.2/auto/types/sizeof
125===================================================================
126--- nginx-1.12.2.orig/auto/types/sizeof
127+++ nginx-1.12.2/auto/types/sizeof
128@@ -12,9 +12,12 @@ checking for $ngx_type size
129
130 END
131
132-ngx_size=
133+ngx_size=$(eval "echo \$NGX_WITH_${ngx_param}")
134
135-cat << END > $NGX_AUTOTEST.c
136+if [ ".$ngx_size" != "." ]; then
137+    echo " $ngx_size bytes"
138+else
139+    cat << END > $NGX_AUTOTEST.c
140
141 #include <sys/types.h>
142 #include <sys/time.h>
143@@ -33,15 +36,16 @@ int main(void) {
144 END
145
146
147-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
148-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
149+    ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
150+              -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
151
152-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
153+    eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
154
155
156-if [ -x $NGX_AUTOTEST ]; then
157-    ngx_size=`$NGX_AUTOTEST`
158-    echo " $ngx_size bytes"
159+    if [ -x $NGX_AUTOTEST ]; then
160+        ngx_size=`$NGX_AUTOTEST`
161+        echo " $ngx_size bytes"
162+    fi
163 fi
164
165
166Index: nginx-1.12.2/auto/unix
167===================================================================
168--- nginx-1.12.2.orig/auto/unix
169+++ nginx-1.12.2/auto/unix
170@@ -587,13 +587,13 @@ ngx_feature_libs=
171
172 # C types
173
174-ngx_type="int"; . auto/types/sizeof
175+ngx_type="int"; ngx_param="INT"; . auto/types/sizeof
176
177-ngx_type="long"; . auto/types/sizeof
178+ngx_type="long"; ngx_param="LONG"; . auto/types/sizeof
179
180-ngx_type="long long"; . auto/types/sizeof
181+ngx_type="long long"; ngx_param="LONG_LONG"; . auto/types/sizeof
182
183-ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
184+ngx_type="void *"; ngx_param="PTR_SIZE"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
185 ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
186
187
188@@ -604,7 +604,7 @@ NGX_INCLUDE_AUTO_CONFIG_H="#include \"ng
189 ngx_type="uint32_t"; ngx_types="u_int32_t"; . auto/types/typedef
190 ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
191
192-ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
193+ngx_type="sig_atomic_t"; ngx_param="SIG_ATOMIC_T"; ngx_types="int"; . auto/types/typedef
194 . auto/types/sizeof
195 ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
196
197@@ -620,15 +620,15 @@ ngx_type="rlim_t"; ngx_types="int"; . au
198
199 . auto/endianness
200
201-ngx_type="size_t"; . auto/types/sizeof
202+ngx_type="size_t"; ngx_param="SIZE_T"; . auto/types/sizeof
203 ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
204 ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
205
206-ngx_type="off_t"; . auto/types/sizeof
207+ngx_type="off_t"; ngx_param="OFF_T"; . auto/types/sizeof
208 ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
209 ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
210
211-ngx_type="time_t"; . auto/types/sizeof
212+ngx_type="time_t"; ngx_param="TIME_T"; . auto/types/sizeof
213 ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
214 ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
215 ngx_param=NGX_MAX_TIME_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
216