[Mesa-dev] [PATCH 1/2] configure.ac: Add support for Android builds

Nicolas Boichat drinkcat at chromium.org
Mon May 23 13:42:20 UTC 2016


On Mon, May 23, 2016 at 8:20 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 23 May 2016 at 12:17, Nicolas Boichat <drinkcat at chromium.org> wrote:
>> On Mon, May 23, 2016 at 5:49 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>>> [...]
>>>>> Do you guys have X related libraries on the host_os ? Or you
>>>>> explicitly disable those mesa features that depend on it ?
>>>>
>>>> AFAIK, no X libraries, neither on Chrome OS or Android side.
>>>>
>>> Just realised that Android requires additional libraries (and their
>>> respective headers)
>>>
>>> Quick grep shows
>>>
>>> for libEGL:
>>> libhardware
>>> liblog
>>> libcutils
>>> libgralloc_drm
>>> libsync
>>>
>>> For the dri module(s):
>>> libcutils
>>> liblog
>>>
>>>
>>> How are you managing to build without mentioning there ? There would
>>> be either issues due to missing includes or unresolved symbols.
>>
>> By manually adding the libs into some *_LIBS variables:
>>
>> export DRM_GRALLOC_LIBS="-lsync -lcutils"
>> export LIBDRM_LIBS="-ldrm ${DRM_GRALLOC_LIBS}"
>> export INTEL_LIBS+="-lgralloc_drm"
>>
>> Not very pretty, but it works (some of the dependencies are implicit, then)...
>>
> Indeed.
>
>> In the interval of time between I sent the patch and now, we started
>> using this in src/egl/Makefile.am (3 new lines after the "if" line):
>>
>> if HAVE_EGL_PLATFORM_ANDROID
>> libEGL_la_LIBADD += -lhardware -lcutils -lsync
>> libEGL_la_LIBADD += $(DRM_GRALLOC_LIBS)
>> AM_CFLAGS += $(DRM_GRALLOC_CFLAGS)
>> AM_CFLAGS += -DHAVE_ANDROID_PLATFORM
>> dri2_backend_FILES += drivers/dri2/platform_android.c
>> endif
>>
>> which allows us to use saner _LIBS definitions:
>> export DRM_GRALLOC_LIBS="-lgralloc_drm"
>
>> export LIBDRM_LIBS="-ldrm"
>> export INTEL_LIBS="${LIBDRM_LIBS} -ldrm_intel"
>>
> Hmm ...configure should error out if the these two deps. are unmet. We
> either have a bug or there's some extra patches somewhere ;-)

We also set PKGCONFIG="false", because, well, we do not have .pc files
for Android libs. We _could_ create them manually, though, but I'm not
100% convinced it's any better than specifying them in the mesa ebuild
(knowing that mesa is the only package we build this way, the
dependencies are prebuilts that we pull from Android builders).

So we replace them with LIBXYZ_[CFLAGS/LIBS], and configure is happy with that.

One thing that I wonder about is how we could specify
libEGL_la_LIBADD += -lhardware -lcutils -lsync
without hardcoding it in the Makefile.am.

Any idea how we could do that? Or do you think it's ok to hardcode the libs?

> Can we have .pc files for the extra libraries (something like below,
> with the @@ expanded). That way one can use
> PKG_CHECK_MODULES(ANDROID_EGL, ....) PKG_CHECK_MODULES(ANDROID_DRI,
> ...) and the respective _CFLAGS, _LIBS in the targets.
>
> prefix=@prefix@
> exec_prefix=${prefix}
> libdir=@libdir@
> includedir=@includedir@
>
> Name: xatracker
> Description: Xorg Gallium3D acceleration library
> Version: @XA_VERSION@
> Libs: -L${libdir} -lxatracker
>
>> This seems to be a little odd as HAVE_EGL_PLATFORM_ANDROID is not 100%
>> the same thing as building for Android target (even though I can't see
>> how one could work without the other, and platform_android.c would not
>> build on other targets anyway)...
>>
> Indeed it does. I'll push these two in a second, but please follow up
> with any extra patches to make things a bit easier to manage.

Thanks! I will follow up.

Best,

Nicolas


More information about the mesa-dev mailing list