[PATCH 1 of 2] build: add host-cc option

aduskett at gmail.com aduskett at gmail.com
Fri Jun 25 21:13:48 UTC 2021


# HG changeset patch
# User Adam Duskett <aduskett at gmail.com>
# Date 1624653981 25200
#      Fri Jun 25 13:46:21 2021 -0700
# Node ID e6d0b8882618fd43f4b97a6d0e708de9b82d44e5
# Parent  2e84334ca8dbbf10d0fa7ca413757d7980158d91
build: add host-cc option

When running ./configure, the build system currently builds the echo
application using the specified --cc. However, when cross-compiling,
the echo program is currently compiled using the same compiler, which
results in the host x86 pc unable to execute the echo utility.

Add a --host-cc compile option and use the host cc to build the echo
utility.

diff -r 2e84334ca8db -r e6d0b8882618 auto/echo/build
--- a/auto/echo/build	Thu Jun 24 04:01:15 2021 +0100
+++ b/auto/echo/build	Fri Jun 25 13:46:21 2021 -0700
@@ -7,7 +7,7 @@
 
 rm -f $NXT_BUILD_DIR/echo
 
-nxt_echo_test="$CC -o $NXT_BUILD_DIR/echo -O $NXT_CC_OPT
+nxt_echo_test="$HOST_CC -o $NXT_BUILD_DIR/echo -O $NXT_CC_OPT
                auto/echo/echo.c $NXT_LD_OPT"
 
 # "|| true" is to bypass "set -e" setting.
diff -r 2e84334ca8db -r e6d0b8882618 auto/help
--- a/auto/help	Thu Jun 24 04:01:15 2021 +0100
+++ b/auto/help	Fri Jun 25 13:46:21 2021 -0700
@@ -9,6 +9,7 @@
 
   --cc=FILE            set C compiler filename, default: "$CC"
   --cc-opt=OPTIONS     set additional C compiler options
+  --host-cc=FILE       set host C compiler filename, default: "$CC"
   --ld-opt=OPTIONS     set additional linker options
 
   --prefix=DIRECTORY   set prefix for relative pathnames, default: none
diff -r 2e84334ca8db -r e6d0b8882618 auto/options
--- a/auto/options	Thu Jun 24 04:01:15 2021 +0100
+++ b/auto/options	Fri Jun 25 13:46:21 2021 -0700
@@ -52,6 +52,7 @@
     case "$nxt_option" in
         --cc=*)                          CC="$value"                         ;;
         --cc-opt=*)                      NXT_CC_OPT="$value"                 ;;
+        --host-cc=*)                     HOST_CC="$value"                    ;;
         --ld-opt=*)                      NXT_LD_OPT="$value"                 ;;
 
         --prefix=*)                      NXT_PREFIX="$value"                 ;;
diff -r 2e84334ca8db -r e6d0b8882618 auto/save
--- a/auto/save	Thu Jun 24 04:01:15 2021 +0100
+++ b/auto/save	Fri Jun 25 13:46:21 2021 -0700
@@ -8,6 +8,7 @@
 NXT_SYSTEM='$NXT_SYSTEM'
 
 CC='$CC'
+HOST_CC='$HOST_CC'
 CFLAGS='$CFLAGS'
 
 NXT_CC_NAME='$NXT_CC_NAME'
diff -r 2e84334ca8db -r e6d0b8882618 configure
--- a/configure	Thu Jun 24 04:01:15 2021 +0100
+++ b/configure	Fri Jun 25 13:46:21 2021 -0700
@@ -29,6 +29,7 @@
 NXT_MAKEFILE=$NXT_BUILD_DIR/Makefile
 
 CC=${CC:-cc}
+HOST_CC=${HOST_CC:-cc}
 
 NXT_DAEMON=unitd
 NXT_BINDIR="bin"



More information about the unit mailing list