aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-11-11 21:33:16 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-11-11 21:33:16 +0000
commit3f15f46db384dfd42ea2a3a4e173bc8939a3812e (patch)
treeb70dabdd050cf86bf2514482e379850908dfa018
parenta373f23216120dfa63ec6613ec99639880e35505 (diff)
parent0f0a929337d327faea386440b9934df833d55e9f (diff)
downloadkmod-3f15f46db384dfd42ea2a3a4e173bc8939a3812e.tar.gz
Snap for 6001391 from 0f0a929337d327faea386440b9934df833d55e9f to qt-aml-resolv-releaseandroid-mainline-10.0.0_r8android10-mainline-resolv-release
Change-Id: I0162fac370cb94d8f6fe82ec0296556c7034ce51
-rw-r--r--Android.bp56
-rw-r--r--port-gnu/config.h11
-rw-r--r--shared/missing.h2
3 files changed, 49 insertions, 20 deletions
diff --git a/Android.bp b/Android.bp
index 9ef1efb..2ebdd16 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,32 @@
-cc_binary_host {
+cc_defaults {
+ name: "libkmod_cflags_common",
+ local_include_dirs: ["port-gnu"],
+ cflags: [
+ "-include config.h",
+ "-ffunction-sections",
+ "-fdata-sections",
+ "-Wall",
+ "-Werror",
+ "-Wno-format",
+ "-Wno-unused-parameter",
+ "-Wno-unused-variable",
+ "-Dsecure_getenv=getenv",
+ "-DHAVE_CONFIG_H",
+ "-DANOTHER_BRICK_IN_THE",
+ "-DSYSCONFDIR=\"/tmp\"",
+ ],
+ target: {
+ linux_glibc: {
+ cflags: ["-DHAVE_DECL_STRNDUPA"]
+ }
+ }
+}
+
+cc_library_static {
+ defaults: ["libkmod_cflags_common"],
+ export_include_dirs: ["libkmod"],
+ host_supported: true,
+ name: "libkmod",
srcs: [
"libkmod/libkmod.c",
"libkmod/libkmod-file.c",
@@ -13,6 +41,14 @@ cc_binary_host {
"shared/util.c",
"shared/hash.c",
"shared/strbuf.c",
+ ],
+ visibility: ["//external/igt-gpu-tools"],
+}
+
+cc_binary_host {
+ defaults: ["libkmod_cflags_common"],
+ name: "depmod",
+ srcs: [
"tools/port.c",
"tools/depmod.c",
"tools/kmod.c",
@@ -26,21 +62,5 @@ cc_binary_host {
"tools/lsmod.c",
"tools/remove.c",
],
-
- name: "depmod",
- local_include_dirs: ["port-gnu"],
- cflags: [
- "-include config.h",
- "-ffunction-sections",
- "-fdata-sections",
- "-Wall",
- "-Werror",
- "-Wno-format",
- "-Wno-unused-parameter",
- "-Wno-unused-variable",
- "-Dsecure_getenv=getenv",
- "-DHAVE_CONFIG_H",
- "-DANOTHER_BRICK_IN_THE",
- "-DSYSCONFDIR=\"/tmp\"",
- ],
+ static_libs: ["libkmod"],
}
diff --git a/port-gnu/config.h b/port-gnu/config.h
index 8f527cb..eb4ce84 100644
--- a/port-gnu/config.h
+++ b/port-gnu/config.h
@@ -22,7 +22,7 @@
/* Define to 1 if you have the declaration of `strndupa', and to 0 if you
don't. */
-#define HAVE_DECL_STRNDUPA 1
+/* #define HAVE_DECL_STRNDUPA */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
@@ -181,3 +181,12 @@ char* basename(const char*);
#include <endian.h>
#endif
+
+#if defined(__ANDROID__)
+#include <stdlib.h>
+#include <unistd.h>
+static inline char *get_current_dir_name(void)
+{
+ return getcwd(malloc(PATH_MAX), PATH_MAX);
+}
+#endif
diff --git a/shared/missing.h b/shared/missing.h
index 4c0d136..72aaa95 100644
--- a/shared/missing.h
+++ b/shared/missing.h
@@ -33,7 +33,7 @@ static inline int finit_module(int fd, const char *uargs, int flags)
}
#endif
-#if !HAVE_DECL_STRNDUPA
+#if (!HAVE_DECL_STRNDUPA && !defined(__APPLE__))
#define strndupa(s, n) \
({ \
const char *__old = (s); \