Enable host build for gralloc

bug: 116712605

- No libdl needed on host
- Define PAGE_SIZE
- Include gralloc in build

+ Consolidate a few build script conditionals
  in egl Android.mk
+ Remove unused Callstack.h

Change-Id: I2e5f8050971d41e7ae26910ce6bd43dad114e5c5
diff --git a/Android.mk b/Android.mk
index 0c8748e..97452fe 100644
--- a/Android.mk
+++ b/Android.mk
@@ -57,6 +57,7 @@
     -DANDROID \
     -DGL_GLEXT_PROTOTYPES \
     -fvisibility=default \
+    -DPAGE_SIZE=4096 \
 
 endif # GOLDFISH_OPENGL_BUILD_FOR_HOST
 
@@ -136,9 +137,10 @@
 include $(GOLDFISH_OPENGL_PATH)/system/GLESv1/Android.mk
 include $(GOLDFISH_OPENGL_PATH)/system/GLESv2/Android.mk
 
+include $(GOLDFISH_OPENGL_PATH)/system/gralloc/Android.mk
+
 ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
 
-include $(GOLDFISH_OPENGL_PATH)/system/gralloc/Android.mk
 include $(GOLDFISH_OPENGL_PATH)/system/egl/Android.mk
 
 endif # !GOLDFISH_OPENGL_BUILD_FOR_HOST
diff --git a/system/egl/Android.mk b/system/egl/Android.mk
index 9864e13..eab1c9c 100644
--- a/system/egl/Android.mk
+++ b/system/egl/Android.mk
@@ -13,16 +13,17 @@
     egl.cpp \
     ClientAPIExts.cpp
 
-ifdef IS_AT_LEAST_OPD1
-LOCAL_SHARED_LIBRARIES += libdl libnativewindow
-else
+ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
+
 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
 endif
@@ -34,6 +35,8 @@
 # Used to access the Bionic private OpenGL TLS slot
 LOCAL_C_INCLUDES += bionic/libc/private
 
+endif # !GOLDFISH_OPENGL_BUILD_FOR_HOST
+
 $(call emugl-end-module)
 
 #### egl.cfg ####
diff --git a/system/gralloc/Android.mk b/system/gralloc/Android.mk
index 190bfd6..88dd193 100644
--- a/system/gralloc/Android.mk
+++ b/system/gralloc/Android.mk
@@ -12,9 +12,11 @@
 
 LOCAL_SRC_FILES := gralloc.cpp
 
+ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
 # Need to access the special OPENGL TLS Slot
 LOCAL_C_INCLUDES += bionic/libc/private
 LOCAL_SHARED_LIBRARIES += libdl
+endif
 
 $$(call emugl-end-module)
 endef  # define gralloc_recipe
diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp
index 0c1b835..4f610c0 100644
--- a/system/gralloc/gralloc.cpp
+++ b/system/gralloc/gralloc.cpp
@@ -34,7 +34,6 @@
 #include "ProcessPipe.h"
 #include "ThreadInfo.h"
 #include "glUtils.h"
-#include <utils/CallStack.h>
 #include <cutils/log.h>
 #include <cutils/properties.h>