From 96007f52dd13948edc8a1cf9cdb8fc2ce6c14659 Mon Sep 17 00:00:00 2001 From: hmtheboy154 Date: Wed, 28 Jun 2023 16:53:41 -0400 Subject: [PATCH] Enable xmlconfig on Android I don't know why Mesa still block it, but let's put this into good use. This commit includes : - Remove Android availability check on xmlconfig - Include libxml2 into Android.mk - Enable xmlconfig in mesa3d_cross.mk - On Android, /etc/drirc file will move to /vendor/etc/drirc, while /usr/share/drirc.d will move to /data/vendor/drirc.d Signed-off-by: hmtheboy154 --- android/Android.mk | 4 ++-- android/mesa3d_cross.mk | 1 + meson.build | 6 +++--- src/util/xmlconfig.c | 7 +++++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/android/Android.mk b/android/Android.mk index 58ceb1c5eaf..fe6e223a4e3 100644 --- a/android/Android.mk +++ b/android/Android.mk @@ -39,10 +39,10 @@ MESA_VK_LIB_SUFFIX_swrast := lvp include $(CLEAR_VARS) -LOCAL_SHARED_LIBRARIES := libc libdl libdrm libm liblog libcutils libz libc++ libnativewindow libsync libhardware +LOCAL_SHARED_LIBRARIES := libc libdl libdrm libm liblog libcutils libz libc++ libnativewindow libsync libhardware libxml2 LOCAL_STATIC_LIBRARIES := libexpat libarect libelf LOCAL_HEADER_LIBRARIES := libnativebase_headers hwvulkan_headers -MESON_GEN_PKGCONFIGS := cutils expat hardware libdrm:$(LIBDRM_VERSION) nativewindow sync zlib:1.2.11 libelf +MESON_GEN_PKGCONFIGS := cutils expat hardware libdrm:$(LIBDRM_VERSION) nativewindow sync zlib:1.2.11 libelf libxml2 LOCAL_CFLAGS += $(BOARD_MESA3D_CFLAGS) ifneq ($(filter swrast,$(BOARD_MESA3D_GALLIUM_DRIVERS) $(BOARD_MESA3D_VULKAN_DRIVERS)),) diff --git a/android/mesa3d_cross.mk b/android/mesa3d_cross.mk index 4a4609562ea..744b8fa1ca6 100644 --- a/android/mesa3d_cross.mk +++ b/android/mesa3d_cross.mk @@ -95,6 +95,7 @@ MESON_GEN_NINJA := \ -Dandroid-libbacktrace=disabled \ -Dallow-kcmp=enabled \ -Dintel-xe-kmd=enabled \ + -Dxmlconfig=enabled \ MESON_BUILD := PATH=/usr/bin:/bin:/sbin:$$PATH ninja -C $(MESON_OUT_DIR)/build diff --git a/meson.build b/meson.build index 2902c1019f6..39c5a60b13c 100644 --- a/meson.build +++ b/meson.build @@ -1537,7 +1537,7 @@ if dep_thread.found() endif with_expat = get_option('expat') \ - .disable_auto_if(with_platform_android or with_platform_windows) + .disable_auto_if(with_platform_windows) if host_machine.system() == 'darwin' dep_expat = meson.get_compiler('c').find_library('expat', required : with_expat) @@ -1553,8 +1553,8 @@ endif # We don't require expat on Android or Windows use_xmlconfig = get_option('xmlconfig') \ - .require(not (with_platform_android or with_platform_windows), - error_message : 'xmlconfig not available on Android or Windows') \ + .require(not (with_platform_windows), + error_message : 'xmlconfig not available on Windows') \ .require(dep_expat.found(), error_message : 'requires expat') \ .allowed() diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c index 7a753e37e05..f6e1e7ad61b 100644 --- a/src/util/xmlconfig.c +++ b/src/util/xmlconfig.c @@ -1165,6 +1165,11 @@ initOptionCache(driOptionCache *cache, const driOptionCache *info) } } +#ifdef __ANDROID__ +#define SYSCONFDIR "/vendor/etc" +#define DATADIR "/data/vendor" +#else + #ifndef SYSCONFDIR #define SYSCONFDIR "/etc" #endif @@ -1173,6 +1178,8 @@ initOptionCache(driOptionCache *cache, const driOptionCache *info) #define DATADIR "/usr/share" #endif +#endif /* __ANDROID__ */ + static const char *execname; void