diff --git a/src/android_stub/README.md b/src/android_stub/README.md new file mode 100644 index 00000000000..9c85e75c7a3 --- /dev/null +++ b/src/android_stub/README.md @@ -0,0 +1,5 @@ +The Android NDK doesn't come with enough of the platform libraries we +need to build Mesa drivers out of tree, so android_stub has stub +versions of those library that aren't installed which we link against, +relying on the real libraries to be present when the Mesa driver is +deployed. diff --git a/src/android_stub/android_stub.cpp b/src/android_stub/android_stub.cpp deleted file mode 100644 index f31e3cc0c37..00000000000 --- a/src/android_stub/android_stub.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include -#include - -extern "C" { - -int property_get(const char* key, char* value, const char* default_value) -{ - return 0; -} - -/* timeout in msecs */ -int sync_wait(int fd, int timeout) -{ - return 0; -} - -/* From hardware/hardware.h */ - -int hw_get_module(const char *id, const struct hw_module_t **module) -{ - return 0; -} - -/* From android/log.h */ - -int __android_log_print(int prio, const char* tag, const char* fmt, ...) -{ - return 0; -} - -int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) -{ - return 0; -} - -} - -/* From backtrace/Backtrace.h */ - -Backtrace* -Backtrace::Create(pid_t pid, pid_t tid, BacktraceMap* map) -{ - return NULL; -} - -std::string -backtrace_map_t::Name() const -{ - return ""; -} - diff --git a/src/android_stub/backtrace_stub.cpp b/src/android_stub/backtrace_stub.cpp new file mode 100644 index 00000000000..1b7f7efd644 --- /dev/null +++ b/src/android_stub/backtrace_stub.cpp @@ -0,0 +1,14 @@ +#include + +Backtrace* +Backtrace::Create(pid_t pid, pid_t tid, BacktraceMap* map) +{ + return NULL; +} + +std::string +backtrace_map_t::Name() const +{ + return ""; +} + diff --git a/src/android_stub/cutils_stub.cpp b/src/android_stub/cutils_stub.cpp new file mode 100644 index 00000000000..b660ec9d6d7 --- /dev/null +++ b/src/android_stub/cutils_stub.cpp @@ -0,0 +1,10 @@ +#include + +extern "C" { + +int property_get(const char* key, char* value, const char* default_value) +{ + return 0; +} + +} diff --git a/src/android_stub/hardware_stub.cpp b/src/android_stub/hardware_stub.cpp new file mode 100644 index 00000000000..4cb973fd2ac --- /dev/null +++ b/src/android_stub/hardware_stub.cpp @@ -0,0 +1,10 @@ +#include + +extern "C" { + +int hw_get_module(const char *id, const struct hw_module_t **module) +{ + return 0; +} + +} diff --git a/src/android_stub/log_stub.cpp b/src/android_stub/log_stub.cpp new file mode 100644 index 00000000000..29ba87b3748 --- /dev/null +++ b/src/android_stub/log_stub.cpp @@ -0,0 +1,15 @@ +#include + +extern "C" { + +int __android_log_print(int prio, const char* tag, const char* fmt, ...) +{ + return 0; +} + +int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) +{ + return 0; +} + +} diff --git a/src/android_stub/meson.build b/src/android_stub/meson.build index ad9abf50e03..a4dc349d28f 100644 --- a/src/android_stub/meson.build +++ b/src/android_stub/meson.build @@ -1,12 +1,16 @@ if with_android_stub - _libmesa_android_stub = static_library( - 'mesa_android_stub', - files('android_stub.cpp'), - include_directories : inc_include, - gnu_symbol_visibility : 'hidden', - ) + stub_libs = [] + + foreach lib : ['backtrace', 'cutils', 'hardware', 'log', 'sync'] + stub_libs += shared_library( + lib, + files(lib + '_stub.cpp'), + include_directories : inc_include, + install : false, + ) + endforeach dep_android = declare_dependency( - link_with : _libmesa_android_stub, + link_with : stub_libs, ) endif diff --git a/src/android_stub/sync_stub.cpp b/src/android_stub/sync_stub.cpp new file mode 100644 index 00000000000..963d928a47f --- /dev/null +++ b/src/android_stub/sync_stub.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include +#include + +extern "C" { + +/* timeout in msecs */ +int sync_wait(int fd, int timeout) +{ + return 0; +} + +int sync_merge(const char *name, int fd, int fd2) +{ + return 0; +} + +}