xref: /OK3568_Linux_fs/buildroot/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# imx-gpu-viv
4#
5################################################################################
6
7ifeq ($(BR2_aarch64),y)
8IMX_GPU_VIV_VERSION = 6.4.3.p2.0-aarch64
9else
10IMX_GPU_VIV_VERSION = 6.4.3.p2.0-aarch32
11endif
12IMX_GPU_VIV_SITE = $(FREESCALE_IMX_SITE)
13IMX_GPU_VIV_SOURCE = imx-gpu-viv-$(IMX_GPU_VIV_VERSION).bin
14
15IMX_GPU_VIV_INSTALL_STAGING = YES
16
17IMX_GPU_VIV_LICENSE = NXP Semiconductor Software License Agreement
18IMX_GPU_VIV_LICENSE_FILES = EULA COPYING
19IMX_GPU_VIV_REDISTRIBUTE = NO
20
21IMX_GPU_VIV_PROVIDES = libegl libgles libopencl libopenvg
22IMX_GPU_VIV_LIB_TARGET = $(call qstrip,$(BR2_PACKAGE_IMX_GPU_VIV_OUTPUT))
23
24ifeq ($(IMX_GPU_VIV_LIB_TARGET),x11)
25# The libGAL.so library provided by imx-gpu-viv uses X functions. Packages
26# may want to link against libGAL.so (QT5 Base with OpenGL and X support
27# does so). For this to work we need build dependencies to libXdamage,
28# libXext and libXfixes so that X functions used in libGAL.so are referenced.
29IMX_GPU_VIV_DEPENDENCIES += xlib_libXdamage xlib_libXext xlib_libXfixes
30endif
31
32# Libraries are linked against libdrm, except framebuffer output on ARM
33ifneq ($(IMX_GPU_VIV_LIB_TARGET)$(BR2_arm),fby)
34IMX_GPU_VIV_DEPENDENCIES += libdrm
35endif
36
37ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
38IMX_GPU_VIV_DEPENDENCIES += wayland
39endif
40
41define IMX_GPU_VIV_EXTRACT_CMDS
42	$(call FREESCALE_IMX_EXTRACT_HELPER,$(IMX_GPU_VIV_DL_DIR)/$(IMX_GPU_VIV_SOURCE))
43endef
44
45ifeq ($(IMX_GPU_VIV_LIB_TARGET),fb)
46define IMX_GPU_VIV_FIXUP_PKGCONFIG
47	ln -sf egl_linuxfb.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
48endef
49else ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
50define IMX_GPU_VIV_FIXUP_PKGCONFIG
51	ln -sf egl_wayland.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
52endef
53else ifeq ($(IMX_GPU_VIV_LIB_TARGET),x11)
54define IMX_GPU_VIV_FIXUP_PKGCONFIG
55	$(foreach lib,egl gbm glesv1_cm glesv2 vg, \
56		ln -sf $(lib)_x11.pc $(@D)/gpu-core/usr/lib/pkgconfig/$(lib).pc
57	)
58endef
59endif
60
61# Instead of building, we fix up the inconsistencies that exist
62# in the upstream archive here. We also remove unused backend files.
63# Make sure these commands are idempotent.
64define IMX_GPU_VIV_BUILD_CMDS
65	cp -dpfr $(@D)/gpu-core/usr/lib/$(IMX_GPU_VIV_LIB_TARGET)/* $(@D)/gpu-core/usr/lib/
66	$(foreach backend,fb x11 wayland, \
67		$(RM) -r $(@D)/gpu-core/usr/lib/$(backend)
68	)
69	$(IMX_GPU_VIV_FIXUP_PKGCONFIG)
70endef
71
72define IMX_GPU_VIV_INSTALL_STAGING_CMDS
73	cp -r $(@D)/gpu-core/usr/* $(STAGING_DIR)/usr
74endef
75
76ifeq ($(BR2_PACKAGE_IMX_GPU_VIV_EXAMPLES),y)
77define IMX_GPU_VIV_INSTALL_EXAMPLES
78	mkdir -p $(TARGET_DIR)/usr/share/examples/
79	cp -r $(@D)/gpu-demos/opt/* $(TARGET_DIR)/usr/share/examples/
80endef
81endif
82
83ifeq ($(BR2_PACKAGE_IMX_GPU_VIV_GMEM_INFO),y)
84define IMX_GPU_VIV_INSTALL_GMEM_INFO
85	cp -dpfr $(@D)/gpu-tools/gmem-info/usr/bin/* $(TARGET_DIR)/usr/bin/
86endef
87endif
88
89define IMX_GPU_VIV_INSTALL_TARGET_CMDS
90	$(IMX_GPU_VIV_INSTALL_EXAMPLES)
91	$(IMX_GPU_VIV_INSTALL_GMEM_INFO)
92	cp -a $(@D)/gpu-core/usr/lib $(TARGET_DIR)/usr
93	$(INSTALL) -D -m 0644 $(@D)/gpu-core/etc/Vivante.icd $(TARGET_DIR)/etc/OpenCL/vendors/Vivante.icd
94endef
95
96$(eval $(generic-package))
97