mesa3d-headers: fix installation of dri.pc
[buildroot-gz.git] / package / mesa3d-headers / mesa3d-headers.mk
blob7ae5966926a5ee22296c7c12a0515143f9986d1e
1 ################################################################################
3 # mesa3d-headers
5 ################################################################################
7 # mesa3d-headers is inherently incompatible with mesa3d, so error out
8 # if both are enabled.
9 ifeq ($(BR2_PACKAGE_MESA3D)$(BR2_PACKAGE_MESA3D_HEADERS),yy)
10 $(error mesa3d-headers enabled, but mesa3d enabled too)
11 endif
13 # Not possible to directly refer to mesa3d variables, because of
14 # first/second expansion trickery...
15 MESA3D_HEADERS_VERSION = 13.0.4
16 MESA3D_HEADERS_SOURCE = mesa-$(MESA3D_HEADERS_VERSION).tar.xz
17 MESA3D_HEADERS_SITE = ftp://ftp.freedesktop.org/pub/mesa/$(MESA3D_HEADERS_VERSION)
18 MESA3D_HEADERS_LICENSE = MIT, SGI, Khronos
19 MESA3D_HEADERS_LICENSE_FILES = docs/license.html
21 # Only installs header files
22 MESA3D_HEADERS_INSTALL_STAGING = YES
23 MESA3D_HEADERS_INSTALL_TARGET = NO
25 MESA3D_HEADERS_DIRS = KHR
27 ifeq ($(BR2_PACKAGE_HAS_LIBGL),y)
29 MESA3D_HEADERS_DIRS += GL
31 ifeq ($(BR2_PACKAGE_XORG7),y)
33 # Not using $(SED) because we do not want to work in-place, and $(SED)
34 # contains -i.
35 define MESA3D_HEADERS_BUILD_DRI_PC
36 sed -e 's:@\(exec_\)\?prefix@:/usr:' \
37 -e 's:@libdir@:${exec_prefix}/lib:' \
38 -e 's:@includedir@:${prefix}/include:' \
39 -e 's:@DRI_DRIVER_INSTALL_DIR@:${libdir}/dri:' \
40 -e 's:@VERSION@:$(MESA3D_HEADERS_VERSION):' \
41 -e 's:@DRI_PC_REQ_PRIV@::' \
42 $(@D)/src/mesa/drivers/dri/dri.pc.in \
43 >$(@D)/src/mesa/drivers/dri/dri.pc
44 endef
46 define MESA3D_HEADERS_INSTALL_DRI_PC
47 $(INSTALL) -D -m 0644 $(@D)/include/GL/internal/dri_interface.h \
48 $(STAGING_DIR)/usr/include/GL/internal/dri_interface.h
49 $(INSTALL) -D -m 0644 $(@D)/src/mesa/drivers/dri/dri.pc \
50 $(STAGING_DIR)/usr/lib/pkgconfig/dri.pc
51 endef
53 endif # Xorg
55 endif # OpenGL
57 ifeq ($(BR2_PACKAGE_HAS_LIBEGL),y)
58 MESA3D_HEADERS_DIRS += EGL
59 endif
61 ifeq ($(BR2_PACKAGE_HAS_LIBGLES),y)
62 MESA3D_HEADERS_DIRS += GLES GLES2
63 endif
65 ifeq ($(BR2_PACKAGE_HAS_LIBOPENVG),y)
66 MESA3D_HEADERS_DIRS += VG
67 endif
69 define MESA3D_HEADERS_BUILD_CMDS
70 $(MESA3D_HEADERS_BUILD_DRI_PC)
71 endef
73 define MESA3D_HEADERS_INSTALL_STAGING_CMDS
74 $(foreach d,$(MESA3D_HEADERS_DIRS),\
75 cp -dpfr $(@D)/include/$(d) $(STAGING_DIR)/usr/include/ || exit 1$(sep))
76 $(MESA3D_HEADERS_INSTALL_DRI_PC)
77 endef
79 $(eval $(generic-package))