[PATCH] build: Add Android.mk script to build wayland libraries as external library of Android

mchalain [marc.chalain@gmail.com] marc.chalain at gmail.com
Mon Jul 15 09:05:35 PDT 2013


From: mchalain <marc.chalain at gmail.com>

The Wayland directory has to be inside "external" directory of Android tree.
On some old Android bionic version wayland needs an extra support for timerfd_create and signalfd. To pass this problem, I develop a "libglibcpatches" which implement this syscalls. You will can find this library on github repository. But this syscalls exist on the last version of bionic.
The libwayland_client allows to develop a FrameBuffer client for SurfaceFlinger of Android and to run Android over weston or other Wayland server.
The libwayland_server should allows to develop a compositor over SurfaceFlinger, but I never try.
---
 Android.mk |  127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 127 insertions(+)
 create mode 100644 Android.mk

diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..bd13692
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,127 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# the purpose of this sample is to demonstrate how one can
+# generate two distinct shared libraries and have them both
+# uploaded in
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+topdir=external
+ifneq ($(HAVE_SIGNALFD),y)
+GLIBCPATCHES_INCLUDES=$(topdir)/glibcpatches/include
+GLIBCPATCHES_LIBS=libglibcpatches
+endif
+ifeq ($(HAVE_RT),y)
+RT=-lrt
+endif
+
+# scanner, which compile protocol from xml file
+#
+include $(CLEAR_VARS)
+
+wayland_scanner = wayland-scanner
+LOCAL_MODULE    := $(wayland_scanner)
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES :=		\
+	src/wayland-util.c \
+	src/scanner.c
+LOCAL_SHARED_LIBRARIES := libexpat
+LOCAL_C_INCLUDES := $(topdir)/expat/lib
+
+include $(BUILD_HOST_EXECUTABLE)
+
+# util lib, which will be built statically
+#
+include $(CLEAR_VARS)
+
+LOCAL_MODULE    := libwayland-util
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES :=				\
+	src/connection.c				\
+	src/wayland-util.c				\
+	src/wayland-os.c
+LOCAL_C_INCLUDES := 		\
+			$(topdir)/libffi/$(ffi_os)-$(ffi_arch) \
+			$(LOCAL_PATH)/src \
+			$(GLIBCPATCHES_INCLUDES)
+LOCAL_SHARED_LIBRARIES := libffi $(GLIBCPATCHES_LIBS)
+include $(BUILD_STATIC_LIBRARY)
+
+# server lib, which will depend on and include the util
+#
+include $(CLEAR_VARS)
+
+LOCAL_MODULE    := libwayland_server
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_SRC_FILES := 			\
+	src/wayland-protocol.c			\
+	src/wayland-server-protocol.h	\
+	src/wayland-server.c			\
+	src/wayland-shm.c				\
+	src/data-device.c				\
+	src/event-loop.c
+LOCAL_CFLAGS := -I$(LOCAL_PATH)
+LOCAL_LDLIBS    += $(RT) -lm
+#LOCAL_LDFLAGS = \
+#	-Wl,-version-info,$(wayland_major):$(wayland_minor):$(wayland_micro)
+LOCAL_C_INCLUDES := 			\
+			$(topdir)/libffi/$(ffi_os)-$(ffi_arch) \
+			$(LOCAL_PATH)/src \
+			$(GLIBCPATCHES_INCLUDES)
+LOCAL_STATIC_LIBRARIES := libwayland-util
+LOCAL_SHARED_LIBRARIES := libffi $(GLIBCPATCHES_LIBS)
+
+include $(BUILD_SHARED_LIBRARY)
+
+# client lib, which will depend on and include the util
+#
+include $(CLEAR_VARS)
+
+LOCAL_MODULE    := libwayland_client
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES :=		\
+	src/wayland-protocol.c			\
+	src/wayland-client-protocol.h 	\
+	src/wayland-client.c
+LOCAL_LDLIBS    += $(RT) -lm
+#LOCAL_LDFLAGS = \
+#	-Wl,-version-info,$(wayland_major):$(wayland_minor):$(wayland_micro)
+LOCAL_STATIC_LIBRARIES := libwayland-util
+LOCAL_SHARED_LIBRARIES := libffi $(GLIBCPATCHES_LIBS)
+
+include $(BUILD_SHARED_LIBRARY)
+
+$(BUILD_SOURCES): $(wayland_scanner)
+$(LOCAL_PATH)/src/wayland-version.h:$(LOCAL_PATH)/src/wayland-version.h.in
+	sed "s/@WAYLAND_VERSION_MAJOR@/$(wayland_major)/" $< > $@
+	sed -i "s/@WAYLAND_VERSION_MINOR@/$(wayland_minor)/" $@ 
+	sed -i "s/@WAYLAND_VERSION_MICRO@/$(wayland_micro)/" $@
+	sed -i "s/@WAYLAND_VERSION@/$(wayland_version)/" $@
+$(LOCAL_PATH)/src/%-client-protocol.h: $(LOCAL_PATH)/protocol/%.xml
+	$(wayland_scanner) client-header < $< > $@
+$(LOCAL_PATH)/src/%-server-protocol.h: $(LOCAL_PATH)/protocol/%.xml
+	$(wayland_scanner) server-header < $< > $@
+$(LOCAL_PATH)/src/%-protocol.c: $(LOCAL_PATH)/protocol/%.xml \
+							$(LOCAL_PATH)/src/%-server-protocol.h \
+							$(LOCAL_PATH)/src/%-client-protocol.h \
+							$(LOCAL_PATH)/src/wayland-version.h
+	$(wayland_scanner) code < $< > $@
+
+BUILT_SOURCES =	$(addprefix $(LOCAL_PATH)/src/,	\
+	wayland-protocol.c \
+	)
-- 
1.7.9.5



More information about the wayland-devel mailing list