Merge "Create the AutoGoldfishDmaContext class"
diff --git a/Android.mk b/Android.mk
index 97452fe..be7551e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -125,12 +125,6 @@
 include $(GOLDFISH_OPENGL_PATH)/system/GLESv2_enc/Android.mk
 include $(GOLDFISH_OPENGL_PATH)/system/renderControl_enc/Android.mk
 
-# TODO: Get the rest of the libraries to build on host
-# From here, we require more android framework
-# reimplementations on host:
-# goldfish_dma
-# sockets
-# etc.
 include $(GOLDFISH_OPENGL_PATH)/system/OpenglSystemCommon/Android.mk
 
 # System shared libraries
@@ -139,10 +133,6 @@
 
 include $(GOLDFISH_OPENGL_PATH)/system/gralloc/Android.mk
 
-ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
-
 include $(GOLDFISH_OPENGL_PATH)/system/egl/Android.mk
 
-endif # !GOLDFISH_OPENGL_BUILD_FOR_HOST
-
 endif
diff --git a/system/OpenglSystemCommon/ThreadInfo_host.cpp b/system/OpenglSystemCommon/ThreadInfo_host.cpp
index 8492039..3fe5d58 100644
--- a/system/OpenglSystemCommon/ThreadInfo_host.cpp
+++ b/system/OpenglSystemCommon/ThreadInfo_host.cpp
@@ -15,6 +15,15 @@
 
 #include "android/base/threads/Thread.h"
 
+static bool sDefaultTlsDestructorCallback(__attribute__((__unused__)) void* ptr) {
+  return true;
+}
+static bool (*sTlsDestructorCallback)(void*) = sDefaultTlsDestructorCallback;
+
+void setTlsDestructor(tlsDtorCallback func) {
+    sTlsDestructorCallback = func;
+}
+
 EGLThreadInfo *goldfish_get_egl_tls()
 {
     return 0;
diff --git a/system/egl/Android.mk b/system/egl/Android.mk
index eab1c9c..80778bd 100644
--- a/system/egl/Android.mk
+++ b/system/egl/Android.mk
@@ -18,11 +18,6 @@
 LOCAL_SHARED_LIBRARIES += libdl
 endif
 
-ifdef IS_AT_LEAST_OPD1
-LOCAL_SHARED_LIBRARIES += libnativewindow
-LOCAL_STATIC_LIBRARIES += libarect
-endif
-
 ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
 ifdef IS_AT_LEAST_OPM1
 LOCAL_HEADER_LIBRARIES += libui_headers
@@ -30,6 +25,8 @@
 
 ifdef IS_AT_LEAST_OPD1
 LOCAL_HEADER_LIBRARIES += libnativebase_headers
+LOCAL_STATIC_LIBRARIES += libarect
+LOCAL_SHARED_LIBRARIES += libnativewindow
 endif
 
 # Used to access the Bionic private OpenGL TLS slot
diff --git a/system/egl/goldfish_sync.h b/system/egl/goldfish_sync.h
index 6d98270..ec29bee 100644
--- a/system/egl/goldfish_sync.h
+++ b/system/egl/goldfish_sync.h
@@ -15,6 +15,25 @@
 #ifndef ANDROID_INCLUDE_HARDWARE_GOLDFISH_SYNC_H
 #define ANDROID_INCLUDE_HARDWARE_GOLDFISH_SYNC_H
 
+#ifdef HOST_BUILD
+
+static __inline__ int goldfish_sync_open() {
+    return 0;
+}
+
+static __inline__ int goldfish_sync_close(int sync_fd) {
+    return 0;
+}
+
+static __inline__ int goldfish_sync_queue_work(int goldfish_sync_fd,
+                                                uint64_t host_glsync,
+                                                uint64_t host_thread,
+                                                int* fd_out) {
+    return 0;
+}
+
+#else
+
 #include <errno.h>
 #include <linux/ioctl.h>
 #include <linux/types.h>
@@ -80,4 +99,6 @@
     return err;
 }
 
+#endif // !HOST_BUILD
+
 #endif