[PATCH 2/2] Added support for compiling against Android bionic
Dan Fandrich
dan at coneharvesters.com
Mon May 30 21:05:13 UTC 2011
It's not easy compiling something against bionic using the
Android compiler outside the Android build system, but it can
at least now happen.
Signed-off-by: Dan Fandrich <dan at coneharvesters.com>
---
Conditionally compiling xmalloc_ttyname() is a bit ugly, but necessary
since bionic doesn't have ttyname_r.
include/platform.h | 6 ++++++
libbb/appletlib.c | 6 +++++-
libbb/obscure.c | 2 ++
libbb/xfuncs_printf.c | 2 ++
networking/interface.c | 2 +-
5 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/include/platform.h b/include/platform.h
index 2b84447..780568c 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -391,6 +391,12 @@ typedef unsigned smalluint;
# undef HAVE_STPCPY
#endif
+#if defined(ANDROID)
+# undef HAVE_DPRINTF
+# undef HAVE_STPCPY
+# undef HAVE_STRCHRNUL
+#endif
+
/*
* Now, define prototypes for all the functions defined in platform.c
* These must come after all the HAVE_* macros are defined (or not)
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 0dac0ba..a206a6a 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -36,7 +36,11 @@
/* Try to pull in PAGE_SIZE */
#ifdef __linux__
-# include <sys/user.h>
+# ifdef ANDROID
+# include <sys/mman.h>
+# else
+# include <sys/user.h>
+# endif
#endif
#ifdef __GNU__ /* Hurd */
# include <mach/vm_param.h>
diff --git a/libbb/obscure.c b/libbb/obscure.c
index dd8cd31..4af9ef2 100644
--- a/libbb/obscure.c
+++ b/libbb/obscure.c
@@ -109,10 +109,12 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc
if (string_checker(new_p, pw->pw_name)) {
return "similar to username";
}
+#ifndef ANDROID
/* no gecos as-is, as sub-string, reversed, capitalized, doubled */
if (pw->pw_gecos[0] && string_checker(new_p, pw->pw_gecos)) {
return "similar to gecos";
}
+#endif
/* hostname as-is, as sub-string, reversed, capitalized, doubled */
hostname = safe_gethostname();
i = string_checker(new_p, hostname);
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 56ee459..37cb526 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -538,6 +538,7 @@ int FAST_FUNC bb_xioctl(int fd, unsigned request, void *argp)
}
#endif
+#ifndef ANDROID
char* FAST_FUNC xmalloc_ttyname(int fd)
{
char *buf = xzalloc(128);
@@ -548,6 +549,7 @@ char* FAST_FUNC xmalloc_ttyname(int fd)
}
return buf;
}
+#endif
void FAST_FUNC generate_uuid(uint8_t *buf)
{
diff --git a/networking/interface.c b/networking/interface.c
index bea54c1..21f4006 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -32,7 +32,7 @@
*/
#include <net/if.h>
#include <net/if_arp.h>
-#ifndef __UCLIBC__
+#if !defined(__UCLIBC__) && !defined(ANDROID)
# include <net/ethernet.h>
#else
# include <linux/if_ether.h>
--
1.7.0.4
More information about the busybox
mailing list