Skip to contentSkip to conversation

nginx 1.7.4 cross-compiling patches

meta-webserver James Le Cuirot 4 participants 7 messages Aug 27, 2014 – Sep 1, 2014

lore
Share & tools
lore
#0 lore raw

Hello,

I was trying to cross-compile nginx 1.7.4 on Gentoo and found your nginx-cross.patch. It almost applied, despite being prepared against 1.0.11. I recreated it and everything worked except that the --with-endian option is not actually effective. I have attached the new nginx-cross.patch as well as a --with-endian fix. Hope this helps. As I don't use OpenEmbedded, I'll leave updating the nginx package to you.

Regards,
James

auto/feature +25 -7
diff -Naur nginx-1.7.4.orig/auto/feature nginx-1.7.4/auto/feature
@@ -49,12 +49,20 @@
 
 if [ -x $NGX_AUTOTEST ]; then
 
+    if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+        NGX_AUTOTEST_EXEC="true"
+	NGX_FOUND_MSG=" (not tested, cross compiling)"
+    else
+        NGX_AUTOTEST_EXEC="$NGX_AUTOTEST"
+	NGX_FOUND_MSG=""
+    fi
+
     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 /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+                echo " found$NGX_FOUND_MSG"
                 ngx_found=yes
 
                 if test -n "$ngx_feature_name"; then
@@ -68,17 +76,27 @@
 
         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 /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+                echo " found$NGX_FOUND_MSG"
                 ngx_found=yes
 
-                cat << END >> $NGX_AUTO_CONFIG_H
+                if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+                    cat << END >> $NGX_AUTO_CONFIG_H
 
 #ifndef $ngx_feature_name
-#define $ngx_feature_name  `$NGX_AUTOTEST`
+#define $ngx_feature_name  $(eval "echo \$NGX_WITH_${ngx_feature_name}")
 #endif
 
 END
+		else
+                    cat << END >> $NGX_AUTO_CONFIG_H
+
+#ifndef $ngx_feature_name
+#define $ngx_feature_name  `$NGX_AUTOTEST_EXEC`
+#endif
+
+END
+                fi
             else
                 echo " found but is not working"
             fi
@@ -86,7 +104,7 @@
 
         bug)
             # /bin/sh is used to intercept "Killed" or "Abort trap" messages
-            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+            if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
                 echo " not found"
 
             else
auto/options +25 -0
diff -Naur nginx-1.7.4.orig/auto/options nginx-1.7.4/auto/options
@@ -316,6 +316,18 @@
         --test-build-rtsig)              NGX_TEST_BUILD_RTSIG=YES   ;;
         --test-build-solaris-sendfilev)  NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;;
 
+        # cross compile support
+        --with-int=*)                    NGX_WITH_INT="$value"          ;;
+        --with-long=*)                   NGX_WITH_LONG="$value"         ;;
+        --with-long-long=*)              NGX_WITH_LONG_LONG="$value"    ;;
+        --with-ptr-size=*)               NGX_WITH_PTR_SIZE="$value"     ;;
+        --with-sig-atomic-t=*)           NGX_WITH_SIG_ATOMIC_T="$value" ;;
+        --with-size-t=*)                 NGX_WITH_SIZE_T="$value"       ;;
+        --with-off-t=*)                  NGX_WITH_OFF_T="$value"        ;;
+        --with-time-t=*)                 NGX_WITH_TIME_T="$value"       ;;
+        --with-sys-nerr=*)               NGX_WITH_NGX_SYS_NERR="$value" ;;
+        --with-endian=*)                 NGX_WITH_ENDIAN="$value"       ;;
+
         *)
             echo "$0: error: invalid option \"$option\""
             exit 1
@@ -472,6 +484,17 @@
 
   --with-debug                       enable debug logging
 
+  --with-int=VALUE                   force int size
+  --with-long=VALUE                  force long size
+  --with-long-long=VALUE             force long long size
+  --with-ptr-size=VALUE              force pointer size
+  --with-sig-atomic-t=VALUE          force sig_atomic_t size
+  --with-size-t=VALUE                force size_t size
+  --with-off-t=VALUE                 force off_t size
+  --with-time-t=VALUE                force time_t size
+  --with-sys-nerr=VALUE              force sys_nerr value
+  --with-endian=VALUE                force system endianess
+
 END
 
     exit 1
@@ -493,6 +516,8 @@
 
 if [ ".$NGX_PLATFORM" = ".win32" ]; then
     NGX_WINE=$WINE
+elif [ ! -z "$NGX_PLATFORM" ]; then
+    NGX_CROSS_COMPILE="yes"
 fi
 
 
auto/types/sizeof +14 -10
diff -Naur nginx-1.7.4.orig/auto/types/sizeof nginx-1.7.4/auto/types/sizeof
@@ -12,9 +12,12 @@
 
 END
 
-ngx_size=
+ngx_size=$(eval "echo \$NGX_WITH_${ngx_param}")
 
-cat << END > $NGX_AUTOTEST.c
+if [ ".$ngx_size" != "." ]; then
+    echo " $ngx_size bytes"
+else
+    cat << END > $NGX_AUTOTEST.c
 
 #include <sys/types.h>
 #include <sys/time.h>
@@ -33,19 +36,20 @@
 END
 
 
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+    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"
+    eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
 
 
-if [ -x $NGX_AUTOTEST ]; then
-    ngx_size=`$NGX_AUTOTEST`
-    echo " $ngx_size bytes"
-fi
+    if [ -x $NGX_AUTOTEST ]; then
+        ngx_size=`$NGX_AUTOTEST`
+        echo " $ngx_size bytes"
+    fi
 
 
-rm -rf $NGX_AUTOTEST*
+    rm -rf $NGX_AUTOTEST*
+fi
 
 
 case $ngx_size in
auto/unix +8 -8
diff -Naur nginx-1.7.4.orig/auto/unix nginx-1.7.4/auto/unix
@@ -460,13 +460,13 @@
 
 # C types
 
-ngx_type="int"; . auto/types/sizeof
+ngx_type="int"; ngx_param="INT"; . auto/types/sizeof
 
-ngx_type="long"; . auto/types/sizeof
+ngx_type="long"; ngx_param="LONG"; . auto/types/sizeof
 
-ngx_type="long long"; . auto/types/sizeof
+ngx_type="long long"; ngx_param="LONG_LONG"; . auto/types/sizeof
 
-ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
+ngx_type="void *"; ngx_param="PTR_SIZE"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
 ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
 
 
@@ -483,7 +483,7 @@
 
 ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
 
-ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
+ngx_type="sig_atomic_t"; ngx_param="SIG_ATOMIC_T"; ngx_types="int"; . auto/types/typedef
 . auto/types/sizeof
 ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
 
@@ -499,15 +499,15 @@
 
 . auto/endianness
 
-ngx_type="size_t"; . auto/types/sizeof
+ngx_type="size_t"; ngx_param="SIZE_T"; . auto/types/sizeof
 ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
 ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 
-ngx_type="off_t"; . auto/types/sizeof
+ngx_type="off_t"; ngx_param="OFF_T"; . auto/types/sizeof
 ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
 ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 
-ngx_type="time_t"; . auto/types/sizeof
+ngx_type="time_t"; ngx_param="TIME_T"; . auto/types/sizeof
 ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
 ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 
endianness renamed from endianness.orig +24 -17

56 lines not on this page · raw message

#1 lore raw
Quoted 9 lines · James Le Cuirot

Hello,

I was trying to cross-compile nginx 1.7.4 on Gentoo and found your nginx-cross.patch. It almost applied, despite being prepared against 1.0.11. I recreated it and everything worked except that the --with-endian option is not actually effective. I have attached the new nginx-cross.patch as well as a --with-endian fix. Hope this helps. As I don't use OpenEmbedded, I'll leave updating the nginx package to you.

thanks for the patch. I hope it will appear in patchwork and can be picked by someone doing package upgrade

Quoted 283 lines

Regards,
James

diff -Naur nginx-1.7.4.orig/auto/feature nginx-1.7.4/auto/feature

auto/feature +25 -7
@@ -49,12 +49,20 @@
 
 if [ -x $NGX_AUTOTEST ]; then
 
+    if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+        NGX_AUTOTEST_EXEC="true"
+	NGX_FOUND_MSG=" (not tested, cross compiling)"
+    else
+        NGX_AUTOTEST_EXEC="$NGX_AUTOTEST"
+	NGX_FOUND_MSG=""
+    fi
+
     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 /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+                echo " found$NGX_FOUND_MSG"
                 ngx_found=yes
 
                 if test -n "$ngx_feature_name"; then
@@ -68,17 +76,27 @@
 
         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 /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+                echo " found$NGX_FOUND_MSG"
                 ngx_found=yes
 
-                cat << END >> $NGX_AUTO_CONFIG_H
+                if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+                    cat << END >> $NGX_AUTO_CONFIG_H
 
 #ifndef $ngx_feature_name
-#define $ngx_feature_name  `$NGX_AUTOTEST`
+#define $ngx_feature_name  $(eval "echo \$NGX_WITH_${ngx_feature_name}")
 #endif
 
 END
+		else
+                    cat << END >> $NGX_AUTO_CONFIG_H
+
+#ifndef $ngx_feature_name
+#define $ngx_feature_name  `$NGX_AUTOTEST_EXEC`
+#endif
+
+END
+                fi
             else
                 echo " found but is not working"
             fi
@@ -86,7 +104,7 @@
 
         bug)
             # /bin/sh is used to intercept "Killed" or "Abort trap" messages
-            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+            if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
                 echo " not found"
 
             else

diff -Naur nginx-1.7.4.orig/auto/options nginx-1.7.4/auto/options

auto/options +25 -0
@@ -316,6 +316,18 @@
         --test-build-rtsig)              NGX_TEST_BUILD_RTSIG=YES   ;;
         --test-build-solaris-sendfilev)  NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;;
 
+        # cross compile support
+        --with-int=*)                    NGX_WITH_INT="$value"          ;;
+        --with-long=*)                   NGX_WITH_LONG="$value"         ;;
+        --with-long-long=*)              NGX_WITH_LONG_LONG="$value"    ;;
+        --with-ptr-size=*)               NGX_WITH_PTR_SIZE="$value"     ;;
+        --with-sig-atomic-t=*)           NGX_WITH_SIG_ATOMIC_T="$value" ;;
+        --with-size-t=*)                 NGX_WITH_SIZE_T="$value"       ;;
+        --with-off-t=*)                  NGX_WITH_OFF_T="$value"        ;;
+        --with-time-t=*)                 NGX_WITH_TIME_T="$value"       ;;
+        --with-sys-nerr=*)               NGX_WITH_NGX_SYS_NERR="$value" ;;
+        --with-endian=*)                 NGX_WITH_ENDIAN="$value"       ;;
+
         *)
             echo "$0: error: invalid option \"$option\""
             exit 1
@@ -472,6 +484,17 @@
 
   --with-debug                       enable debug logging
 
+  --with-int=VALUE                   force int size
+  --with-long=VALUE                  force long size
+  --with-long-long=VALUE             force long long size
+  --with-ptr-size=VALUE              force pointer size
+  --with-sig-atomic-t=VALUE          force sig_atomic_t size
+  --with-size-t=VALUE                force size_t size
+  --with-off-t=VALUE                 force off_t size
+  --with-time-t=VALUE                force time_t size
+  --with-sys-nerr=VALUE              force sys_nerr value
+  --with-endian=VALUE                force system endianess
+
 END
 
     exit 1
@@ -493,6 +516,8 @@
 
 if [ ".$NGX_PLATFORM" = ".win32" ]; then
     NGX_WINE=$WINE
+elif [ ! -z "$NGX_PLATFORM" ]; then
+    NGX_CROSS_COMPILE="yes"
 fi
 
 

diff -Naur nginx-1.7.4.orig/auto/types/sizeof nginx-1.7.4/auto/types/sizeof

auto/types/sizeof +14 -10
@@ -12,9 +12,12 @@
 
 END
 
-ngx_size=
+ngx_size=$(eval "echo \$NGX_WITH_${ngx_param}")
 
-cat << END > $NGX_AUTOTEST.c
+if [ ".$ngx_size" != "." ]; then
+    echo " $ngx_size bytes"
+else
+    cat << END > $NGX_AUTOTEST.c
 
 #include <sys/types.h>
 #include <sys/time.h>
@@ -33,19 +36,20 @@
 END
 
 
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+    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"
+    eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
 
 
-if [ -x $NGX_AUTOTEST ]; then
-    ngx_size=`$NGX_AUTOTEST`
-    echo " $ngx_size bytes"
-fi
+    if [ -x $NGX_AUTOTEST ]; then
+        ngx_size=`$NGX_AUTOTEST`
+        echo " $ngx_size bytes"
+    fi
 
 
-rm -rf $NGX_AUTOTEST*
+    rm -rf $NGX_AUTOTEST*
+fi
 
 
 case $ngx_size in

diff -Naur nginx-1.7.4.orig/auto/unix nginx-1.7.4/auto/unix

auto/unix +8 -8
@@ -460,13 +460,13 @@
 
 # C types
 
-ngx_type="int"; . auto/types/sizeof
+ngx_type="int"; ngx_param="INT"; . auto/types/sizeof
 
-ngx_type="long"; . auto/types/sizeof
+ngx_type="long"; ngx_param="LONG"; . auto/types/sizeof
 
-ngx_type="long long"; . auto/types/sizeof
+ngx_type="long long"; ngx_param="LONG_LONG"; . auto/types/sizeof
 
-ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
+ngx_type="void *"; ngx_param="PTR_SIZE"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
 ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
 
 
@@ -483,7 +483,7 @@
 
 ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
 
-ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
+ngx_type="sig_atomic_t"; ngx_param="SIG_ATOMIC_T"; ngx_types="int"; . auto/types/typedef
 . auto/types/sizeof
 ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
 
@@ -499,15 +499,15 @@
 
 . auto/endianness
 
-ngx_type="size_t"; . auto/types/sizeof
+ngx_type="size_t"; ngx_param="SIZE_T"; . auto/types/sizeof
 ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
 ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 
-ngx_type="off_t"; . auto/types/sizeof
+ngx_type="off_t"; ngx_param="OFF_T"; . auto/types/sizeof
 ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
 ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 
-ngx_type="time_t"; . auto/types/sizeof
+ngx_type="time_t"; ngx_param="TIME_T"; . auto/types/sizeof
 ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
 ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 
endianness renamed from endianness.orig +24 -17
@@ -8,7 +8,13 @@
 echo "checking for system byte ordering" >> $NGX_ERR
 
 
-cat << END > $NGX_AUTOTEST.c
+if [ ".$NGX_WITH_ENDIAN" = ".little" ]; then
+    echo " little endian"
+    have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+elif [ ".$NGX_WITH_ENDIAN" = ".big" ]; then
+    echo " big endian"
+else
+    cat << END > $NGX_AUTOTEST.c
 
 int main() {
     int i = 0x11223344;
@@ -21,25 +27,26 @@
 
 END
 
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+    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"
+    eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
 
-if [ -x $NGX_AUTOTEST ]; then
-    if $NGX_AUTOTEST >/dev/null 2>&1; then
-        echo " little endian"
-        have=NGX_HAVE_LITTLE_ENDIAN . auto/have
-    else
-        echo " big endian"
-    fi
+    if [ -x $NGX_AUTOTEST ]; then
+        if $NGX_AUTOTEST >/dev/null 2>&1; then
+            echo " little endian"
+            have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+        else
+            echo " big endian"
+        fi
 
-    rm -rf $NGX_AUTOTEST*
+        rm -rf $NGX_AUTOTEST*
 
-else
-    rm -rf $NGX_AUTOTEST*
+    else
+        rm -rf $NGX_AUTOTEST*
 
-    echo
-    echo "$0: error: cannot detect system byte ordering"
-    exit 1
+        echo
+        echo "$0: error: cannot detect system byte ordering"
+        exit 1
+    fi
 fi
Signature · 5 lines
-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
#2 lore raw
Quoted 11 lines · Khem Raj
Quoted 9 lines · James Le Cuirot

Hello,

I was trying to cross-compile nginx 1.7.4 on Gentoo and found your nginx-cross.patch. It almost applied, despite being prepared against 1.0.11. I recreated it and everything worked except that the --with-endian option is not actually effective. I have attached the new nginx-cross.patch as well as a --with-endian fix. Hope this helps. As I don't use OpenEmbedded, I'll leave updating the nginx package to you.

Quoted 2 lines

thanks for the patch. I hope it will appear in patchwork and can be picked by someone doing package upgrade

It's not correctly picked by patchwork
http://patchwork.openembedded.org/patch/79247/

James: Please resend with git send-email as README suggests
http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Quoted 290 lines
Quoted 284 lines

Regards,
James

diff -Naur nginx-1.7.4.orig/auto/feature nginx-1.7.4/auto/feature

auto/feature +25 -7
@@ -49,12 +49,20 @@
 
 if [ -x $NGX_AUTOTEST ]; then
 
+    if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+        NGX_AUTOTEST_EXEC="true"
+	NGX_FOUND_MSG=" (not tested, cross compiling)"
+    else
+        NGX_AUTOTEST_EXEC="$NGX_AUTOTEST"
+	NGX_FOUND_MSG=""
+    fi
+
     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 /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+                echo " found$NGX_FOUND_MSG"
                 ngx_found=yes
 
                 if test -n "$ngx_feature_name"; then
@@ -68,17 +76,27 @@
 
         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 /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+                echo " found$NGX_FOUND_MSG"
                 ngx_found=yes
 
-                cat << END >> $NGX_AUTO_CONFIG_H
+                if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+                    cat << END >> $NGX_AUTO_CONFIG_H
 
 #ifndef $ngx_feature_name
-#define $ngx_feature_name  `$NGX_AUTOTEST`
+#define $ngx_feature_name  $(eval "echo \$NGX_WITH_${ngx_feature_name}")
 #endif
 
 END
+		else
+                    cat << END >> $NGX_AUTO_CONFIG_H
+
+#ifndef $ngx_feature_name
+#define $ngx_feature_name  `$NGX_AUTOTEST_EXEC`
+#endif
+
+END
+                fi
             else
                 echo " found but is not working"
             fi
@@ -86,7 +104,7 @@
 
         bug)
             # /bin/sh is used to intercept "Killed" or "Abort trap" messages
-            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+            if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
                 echo " not found"
 
             else

diff -Naur nginx-1.7.4.orig/auto/options nginx-1.7.4/auto/options

auto/options +25 -0
@@ -316,6 +316,18 @@
         --test-build-rtsig)              NGX_TEST_BUILD_RTSIG=YES   ;;
         --test-build-solaris-sendfilev)  NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;;
 
+        # cross compile support
+        --with-int=*)                    NGX_WITH_INT="$value"          ;;
+        --with-long=*)                   NGX_WITH_LONG="$value"         ;;
+        --with-long-long=*)              NGX_WITH_LONG_LONG="$value"    ;;
+        --with-ptr-size=*)               NGX_WITH_PTR_SIZE="$value"     ;;
+        --with-sig-atomic-t=*)           NGX_WITH_SIG_ATOMIC_T="$value" ;;
+        --with-size-t=*)                 NGX_WITH_SIZE_T="$value"       ;;
+        --with-off-t=*)                  NGX_WITH_OFF_T="$value"        ;;
+        --with-time-t=*)                 NGX_WITH_TIME_T="$value"       ;;
+        --with-sys-nerr=*)               NGX_WITH_NGX_SYS_NERR="$value" ;;
+        --with-endian=*)                 NGX_WITH_ENDIAN="$value"       ;;
+
         *)
             echo "$0: error: invalid option \"$option\""
             exit 1
@@ -472,6 +484,17 @@
 
   --with-debug                       enable debug logging
 
+  --with-int=VALUE                   force int size
+  --with-long=VALUE                  force long size
+  --with-long-long=VALUE             force long long size
+  --with-ptr-size=VALUE              force pointer size
+  --with-sig-atomic-t=VALUE          force sig_atomic_t size
+  --with-size-t=VALUE                force size_t size
+  --with-off-t=VALUE                 force off_t size
+  --with-time-t=VALUE                force time_t size
+  --with-sys-nerr=VALUE              force sys_nerr value
+  --with-endian=VALUE                force system endianess
+
 END
 
     exit 1
@@ -493,6 +516,8 @@
 
 if [ ".$NGX_PLATFORM" = ".win32" ]; then
     NGX_WINE=$WINE
+elif [ ! -z "$NGX_PLATFORM" ]; then
+    NGX_CROSS_COMPILE="yes"
 fi
 
 

diff -Naur nginx-1.7.4.orig/auto/types/sizeof nginx-1.7.4/auto/types/sizeof

auto/types/sizeof +14 -10
@@ -12,9 +12,12 @@
 
 END
 
-ngx_size=
+ngx_size=$(eval "echo \$NGX_WITH_${ngx_param}")
 
-cat << END > $NGX_AUTOTEST.c
+if [ ".$ngx_size" != "." ]; then
+    echo " $ngx_size bytes"
+else
+    cat << END > $NGX_AUTOTEST.c
 
 #include <sys/types.h>
 #include <sys/time.h>
@@ -33,19 +36,20 @@
 END
 
 
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+    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"
+    eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
 
 
-if [ -x $NGX_AUTOTEST ]; then
-    ngx_size=`$NGX_AUTOTEST`
-    echo " $ngx_size bytes"
-fi
+    if [ -x $NGX_AUTOTEST ]; then
+        ngx_size=`$NGX_AUTOTEST`
+        echo " $ngx_size bytes"
+    fi
 
 
-rm -rf $NGX_AUTOTEST*
+    rm -rf $NGX_AUTOTEST*
+fi
 
 
 case $ngx_size in

diff -Naur nginx-1.7.4.orig/auto/unix nginx-1.7.4/auto/unix

auto/unix +8 -8
@@ -460,13 +460,13 @@
 
 # C types
 
-ngx_type="int"; . auto/types/sizeof
+ngx_type="int"; ngx_param="INT"; . auto/types/sizeof
 
-ngx_type="long"; . auto/types/sizeof
+ngx_type="long"; ngx_param="LONG"; . auto/types/sizeof
 
-ngx_type="long long"; . auto/types/sizeof
+ngx_type="long long"; ngx_param="LONG_LONG"; . auto/types/sizeof
 
-ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
+ngx_type="void *"; ngx_param="PTR_SIZE"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
 ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
 
 
@@ -483,7 +483,7 @@
 
 ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
 
-ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
+ngx_type="sig_atomic_t"; ngx_param="SIG_ATOMIC_T"; ngx_types="int"; . auto/types/typedef
 . auto/types/sizeof
 ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
 
@@ -499,15 +499,15 @@
 
 . auto/endianness
 
-ngx_type="size_t"; . auto/types/sizeof
+ngx_type="size_t"; ngx_param="SIZE_T"; . auto/types/sizeof
 ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
 ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 
-ngx_type="off_t"; . auto/types/sizeof
+ngx_type="off_t"; ngx_param="OFF_T"; . auto/types/sizeof
 ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
 ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 
-ngx_type="time_t"; . auto/types/sizeof
+ngx_type="time_t"; ngx_param="TIME_T"; . auto/types/sizeof
 ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
 ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 
endianness renamed from endianness.orig +24 -17
@@ -8,7 +8,13 @@
 echo "checking for system byte ordering" >> $NGX_ERR
 
 
-cat << END > $NGX_AUTOTEST.c
+if [ ".$NGX_WITH_ENDIAN" = ".little" ]; then
+    echo " little endian"
+    have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+elif [ ".$NGX_WITH_ENDIAN" = ".big" ]; then
+    echo " big endian"
+else
+    cat << END > $NGX_AUTOTEST.c
 
 int main() {
     int i = 0x11223344;
@@ -21,25 +27,26 @@
 
 END
 
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+    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"
+    eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
 
-if [ -x $NGX_AUTOTEST ]; then
-    if $NGX_AUTOTEST >/dev/null 2>&1; then
-        echo " little endian"
-        have=NGX_HAVE_LITTLE_ENDIAN . auto/have
-    else
-        echo " big endian"
-    fi
+    if [ -x $NGX_AUTOTEST ]; then
+        if $NGX_AUTOTEST >/dev/null 2>&1; then
+            echo " little endian"
+            have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+        else
+            echo " big endian"
+        fi
 
-    rm -rf $NGX_AUTOTEST*
+        rm -rf $NGX_AUTOTEST*
 
-else
-    rm -rf $NGX_AUTOTEST*
+    else
+        rm -rf $NGX_AUTOTEST*
 
-    echo
-    echo "$0: error: cannot detect system byte ordering"
-    exit 1
+        echo
+        echo "$0: error: cannot detect system byte ordering"
+        exit 1
+    fi
 fi
Signature · 5 lines
-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 4 lines
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#3 lore raw
Quoted 12 lines · On Thu, 28 Aug 2014 11:29:44 +0200 Martin Jansa <[email protected]> wrote:
Quoted 11 lines · Khem Raj
Quoted 9 lines · James Le Cuirot

Hello,

I was trying to cross-compile nginx 1.7.4 on Gentoo and found your nginx-cross.patch. It almost applied, despite being prepared against 1.0.11. I recreated it and everything worked except that the --with-endian option is not actually effective. I have attached the new nginx-cross.patch as well as a --with-endian fix. Hope this helps. As I don't use OpenEmbedded, I'll leave updating the nginx package to you.

Quoted 8 lines
Quoted 2 lines

thanks for the patch. I hope it will appear in patchwork and can be picked by someone doing package upgrade

It's not correctly picked by patchwork
http://patchwork.openembedded.org/patch/79247/

James: Please resend with git send-email as README suggests
http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Hi Martin. I was going to but I figured that wouldn't really make sense unless the package script was updated as well. If it were just merged as-is, it would break the package. Would you still like it submitted in this form anyway?

#4 lore raw
Quoted 21 lines · James Le Cuirot
Quoted 18 lines · On Thu, 28 Aug 2014 11:29:44 +0200 Martin Jansa <[email protected]> wrote:
Quoted 11 lines · Khem Raj
Quoted 9 lines · James Le Cuirot

Hello,

I was trying to cross-compile nginx 1.7.4 on Gentoo and found your nginx-cross.patch. It almost applied, despite being prepared against 1.0.11. I recreated it and everything worked except that the --with-endian option is not actually effective. I have attached the new nginx-cross.patch as well as a --with-endian fix. Hope this helps. As I don't use OpenEmbedded, I'll leave updating the nginx package to you.

Quoted 2 lines

thanks for the patch. I hope it will appear in patchwork and can be picked by someone doing package upgrade

It's not correctly picked by patchwork
http://patchwork.openembedded.org/patch/79247/

Quoted 7 lines
Quoted 2 lines

James: Please resend with git send-email as README suggests
http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Hi Martin. I was going to but I figured that wouldn't really make sense unless the package script was updated as well. If it were just merged as-is, it would break the package. Would you still like it submitted in this form anyway?

Please submit it together with upgrade from 1.4.4. to newer 1.7.4 version.

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#5 lore raw
Quoted 25 lines · On Thu, 28 Aug 2014 16:27:59 +0200 Martin Jansa <[email protected]> wrote:
Quoted 24 lines · James Le Cuirot
Quoted 20 lines · On Thu, 28 Aug 2014 11:29:44 +0200 Martin Jansa <[email protected]> wrote:
Quoted 11 lines · Khem Raj
Quoted 9 lines · James Le Cuirot

Hello,

I was trying to cross-compile nginx 1.7.4 on Gentoo and found your nginx-cross.patch. It almost applied, despite being prepared against 1.0.11. I recreated it and everything worked except that the --with-endian option is not actually effective. I have attached the new nginx-cross.patch as well as a --with-endian fix. Hope this helps. As I don't use OpenEmbedded, I'll leave updating the nginx package to you.

Quoted 2 lines

thanks for the patch. I hope it will appear in patchwork and can be picked by someone doing package upgrade

It's not correctly picked by patchwork
http://patchwork.openembedded.org/patch/79247/

James: Please resend with git send-email as README suggests
http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Quoted 7 lines
Quoted 4 lines

Hi Martin. I was going to but I figured that wouldn't really make sense unless the package script was updated as well. If it were just merged as-is, it would break the package. Would you still like it submitted in this form anyway?

Please submit it together with upgrade from 1.4.4. to newer 1.7.4 version.

As I already stated, I don't use and have never used OpenEmbedded. I just picked the existing patch up for use with Gentoo and was being courteous by providing my improvements. I don't have time to update and test a package for a distro I have never used. Sorry.

#6 lore raw

Hi James,

Quoted 32 lines · On Thursday 28 August 2014 15:49:25 James Le Cuirot wrote:
Quoted 30 lines · On Thu, 28 Aug 2014 16:27:59 +0200 Martin Jansa <[email protected]> wrote:
Quoted 28 lines · James Le Cuirot

On Thu, 28 Aug 2014 11:29:44 +0200

Quoted 12 lines · Martin Jansa
Quoted 11 lines · Khem Raj
Quoted 9 lines · James Le Cuirot

Hello,

I was trying to cross-compile nginx 1.7.4 on Gentoo and found your nginx-cross.patch. It almost applied, despite being prepared against 1.0.11. I recreated it and everything worked except that the --with-endian option is not actually effective. I have attached the new nginx-cross.patch as well as a --with-endian fix. Hope this helps. As I don't use OpenEmbedded, I'll leave updating the nginx package to you.

Quoted 8 lines
Quoted 2 lines

thanks for the patch. I hope it will appear in patchwork and can be picked by someone doing package upgrade

It's not correctly picked by patchwork
http://patchwork.openembedded.org/patch/79247/

James: Please resend with git send-email as README suggests
http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Hi Martin. I was going to but I figured that wouldn't really make sense unless the package script was updated as well. If it were just merged as-is, it would break the package. Would you still like it submitted in this form anyway?

Quoted 7 lines
Quoted 2 lines

Please submit it together with upgrade from 1.4.4. to newer 1.7.4 version.

As I already stated, I don't use and have never used OpenEmbedded. I just picked the existing patch up for use with Gentoo and was being courteous by providing my improvements. I don't have time to update and test a package for a distro I have never used. Sorry.

OK, thanks for sending it anyway and we'll keep it aside for when someone gets the time to update the nginx recipe.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre