imx-gpu-viv.mk 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ################################################################################
  2. #
  3. # imx-gpu-viv
  4. #
  5. ################################################################################
  6. IMX_GPU_VIV_VERSION = 6.2.2.p0-aarch32
  7. IMX_GPU_VIV_SITE = $(FREESCALE_IMX_SITE)
  8. IMX_GPU_VIV_SOURCE = imx-gpu-viv-$(IMX_GPU_VIV_VERSION).bin
  9. IMX_GPU_VIV_INSTALL_STAGING = YES
  10. IMX_GPU_VIV_LICENSE = NXP Semiconductor Software License Agreement
  11. IMX_GPU_VIV_LICENSE_FILES = EULA COPYING
  12. IMX_GPU_VIV_REDISTRIBUTE = NO
  13. IMX_GPU_VIV_PROVIDES = libegl libgles libopenvg
  14. IMX_GPU_VIV_LIB_TARGET = $(call qstrip,$(BR2_PACKAGE_IMX_GPU_VIV_OUTPUT))
  15. ifeq ($(IMX_GPU_VIV_LIB_TARGET),x11)
  16. # The libGAL.so library provided by imx-gpu-viv uses X functions. Packages
  17. # may want to link against libGAL.so (QT5 Base with OpenGL and X support
  18. # does so). For this to work we need build dependencies to libXdamage,
  19. # libXext and libXfixes so that X functions used in libGAL.so are referenced.
  20. IMX_GPU_VIV_DEPENDENCIES += xlib_libXdamage xlib_libXext xlib_libXfixes
  21. endif
  22. define IMX_GPU_VIV_EXTRACT_CMDS
  23. $(call FREESCALE_IMX_EXTRACT_HELPER,$(IMX_GPU_VIV_DL_DIR)/$(IMX_GPU_VIV_SOURCE))
  24. endef
  25. # Instead of building, we fix up the inconsistencies that exist
  26. # in the upstream archive here.
  27. # Make sure these commands are idempotent.
  28. define IMX_GPU_VIV_BUILD_CMDS
  29. $(SED) 's/defined(LINUX)/defined(__linux__)/g' $(@D)/gpu-core/usr/include/*/*.h
  30. ln -sf libGL.so.1.2 $(@D)/gpu-core/usr/lib/libGL.so
  31. ln -sf libGL.so.1.2 $(@D)/gpu-core/usr/lib/libGL.so.1
  32. ln -sf libGL.so.1.2 $(@D)/gpu-core/usr/lib/libGL.so.1.2.0
  33. ln -sf libEGL-$(IMX_GPU_VIV_LIB_TARGET).so $(@D)/gpu-core/usr/lib/libEGL.so
  34. ln -sf libEGL-$(IMX_GPU_VIV_LIB_TARGET).so $(@D)/gpu-core/usr/lib/libEGL.so.1
  35. ln -sf libEGL-$(IMX_GPU_VIV_LIB_TARGET).so $(@D)/gpu-core/usr/lib/libEGL.so.1.0
  36. ln -sf libGLESv2-$(IMX_GPU_VIV_LIB_TARGET).so $(@D)/gpu-core/usr/lib/libGLESv2.so
  37. ln -sf libGLESv2-$(IMX_GPU_VIV_LIB_TARGET).so $(@D)/gpu-core/usr/lib/libGLESv2.so.2
  38. ln -sf libGLESv2-$(IMX_GPU_VIV_LIB_TARGET).so $(@D)/gpu-core/usr/lib/libGLESv2.so.2.0.0
  39. ln -sf libGAL-$(IMX_GPU_VIV_LIB_TARGET).so $(@D)/gpu-core/usr/lib/libGAL.so
  40. ln -sf libVDK-$(IMX_GPU_VIV_LIB_TARGET).so $(@D)/gpu-core/usr/lib/libVDK.so
  41. endef
  42. ifeq ($(IMX_GPU_VIV_LIB_TARGET),fb)
  43. define IMX_GPU_VIV_FIXUP_FB_HEADERS
  44. $(SED) '39i\
  45. #if !defined(EGL_API_X11) && !defined(EGL_API_DFB) && !defined(EGL_API_FB) \n\
  46. #define EGL_API_FB \n\
  47. #endif' $(STAGING_DIR)/usr/include/EGL/eglplatform.h
  48. endef
  49. endif
  50. ifeq ($(IMX_GPU_VIV_LIB_TARGET),fb)
  51. define IMX_GPU_VIV_FIXUP_PKGCONFIG
  52. ln -sf egl_linuxfb.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
  53. endef
  54. endif
  55. ifeq ($(IMX_GPU_VIV_LIB_TARGET),x11)
  56. define IMX_GPU_VIV_FIXUP_PKGCONFIG
  57. for lib in egl gbm glesv1_cm glesv2 vg; do \
  58. ln -sf $${lib}_x11.pc $(@D)/gpu-core/usr/lib/pkgconfig/$${lib}.pc
  59. done
  60. endef
  61. endif
  62. define IMX_GPU_VIV_INSTALL_STAGING_CMDS
  63. cp -r $(@D)/gpu-core/usr/* $(STAGING_DIR)/usr
  64. $(IMX_GPU_VIV_FIXUP_FB_HEADERS)
  65. $(IMX_GPU_VIV_FIXUP_PKGCONFIG)
  66. for lib in egl gbm glesv1_cm glesv2 vg; do \
  67. $(INSTALL) -m 0644 -D \
  68. $(@D)/gpu-core/usr/lib/pkgconfig/$${lib}.pc \
  69. $(STAGING_DIR)/usr/lib/pkgconfig/$${lib}.pc; \
  70. done
  71. endef
  72. ifeq ($(BR2_PACKAGE_IMX_GPU_VIV_EXAMPLES),y)
  73. define IMX_GPU_VIV_INSTALL_EXAMPLES
  74. mkdir -p $(TARGET_DIR)/usr/share/examples/
  75. cp -r $(@D)/gpu-demos/opt/* $(TARGET_DIR)/usr/share/examples/
  76. endef
  77. endif
  78. ifeq ($(BR2_PACKAGE_IMX_GPU_VIV_GMEM_INFO),y)
  79. define IMX_GPU_VIV_INSTALL_GMEM_INFO
  80. cp -dpfr $(@D)/gpu-tools/gmem-info/usr/bin/* $(TARGET_DIR)/usr/bin/
  81. endef
  82. endif
  83. # On the target, remove the unused libraries.
  84. # Note that this is _required_, else ldconfig may create symlinks
  85. # to the wrong library
  86. define IMX_GPU_VIV_INSTALL_TARGET_CMDS
  87. $(IMX_GPU_VIV_INSTALL_EXAMPLES)
  88. $(IMX_GPU_VIV_INSTALL_GMEM_INFO)
  89. cp -a $(@D)/gpu-core/usr/lib $(TARGET_DIR)/usr
  90. for lib in EGL GAL GLESv2 VDK; do \
  91. for f in $(TARGET_DIR)/usr/lib/lib$${lib}-*.so; do \
  92. case $$f in \
  93. *-$(IMX_GPU_VIV_LIB_TARGET).so) : ;; \
  94. *) $(RM) $$f ;; \
  95. esac; \
  96. done; \
  97. done
  98. endef
  99. $(eval $(generic-package))