diff options
author | Garfield Tan <xutan@google.com> | 2017-10-11 14:19:38 -0700 |
---|---|---|
committer | Garfield Tan <xutan@google.com> | 2017-10-13 22:47:11 +0000 |
commit | 64bee9283291c272b89686cf7f0849bef7f1f88f (patch) | |
tree | 9eac89e7598f203b4f57f84e5dec5b9feafc6c64 | |
parent | 854658bf44d01f3aab43c06b2bfac3b01afacc1d (diff) | |
download | wayland-64bee9283291c272b89686cf7f0849bef7f1f88f.tar.gz |
Convert Android.mk to Android.bp.
Test: None. libffi is not correct in master.
Change-Id: I721189e57d92ec69f4faa862e9ff0463da72ac06
-rw-r--r-- | Android.bp | 92 | ||||
-rw-r--r-- | Android.mk | 124 | ||||
-rwxr-xr-x | gen_wayland_version_header.sh | 33 |
3 files changed, 125 insertions, 124 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..a3e9f7b --- /dev/null +++ b/Android.bp @@ -0,0 +1,92 @@ +// Copyright (C) 2017 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. + +cc_defaults { + name: "wayland_defaults", + + cflags: [ + "-Wall", + "-Wextra", + "-Wno-unused-parameter", + "-g", + "-Wstrict-prototypes", + "-Wmissing-prototypes", + "-fvisibility=hidden", + "-Wno-pointer-arith", + ], +} + +// Generate wayland-version.h +genrule { + name: "wayland_version_header", + cmd: "$(location gen_wayland_version_header.sh) $(location configure.ac) < $(in) > $(out)", + srcs: ["src/wayland-version.h.in"], + out: ["wayland-version.h"], + tool_files: ["gen_wayland_version_header.sh", "configure.ac"], +} + +// Build wayland_scanner, used to generate code +cc_binary_host { + name: "wayland_scanner", + defaults: ["wayland_defaults"], + srcs: ["src/scanner.c", "src/wayland-util.c"], + static_libs: ["libexpat"], + generated_headers: ["wayland_version_header"], +} + +// Copy XML protocols to generated source folders +wayland_protocol = ["protocol/wayland.xml"] +genrule { + name: "wayland_protocols", + cmd: "cp $(in) $(genDir)", + srcs: wayland_protocol, + out: ["wayland.xml"], + tool_files: ["."], +} + +// Generate protocol source files +genrule { + name: "wayland_protocol_sources", + cmd: "$(location wayland_scanner) code < $(in) > $(out)", + srcs: [":wayland_protocols"], + out: ["wayland-protocol.c"], + tools: ["wayland_scanner"], +} + +// Generate protocol header files +genrule { + name: "wayland_protocol_headers", + cmd: "$(location wayland_scanner) client-header < $(in) > $(out)", + srcs: [":wayland_protocols"], + out: ["wayland-client-protocol.h"], + tools: ["wayland_scanner"], +} + +// Build wayland_client +cc_library_static { + name: "libwayland_client", + defaults: ["wayland_defaults"], + srcs: [ + "src/connection.c", + "src/wayland-client.c", + "src/wayland-os.c", + "src/wayland-util.c", + ], + generated_sources: ["wayland_protocol_sources"], + static_libs: ["libffi"], + local_include_dirs: ["src"], + generated_headers: ["wayland_version_header", "wayland_protocol_headers"], + export_include_dirs: ["src"], + export_generated_headers: ["wayland_version_header"], +} diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 268254e..0000000 --- a/Android.mk +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright (C) 2015 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. - -LOCAL_PATH := $(call my-dir) - -WAYLAND_CFLAGS := -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -WAYLAND_CFLAGS += -Wmissing-prototypes -fvisibility=hidden -Wno-pointer-arith - -############################################################################### -# Build wayland_scanner, used to generate code - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - src/scanner.c \ - src/wayland-util.c \ - -LOCAL_STATIC_LIBRARIES := \ - libexpat \ - -LOCAL_C_INCLUDES := \ - external/expat/lib \ - -LOCAL_CFLAGS += $(WAYLAND_CFLAGS) - -# These files are generated, and we must make them a dependency to ensure they -# are generated before we try to include them. -LOCAL_ADDITIONAL_DEPENDENCIES += \ - src/wayland-version.h \ - -LOCAL_MODULE := wayland_scanner -LOCAL_MODULE_TAGS := optional -include $(BUILD_HOST_EXECUTABLE) - - -############################################################################### -# Build libwayland_client - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - src/connection.c \ - src/wayland-client.c \ - src/wayland-os.c \ - src/wayland-util.c \ - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/src \ - -LOCAL_STATIC_LIBRARIES := \ - libffi \ - -LOCAL_CFLAGS += $(WAYLAND_CFLAGS) - -LOCAL_MODULE := libwayland_client -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_CLASS := STATIC_LIBRARIES -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src - -# Export a list of all included protocols for convenience. -ALL_MODULES.$(LOCAL_MODULE).PROTOCOLS := \ - $(LOCAL_PATH)/protocol/wayland.xml \ - -# --- Generate the client protocol implementation data -generated_sources := $(call local-generated-sources-dir) -GEN := $(addprefix $(generated_sources)/, \ - wayland-protocol.c \ - ) -LOCAL_GENERATED_SOURCES += $(GEN) -$(GEN) : PRIVATE_PATH := $(LOCAL_PATH) -$(GEN) : PRIVATE_CUSTOM_TOOL = $(HOST_OUT_EXECUTABLES)/wayland_scanner code < $< > $@ -$(GEN) : $(HOST_OUT_EXECUTABLES)/wayland_scanner -$(GEN) : $(generated_sources)/%-protocol.c : $(LOCAL_PATH)/protocol/%.xml - $(transform-generated-source) -# Note: The line above must be indented with tabs. - -# --- Generate the client protocol headers -# We must put the output where the users of the library can see it. -GEN := $(addprefix $(LOCAL_PATH)/src/, \ - wayland-client-protocol.h \ - ) -LOCAL_ADDITIONAL_DEPENDENCIES += $(GEN) -$(GEN) : PRIVATE_PATH := $(LOCAL_PATH) -$(GEN) : PRIVATE_CUSTOM_TOOL = $(HOST_OUT_EXECUTABLES)/wayland_scanner client-header < $< > $@ -$(GEN) : $(HOST_OUT_EXECUTABLES)/wayland_scanner -$(GEN) : $(LOCAL_PATH)/src/%-client-protocol.h : $(LOCAL_PATH)/protocol/%.xml - $(transform-generated-source) -# Note: The line above must be indented with tabs. - -# --- Generate wayland-version.h from wayland-version.h.in -# This process does some simple text substitution based on values defined in configure.ac -# We must put the output where the users of the library can see it. -GEN := $(addprefix $(LOCAL_PATH)/src/, \ - wayland-version.h \ - ) -LOCAL_ADDITIONAL_DEPENDENCIES += $(GEN) -$(GEN) : PRIVATE_PATH := $(LOCAL_PATH) -$(GEN) : PRIVATE_CUSTOM_TOOL = \ - export WAYLAND_VERSION_MAJOR=$$(grep -o -E 'define..wayland_major_version.+' $(PRIVATE_PATH)/configure.ac | grep -o -E '[0-9]+') ; \ - export WAYLAND_VERSION_MINOR=$$(grep -o -E 'define..wayland_minor_version.+' $(PRIVATE_PATH)/configure.ac | grep -o -E '[0-9]+') ; \ - export WAYLAND_VERSION_MICRO=$$(grep -o -E 'define..wayland_micro_version.+' $(PRIVATE_PATH)/configure.ac | grep -o -E '[0-9]+') ; \ - export WAYLAND_VERSION="$${WAYLAND_VERSION_MAJOR}.$${WAYLAND_VERSION_MINOR}.$${WAYLAND_VERSION_MICRO}" ; \ - sed \ - -e s/@WAYLAND_VERSION_MAJOR@/$${WAYLAND_VERSION_MAJOR}/ \ - -e s/@WAYLAND_VERSION_MINOR@/$${WAYLAND_VERSION_MINOR}/ \ - -e s/@WAYLAND_VERSION_MICRO@/$${WAYLAND_VERSION_MICRO}/ \ - -e s/@WAYLAND_VERSION_MICRO@/$${WAYLAND_VERSION_MICRO}/ \ - -e s/@WAYLAND_VERSION@/$${WAYLAND_VERSION}/ < $< > $@ -$(GEN) : $(LOCAL_PATH)/src/%.h : $(LOCAL_PATH)/src/%.h.in | $(LOCAL_PATH)/configure.ac - $(transform-generated-source) -# Note: The line above must be indented with tabs. - -include $(BUILD_STATIC_LIBRARY) diff --git a/gen_wayland_version_header.sh b/gen_wayland_version_header.sh new file mode 100755 index 0000000..c7d08d6 --- /dev/null +++ b/gen_wayland_version_header.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright (C) 2017 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. + +if [[ $# -ne 1 ]]; then + echo "Usage: gen_wayland_version_header.sh <path_to_configure.ac>\ + < wayland_version.h.in > wayland_version.h" >&2 + exit 1 +fi + +set -e +CONFIGURE_AC="$1" +WAYLAND_VERSION_MAJOR="$(grep -o -E 'define..wayland_major_version.+' ${CONFIGURE_AC} | grep -o -E '[0-9]+')" +WAYLAND_VERSION_MINOR="$(grep -o -E 'define..wayland_minor_version.+' ${CONFIGURE_AC} | grep -o -E '[0-9]+')" +WAYLAND_VERSION_MICRO="$(grep -o -E 'define..wayland_micro_version.+' ${CONFIGURE_AC} | grep -o -E '[0-9]+')" +WAYLAND_VERSION="${WAYLAND_VERSION_MAJOR}.${WAYLAND_VERSION_MINOR}.${WAYLAND_VERSION_MICRO}" ; \ +sed \ + -e s/@WAYLAND_VERSION_MAJOR@/${WAYLAND_VERSION_MAJOR}/ \ + -e s/@WAYLAND_VERSION_MINOR@/${WAYLAND_VERSION_MINOR}/ \ + -e s/@WAYLAND_VERSION_MICRO@/${WAYLAND_VERSION_MICRO}/ \ + -e s/@WAYLAND_VERSION_MICRO@/${WAYLAND_VERSION_MICRO}/ \ + -e s/@WAYLAND_VERSION@/${WAYLAND_VERSION}/ |