diff mbox series

libdrm: Convert to Android.mk to Android.bp

Message ID 20190924212920.76103-1-john.stultz@linaro.org
State New
Headers show
Series libdrm: Convert to Android.mk to Android.bp | expand

Commit Message

John Stultz Sept. 24, 2019, 9:29 p.m. UTC
This patch removes the deprecated Android.mk files and replaces
them with Android.bp files, used in Android N and newer
releases.

This is needed in order to build libdrm/master against recent
Android releases and AOSP/master, as some of the Treble build
options required since Android O cannot be expressed in
Andorid.mk files.

Patch originally by Dan Willemsen with fixes folded in by:
 Jerry Zhang, Eliott Hughes and myself.

While this does cost comptability with older pre Android N
releases, I'd contend that being able to build/test
libdrm/master against AOSP/master and recent releases is more
valuable then soley maintaining support for old and unsupported
Android releases.

With this change, the only patches carried by Android for libdrm
would be the gerrit OWNERS meta-data file.

Cc: Mauro Rossi <issor.oruam@gmail.com>
Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Rob Clark <robdclark@chromium.org>
Cc: Eric Anholt <anholt@google.com>
Cc: Jiyong Park <jiyong@google.com>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Dan Willemsen <dwillemsen@google.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Vishal Bhoj <vishal.bhoj@linaro.org>
Acked-by: Eric Anholt <eric@anholt.net>

Acked-by: Eric Engestrom <eric@engestrom.ch>

Signed-off-by: John Stultz <john.stultz@linaro.org>

---
 Android.bp                        | 66 +++++++++++++++++++++++++++
 Android.common.mk                 | 19 --------
 Android.mk                        | 74 -------------------------------
 Android.sources.bp                | 12 +++++
 Android.sources.bp.mk             | 25 +++++++++++
 amdgpu/Android.bp                 | 16 +++++++
 amdgpu/Android.mk                 | 19 --------
 amdgpu/Android.sources.bp         | 15 +++++++
 data/Android.bp                   |  6 +++
 data/Android.mk                   | 10 -----
 etnaviv/Android.bp                | 11 +++++
 etnaviv/Android.mk                | 14 ------
 etnaviv/Android.sources.bp        | 13 ++++++
 freedreno/Android.bp              | 11 +++++
 freedreno/Android.mk              | 14 ------
 freedreno/Android.sources.bp      | 16 +++++++
 intel/Android.bp                  | 36 +++++++++++++++
 intel/Android.mk                  | 38 ----------------
 intel/Android.sources.bp          | 13 ++++++
 libkms/Android.bp                 | 15 +++++++
 libkms/Android.mk                 | 51 ---------------------
 libkms/Android.sources.bp         | 38 ++++++++++++++++
 nouveau/Android.bp                | 11 +++++
 nouveau/Android.mk                | 14 ------
 nouveau/Android.sources.bp        | 11 +++++
 omap/Android.bp                   | 12 +++++
 omap/Android.mk                   | 13 ------
 omap/Android.sources.bp           |  8 ++++
 radeon/Android.bp                 | 11 +++++
 radeon/Android.mk                 | 14 ------
 radeon/Android.sources.bp         | 13 ++++++
 tegra/Android.bp                  | 14 ++++++
 tests/Android.bp                  |  6 +++
 tests/Android.mk                  |  1 -
 tests/modetest/Android.bp         | 12 +++++
 tests/modetest/Android.mk         | 14 ------
 tests/modetest/Android.sources.bp | 10 +++++
 tests/proptest/Android.bp         |  8 ++++
 tests/proptest/Android.mk         | 14 ------
 tests/util/Android.bp             | 35 +++++++++++++++
 tests/util/Android.mk             | 38 ----------------
 tests/util/Android.sources.bp     | 10 +++++
 42 files changed, 454 insertions(+), 347 deletions(-)
 create mode 100644 Android.bp
 delete mode 100644 Android.common.mk
 delete mode 100644 Android.mk
 create mode 100644 Android.sources.bp
 create mode 100644 Android.sources.bp.mk
 create mode 100644 amdgpu/Android.bp
 delete mode 100644 amdgpu/Android.mk
 create mode 100644 amdgpu/Android.sources.bp
 create mode 100644 data/Android.bp
 delete mode 100644 data/Android.mk
 create mode 100644 etnaviv/Android.bp
 delete mode 100644 etnaviv/Android.mk
 create mode 100644 etnaviv/Android.sources.bp
 create mode 100644 freedreno/Android.bp
 delete mode 100644 freedreno/Android.mk
 create mode 100644 freedreno/Android.sources.bp
 create mode 100644 intel/Android.bp
 delete mode 100644 intel/Android.mk
 create mode 100644 intel/Android.sources.bp
 create mode 100644 libkms/Android.bp
 delete mode 100644 libkms/Android.mk
 create mode 100644 libkms/Android.sources.bp
 create mode 100644 nouveau/Android.bp
 delete mode 100644 nouveau/Android.mk
 create mode 100644 nouveau/Android.sources.bp
 create mode 100644 omap/Android.bp
 delete mode 100644 omap/Android.mk
 create mode 100644 omap/Android.sources.bp
 create mode 100644 radeon/Android.bp
 delete mode 100644 radeon/Android.mk
 create mode 100644 radeon/Android.sources.bp
 create mode 100644 tegra/Android.bp
 create mode 100644 tests/Android.bp
 delete mode 100644 tests/Android.mk
 create mode 100644 tests/modetest/Android.bp
 delete mode 100644 tests/modetest/Android.mk
 create mode 100644 tests/modetest/Android.sources.bp
 create mode 100644 tests/proptest/Android.bp
 delete mode 100644 tests/proptest/Android.mk
 create mode 100644 tests/util/Android.bp
 delete mode 100644 tests/util/Android.mk
 create mode 100644 tests/util/Android.sources.bp

-- 
2.17.1

Comments

Robert Foss Sept. 24, 2019, 9:51 p.m. UTC | #1
Thanks for submitting this.

Acked-by: Robert Foss <robert.foss@collabora.com>

On 24.09.19 23:29, John Stultz wrote:
> This patch removes the deprecated Android.mk files and replaces
> them with Android.bp files, used in Android N and newer
> releases.
> 
> This is needed in order to build libdrm/master against recent
> Android releases and AOSP/master, as some of the Treble build
> options required since Android O cannot be expressed in
> Andorid.mk files.
> 
> Patch originally by Dan Willemsen with fixes folded in by:
>   Jerry Zhang, Eliott Hughes and myself.
> 
> While this does cost comptability with older pre Android N
> releases, I'd contend that being able to build/test
> libdrm/master against AOSP/master and recent releases is more
> valuable then soley maintaining support for old and unsupported
> Android releases.
> 
> With this change, the only patches carried by Android for libdrm
> would be the gerrit OWNERS meta-data file.
> 
> Cc: Mauro Rossi <issor.oruam@gmail.com>
> Cc: Chih-Wei Huang <cwhuang@android-x86.org>
> Cc: Robert Foss <robert.foss@collabora.com>
> Cc: Tapani Pälli <tapani.palli@intel.com>
> Cc: Chih-Wei Huang <cwhuang@android-x86.org>
> Cc: Emil Velikov <emil.velikov@collabora.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: Rob Clark <robdclark@chromium.org>
> Cc: Eric Anholt <anholt@google.com>
> Cc: Jiyong Park <jiyong@google.com>
> Cc: Alistair Strachan <astrachan@google.com>
> Cc: Dan Willemsen <dwillemsen@google.com>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Vishal Bhoj <vishal.bhoj@linaro.org>
> Acked-by: Eric Anholt <eric@anholt.net>
> Acked-by: Eric Engestrom <eric@engestrom.ch>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>   Android.bp                        | 66 +++++++++++++++++++++++++++
>   Android.common.mk                 | 19 --------
>   Android.mk                        | 74 -------------------------------
>   Android.sources.bp                | 12 +++++
>   Android.sources.bp.mk             | 25 +++++++++++
>   amdgpu/Android.bp                 | 16 +++++++
>   amdgpu/Android.mk                 | 19 --------
>   amdgpu/Android.sources.bp         | 15 +++++++
>   data/Android.bp                   |  6 +++
>   data/Android.mk                   | 10 -----
>   etnaviv/Android.bp                | 11 +++++
>   etnaviv/Android.mk                | 14 ------
>   etnaviv/Android.sources.bp        | 13 ++++++
>   freedreno/Android.bp              | 11 +++++
>   freedreno/Android.mk              | 14 ------
>   freedreno/Android.sources.bp      | 16 +++++++
>   intel/Android.bp                  | 36 +++++++++++++++
>   intel/Android.mk                  | 38 ----------------
>   intel/Android.sources.bp          | 13 ++++++
>   libkms/Android.bp                 | 15 +++++++
>   libkms/Android.mk                 | 51 ---------------------
>   libkms/Android.sources.bp         | 38 ++++++++++++++++
>   nouveau/Android.bp                | 11 +++++
>   nouveau/Android.mk                | 14 ------
>   nouveau/Android.sources.bp        | 11 +++++
>   omap/Android.bp                   | 12 +++++
>   omap/Android.mk                   | 13 ------
>   omap/Android.sources.bp           |  8 ++++
>   radeon/Android.bp                 | 11 +++++
>   radeon/Android.mk                 | 14 ------
>   radeon/Android.sources.bp         | 13 ++++++
>   tegra/Android.bp                  | 14 ++++++
>   tests/Android.bp                  |  6 +++
>   tests/Android.mk                  |  1 -
>   tests/modetest/Android.bp         | 12 +++++
>   tests/modetest/Android.mk         | 14 ------
>   tests/modetest/Android.sources.bp | 10 +++++
>   tests/proptest/Android.bp         |  8 ++++
>   tests/proptest/Android.mk         | 14 ------
>   tests/util/Android.bp             | 35 +++++++++++++++
>   tests/util/Android.mk             | 38 ----------------
>   tests/util/Android.sources.bp     | 10 +++++
>   42 files changed, 454 insertions(+), 347 deletions(-)
>   create mode 100644 Android.bp
>   delete mode 100644 Android.common.mk
>   delete mode 100644 Android.mk
>   create mode 100644 Android.sources.bp
>   create mode 100644 Android.sources.bp.mk
>   create mode 100644 amdgpu/Android.bp
>   delete mode 100644 amdgpu/Android.mk
>   create mode 100644 amdgpu/Android.sources.bp
>   create mode 100644 data/Android.bp
>   delete mode 100644 data/Android.mk
>   create mode 100644 etnaviv/Android.bp
>   delete mode 100644 etnaviv/Android.mk
>   create mode 100644 etnaviv/Android.sources.bp
>   create mode 100644 freedreno/Android.bp
>   delete mode 100644 freedreno/Android.mk
>   create mode 100644 freedreno/Android.sources.bp
>   create mode 100644 intel/Android.bp
>   delete mode 100644 intel/Android.mk
>   create mode 100644 intel/Android.sources.bp
>   create mode 100644 libkms/Android.bp
>   delete mode 100644 libkms/Android.mk
>   create mode 100644 libkms/Android.sources.bp
>   create mode 100644 nouveau/Android.bp
>   delete mode 100644 nouveau/Android.mk
>   create mode 100644 nouveau/Android.sources.bp
>   create mode 100644 omap/Android.bp
>   delete mode 100644 omap/Android.mk
>   create mode 100644 omap/Android.sources.bp
>   create mode 100644 radeon/Android.bp
>   delete mode 100644 radeon/Android.mk
>   create mode 100644 radeon/Android.sources.bp
>   create mode 100644 tegra/Android.bp
>   create mode 100644 tests/Android.bp
>   delete mode 100644 tests/Android.mk
>   create mode 100644 tests/modetest/Android.bp
>   delete mode 100644 tests/modetest/Android.mk
>   create mode 100644 tests/modetest/Android.sources.bp
>   create mode 100644 tests/proptest/Android.bp
>   delete mode 100644 tests/proptest/Android.mk
>   create mode 100644 tests/util/Android.bp
>   delete mode 100644 tests/util/Android.mk
>   create mode 100644 tests/util/Android.sources.bp
> 
> diff --git a/Android.bp b/Android.bp
> new file mode 100644
> index 00000000..6fe434c6
> --- /dev/null
> +++ b/Android.bp
> @@ -0,0 +1,66 @@
> +//
> +// Copyright © 2011-2012 Intel Corporation
> +//
> +// Permission is hereby granted, free of charge, to any person obtaining a
> +// copy of this software and associated documentation files (the "Software"),
> +// to deal in the Software without restriction, including without limitation
> +// the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +// and/or sell copies of the Software, and to permit persons to whom the
> +// Software is furnished to do so, subject to the following conditions:
> +//
> +// The above copyright notice and this permission notice (including the next
> +// paragraph) shall be included in all copies or substantial portions of the
> +// Software.
> +//
> +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> +// IN THE SOFTWARE.
> +//
> +
> +subdirs = ["*"]
> +build = ["Android.sources.bp"]
> +
> +cc_defaults {
> +    name: "libdrm_defaults",
> +    cflags: [
> +        // XXX: Consider moving these to config.h analogous to autoconf.
> +        "-DMAJOR_IN_SYSMACROS=1",
> +        "-DHAVE_VISIBILITY=1",
> +        "-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1",
> +
> +        "-Wall",
> +        "-Werror",
> +        "-Wno-deprecated-declarations",
> +        "-Wno-format",
> +        "-Wno-gnu-variable-sized-type-not-at-end",
> +        "-Wno-pointer-arith",
> +        "-Wno-unused-parameter",
> +        "-Wno-unused-variable",
> +        "-Wno-missing-field-initializers",
> +    ],
> +    export_include_dirs: ["."],
> +}
> +
> +// Library for the device
> +cc_library {
> +    name: "libdrm",
> +    recovery_available: true,
> +    vendor_available: true,
> +    defaults: [
> +        "libdrm_defaults",
> +        "libdrm_sources",
> +    ],
> +
> +    export_include_dirs: ["include/drm", "android"],
> +
> +    cflags: [
> +        "-Wno-enum-conversion",
> +        "-Wno-pointer-arith",
> +        "-Wno-sign-compare",
> +        "-Wno-tautological-compare",
> +    ],
> +}
> diff --git a/Android.common.mk b/Android.common.mk
> deleted file mode 100644
> index d0e5d559..00000000
> --- a/Android.common.mk
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -# XXX: Consider moving these to config.h analogous to autoconf.
> -LOCAL_CFLAGS += \
> -	-DMAJOR_IN_SYSMACROS=1 \
> -	-DHAVE_VISIBILITY=1 \
> -	-fvisibility=hidden \
> -	-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
> -
> -LOCAL_CFLAGS += \
> -	-Wno-error \
> -	-Wno-unused-parameter \
> -	-Wno-missing-field-initializers \
> -	-Wno-pointer-arith \
> -	-Wno-enum-conversion
> -
> -# Quiet down the build system and remove any .h files from the sources
> -LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES))
> -LOCAL_EXPORT_C_INCLUDE_DIRS += $(LOCAL_PATH)
> -
> -LOCAL_PROPRIETARY_MODULE := true
> diff --git a/Android.mk b/Android.mk
> deleted file mode 100644
> index 0ab6f0f9..00000000
> --- a/Android.mk
> +++ /dev/null
> @@ -1,74 +0,0 @@
> -#
> -# Copyright © 2011-2012 Intel Corporation
> -#
> -# Permission is hereby granted, free of charge, to any person obtaining a
> -# copy of this software and associated documentation files (the "Software"),
> -# to deal in the Software without restriction, including without limitation
> -# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> -# and/or sell copies of the Software, and to permit persons to whom the
> -# Software is furnished to do so, subject to the following conditions:
> -#
> -# The above copyright notice and this permission notice (including the next
> -# paragraph) shall be included in all copies or substantial portions of the
> -# Software.
> -#
> -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> -# IN THE SOFTWARE.
> -#
> -
> -LIBDRM_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
> -ifneq ($(filter 2 4, $(LIBDRM_ANDROID_MAJOR_VERSION)),)
> -$(error "Android 4.4 and earlier not supported")
> -endif
> -
> -LIBDRM_COMMON_MK := $(call my-dir)/Android.common.mk
> -
> -LOCAL_PATH := $(call my-dir)
> -LIBDRM_TOP := $(LOCAL_PATH)
> -
> -include $(CLEAR_VARS)
> -
> -# Import variables LIBDRM_{,H,INCLUDE_H,INCLUDE_ANDROID_H,INCLUDE_VMWGFX_H}_FILES
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -#static library for the device (recovery)
> -include $(CLEAR_VARS)
> -LOCAL_MODULE := libdrm
> -
> -LOCAL_SRC_FILES := $(LIBDRM_FILES)
> -LOCAL_EXPORT_C_INCLUDE_DIRS := \
> -	$(LOCAL_PATH) \
> -	$(LOCAL_PATH)/include/drm \
> -	$(LOCAL_PATH)/android
> -
> -LOCAL_C_INCLUDES := \
> -	$(LOCAL_PATH)/include/drm
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_STATIC_LIBRARY)
> -
> -# Shared library for the device
> -include $(CLEAR_VARS)
> -LOCAL_MODULE := libdrm
> -
> -LOCAL_SRC_FILES := $(LIBDRM_FILES)
> -LOCAL_EXPORT_C_INCLUDE_DIRS := \
> -	$(LOCAL_PATH) \
> -	$(LOCAL_PATH)/include/drm \
> -	$(LOCAL_PATH)/android
> -
> -LOCAL_SHARED_LIBRARIES := \
> -	libcutils
> -
> -LOCAL_C_INCLUDES := \
> -        $(LOCAL_PATH)/include/drm
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_SHARED_LIBRARY)
> -
> -include $(call all-makefiles-under,$(LOCAL_PATH))
> diff --git a/Android.sources.bp b/Android.sources.bp
> new file mode 100644
> index 00000000..73356dd8
> --- /dev/null
> +++ b/Android.sources.bp
> @@ -0,0 +1,12 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libdrm_sources",
> +    srcs: [
> +        "xf86drm.c",
> +        "xf86drmHash.c",
> +        "xf86drmRandom.c",
> +        "xf86drmSL.c",
> +        "xf86drmMode.c",
> +    ],
> +}
> diff --git a/Android.sources.bp.mk b/Android.sources.bp.mk
> new file mode 100644
> index 00000000..26b61c1e
> --- /dev/null
> +++ b/Android.sources.bp.mk
> @@ -0,0 +1,25 @@
> +# Usage: make -f path/to/Android.sources.bp.mk NAMES=<> >Android.sources.bp
> +#
> +# It will read the Makefile.sources in the current directory, and
> +# write <NAME>_FILES to stdout as an Android.bp cc_defaults module.
> +
> +.PHONY: all
> +all:
> +	@# Do nothing
> +
> +include Makefile.sources
> +
> +empty :=
> +indent := $(empty)    $(empty)
> +
> +$(info // Autogenerated with Android.sources.bp.mk)
> +$(foreach NAME,$(NAMES), \
> +  $(eval lower_name := $(shell echo $(PREFIX)$(NAME) | tr 'A-Z' 'a-z')) \
> +  $(info ) \
> +  $(info cc_defaults {) \
> +  $(info $(indent)name: "$(lower_name)_sources",) \
> +  $(info $(indent)srcs: [) \
> +  $(foreach f,$(filter %.c,$($(NAME)_FILES)), \
> +    $(info $(indent)$(indent)"$(f)",)) \
> +  $(info $(indent)],) \
> +  $(info }))
> diff --git a/amdgpu/Android.bp b/amdgpu/Android.bp
> new file mode 100644
> index 00000000..976f03e9
> --- /dev/null
> +++ b/amdgpu/Android.bp
> @@ -0,0 +1,16 @@
> +build = ["Android.sources.bp"]
> +
> +cc_library_shared {
> +    name: "libdrm_amdgpu",
> +
> +    cflags: [
> +	"-DAMDGPU_ASIC_ID_TABLE=\"/vendor/etc/hwdata/amdgpu.ids\""
> +    ],
> +
> +    defaults: [
> +        "libdrm_defaults",
> +        "libdrm_amdgpu_sources",
> +    ],
> +    vendor: true,
> +    shared_libs: ["libdrm"],
> +}
> diff --git a/amdgpu/Android.mk b/amdgpu/Android.mk
> deleted file mode 100644
> index 1f028d0b..00000000
> --- a/amdgpu/Android.mk
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -LOCAL_PATH := $(call my-dir)
> -include $(CLEAR_VARS)
> -
> -# Import variables LIBDRM_AMDGPU_FILES, LIBDRM_AMDGPU_H_FILES
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_MODULE := libdrm_amdgpu
> -
> -LOCAL_SHARED_LIBRARIES := libdrm
> -
> -LOCAL_SRC_FILES := $(LIBDRM_AMDGPU_FILES)
> -
> -LOCAL_CFLAGS := \
> -	-DAMDGPU_ASIC_ID_TABLE=\"/vendor/etc/hwdata/amdgpu.ids\"
> -
> -LOCAL_REQUIRED_MODULES := amdgpu.ids
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_SHARED_LIBRARY)
> diff --git a/amdgpu/Android.sources.bp b/amdgpu/Android.sources.bp
> new file mode 100644
> index 00000000..be85283d
> --- /dev/null
> +++ b/amdgpu/Android.sources.bp
> @@ -0,0 +1,15 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libdrm_amdgpu_sources",
> +    srcs: [
> +	"amdgpu_asic_id.c",
> +        "amdgpu_bo.c",
> +        "amdgpu_cs.c",
> +        "amdgpu_device.c",
> +        "amdgpu_gpu_info.c",
> +        "amdgpu_vamgr.c",
> +	"amdgpu_vm.c",
> +        "handle_table.c",
> +    ],
> +}
> diff --git a/data/Android.bp b/data/Android.bp
> new file mode 100644
> index 00000000..47f64371
> --- /dev/null
> +++ b/data/Android.bp
> @@ -0,0 +1,6 @@
> +prebuilt_etc {
> +    name: "amdgpu.ids",
> +    proprietary: true,
> +    sub_dir: "hwdata",
> +    src: "amdgpu.ids",
> +}
> diff --git a/data/Android.mk b/data/Android.mk
> deleted file mode 100644
> index 62013f0c..00000000
> --- a/data/Android.mk
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -LOCAL_PATH := $(call my-dir)
> -
> -include $(CLEAR_VARS)
> -LOCAL_MODULE := amdgpu.ids
> -LOCAL_MODULE_TAGS := optional
> -LOCAL_MODULE_CLASS := ETC
> -LOCAL_PROPRIETARY_MODULE := true
> -LOCAL_MODULE_RELATIVE_PATH := hwdata
> -LOCAL_SRC_FILES := $(LOCAL_MODULE)
> -include $(BUILD_PREBUILT)
> diff --git a/etnaviv/Android.bp b/etnaviv/Android.bp
> new file mode 100644
> index 00000000..21deda99
> --- /dev/null
> +++ b/etnaviv/Android.bp
> @@ -0,0 +1,11 @@
> +build = ["Android.sources.bp"]
> +
> +cc_library_shared {
> +    name: "libdrm_etnaviv",
> +    defaults: [
> +        "libdrm_defaults",
> +        "libdrm_etnaviv_sources",
> +    ],
> +    vendor: true,
> +    shared_libs: ["libdrm"],
> +}
> diff --git a/etnaviv/Android.mk b/etnaviv/Android.mk
> deleted file mode 100644
> index 390f9a98..00000000
> --- a/etnaviv/Android.mk
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -LOCAL_PATH := $(call my-dir)
> -include $(CLEAR_VARS)
> -
> -# Import variables LIBDRM_ETNAVIV_FILES, LIBDRM_ETNAVIV_H_FILES
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_MODULE := libdrm_etnaviv
> -
> -LOCAL_SHARED_LIBRARIES := libdrm
> -
> -LOCAL_SRC_FILES := $(LIBDRM_ETNAVIV_FILES)
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_SHARED_LIBRARY)
> diff --git a/etnaviv/Android.sources.bp b/etnaviv/Android.sources.bp
> new file mode 100644
> index 00000000..aa828900
> --- /dev/null
> +++ b/etnaviv/Android.sources.bp
> @@ -0,0 +1,13 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libdrm_etnaviv_sources",
> +    srcs: [
> +        "etnaviv_device.c",
> +        "etnaviv_gpu.c",
> +        "etnaviv_bo.c",
> +        "etnaviv_bo_cache.c",
> +        "etnaviv_pipe.c",
> +        "etnaviv_cmd_stream.c",
> +    ],
> +}
> diff --git a/freedreno/Android.bp b/freedreno/Android.bp
> new file mode 100644
> index 00000000..9fca9b12
> --- /dev/null
> +++ b/freedreno/Android.bp
> @@ -0,0 +1,11 @@
> +build = ["Android.sources.bp"]
> +
> +cc_library_shared {
> +    name: "libdrm_freedreno",
> +    defaults: [
> +        "libdrm_defaults",
> +        "libdrm_freedreno_sources",
> +    ],
> +    vendor: true,
> +    shared_libs: ["libdrm"],
> +}
> diff --git a/freedreno/Android.mk b/freedreno/Android.mk
> deleted file mode 100644
> index 2b582aed..00000000
> --- a/freedreno/Android.mk
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -LOCAL_PATH := $(call my-dir)
> -include $(CLEAR_VARS)
> -
> -# Import variables LIBDRM_FREEDRENO_FILES, LIBDRM_FREEDRENO_H_FILES
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_MODULE := libdrm_freedreno
> -
> -LOCAL_SHARED_LIBRARIES := libdrm
> -
> -LOCAL_SRC_FILES := $(LIBDRM_FREEDRENO_FILES)
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_SHARED_LIBRARY)
> diff --git a/freedreno/Android.sources.bp b/freedreno/Android.sources.bp
> new file mode 100644
> index 00000000..3c1ca316
> --- /dev/null
> +++ b/freedreno/Android.sources.bp
> @@ -0,0 +1,16 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libdrm_freedreno_sources",
> +    srcs: [
> +        "freedreno_device.c",
> +        "freedreno_pipe.c",
> +        "freedreno_ringbuffer.c",
> +        "freedreno_bo.c",
> +        "freedreno_bo_cache.c",
> +        "msm/msm_bo.c",
> +        "msm/msm_device.c",
> +        "msm/msm_pipe.c",
> +        "msm/msm_ringbuffer.c",
> +    ],
> +}
> diff --git a/intel/Android.bp b/intel/Android.bp
> new file mode 100644
> index 00000000..22713acc
> --- /dev/null
> +++ b/intel/Android.bp
> @@ -0,0 +1,36 @@
> +//
> +// Copyright © 2011 Intel Corporation
> +//
> +// Permission is hereby granted, free of charge, to any person obtaining a
> +// copy of this software and associated documentation files (the "Software"),
> +// to deal in the Software without restriction, including without limitation
> +// the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +// and/or sell copies of the Software, and to permit persons to whom the
> +// Software is furnished to do so, subject to the following conditions:
> +//
> +// The above copyright notice and this permission notice (including the next
> +// paragraph) shall be included in all copies or substantial portions of the
> +// Software.
> +//
> +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> +// IN THE SOFTWARE.
> +//
> +
> +build = ["Android.sources.bp"]
> +
> +cc_library_shared {
> +    name: "libdrm_intel",
> +    defaults: [
> +        "libdrm_defaults",
> +        "libdrm_intel_sources",
> +    ],
> +    vendor: true,
> +
> +    // Removed dependency to libpciaccess: not used on Android
> +    shared_libs: ["libdrm"],
> +}
> diff --git a/intel/Android.mk b/intel/Android.mk
> deleted file mode 100644
> index f45312dd..00000000
> --- a/intel/Android.mk
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -#
> -# Copyright © 2011 Intel Corporation
> -#
> -# Permission is hereby granted, free of charge, to any person obtaining a
> -# copy of this software and associated documentation files (the "Software"),
> -# to deal in the Software without restriction, including without limitation
> -# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> -# and/or sell copies of the Software, and to permit persons to whom the
> -# Software is furnished to do so, subject to the following conditions:
> -#
> -# The above copyright notice and this permission notice (including the next
> -# paragraph) shall be included in all copies or substantial portions of the
> -# Software.
> -#
> -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> -# IN THE SOFTWARE.
> -#
> -
> -LOCAL_PATH := $(call my-dir)
> -include $(CLEAR_VARS)
> -
> -# Import variables LIBDRM_INTEL_FILES, LIBDRM_INTEL_H_FILES
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_MODULE := libdrm_intel
> -
> -LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES)
> -
> -LOCAL_SHARED_LIBRARIES := \
> -	libdrm
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_SHARED_LIBRARY)
> diff --git a/intel/Android.sources.bp b/intel/Android.sources.bp
> new file mode 100644
> index 00000000..46e0328f
> --- /dev/null
> +++ b/intel/Android.sources.bp
> @@ -0,0 +1,13 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libdrm_intel_sources",
> +    srcs: [
> +        "intel_bufmgr.c",
> +        "intel_bufmgr_fake.c",
> +        "intel_bufmgr_gem.c",
> +        "intel_decode.c",
> +        "intel_chipset.c",
> +        "mm.c",
> +    ],
> +}
> diff --git a/libkms/Android.bp b/libkms/Android.bp
> new file mode 100644
> index 00000000..b09dbf42
> --- /dev/null
> +++ b/libkms/Android.bp
> @@ -0,0 +1,15 @@
> +build = ["Android.sources.bp"]
> +
> +cc_library_shared {
> +    name: "libkms",
> +    defaults: [
> +        "libdrm_defaults",
> +        "libkms_sources",
> +        "libkms_vmwgfx_sources",
> +        "libkms_intel_sources",
> +        "libkms_nouveau_sources",
> +        "libkms_radeon_sources",
> +    ],
> +    vendor: true,
> +    shared_libs: ["libdrm"],
> +}
> diff --git a/libkms/Android.mk b/libkms/Android.mk
> deleted file mode 100644
> index a8b9489f..00000000
> --- a/libkms/Android.mk
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS)))
> -
> -intel_drivers := i915 i965 i915g iris
> -radeon_drivers := r300g r600g radeonsi
> -nouveau_drivers := nouveau
> -virgl_drivers := virgl
> -vmwgfx_drivers := vmwgfx
> -
> -valid_drivers := \
> -	$(intel_drivers) \
> -	$(radeon_drivers) \
> -	$(nouveau_drivers) \
> -	$(virgl_drivers) \
> -	$(vmwgfx_drivers)
> -
> -# warn about invalid drivers
> -invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS))
> -ifneq ($(invalid_drivers),)
> -$(warning invalid GPU drivers: $(invalid_drivers))
> -# tidy up
> -DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS))
> -endif
> -
> -LOCAL_PATH := $(call my-dir)
> -
> -include $(CLEAR_VARS)
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_SRC_FILES := $(LIBKMS_FILES)
> -
> -ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),)
> -LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES)
> -endif
> -
> -ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),)
> -LOCAL_SRC_FILES += $(LIBKMS_INTEL_FILES)
> -endif
> -
> -ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),)
> -LOCAL_SRC_FILES += $(LIBKMS_NOUVEAU_FILES)
> -endif
> -
> -ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),)
> -LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES)
> -endif
> -
> -LOCAL_MODULE := libkms
> -LOCAL_SHARED_LIBRARIES := libdrm
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_SHARED_LIBRARY)
> diff --git a/libkms/Android.sources.bp b/libkms/Android.sources.bp
> new file mode 100644
> index 00000000..5582f235
> --- /dev/null
> +++ b/libkms/Android.sources.bp
> @@ -0,0 +1,38 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libkms_sources",
> +    srcs: [
> +        "linux.c",
> +        "dumb.c",
> +        "api.c",
> +    ],
> +}
> +
> +cc_defaults {
> +    name: "libkms_vmwgfx_sources",
> +    srcs: [
> +        "vmwgfx.c",
> +    ],
> +}
> +
> +cc_defaults {
> +    name: "libkms_intel_sources",
> +    srcs: [
> +        "intel.c",
> +    ],
> +}
> +
> +cc_defaults {
> +    name: "libkms_nouveau_sources",
> +    srcs: [
> +        "nouveau.c",
> +    ],
> +}
> +
> +cc_defaults {
> +    name: "libkms_radeon_sources",
> +    srcs: [
> +        "radeon.c",
> +    ],
> +}
> diff --git a/nouveau/Android.bp b/nouveau/Android.bp
> new file mode 100644
> index 00000000..12c37e3d
> --- /dev/null
> +++ b/nouveau/Android.bp
> @@ -0,0 +1,11 @@
> +build = ["Android.sources.bp"]
> +
> +cc_library_shared {
> +    name: "libdrm_nouveau",
> +    defaults: [
> +        "libdrm_defaults",
> +        "libdrm_nouveau_sources",
> +    ],
> +    vendor: true,
> +    shared_libs: ["libdrm"],
> +}
> diff --git a/nouveau/Android.mk b/nouveau/Android.mk
> deleted file mode 100644
> index b430af4f..00000000
> --- a/nouveau/Android.mk
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -LOCAL_PATH := $(call my-dir)
> -include $(CLEAR_VARS)
> -
> -# Import variables LIBDRM_NOUVEAU_FILES, LIBDRM_NOUVEAU_H_FILES
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_MODULE := libdrm_nouveau
> -
> -LOCAL_SHARED_LIBRARIES := libdrm
> -
> -LOCAL_SRC_FILES := $(LIBDRM_NOUVEAU_FILES)
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_SHARED_LIBRARY)
> diff --git a/nouveau/Android.sources.bp b/nouveau/Android.sources.bp
> new file mode 100644
> index 00000000..5ecdb53c
> --- /dev/null
> +++ b/nouveau/Android.sources.bp
> @@ -0,0 +1,11 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libdrm_nouveau_sources",
> +    srcs: [
> +        "nouveau.c",
> +        "pushbuf.c",
> +        "bufctx.c",
> +        "abi16.c",
> +    ],
> +}
> diff --git a/omap/Android.bp b/omap/Android.bp
> new file mode 100644
> index 00000000..05ca7d2d
> --- /dev/null
> +++ b/omap/Android.bp
> @@ -0,0 +1,12 @@
> +build = ["Android.sources.bp"]
> +
> +cc_library_shared {
> +    name: "libdrm_omap",
> +    defaults: [
> +        "libdrm_defaults",
> +        "libdrm_omap_sources",
> +    ],
> +    vendor: true,
> +
> +    shared_libs: ["libdrm"],
> +}
> diff --git a/omap/Android.mk b/omap/Android.mk
> deleted file mode 100644
> index b25cca13..00000000
> --- a/omap/Android.mk
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -LOCAL_PATH := $(call my-dir)
> -include $(CLEAR_VARS)
> -
> -LOCAL_MODULE := libdrm_omap
> -LOCAL_VENDOR_MODULE := true
> -
> -LOCAL_SRC_FILES := omap_drm.c
> -
> -LOCAL_SHARED_LIBRARIES := libdrm
> -
> -include $(LIBDRM_COMMON_MK)
> -
> -include $(BUILD_SHARED_LIBRARY)
> diff --git a/omap/Android.sources.bp b/omap/Android.sources.bp
> new file mode 100644
> index 00000000..3c7da94a
> --- /dev/null
> +++ b/omap/Android.sources.bp
> @@ -0,0 +1,8 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libdrm_omap_sources",
> +    srcs: [
> +	"omap_drm.c",
> +    ],
> +}
> diff --git a/radeon/Android.bp b/radeon/Android.bp
> new file mode 100644
> index 00000000..9d0a09ec
> --- /dev/null
> +++ b/radeon/Android.bp
> @@ -0,0 +1,11 @@
> +build = ["Android.sources.bp"]
> +
> +cc_library_shared {
> +    name: "libdrm_radeon",
> +    defaults: [
> +        "libdrm_defaults",
> +        "libdrm_radeon_sources",
> +    ],
> +    vendor: true,
> +    shared_libs: ["libdrm"],
> +}
> diff --git a/radeon/Android.mk b/radeon/Android.mk
> deleted file mode 100644
> index 71040dab..00000000
> --- a/radeon/Android.mk
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -LOCAL_PATH := $(call my-dir)
> -include $(CLEAR_VARS)
> -
> -# Import variables LIBDRM_RADEON_FILES, LIBDRM_RADEON_H_FILES
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_MODULE := libdrm_radeon
> -
> -LOCAL_SHARED_LIBRARIES := libdrm
> -
> -LOCAL_SRC_FILES := $(LIBDRM_RADEON_FILES)
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_SHARED_LIBRARY)
> diff --git a/radeon/Android.sources.bp b/radeon/Android.sources.bp
> new file mode 100644
> index 00000000..820ac4d6
> --- /dev/null
> +++ b/radeon/Android.sources.bp
> @@ -0,0 +1,13 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libdrm_radeon_sources",
> +    srcs: [
> +        "radeon_bo_gem.c",
> +        "radeon_cs_gem.c",
> +        "radeon_cs_space.c",
> +        "radeon_bo.c",
> +        "radeon_cs.c",
> +        "radeon_surface.c",
> +    ],
> +}
> diff --git a/tegra/Android.bp b/tegra/Android.bp
> new file mode 100644
> index 00000000..33eaf6c5
> --- /dev/null
> +++ b/tegra/Android.bp
> @@ -0,0 +1,14 @@
> +cc_library_shared {
> +    name: "libdrm_tegra",
> +    vendor: true,
> +    shared_libs: ["libdrm"],
> +
> +    srcs: ["tegra.c"],
> +
> +    cflags: [
> +        "-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1",
> +        "-Wall",
> +        "-Werror",
> +        "-Wno-unused-variable",
> +    ],
> +}
> diff --git a/tests/Android.bp b/tests/Android.bp
> new file mode 100644
> index 00000000..cdc6c2cf
> --- /dev/null
> +++ b/tests/Android.bp
> @@ -0,0 +1,6 @@
> +subdirs = ["*"]
> +
> +cc_library_headers {
> +    name: "libdrm_test_headers",
> +    export_include_dirs: ["."],
> +}
> diff --git a/tests/Android.mk b/tests/Android.mk
> deleted file mode 100644
> index 5053e7d6..00000000
> --- a/tests/Android.mk
> +++ /dev/null
> @@ -1 +0,0 @@
> -include $(call all-subdir-makefiles)
> diff --git a/tests/modetest/Android.bp b/tests/modetest/Android.bp
> new file mode 100644
> index 00000000..ca811fee
> --- /dev/null
> +++ b/tests/modetest/Android.bp
> @@ -0,0 +1,12 @@
> +build = ["Android.sources.bp"]
> +
> +cc_test {
> +    name: "modetest",
> +    defaults: [
> +        "libdrm_defaults",
> +        "modetest_sources",
> +    ],
> +
> +    shared_libs: ["libdrm"],
> +    static_libs: ["libdrm_util"],
> +}
> diff --git a/tests/modetest/Android.mk b/tests/modetest/Android.mk
> deleted file mode 100644
> index c1a71fd9..00000000
> --- a/tests/modetest/Android.mk
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -LOCAL_PATH := $(call my-dir)
> -
> -include $(CLEAR_VARS)
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_SRC_FILES := $(MODETEST_FILES)
> -
> -LOCAL_MODULE := modetest
> -
> -LOCAL_SHARED_LIBRARIES := libdrm
> -LOCAL_STATIC_LIBRARIES := libdrm_util
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_EXECUTABLE)
> diff --git a/tests/modetest/Android.sources.bp b/tests/modetest/Android.sources.bp
> new file mode 100644
> index 00000000..c6aca2ef
> --- /dev/null
> +++ b/tests/modetest/Android.sources.bp
> @@ -0,0 +1,10 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "modetest_sources",
> +    srcs: [
> +        "buffers.c",
> +        "cursor.c",
> +        "modetest.c",
> +    ],
> +}
> diff --git a/tests/proptest/Android.bp b/tests/proptest/Android.bp
> new file mode 100644
> index 00000000..28c87e91
> --- /dev/null
> +++ b/tests/proptest/Android.bp
> @@ -0,0 +1,8 @@
> +cc_test {
> +    name: "proptest",
> +    defaults: ["libdrm_defaults"],
> +    srcs: ["proptest.c"],
> +
> +    shared_libs: ["libdrm"],
> +    static_libs: ["libdrm_util"],
> +}
> diff --git a/tests/proptest/Android.mk b/tests/proptest/Android.mk
> deleted file mode 100644
> index 91a590fc..00000000
> --- a/tests/proptest/Android.mk
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -LOCAL_PATH := $(call my-dir)
> -
> -include $(CLEAR_VARS)
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_SRC_FILES := $(PROPTEST_FILES)
> -
> -LOCAL_MODULE := proptest
> -
> -LOCAL_SHARED_LIBRARIES := libdrm
> -LOCAL_STATIC_LIBRARIES := libdrm_util
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_EXECUTABLE)
> diff --git a/tests/util/Android.bp b/tests/util/Android.bp
> new file mode 100644
> index 00000000..36d18206
> --- /dev/null
> +++ b/tests/util/Android.bp
> @@ -0,0 +1,35 @@
> +//
> +// Copyright © 2015 NVIDIA Corporation
> +//
> +// Permission is hereby granted, free of charge, to any person obtaining a
> +// copy of this software and associated documentation files (the "Software"),
> +// to deal in the Software without restriction, including without limitation
> +// the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +// and/or sell copies of the Software, and to permit persons to whom the
> +// Software is furnished to do so, subject to the following conditions:
> +//
> +// The above copyright notice and this permission notice (including the next
> +// paragraph) shall be included in all copies or substantial portions of the
> +// Software.
> +//
> +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> +// IN THE SOFTWARE.
> +//
> +
> +build = ["Android.sources.bp"]
> +
> +cc_library_static {
> +    name: "libdrm_util",
> +    defaults: [
> +        "libdrm_defaults",
> +        "libdrm_util_sources",
> +    ],
> +    shared_libs: ["libdrm"],
> +    header_libs: ["libdrm_test_headers"],
> +    export_header_lib_headers: ["libdrm_test_headers"],
> +}
> diff --git a/tests/util/Android.mk b/tests/util/Android.mk
> deleted file mode 100644
> index 12eccb42..00000000
> --- a/tests/util/Android.mk
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -#
> -# Copyright © 2015 NVIDIA Corporation
> -#
> -# Permission is hereby granted, free of charge, to any person obtaining a
> -# copy of this software and associated documentation files (the "Software"),
> -# to deal in the Software without restriction, including without limitation
> -# the rights to use, copy, modify, merge, publish, distribute, sublicense,
> -# and/or sell copies of the Software, and to permit persons to whom the
> -# Software is furnished to do so, subject to the following conditions:
> -#
> -# The above copyright notice and this permission notice (including the next
> -# paragraph) shall be included in all copies or substantial portions of the
> -# Software.
> -#
> -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> -# IN THE SOFTWARE.
> -#
> -
> -LOCAL_PATH := $(call my-dir)
> -
> -include $(CLEAR_VARS)
> -include $(LOCAL_PATH)/Makefile.sources
> -
> -LOCAL_MODULE := libdrm_util
> -
> -LOCAL_SHARED_LIBRARIES := libdrm
> -
> -LOCAL_SRC_FILES := $(UTIL_FILES)
> -
> -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LIBDRM_TOP)/tests
> -
> -include $(LIBDRM_COMMON_MK)
> -include $(BUILD_STATIC_LIBRARY)
> diff --git a/tests/util/Android.sources.bp b/tests/util/Android.sources.bp
> new file mode 100644
> index 00000000..529e1124
> --- /dev/null
> +++ b/tests/util/Android.sources.bp
> @@ -0,0 +1,10 @@
> +// Autogenerated with Android.sources.bp.mk
> +
> +cc_defaults {
> +    name: "libdrm_util_sources",
> +    srcs: [
> +        "format.c",
> +        "kms.c",
> +        "pattern.c",
> +    ],
> +}
>
Rob Herring Sept. 24, 2019, 10:24 p.m. UTC | #2
On Tue, Sep 24, 2019 at 4:29 PM John Stultz <john.stultz@linaro.org> wrote:
>
> This patch removes the deprecated Android.mk files and replaces
> them with Android.bp files, used in Android N and newer
> releases.
>
> This is needed in order to build libdrm/master against recent
> Android releases and AOSP/master, as some of the Treble build
> options required since Android O cannot be expressed in
> Andorid.mk files.
>
> Patch originally by Dan Willemsen with fixes folded in by:
>  Jerry Zhang, Eliott Hughes and myself.
>
> While this does cost comptability with older pre Android N
> releases, I'd contend that being able to build/test
> libdrm/master against AOSP/master and recent releases is more
> valuable then soley maintaining support for old and unsupported
> Android releases.

Trying to maintain something that works across more than 3 releases or
so is painful. I don't think android-x86 folks have the bandwidth to
maintain things older than that *and* update to newer versions. So I
think only supporting the n latest releases is good.

Are .bp files for master/Q compatible back to N (or O)? IIRC, at least
for the first couple of releases with .bp files, they seemed to have
incompatible changes.

Rob
John Stultz Sept. 24, 2019, 11:30 p.m. UTC | #3
On Tue, Sep 24, 2019 at 3:24 PM Rob Herring <robh@kernel.org> wrote:
>
> On Tue, Sep 24, 2019 at 4:29 PM John Stultz <john.stultz@linaro.org> wrote:
> >
> > This patch removes the deprecated Android.mk files and replaces
> > them with Android.bp files, used in Android N and newer
> > releases.
> >
> > This is needed in order to build libdrm/master against recent
> > Android releases and AOSP/master, as some of the Treble build
> > options required since Android O cannot be expressed in
> > Andorid.mk files.
> >
> > Patch originally by Dan Willemsen with fixes folded in by:
> >  Jerry Zhang, Eliott Hughes and myself.
> >
> > While this does cost comptability with older pre Android N
> > releases, I'd contend that being able to build/test
> > libdrm/master against AOSP/master and recent releases is more
> > valuable then soley maintaining support for old and unsupported
> > Android releases.
>
> Trying to maintain something that works across more than 3 releases or
> so is painful. I don't think android-x86 folks have the bandwidth to
> maintain things older than that *and* update to newer versions. So I
> think only supporting the n latest releases is good.
>
> Are .bp files for master/Q compatible back to N (or O)? IIRC, at least
> for the first couple of releases with .bp files, they seemed to have
> incompatible changes.

I think there have possibly been some incompatible changes, as I know
early w/ bp files things were more in flux. That said, there haven't
been many changes to the libdrm bp files since the conversion was
first done in 2017 (so Android O). I'll checkout N and validate so I
can provide a more concrete assurance.

thanks
-john
John Stultz Sept. 25, 2019, 6:09 a.m. UTC | #4
On Tue, Sep 24, 2019 at 4:30 PM John Stultz <john.stultz@linaro.org> wrote:
> On Tue, Sep 24, 2019 at 3:24 PM Rob Herring <robh@kernel.org> wrote:
> > Trying to maintain something that works across more than 3 releases or
> > so is painful. I don't think android-x86 folks have the bandwidth to
> > maintain things older than that *and* update to newer versions. So I
> > think only supporting the n latest releases is good.
> >
> > Are .bp files for master/Q compatible back to N (or O)? IIRC, at least
> > for the first couple of releases with .bp files, they seemed to have
> > incompatible changes.
>
> I think there have possibly been some incompatible changes, as I know
> early w/ bp files things were more in flux. That said, there haven't
> been many changes to the libdrm bp files since the conversion was
> first done in 2017 (so Android O). I'll checkout N and validate so I
> can provide a more concrete assurance.

Ah. Crud. You're right. The bp syntax has shifted enough over time to
cause problems w/ the current file when building against older Android
releases.   N falls over pretty hard, and O and even P have issues w/
"recovery_available: ", and "prebuilt_etc" syntax.  So my proposed
commit message mischaracterizes the state of older builds. Apologies!

I'll try to reach out to the android devs to see if there's any sort
of compat magic that can be done to keep things working on older
versions. That said, I'm still torn, as without this the current
libdrm/master code is broken with AOSP/master and Q.  Its frustrating
we have to have this seemingly exclusive trade off.

I'm curious if folks might be willing to consider something like an
upstream branch to preserve the build bits that work with prior
Android releases? Or any other ideas?

thanks
-john
Eric Engestrom Sept. 25, 2019, 10:39 a.m. UTC | #5
On Tuesday, 2019-09-24 23:09:08 -0700, John Stultz wrote:
> On Tue, Sep 24, 2019 at 4:30 PM John Stultz <john.stultz@linaro.org> wrote:
> > On Tue, Sep 24, 2019 at 3:24 PM Rob Herring <robh@kernel.org> wrote:
> > > Trying to maintain something that works across more than 3 releases or
> > > so is painful. I don't think android-x86 folks have the bandwidth to
> > > maintain things older than that *and* update to newer versions. So I
> > > think only supporting the n latest releases is good.
> > >
> > > Are .bp files for master/Q compatible back to N (or O)? IIRC, at least
> > > for the first couple of releases with .bp files, they seemed to have
> > > incompatible changes.
> >
> > I think there have possibly been some incompatible changes, as I know
> > early w/ bp files things were more in flux. That said, there haven't
> > been many changes to the libdrm bp files since the conversion was
> > first done in 2017 (so Android O). I'll checkout N and validate so I
> > can provide a more concrete assurance.
> 
> Ah. Crud. You're right. The bp syntax has shifted enough over time to
> cause problems w/ the current file when building against older Android
> releases.   N falls over pretty hard, and O and even P have issues w/
> "recovery_available: ", and "prebuilt_etc" syntax.  So my proposed
> commit message mischaracterizes the state of older builds. Apologies!
> 
> I'll try to reach out to the android devs to see if there's any sort
> of compat magic that can be done to keep things working on older
> versions. That said, I'm still torn, as without this the current
> libdrm/master code is broken with AOSP/master and Q.  Its frustrating
> we have to have this seemingly exclusive trade off.
> 
> I'm curious if folks might be willing to consider something like an
> upstream branch to preserve the build bits that work with prior
> Android releases? Or any other ideas?

Is _not_ deleting Android.mk an option?

That would have the obvious cost of duplicating the build system
maintenance effort, but if that's the only way to not drop support for
everything before Q...

(fwiw, my ack only applies with "reasonable" support of previous
versions :] )
Mauro Rossi Sept. 25, 2019, 3 p.m. UTC | #6
Hello

On Wed, Sep 25, 2019 at 12:39 PM Eric Engestrom <eric.engestrom@intel.com>
wrote:

> On Tuesday, 2019-09-24 23:09:08 -0700, John Stultz wrote:

> > On Tue, Sep 24, 2019 at 4:30 PM John Stultz <john.stultz@linaro.org>

> wrote:

> > > On Tue, Sep 24, 2019 at 3:24 PM Rob Herring <robh@kernel.org> wrote:

> > > > Trying to maintain something that works across more than 3 releases

> or

> > > > so is painful. I don't think android-x86 folks have the bandwidth to

> > > > maintain things older than that *and* update to newer versions. So I

> > > > think only supporting the n latest releases is good.

>


N is not a problem, per se, but if there are non supported Blueprint module
types used
it will not be possible to actually replicate Android.mk build rules to
Android.bp and the build will be missing some targets (for example is not
possible to install prebuilt files to $OUT)


> > > >

> > > > Are .bp files for master/Q compatible back to N (or O)? IIRC, at

> least

> > > > for the first couple of releases with .bp files, they seemed to have

> > > > incompatible changes.

> > >

> > > I think there have possibly been some incompatible changes, as I know

> > > early w/ bp files things were more in flux. That said, there haven't

> > > been many changes to the libdrm bp files since the conversion was

> > > first done in 2017 (so Android O). I'll checkout N and validate so I

> > > can provide a more concrete assurance.

> >

> > Ah. Crud. You're right. The bp syntax has shifted enough over time to

> > cause problems w/ the current file when building against older Android

> > releases.   N falls over pretty hard, and O and even P have issues w/

> > "recovery_available: ", and "prebuilt_etc" syntax.  So my proposed

> > commit message mischaracterizes the state of older builds. Apologies!

>


I confirm that when trying drm_hwcomposer master build with oreo-x86
(Android O based)
I had to do manual procedures relying on Android.mk preliminary build +
Android.bp build [1] with some ugly workaround [2]

Procedure:

First build with Android.mk versions on drm_hwcomposer and libdrm
because /system/vendor/etc/hwdata/amdgpu.ids target required prebuild_etc
module type
then I used used Android.bp branches of drm_hwcomposer and libdrm

[1] https://github.com/maurossi/drm/commits/blueprint_oreo-x86 NOTE:
inspired by AOSP fa32e29 "Convert to Android.bp

[2]
https://github.com/maurossi/drm/commit/8727ddbd29e592a54ac234be99f63f262d0ff529


> >

> > I'll try to reach out to the android devs to see if there's any sort

> > of compat magic that can be done to keep things working on older

> > versions. That said, I'm still torn, as without this the current

> > libdrm/master code is broken with AOSP/master and Q.  Its frustrating

> > we have to have this seemingly exclusive trade off.

> >

> > I'm curious if folks might be willing to consider something like an

> > upstream branch to preserve the build bits that work with prior

> > Android releases? Or any other ideas?

>

> Is _not_ deleting Android.mk an option?

>

> That would have the obvious cost of duplicating the build system

> maintenance effort, but if that's the only way to not drop support for

> everything before Q...

>

> (fwiw, my ack only applies with "reasonable" support of previous

> versions :] )

>


Hi Eric,
in my case with both Android.mk and Android.bp the build is failing with
duplicated module name error
Mauro
<div dir="ltr"><div>Hello</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 25, 2019 at 12:39 PM Eric Engestrom &lt;<a href="mailto:eric.engestrom@intel.com">eric.engestrom@intel.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tuesday, 2019-09-24 23:09:08 -0700, John Stultz wrote:<br>
&gt; On Tue, Sep 24, 2019 at 4:30 PM John Stultz &lt;<a href="mailto:john.stultz@linaro.org" target="_blank">john.stultz@linaro.org</a>&gt; wrote:<br>
&gt; &gt; On Tue, Sep 24, 2019 at 3:24 PM Rob Herring &lt;<a href="mailto:robh@kernel.org" target="_blank">robh@kernel.org</a>&gt; wrote:<br>
&gt; &gt; &gt; Trying to maintain something that works across more than 3 releases or<br>
&gt; &gt; &gt; so is painful. I don&#39;t think android-x86 folks have the bandwidth to<br>
&gt; &gt; &gt; maintain things older than that *and* update to newer versions. So I<br>
&gt; &gt; &gt; think only supporting the n latest releases is good.<br></blockquote><div><br></div><div>N is not a problem, per se, but if there are non supported Blueprint module types used</div><div>it will not be possible to actually replicate Android.mk build rules to Android.bp and the build will be missing some targets (for example is not possible to install prebuilt files to $OUT)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Are .bp files for master/Q compatible back to N (or O)? IIRC, at least<br>
&gt; &gt; &gt; for the first couple of releases with .bp files, they seemed to have<br>
&gt; &gt; &gt; incompatible changes.<br>
&gt; &gt;<br>
&gt; &gt; I think there have possibly been some incompatible changes, as I know<br>
&gt; &gt; early w/ bp files things were more in flux. That said, there haven&#39;t<br>
&gt; &gt; been many changes to the libdrm bp files since the conversion was<br>
&gt; &gt; first done in 2017 (so Android O). I&#39;ll checkout N and validate so I<br>
&gt; &gt; can provide a more concrete assurance.<br>
&gt; <br>
&gt; Ah. Crud. You&#39;re right. The bp syntax has shifted enough over time to<br>
&gt; cause problems w/ the current file when building against older Android<br>
&gt; releases.   N falls over pretty hard, and O and even P have issues w/<br>
&gt; &quot;recovery_available: &quot;, and &quot;prebuilt_etc&quot; syntax.  So my proposed<br>
&gt; commit message mischaracterizes the state of older builds. Apologies!<br></blockquote><div><br></div><div>I confirm that when trying drm_hwcomposer master build with oreo-x86 (Android O based)<br></div><div>I had to do manual procedures relying on Android.mk preliminary build + Android.bp build [1] with some ugly workaround [2]</div><div><br></div><div>Procedure:</div><div><br></div><div>First build with Android.mk versions on drm_hwcomposer and libdrm<br>because /system/vendor/etc/hwdata/amdgpu.ids target required prebuild_etc module type<br>then I used used Android.bp branches of drm_hwcomposer and libdrm<br></div><div><br></div><div>[1] <a href="https://github.com/maurossi/drm/commits/blueprint_oreo-x86">https://github.com/maurossi/drm/commits/blueprint_oreo-x86</a> NOTE: inspired by <span style="background-color:rgb(234,245,255);color:rgb(68,77,86);font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,monospace;font-size:13px;white-space:pre-wrap">AOSP fa32e29 &quot;Convert to Android.bp</span></div><div><br></div><div>[2] <a href="https://github.com/maurossi/drm/commit/8727ddbd29e592a54ac234be99f63f262d0ff529">https://github.com/maurossi/drm/commit/8727ddbd29e592a54ac234be99f63f262d0ff529</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; <br>
&gt; I&#39;ll try to reach out to the android devs to see if there&#39;s any sort<br>
&gt; of compat magic that can be done to keep things working on older<br>
&gt; versions. That said, I&#39;m still torn, as without this the current<br>
&gt; libdrm/master code is broken with AOSP/master and Q.  Its frustrating<br>
&gt; we have to have this seemingly exclusive trade off.<br>
&gt; <br>
&gt; I&#39;m curious if folks might be willing to consider something like an<br>
&gt; upstream branch to preserve the build bits that work with prior<br>
&gt; Android releases? Or any other ideas?<br>
<br>
Is _not_ deleting Android.mk an option?<br>
<br>
That would have the obvious cost of duplicating the build system<br>
maintenance effort, but if that&#39;s the only way to not drop support for<br>
everything before Q...<br>
<br>
(fwiw, my ack only applies with &quot;reasonable&quot; support of previous<br>
versions :] )<br></blockquote><div><br></div><div>Hi Eric,</div><div>in my case with both Android.mk and Android.bp the build is failing with duplicated module name error</div><div>Mauro</div></div></div>
Rob Clark Sept. 25, 2019, 4:04 p.m. UTC | #7
On Tue, Sep 24, 2019 at 11:09 PM John Stultz <john.stultz@linaro.org> wrote:
>
> On Tue, Sep 24, 2019 at 4:30 PM John Stultz <john.stultz@linaro.org> wrote:
> > On Tue, Sep 24, 2019 at 3:24 PM Rob Herring <robh@kernel.org> wrote:
> > > Trying to maintain something that works across more than 3 releases or
> > > so is painful. I don't think android-x86 folks have the bandwidth to
> > > maintain things older than that *and* update to newer versions. So I
> > > think only supporting the n latest releases is good.
> > >
> > > Are .bp files for master/Q compatible back to N (or O)? IIRC, at least
> > > for the first couple of releases with .bp files, they seemed to have
> > > incompatible changes.
> >
> > I think there have possibly been some incompatible changes, as I know
> > early w/ bp files things were more in flux. That said, there haven't
> > been many changes to the libdrm bp files since the conversion was
> > first done in 2017 (so Android O). I'll checkout N and validate so I
> > can provide a more concrete assurance.
>
> Ah. Crud. You're right. The bp syntax has shifted enough over time to
> cause problems w/ the current file when building against older Android
> releases.   N falls over pretty hard, and O and even P have issues w/
> "recovery_available: ", and "prebuilt_etc" syntax.  So my proposed
> commit message mischaracterizes the state of older builds. Apologies!

The CrOS/arc++ approach to build mesa using meson as an android vendor
blob, more decoupled from android build system, seems nicer every day
;-)

Side note, unless you are also caring about new libdrm + old mesa, you
can drop libdrm_freedreno from Android.mk/Android.bp.. we've pulled it
in to $mesa/src/freedreno/drm, an old version only remains in libdrm
for older mesa and for a couple dev/test tools that I use.

BR,
-R

> I'll try to reach out to the android devs to see if there's any sort
> of compat magic that can be done to keep things working on older
> versions. That said, I'm still torn, as without this the current
> libdrm/master code is broken with AOSP/master and Q.  Its frustrating
> we have to have this seemingly exclusive trade off.
>
> I'm curious if folks might be willing to consider something like an
> upstream branch to preserve the build bits that work with prior
> Android releases? Or any other ideas?
>
John Stultz Sept. 25, 2019, 4:17 p.m. UTC | #8
On Wed, Sep 25, 2019 at 3:39 AM Eric Engestrom <eric.engestrom@intel.com> wrote:
>
> On Tuesday, 2019-09-24 23:09:08 -0700, John Stultz wrote:
> > On Tue, Sep 24, 2019 at 4:30 PM John Stultz <john.stultz@linaro.org> wrote:
> > > On Tue, Sep 24, 2019 at 3:24 PM Rob Herring <robh@kernel.org> wrote:
> > > > Trying to maintain something that works across more than 3 releases or
> > > > so is painful. I don't think android-x86 folks have the bandwidth to
> > > > maintain things older than that *and* update to newer versions. So I
> > > > think only supporting the n latest releases is good.
> > > >
> > > > Are .bp files for master/Q compatible back to N (or O)? IIRC, at least
> > > > for the first couple of releases with .bp files, they seemed to have
> > > > incompatible changes.
> > >
> > > I think there have possibly been some incompatible changes, as I know
> > > early w/ bp files things were more in flux. That said, there haven't
> > > been many changes to the libdrm bp files since the conversion was
> > > first done in 2017 (so Android O). I'll checkout N and validate so I
> > > can provide a more concrete assurance.
> >
> > Ah. Crud. You're right. The bp syntax has shifted enough over time to
> > cause problems w/ the current file when building against older Android
> > releases.   N falls over pretty hard, and O and even P have issues w/
> > "recovery_available: ", and "prebuilt_etc" syntax.  So my proposed
> > commit message mischaracterizes the state of older builds. Apologies!
> >
> > I'll try to reach out to the android devs to see if there's any sort
> > of compat magic that can be done to keep things working on older
> > versions. That said, I'm still torn, as without this the current
> > libdrm/master code is broken with AOSP/master and Q.  Its frustrating
> > we have to have this seemingly exclusive trade off.
> >
> > I'm curious if folks might be willing to consider something like an
> > upstream branch to preserve the build bits that work with prior
> > Android releases? Or any other ideas?
>
> Is _not_ deleting Android.mk an option?

Yea, the trouble is O and P will pick up the Android.bp files by
default, so you'd still see the issues or you'd run into duplicate
targets. I'm hoping I can still find some conditional magic tricks for
Android.bp.  I need to look at Mauro's patches though.

> That would have the obvious cost of duplicating the build system
> maintenance effort, but if that's the only way to not drop support for
> everything before Q...

Yea, I'm not eager to have two android build systems in the tree.
Having just one is duplicative enough.

> (fwiw, my ack only applies with "reasonable" support of previous
> versions :] )

Of course, I'm not planning on submitting this change further until I
can find something better.  Apologies again for my assumptions that it
would work with older bp implementations.  My only defence is, in
trying to validate w/ older releases yesterday, my build system pulled
down 135G of data and now my repo is somehow unshallowed and taking 4
times the amount of disk space it was using w/ just AOSP/master. :P So
validating across AOSP versions is no trivial thing.

thanks
-john
Mauro Rossi Sept. 25, 2019, 6 p.m. UTC | #9
On Wed, Sep 25, 2019 at 6:17 PM John Stultz <john.stultz@linaro.org> wrote:

> On Wed, Sep 25, 2019 at 3:39 AM Eric Engestrom <eric.engestrom@intel.com>

> wrote:

> >

> > On Tuesday, 2019-09-24 23:09:08 -0700, John Stultz wrote:

> > > On Tue, Sep 24, 2019 at 4:30 PM John Stultz <john.stultz@linaro.org>

> wrote:

> > > > On Tue, Sep 24, 2019 at 3:24 PM Rob Herring <robh@kernel.org> wrote:

> > > > > Trying to maintain something that works across more than 3

> releases or

> > > > > so is painful. I don't think android-x86 folks have the bandwidth

> to

> > > > > maintain things older than that *and* update to newer versions. So

> I

> > > > > think only supporting the n latest releases is good.

> > > > >

> > > > > Are .bp files for master/Q compatible back to N (or O)? IIRC, at

> least

> > > > > for the first couple of releases with .bp files, they seemed to

> have

> > > > > incompatible changes.

> > > >

> > > > I think there have possibly been some incompatible changes, as I know

> > > > early w/ bp files things were more in flux. That said, there haven't

> > > > been many changes to the libdrm bp files since the conversion was

> > > > first done in 2017 (so Android O). I'll checkout N and validate so I

> > > > can provide a more concrete assurance.

> > >

> > > Ah. Crud. You're right. The bp syntax has shifted enough over time to

> > > cause problems w/ the current file when building against older Android

> > > releases.   N falls over pretty hard, and O and even P have issues w/

> > > "recovery_available: ", and "prebuilt_etc" syntax.  So my proposed

> > > commit message mischaracterizes the state of older builds. Apologies!

> > >

> > > I'll try to reach out to the android devs to see if there's any sort

> > > of compat magic that can be done to keep things working on older

> > > versions. That said, I'm still torn, as without this the current

> > > libdrm/master code is broken with AOSP/master and Q.  Its frustrating

> > > we have to have this seemingly exclusive trade off.

> > >

> > > I'm curious if folks might be willing to consider something like an

> > > upstream branch to preserve the build bits that work with prior

> > > Android releases? Or any other ideas?

> >

> > Is _not_ deleting Android.mk an option?

>

> Yea, the trouble is O and P will pick up the Android.bp files by

> default, so you'd still see the issues or you'd run into duplicate

> targets. I'm hoping I can still find some conditional magic tricks for

> Android.bp.  I need to look at Mauro's patches though.

>

> > That would have the obvious cost of duplicating the build system

> > maintenance effort, but if that's the only way to not drop support for

> > everything before Q...

>

> Yea, I'm not eager to have two android build systems in the tree.

> Having just one is duplicative enough.

>

> > (fwiw, my ack only applies with "reasonable" support of previous

> > versions :] )

>

> Of course, I'm not planning on submitting this change further until I

> can find something better.  Apologies again for my assumptions that it

> would work with older bp implementations.  My only defence is, in

> trying to validate w/ older releases yesterday, my build system pulled

> down 135G of data and now my repo is somehow unshallowed and taking 4

> times the amount of disk space it was using w/ just AOSP/master. :P So

> validating across AOSP versions is no trivial thing.

>

> thanks

> -john

>


For O & P builds if module names collision is avoided,
could Android.bp and Android.mk coexist in the same project?

Could it be possible to use Android.bp for all libdrm targets
but data/Android.bp,
removed and replaced by ./Android.mk with dummy module name and stripped
down to just install /system/vendor/etc/hwdata/amdgpu.ids target ?

If what I'm thinking may work, I could give it a try and report back

Mauro
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 25, 2019 at 6:17 PM John Stultz &lt;<a href="mailto:john.stultz@linaro.org">john.stultz@linaro.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Sep 25, 2019 at 3:39 AM Eric Engestrom &lt;<a href="mailto:eric.engestrom@intel.com" target="_blank">eric.engestrom@intel.com</a>&gt; wrote:<br>
&gt;<br>
&gt; On Tuesday, 2019-09-24 23:09:08 -0700, John Stultz wrote:<br>
&gt; &gt; On Tue, Sep 24, 2019 at 4:30 PM John Stultz &lt;<a href="mailto:john.stultz@linaro.org" target="_blank">john.stultz@linaro.org</a>&gt; wrote:<br>
&gt; &gt; &gt; On Tue, Sep 24, 2019 at 3:24 PM Rob Herring &lt;<a href="mailto:robh@kernel.org" target="_blank">robh@kernel.org</a>&gt; wrote:<br>
&gt; &gt; &gt; &gt; Trying to maintain something that works across more than 3 releases or<br>
&gt; &gt; &gt; &gt; so is painful. I don&#39;t think android-x86 folks have the bandwidth to<br>
&gt; &gt; &gt; &gt; maintain things older than that *and* update to newer versions. So I<br>
&gt; &gt; &gt; &gt; think only supporting the n latest releases is good.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Are .bp files for master/Q compatible back to N (or O)? IIRC, at least<br>
&gt; &gt; &gt; &gt; for the first couple of releases with .bp files, they seemed to have<br>
&gt; &gt; &gt; &gt; incompatible changes.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I think there have possibly been some incompatible changes, as I know<br>
&gt; &gt; &gt; early w/ bp files things were more in flux. That said, there haven&#39;t<br>
&gt; &gt; &gt; been many changes to the libdrm bp files since the conversion was<br>
&gt; &gt; &gt; first done in 2017 (so Android O). I&#39;ll checkout N and validate so I<br>
&gt; &gt; &gt; can provide a more concrete assurance.<br>
&gt; &gt;<br>
&gt; &gt; Ah. Crud. You&#39;re right. The bp syntax has shifted enough over time to<br>
&gt; &gt; cause problems w/ the current file when building against older Android<br>
&gt; &gt; releases.   N falls over pretty hard, and O and even P have issues w/<br>
&gt; &gt; &quot;recovery_available: &quot;, and &quot;prebuilt_etc&quot; syntax.  So my proposed<br>
&gt; &gt; commit message mischaracterizes the state of older builds. Apologies!<br>
&gt; &gt;<br>
&gt; &gt; I&#39;ll try to reach out to the android devs to see if there&#39;s any sort<br>
&gt; &gt; of compat magic that can be done to keep things working on older<br>
&gt; &gt; versions. That said, I&#39;m still torn, as without this the current<br>
&gt; &gt; libdrm/master code is broken with AOSP/master and Q.  Its frustrating<br>
&gt; &gt; we have to have this seemingly exclusive trade off.<br>
&gt; &gt;<br>
&gt; &gt; I&#39;m curious if folks might be willing to consider something like an<br>
&gt; &gt; upstream branch to preserve the build bits that work with prior<br>
&gt; &gt; Android releases? Or any other ideas?<br>
&gt;<br>
&gt; Is _not_ deleting Android.mk an option?<br>
<br>
Yea, the trouble is O and P will pick up the Android.bp files by<br>
default, so you&#39;d still see the issues or you&#39;d run into duplicate<br>
targets. I&#39;m hoping I can still find some conditional magic tricks for<br>
Android.bp.  I need to look at Mauro&#39;s patches though.<br>
<br>
&gt; That would have the obvious cost of duplicating the build system<br>
&gt; maintenance effort, but if that&#39;s the only way to not drop support for<br>
&gt; everything before Q...<br>
<br>
Yea, I&#39;m not eager to have two android build systems in the tree.<br>
Having just one is duplicative enough.<br>
<br>
&gt; (fwiw, my ack only applies with &quot;reasonable&quot; support of previous<br>
&gt; versions :] )<br>
<br>
Of course, I&#39;m not planning on submitting this change further until I<br>
can find something better.  Apologies again for my assumptions that it<br>
would work with older bp implementations.  My only defence is, in<br>
trying to validate w/ older releases yesterday, my build system pulled<br>
down 135G of data and now my repo is somehow unshallowed and taking 4<br>
times the amount of disk space it was using w/ just AOSP/master. :P So<br>
validating across AOSP versions is no trivial thing.<br>
<br>
thanks<br>
-john<br></blockquote><div><br></div><div>For O &amp; P builds if module names collision is avoided, </div><div>could Android.bp and Android.mk coexist in the same project?<br></div><div><br></div><div>Could it be possible to use Android.bp for all libdrm targets but data/Android.bp, </div><div>removed and replaced by ./Android.mk with dummy module name and stripped down to just install /system/vendor/etc/hwdata/amdgpu.ids target ?</div><div><br></div><div>If what I&#39;m thinking may work, I could give it a try and report back</div><div><br></div><div>Mauro<br></div></div></div>
diff mbox series

Patch

diff --git a/Android.bp b/Android.bp
new file mode 100644
index 00000000..6fe434c6
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,66 @@ 
+//
+// Copyright © 2011-2012 Intel Corporation
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice (including the next
+// paragraph) shall be included in all copies or substantial portions of the
+// Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+
+subdirs = ["*"]
+build = ["Android.sources.bp"]
+
+cc_defaults {
+    name: "libdrm_defaults",
+    cflags: [
+        // XXX: Consider moving these to config.h analogous to autoconf.
+        "-DMAJOR_IN_SYSMACROS=1",
+        "-DHAVE_VISIBILITY=1",
+        "-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1",
+
+        "-Wall",
+        "-Werror",
+        "-Wno-deprecated-declarations",
+        "-Wno-format",
+        "-Wno-gnu-variable-sized-type-not-at-end",
+        "-Wno-pointer-arith",
+        "-Wno-unused-parameter",
+        "-Wno-unused-variable",
+        "-Wno-missing-field-initializers",
+    ],
+    export_include_dirs: ["."],
+}
+
+// Library for the device
+cc_library {
+    name: "libdrm",
+    recovery_available: true,
+    vendor_available: true,
+    defaults: [
+        "libdrm_defaults",
+        "libdrm_sources",
+    ],
+
+    export_include_dirs: ["include/drm", "android"],
+
+    cflags: [
+        "-Wno-enum-conversion",
+        "-Wno-pointer-arith",
+        "-Wno-sign-compare",
+        "-Wno-tautological-compare",
+    ],
+}
diff --git a/Android.common.mk b/Android.common.mk
deleted file mode 100644
index d0e5d559..00000000
--- a/Android.common.mk
+++ /dev/null
@@ -1,19 +0,0 @@ 
-# XXX: Consider moving these to config.h analogous to autoconf.
-LOCAL_CFLAGS += \
-	-DMAJOR_IN_SYSMACROS=1 \
-	-DHAVE_VISIBILITY=1 \
-	-fvisibility=hidden \
-	-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-
-LOCAL_CFLAGS += \
-	-Wno-error \
-	-Wno-unused-parameter \
-	-Wno-missing-field-initializers \
-	-Wno-pointer-arith \
-	-Wno-enum-conversion
-
-# Quiet down the build system and remove any .h files from the sources
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS += $(LOCAL_PATH)
-
-LOCAL_PROPRIETARY_MODULE := true
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 0ab6f0f9..00000000
--- a/Android.mk
+++ /dev/null
@@ -1,74 +0,0 @@ 
-#
-# Copyright © 2011-2012 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-
-LIBDRM_ANDROID_MAJOR_VERSION := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
-ifneq ($(filter 2 4, $(LIBDRM_ANDROID_MAJOR_VERSION)),)
-$(error "Android 4.4 and earlier not supported")
-endif
-
-LIBDRM_COMMON_MK := $(call my-dir)/Android.common.mk
-
-LOCAL_PATH := $(call my-dir)
-LIBDRM_TOP := $(LOCAL_PATH)
-
-include $(CLEAR_VARS)
-
-# Import variables LIBDRM_{,H,INCLUDE_H,INCLUDE_ANDROID_H,INCLUDE_VMWGFX_H}_FILES
-include $(LOCAL_PATH)/Makefile.sources
-
-#static library for the device (recovery)
-include $(CLEAR_VARS)
-LOCAL_MODULE := libdrm
-
-LOCAL_SRC_FILES := $(LIBDRM_FILES)
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/include/drm \
-	$(LOCAL_PATH)/android
-
-LOCAL_C_INCLUDES := \
-	$(LOCAL_PATH)/include/drm
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_STATIC_LIBRARY)
-
-# Shared library for the device
-include $(CLEAR_VARS)
-LOCAL_MODULE := libdrm
-
-LOCAL_SRC_FILES := $(LIBDRM_FILES)
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/include/drm \
-	$(LOCAL_PATH)/android
-
-LOCAL_SHARED_LIBRARIES := \
-	libcutils
-
-LOCAL_C_INCLUDES := \
-        $(LOCAL_PATH)/include/drm
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/Android.sources.bp b/Android.sources.bp
new file mode 100644
index 00000000..73356dd8
--- /dev/null
+++ b/Android.sources.bp
@@ -0,0 +1,12 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libdrm_sources",
+    srcs: [
+        "xf86drm.c",
+        "xf86drmHash.c",
+        "xf86drmRandom.c",
+        "xf86drmSL.c",
+        "xf86drmMode.c",
+    ],
+}
diff --git a/Android.sources.bp.mk b/Android.sources.bp.mk
new file mode 100644
index 00000000..26b61c1e
--- /dev/null
+++ b/Android.sources.bp.mk
@@ -0,0 +1,25 @@ 
+# Usage: make -f path/to/Android.sources.bp.mk NAMES=<> >Android.sources.bp
+#
+# It will read the Makefile.sources in the current directory, and
+# write <NAME>_FILES to stdout as an Android.bp cc_defaults module.
+
+.PHONY: all
+all:
+	@# Do nothing
+
+include Makefile.sources
+
+empty :=
+indent := $(empty)    $(empty)
+
+$(info // Autogenerated with Android.sources.bp.mk)
+$(foreach NAME,$(NAMES), \
+  $(eval lower_name := $(shell echo $(PREFIX)$(NAME) | tr 'A-Z' 'a-z')) \
+  $(info ) \
+  $(info cc_defaults {) \
+  $(info $(indent)name: "$(lower_name)_sources",) \
+  $(info $(indent)srcs: [) \
+  $(foreach f,$(filter %.c,$($(NAME)_FILES)), \
+    $(info $(indent)$(indent)"$(f)",)) \
+  $(info $(indent)],) \
+  $(info }))
diff --git a/amdgpu/Android.bp b/amdgpu/Android.bp
new file mode 100644
index 00000000..976f03e9
--- /dev/null
+++ b/amdgpu/Android.bp
@@ -0,0 +1,16 @@ 
+build = ["Android.sources.bp"]
+
+cc_library_shared {
+    name: "libdrm_amdgpu",
+
+    cflags: [
+	"-DAMDGPU_ASIC_ID_TABLE=\"/vendor/etc/hwdata/amdgpu.ids\""
+    ],
+
+    defaults: [
+        "libdrm_defaults",
+        "libdrm_amdgpu_sources",
+    ],
+    vendor: true,
+    shared_libs: ["libdrm"],
+}
diff --git a/amdgpu/Android.mk b/amdgpu/Android.mk
deleted file mode 100644
index 1f028d0b..00000000
--- a/amdgpu/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@ 
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# Import variables LIBDRM_AMDGPU_FILES, LIBDRM_AMDGPU_H_FILES
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_MODULE := libdrm_amdgpu
-
-LOCAL_SHARED_LIBRARIES := libdrm
-
-LOCAL_SRC_FILES := $(LIBDRM_AMDGPU_FILES)
-
-LOCAL_CFLAGS := \
-	-DAMDGPU_ASIC_ID_TABLE=\"/vendor/etc/hwdata/amdgpu.ids\"
-
-LOCAL_REQUIRED_MODULES := amdgpu.ids
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_SHARED_LIBRARY)
diff --git a/amdgpu/Android.sources.bp b/amdgpu/Android.sources.bp
new file mode 100644
index 00000000..be85283d
--- /dev/null
+++ b/amdgpu/Android.sources.bp
@@ -0,0 +1,15 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libdrm_amdgpu_sources",
+    srcs: [
+	"amdgpu_asic_id.c",
+        "amdgpu_bo.c",
+        "amdgpu_cs.c",
+        "amdgpu_device.c",
+        "amdgpu_gpu_info.c",
+        "amdgpu_vamgr.c",
+	"amdgpu_vm.c",
+        "handle_table.c",
+    ],
+}
diff --git a/data/Android.bp b/data/Android.bp
new file mode 100644
index 00000000..47f64371
--- /dev/null
+++ b/data/Android.bp
@@ -0,0 +1,6 @@ 
+prebuilt_etc {
+    name: "amdgpu.ids",
+    proprietary: true,
+    sub_dir: "hwdata",
+    src: "amdgpu.ids",
+}
diff --git a/data/Android.mk b/data/Android.mk
deleted file mode 100644
index 62013f0c..00000000
--- a/data/Android.mk
+++ /dev/null
@@ -1,10 +0,0 @@ 
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := amdgpu.ids
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := ETC
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hwdata
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-include $(BUILD_PREBUILT)
diff --git a/etnaviv/Android.bp b/etnaviv/Android.bp
new file mode 100644
index 00000000..21deda99
--- /dev/null
+++ b/etnaviv/Android.bp
@@ -0,0 +1,11 @@ 
+build = ["Android.sources.bp"]
+
+cc_library_shared {
+    name: "libdrm_etnaviv",
+    defaults: [
+        "libdrm_defaults",
+        "libdrm_etnaviv_sources",
+    ],
+    vendor: true,
+    shared_libs: ["libdrm"],
+}
diff --git a/etnaviv/Android.mk b/etnaviv/Android.mk
deleted file mode 100644
index 390f9a98..00000000
--- a/etnaviv/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@ 
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# Import variables LIBDRM_ETNAVIV_FILES, LIBDRM_ETNAVIV_H_FILES
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_MODULE := libdrm_etnaviv
-
-LOCAL_SHARED_LIBRARIES := libdrm
-
-LOCAL_SRC_FILES := $(LIBDRM_ETNAVIV_FILES)
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_SHARED_LIBRARY)
diff --git a/etnaviv/Android.sources.bp b/etnaviv/Android.sources.bp
new file mode 100644
index 00000000..aa828900
--- /dev/null
+++ b/etnaviv/Android.sources.bp
@@ -0,0 +1,13 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libdrm_etnaviv_sources",
+    srcs: [
+        "etnaviv_device.c",
+        "etnaviv_gpu.c",
+        "etnaviv_bo.c",
+        "etnaviv_bo_cache.c",
+        "etnaviv_pipe.c",
+        "etnaviv_cmd_stream.c",
+    ],
+}
diff --git a/freedreno/Android.bp b/freedreno/Android.bp
new file mode 100644
index 00000000..9fca9b12
--- /dev/null
+++ b/freedreno/Android.bp
@@ -0,0 +1,11 @@ 
+build = ["Android.sources.bp"]
+
+cc_library_shared {
+    name: "libdrm_freedreno",
+    defaults: [
+        "libdrm_defaults",
+        "libdrm_freedreno_sources",
+    ],
+    vendor: true,
+    shared_libs: ["libdrm"],
+}
diff --git a/freedreno/Android.mk b/freedreno/Android.mk
deleted file mode 100644
index 2b582aed..00000000
--- a/freedreno/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@ 
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# Import variables LIBDRM_FREEDRENO_FILES, LIBDRM_FREEDRENO_H_FILES
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_MODULE := libdrm_freedreno
-
-LOCAL_SHARED_LIBRARIES := libdrm
-
-LOCAL_SRC_FILES := $(LIBDRM_FREEDRENO_FILES)
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_SHARED_LIBRARY)
diff --git a/freedreno/Android.sources.bp b/freedreno/Android.sources.bp
new file mode 100644
index 00000000..3c1ca316
--- /dev/null
+++ b/freedreno/Android.sources.bp
@@ -0,0 +1,16 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libdrm_freedreno_sources",
+    srcs: [
+        "freedreno_device.c",
+        "freedreno_pipe.c",
+        "freedreno_ringbuffer.c",
+        "freedreno_bo.c",
+        "freedreno_bo_cache.c",
+        "msm/msm_bo.c",
+        "msm/msm_device.c",
+        "msm/msm_pipe.c",
+        "msm/msm_ringbuffer.c",
+    ],
+}
diff --git a/intel/Android.bp b/intel/Android.bp
new file mode 100644
index 00000000..22713acc
--- /dev/null
+++ b/intel/Android.bp
@@ -0,0 +1,36 @@ 
+//
+// Copyright © 2011 Intel Corporation
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice (including the next
+// paragraph) shall be included in all copies or substantial portions of the
+// Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+
+build = ["Android.sources.bp"]
+
+cc_library_shared {
+    name: "libdrm_intel",
+    defaults: [
+        "libdrm_defaults",
+        "libdrm_intel_sources",
+    ],
+    vendor: true,
+
+    // Removed dependency to libpciaccess: not used on Android
+    shared_libs: ["libdrm"],
+}
diff --git a/intel/Android.mk b/intel/Android.mk
deleted file mode 100644
index f45312dd..00000000
--- a/intel/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@ 
-#
-# Copyright © 2011 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# Import variables LIBDRM_INTEL_FILES, LIBDRM_INTEL_H_FILES
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_MODULE := libdrm_intel
-
-LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES)
-
-LOCAL_SHARED_LIBRARIES := \
-	libdrm
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_SHARED_LIBRARY)
diff --git a/intel/Android.sources.bp b/intel/Android.sources.bp
new file mode 100644
index 00000000..46e0328f
--- /dev/null
+++ b/intel/Android.sources.bp
@@ -0,0 +1,13 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libdrm_intel_sources",
+    srcs: [
+        "intel_bufmgr.c",
+        "intel_bufmgr_fake.c",
+        "intel_bufmgr_gem.c",
+        "intel_decode.c",
+        "intel_chipset.c",
+        "mm.c",
+    ],
+}
diff --git a/libkms/Android.bp b/libkms/Android.bp
new file mode 100644
index 00000000..b09dbf42
--- /dev/null
+++ b/libkms/Android.bp
@@ -0,0 +1,15 @@ 
+build = ["Android.sources.bp"]
+
+cc_library_shared {
+    name: "libkms",
+    defaults: [
+        "libdrm_defaults",
+        "libkms_sources",
+        "libkms_vmwgfx_sources",
+        "libkms_intel_sources",
+        "libkms_nouveau_sources",
+        "libkms_radeon_sources",
+    ],
+    vendor: true,
+    shared_libs: ["libdrm"],
+}
diff --git a/libkms/Android.mk b/libkms/Android.mk
deleted file mode 100644
index a8b9489f..00000000
--- a/libkms/Android.mk
+++ /dev/null
@@ -1,51 +0,0 @@ 
-DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS)))
-
-intel_drivers := i915 i965 i915g iris
-radeon_drivers := r300g r600g radeonsi
-nouveau_drivers := nouveau
-virgl_drivers := virgl
-vmwgfx_drivers := vmwgfx
-
-valid_drivers := \
-	$(intel_drivers) \
-	$(radeon_drivers) \
-	$(nouveau_drivers) \
-	$(virgl_drivers) \
-	$(vmwgfx_drivers)
-
-# warn about invalid drivers
-invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS))
-ifneq ($(invalid_drivers),)
-$(warning invalid GPU drivers: $(invalid_drivers))
-# tidy up
-DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS))
-endif
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_SRC_FILES := $(LIBKMS_FILES)
-
-ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),)
-LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES)
-endif
-
-ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),)
-LOCAL_SRC_FILES += $(LIBKMS_INTEL_FILES)
-endif
-
-ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),)
-LOCAL_SRC_FILES += $(LIBKMS_NOUVEAU_FILES)
-endif
-
-ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),)
-LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES)
-endif
-
-LOCAL_MODULE := libkms
-LOCAL_SHARED_LIBRARIES := libdrm
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_SHARED_LIBRARY)
diff --git a/libkms/Android.sources.bp b/libkms/Android.sources.bp
new file mode 100644
index 00000000..5582f235
--- /dev/null
+++ b/libkms/Android.sources.bp
@@ -0,0 +1,38 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libkms_sources",
+    srcs: [
+        "linux.c",
+        "dumb.c",
+        "api.c",
+    ],
+}
+
+cc_defaults {
+    name: "libkms_vmwgfx_sources",
+    srcs: [
+        "vmwgfx.c",
+    ],
+}
+
+cc_defaults {
+    name: "libkms_intel_sources",
+    srcs: [
+        "intel.c",
+    ],
+}
+
+cc_defaults {
+    name: "libkms_nouveau_sources",
+    srcs: [
+        "nouveau.c",
+    ],
+}
+
+cc_defaults {
+    name: "libkms_radeon_sources",
+    srcs: [
+        "radeon.c",
+    ],
+}
diff --git a/nouveau/Android.bp b/nouveau/Android.bp
new file mode 100644
index 00000000..12c37e3d
--- /dev/null
+++ b/nouveau/Android.bp
@@ -0,0 +1,11 @@ 
+build = ["Android.sources.bp"]
+
+cc_library_shared {
+    name: "libdrm_nouveau",
+    defaults: [
+        "libdrm_defaults",
+        "libdrm_nouveau_sources",
+    ],
+    vendor: true,
+    shared_libs: ["libdrm"],
+}
diff --git a/nouveau/Android.mk b/nouveau/Android.mk
deleted file mode 100644
index b430af4f..00000000
--- a/nouveau/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@ 
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# Import variables LIBDRM_NOUVEAU_FILES, LIBDRM_NOUVEAU_H_FILES
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_MODULE := libdrm_nouveau
-
-LOCAL_SHARED_LIBRARIES := libdrm
-
-LOCAL_SRC_FILES := $(LIBDRM_NOUVEAU_FILES)
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_SHARED_LIBRARY)
diff --git a/nouveau/Android.sources.bp b/nouveau/Android.sources.bp
new file mode 100644
index 00000000..5ecdb53c
--- /dev/null
+++ b/nouveau/Android.sources.bp
@@ -0,0 +1,11 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libdrm_nouveau_sources",
+    srcs: [
+        "nouveau.c",
+        "pushbuf.c",
+        "bufctx.c",
+        "abi16.c",
+    ],
+}
diff --git a/omap/Android.bp b/omap/Android.bp
new file mode 100644
index 00000000..05ca7d2d
--- /dev/null
+++ b/omap/Android.bp
@@ -0,0 +1,12 @@ 
+build = ["Android.sources.bp"]
+
+cc_library_shared {
+    name: "libdrm_omap",
+    defaults: [
+        "libdrm_defaults",
+        "libdrm_omap_sources",
+    ],
+    vendor: true,
+
+    shared_libs: ["libdrm"],
+}
diff --git a/omap/Android.mk b/omap/Android.mk
deleted file mode 100644
index b25cca13..00000000
--- a/omap/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@ 
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libdrm_omap
-LOCAL_VENDOR_MODULE := true
-
-LOCAL_SRC_FILES := omap_drm.c
-
-LOCAL_SHARED_LIBRARIES := libdrm
-
-include $(LIBDRM_COMMON_MK)
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/omap/Android.sources.bp b/omap/Android.sources.bp
new file mode 100644
index 00000000..3c7da94a
--- /dev/null
+++ b/omap/Android.sources.bp
@@ -0,0 +1,8 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libdrm_omap_sources",
+    srcs: [
+	"omap_drm.c",
+    ],
+}
diff --git a/radeon/Android.bp b/radeon/Android.bp
new file mode 100644
index 00000000..9d0a09ec
--- /dev/null
+++ b/radeon/Android.bp
@@ -0,0 +1,11 @@ 
+build = ["Android.sources.bp"]
+
+cc_library_shared {
+    name: "libdrm_radeon",
+    defaults: [
+        "libdrm_defaults",
+        "libdrm_radeon_sources",
+    ],
+    vendor: true,
+    shared_libs: ["libdrm"],
+}
diff --git a/radeon/Android.mk b/radeon/Android.mk
deleted file mode 100644
index 71040dab..00000000
--- a/radeon/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@ 
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# Import variables LIBDRM_RADEON_FILES, LIBDRM_RADEON_H_FILES
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_MODULE := libdrm_radeon
-
-LOCAL_SHARED_LIBRARIES := libdrm
-
-LOCAL_SRC_FILES := $(LIBDRM_RADEON_FILES)
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_SHARED_LIBRARY)
diff --git a/radeon/Android.sources.bp b/radeon/Android.sources.bp
new file mode 100644
index 00000000..820ac4d6
--- /dev/null
+++ b/radeon/Android.sources.bp
@@ -0,0 +1,13 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libdrm_radeon_sources",
+    srcs: [
+        "radeon_bo_gem.c",
+        "radeon_cs_gem.c",
+        "radeon_cs_space.c",
+        "radeon_bo.c",
+        "radeon_cs.c",
+        "radeon_surface.c",
+    ],
+}
diff --git a/tegra/Android.bp b/tegra/Android.bp
new file mode 100644
index 00000000..33eaf6c5
--- /dev/null
+++ b/tegra/Android.bp
@@ -0,0 +1,14 @@ 
+cc_library_shared {
+    name: "libdrm_tegra",
+    vendor: true,
+    shared_libs: ["libdrm"],
+
+    srcs: ["tegra.c"],
+
+    cflags: [
+        "-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1",
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-variable",
+    ],
+}
diff --git a/tests/Android.bp b/tests/Android.bp
new file mode 100644
index 00000000..cdc6c2cf
--- /dev/null
+++ b/tests/Android.bp
@@ -0,0 +1,6 @@ 
+subdirs = ["*"]
+
+cc_library_headers {
+    name: "libdrm_test_headers",
+    export_include_dirs: ["."],
+}
diff --git a/tests/Android.mk b/tests/Android.mk
deleted file mode 100644
index 5053e7d6..00000000
--- a/tests/Android.mk
+++ /dev/null
@@ -1 +0,0 @@ 
-include $(call all-subdir-makefiles)
diff --git a/tests/modetest/Android.bp b/tests/modetest/Android.bp
new file mode 100644
index 00000000..ca811fee
--- /dev/null
+++ b/tests/modetest/Android.bp
@@ -0,0 +1,12 @@ 
+build = ["Android.sources.bp"]
+
+cc_test {
+    name: "modetest",
+    defaults: [
+        "libdrm_defaults",
+        "modetest_sources",
+    ],
+
+    shared_libs: ["libdrm"],
+    static_libs: ["libdrm_util"],
+}
diff --git a/tests/modetest/Android.mk b/tests/modetest/Android.mk
deleted file mode 100644
index c1a71fd9..00000000
--- a/tests/modetest/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@ 
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_SRC_FILES := $(MODETEST_FILES)
-
-LOCAL_MODULE := modetest
-
-LOCAL_SHARED_LIBRARIES := libdrm
-LOCAL_STATIC_LIBRARIES := libdrm_util
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_EXECUTABLE)
diff --git a/tests/modetest/Android.sources.bp b/tests/modetest/Android.sources.bp
new file mode 100644
index 00000000..c6aca2ef
--- /dev/null
+++ b/tests/modetest/Android.sources.bp
@@ -0,0 +1,10 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "modetest_sources",
+    srcs: [
+        "buffers.c",
+        "cursor.c",
+        "modetest.c",
+    ],
+}
diff --git a/tests/proptest/Android.bp b/tests/proptest/Android.bp
new file mode 100644
index 00000000..28c87e91
--- /dev/null
+++ b/tests/proptest/Android.bp
@@ -0,0 +1,8 @@ 
+cc_test {
+    name: "proptest",
+    defaults: ["libdrm_defaults"],
+    srcs: ["proptest.c"],
+
+    shared_libs: ["libdrm"],
+    static_libs: ["libdrm_util"],
+}
diff --git a/tests/proptest/Android.mk b/tests/proptest/Android.mk
deleted file mode 100644
index 91a590fc..00000000
--- a/tests/proptest/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@ 
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_SRC_FILES := $(PROPTEST_FILES)
-
-LOCAL_MODULE := proptest
-
-LOCAL_SHARED_LIBRARIES := libdrm
-LOCAL_STATIC_LIBRARIES := libdrm_util
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_EXECUTABLE)
diff --git a/tests/util/Android.bp b/tests/util/Android.bp
new file mode 100644
index 00000000..36d18206
--- /dev/null
+++ b/tests/util/Android.bp
@@ -0,0 +1,35 @@ 
+//
+// Copyright © 2015 NVIDIA Corporation
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice (including the next
+// paragraph) shall be included in all copies or substantial portions of the
+// Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//
+
+build = ["Android.sources.bp"]
+
+cc_library_static {
+    name: "libdrm_util",
+    defaults: [
+        "libdrm_defaults",
+        "libdrm_util_sources",
+    ],
+    shared_libs: ["libdrm"],
+    header_libs: ["libdrm_test_headers"],
+    export_header_lib_headers: ["libdrm_test_headers"],
+}
diff --git a/tests/util/Android.mk b/tests/util/Android.mk
deleted file mode 100644
index 12eccb42..00000000
--- a/tests/util/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@ 
-#
-# Copyright © 2015 NVIDIA Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-include $(LOCAL_PATH)/Makefile.sources
-
-LOCAL_MODULE := libdrm_util
-
-LOCAL_SHARED_LIBRARIES := libdrm
-
-LOCAL_SRC_FILES := $(UTIL_FILES)
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LIBDRM_TOP)/tests
-
-include $(LIBDRM_COMMON_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/tests/util/Android.sources.bp b/tests/util/Android.sources.bp
new file mode 100644
index 00000000..529e1124
--- /dev/null
+++ b/tests/util/Android.sources.bp
@@ -0,0 +1,10 @@ 
+// Autogenerated with Android.sources.bp.mk
+
+cc_defaults {
+    name: "libdrm_util_sources",
+    srcs: [
+        "format.c",
+        "kms.c",
+        "pattern.c",
+    ],
+}