OSDN Git Service

Don't pass target $CFLAGS to host builds (telling x86 compiler to be big-endian
authorRob Landley <rob@landley.net>
Mon, 2 Nov 2015 14:32:21 +0000 (08:32 -0600)
committerRob Landley <rob@landley.net>
Mon, 2 Nov 2015 14:32:21 +0000 (08:32 -0600)
seldom ends well). Instead add -DBUILD_FOR_HOST to $HOSTCC and wrap #ifdefs
around problematic (smack) includes from toys.h.

configure
lib/lsm.h
scripts/make.sh

index 7b10f6e..ff1aaf2 100644 (file)
--- a/configure
+++ b/configure
@@ -23,3 +23,4 @@ CFLAGS="$CFLAGS -funsigned-char"
 # If HOSTCC needs CFLAGS or LDFLAGS, just add them to the variable
 # ala HOSTCC="blah-cc --static"
 [ -z "$HOSTCC" ] && HOSTCC=cc
+HOSTCC="$HOSTCC -DBUILD_FOR_HOST"
index d7e7de9..aacabe0 100644 (file)
--- a/lib/lsm.h
+++ b/lib/lsm.h
@@ -3,6 +3,8 @@
  * Copyright 2015 Rob Landley <rob@landley.net>
  */
 
+#ifndef BUILD_FOR_HOST
+
 #if CFG_TOYBOX_SELINUX
 #include <selinux/selinux.h>
 #else
@@ -113,3 +115,5 @@ static inline int lsm_fget_context(int file, char **context)
     return smack_new_label_from_file(file, XATTR_NAME_SMACK, context);
   return fgetfilecon(file, context);
 }
+
+#endif // BUILD_FOR_HOST
index a724d5f..3dd4f90 100755 (executable)
@@ -213,7 +213,7 @@ fi
 echo "generated/help.h"
 if [ generated/config2help -ot scripts/config2help.c ]
 then
-  do_loudly $HOSTCC scripts/config2help.c $CFLAGS -I . lib/xwrap.c lib/llist.c \
+  do_loudly $HOSTCC scripts/config2help.c -I . lib/xwrap.c lib/llist.c \
     lib/lib.c lib/portability.c -o generated/config2help || exit 1
 fi
 generated/config2help Config.in $KCONFIG_CONFIG > generated/help.h || exit 1