diff options
author | Niranjan Pendharkar <npendhar@codeaurora.org> | 2013-02-08 14:09:13 -0800 |
---|---|---|
committer | Niranjan Pendharkar <npendhar@codeaurora.org> | 2013-02-08 14:34:44 -0800 |
commit | 8a5f846f83556370f8c69b8573ebd7ceb01653f7 (patch) | |
tree | 33a50a21940ba01cefbf41af94fcf7a9e04972a3 | |
parent | 1736fa987eb6b66b6eaedbc1cd3df4f48b873721 (diff) | |
download | android_external_brctl-8a5f846f83556370f8c69b8573ebd7ceb01653f7.tar.gz android_external_brctl-8a5f846f83556370f8c69b8573ebd7ceb01653f7.tar.bz2 android_external_brctl-8a5f846f83556370f8c69b8573ebd7ceb01653f7.zip |
brctl: Add Android makefiles to build on Android
This patch adds makefiles to build this open source tool
on Android. This patch also addresses some compatibilty
issues between GNU C and bionic C implementation.
Change-Id: Ic35ab4f98d5f252d53e92c6cde43f0673cef9d4a
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | brctl/Android.mk | 25 | ||||
-rw-r--r-- | brctl/brctl.c | 7 | ||||
-rw-r--r-- | libbridge/Android.mk | 17 | ||||
-rw-r--r-- | libbridge/config.h | 80 | ||||
-rw-r--r-- | libbridge/libbridge.h | 4 | ||||
-rw-r--r-- | libbridge/libbridge_devif.c | 5 | ||||
-rw-r--r-- | libbridge/libbridge_if.c | 4 | ||||
-rw-r--r-- | libbridge/libbridge_private.h | 2 |
9 files changed, 137 insertions, 8 deletions
diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..5053e7d --- /dev/null +++ b/Android.mk @@ -0,0 +1 @@ +include $(call all-subdir-makefiles) diff --git a/brctl/Android.mk b/brctl/Android.mk new file mode 100644 index 0000000..04897a2 --- /dev/null +++ b/brctl/Android.mk @@ -0,0 +1,25 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:=\ + brctl_cmd.c \ + brctl_disp.c \ + brctl.c + +LOCAL_CFLAGS := -O2 -g -Wno-ignored-qualifiers +LOCAL_CFLAGS += -Wno-sign-compare -Wno-missing-field-initializers +LOCAL_CFLAGS += -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" +LOCAL_CFLAGS += -DFEATURE_ANDROID + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/../libbridge/ + +LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils + +LOCAL_MODULE_TAGS := debug + +LOCAL_STATIC_LIBRARIES += libbridge + +LOCAL_MODULE := brctl + +include $(BUILD_EXECUTABLE) diff --git a/brctl/brctl.c b/brctl/brctl.c index 46ca352..87af143 100644 --- a/brctl/brctl.c +++ b/brctl/brctl.c @@ -24,7 +24,6 @@ #include "libbridge.h" #include "config.h" - #include "brctl.h" static void help() @@ -39,9 +38,9 @@ int main(int argc, char *const* argv) const struct command *cmd; int f; static const struct option options[] = { - { .name = "help", .val = 'h' }, - { .name = "version", .val = 'V' }, - { 0 } + { .name = "help", .has_arg = '0', .flag = 0, .val = 'h' }, + { .name = "version", .has_arg = '0', .flag = 0, .val = 'V' }, + { 0,0,0,0 } }; while ((f = getopt_long(argc, argv, "Vh", options, NULL)) != EOF) diff --git a/libbridge/Android.mk b/libbridge/Android.mk new file mode 100644 index 0000000..7f73ab2 --- /dev/null +++ b/libbridge/Android.mk @@ -0,0 +1,17 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:=\ + libbridge_devif.c \ + libbridge_if.c \ + libbridge_init.c \ + libbridge_misc.c + +LOCAL_CFLAGS:= -Wall -O2 -g +LOCAL_CFLAGS += -DFEATURE_ANDROID + +LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils +LOCAL_MODULE:= libbridge +LOCAL_MODULE_TAGS := optional + +include $(BUILD_STATIC_LIBRARY) diff --git a/libbridge/config.h b/libbridge/config.h new file mode 100644 index 0000000..774b9e7 --- /dev/null +++ b/libbridge/config.h @@ -0,0 +1,80 @@ +/* libbridge/config.h. Generated from config.h.in by configure. */ +/* libbridge/config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have the `if_indextoname' function. */ +#define HAVE_IF_INDEXTONAME 1 + +/* Define to 1 if you have the `if_nametoindex' function. */ +#define HAVE_IF_NAMETOINDEX 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the <sys/ioctl.h> header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `uname' function. */ +#define HAVE_UNAME 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "bridge-utils" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "bridge-utils 1.5" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "bridge-utils" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.5" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ diff --git a/libbridge/libbridge.h b/libbridge/libbridge.h index 39964f2..e7506e0 100644 --- a/libbridge/libbridge.h +++ b/libbridge/libbridge.h @@ -22,7 +22,9 @@ #include <sys/socket.h> #include <linux/if.h> #include <linux/if_bridge.h> - +#ifdef FEATURE_ANDROID +#include <sys/time.h> +#endif /* defined in net/if.h but that conflicts with linux/if.h... */ extern unsigned int if_nametoindex (const char *__ifname); extern char *if_indextoname (unsigned int __ifindex, char *__ifname); diff --git a/libbridge/libbridge_devif.c b/libbridge/libbridge_devif.c index 1e83925..99a0de0 100644 --- a/libbridge/libbridge_devif.c +++ b/libbridge/libbridge_devif.c @@ -23,8 +23,11 @@ #include <errno.h> #include <string.h> #include <dirent.h> +#ifndef FEATURE_ANDROID #include <sys/fcntl.h> - +#else +#include <fcntl.h> +#endif #include "libbridge.h" #include "libbridge_private.h" diff --git a/libbridge/libbridge_if.c b/libbridge/libbridge_if.c index 77d3f8a..3df9fd7 100644 --- a/libbridge/libbridge_if.c +++ b/libbridge/libbridge_if.c @@ -20,7 +20,11 @@ #include <stdlib.h> #include <errno.h> #include <string.h> +#ifndef FEATURE_ANDROID #include <sys/fcntl.h> +#else +#include <fcntl.h> +#endif #include <sys/ioctl.h> #include "libbridge.h" diff --git a/libbridge/libbridge_private.h b/libbridge/libbridge_private.h index 99a511d..f0fe394 100644 --- a/libbridge/libbridge_private.h +++ b/libbridge/libbridge_private.h @@ -18,9 +18,7 @@ #ifndef _LIBBRIDGE_PRIVATE_H #define _LIBBRIDGE_PRIVATE_H - #include "config.h" - #include <linux/sockios.h> #include <sys/time.h> #include <sys/ioctl.h> |