]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/mesa3d/mesa3d.mk
package/mesa3d: Remove opengl headers files if opengl support is disabled
[coffee/buildroot.git] / package / mesa3d / mesa3d.mk
1 ################################################################################
2 #
3 # mesa3d
4 #
5 ################################################################################
6
7 # When updating the version, please also update mesa3d-headers
8 MESA3D_VERSION = 13.0.0
9 MESA3D_SOURCE = mesa-$(MESA3D_VERSION).tar.xz
10 MESA3D_SITE = ftp://ftp.freedesktop.org/pub/mesa/$(MESA3D_VERSION)
11 MESA3D_LICENSE = MIT, SGI, Khronos
12 MESA3D_LICENSE_FILES = docs/license.html
13 MESA3D_AUTORECONF = YES
14
15 MESA3D_INSTALL_STAGING = YES
16
17 MESA3D_PROVIDES =
18
19 MESA3D_DEPENDENCIES = \
20         host-bison \
21         host-flex \
22         expat \
23         libdrm
24
25 # The Sourcery MIPS toolchain has a special (non-upstream) feature to
26 # have "compact exception handling", which unfortunately breaks with
27 # mesa3d, so we disable it here by passing -mno-compact-eh.
28 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS),y)
29 MESA3D_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -mno-compact-eh"
30 MESA3D_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -mno-compact-eh"
31 endif
32
33 ifeq ($(BR2_PACKAGE_OPENSSL),y)
34 MESA3D_DEPENDENCIES += openssl
35 MESA3D_CONF_OPTS += --with-sha1=libcrypto
36 else ifeq ($(BR2_PACKAGE_LIBGCRYPT),y)
37 MESA3D_DEPENDENCIES += libgcrypt
38 MESA3D_CONF_OPTS += --with-sha1=libgcrypt
39 else ifeq ($(BR2_PACKAGE_LIBSHA1),y)
40 MESA3D_DEPENDENCIES += libsha1
41 MESA3D_CONF_OPTS += --with-sha1=libsha1
42 endif
43
44 ifeq ($(BR2_PACKAGE_XORG7),y)
45 MESA3D_DEPENDENCIES += \
46         xproto_xf86driproto \
47         xproto_dri2proto \
48         xproto_glproto \
49         xlib_libX11 \
50         xlib_libXext \
51         xlib_libXdamage \
52         xlib_libXfixes \
53         libxcb
54 MESA3D_CONF_OPTS += --enable-glx --disable-mangling
55 # quote from mesa3d configure "Building xa requires at least one non swrast gallium driver."
56 ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_XA),y)
57 MESA3D_CONF_OPTS += --enable-xa
58 else
59 MESA3D_CONF_OPTS += --disable-xa
60 endif
61 else
62 MESA3D_CONF_OPTS += \
63         --disable-glx \
64         --disable-xa
65 endif
66
67 # Drivers
68
69 #Gallium Drivers
70 MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU)  += nouveau
71 MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R600)     += r600
72 MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SVGA)     += svga
73 MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST)   += swrast
74 MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4)      += vc4
75 MESA3D_GALLIUM_DRIVERS-$(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL)    += virgl
76 # DRI Drivers
77 MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_SWRAST) += swrast
78 MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_I915)   += i915
79 MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_I965)   += i965
80 MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_NOUVEAU) += nouveau
81 MESA3D_DRI_DRIVERS-$(BR2_PACKAGE_MESA3D_DRI_DRIVER_RADEON) += radeon
82 # Vulkan Drivers
83 MESA3D_VULKAN_DRIVERS-$(BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL)   += intel
84
85 ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER),)
86 MESA3D_CONF_OPTS += \
87         --without-gallium-drivers
88 else
89 MESA3D_CONF_OPTS += \
90         --enable-shared-glapi \
91         --with-gallium-drivers=$(subst $(space),$(comma),$(MESA3D_GALLIUM_DRIVERS-y))
92 endif
93
94 ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER),)
95 MESA3D_CONF_OPTS += \
96         --without-dri-drivers --disable-dri3
97 else
98 ifeq ($(BR2_PACKAGE_XPROTO_DRI3PROTO),y)
99 MESA3D_DEPENDENCIES += xlib_libxshmfence xproto_dri3proto xproto_presentproto
100 MESA3D_CONF_OPTS += --enable-dri3
101 else
102 MESA3D_CONF_OPTS += --disable-dri3
103 endif
104 ifeq ($(BR2_PACKAGE_XLIB_LIBXXF86VM),y)
105 MESA3D_DEPENDENCIES += xlib_libXxf86vm
106 endif
107 MESA3D_CONF_OPTS += \
108         --enable-shared-glapi \
109         --enable-driglx-direct \
110         --with-dri-drivers=$(subst $(space),$(comma),$(MESA3D_DRI_DRIVERS-y))
111 endif
112
113 ifeq ($(BR2_PACKAGE_MESA3D_VULKAN_DRIVER),)
114 MESA3D_CONF_OPTS += \
115         --without-vulkan-drivers
116 else
117 MESA3D_CONF_OPTS += \
118         --with-vulkan-drivers=$(subst $(space),$(comma),$(MESA3D_VULKAN_DRIVERS-y))
119 endif
120
121 # APIs
122
123 ifeq ($(BR2_PACKAGE_MESA3D_OSMESA),y)
124 MESA3D_CONF_OPTS += --enable-osmesa
125 else
126 MESA3D_CONF_OPTS += --disable-osmesa
127 endif
128
129 # Always enable OpenGL:
130 #   - it is needed for GLES (mesa3d's ./configure is a bit weird)
131 MESA3D_CONF_OPTS += --enable-opengl --enable-dri
132
133 # libva and mesa3d have a circular dependency
134 # we do not need libva support in mesa3d, therefore disable this option
135 MESA3D_CONF_OPTS += --disable-va
136
137 # libGL is only provided for a full xorg stack
138 ifeq ($(BR2_PACKAGE_XORG7),y)
139 MESA3D_PROVIDES += libgl
140 else
141 define MESA3D_REMOVE_OPENGL_HEADERS
142         rm -rf $(STAGING_DIR)/usr/include/GL/
143 endef
144
145 MESA3D_POST_INSTALL_STAGING_HOOKS += MESA3D_REMOVE_OPENGL_HEADERS
146 endif
147
148 ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
149 MESA3D_PROVIDES += libegl
150 ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER),y)
151 MESA3D_EGL_PLATFORMS = drm
152 else ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VC4),y)
153 MESA3D_EGL_PLATFORMS = drm
154 else ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL),y)
155 MESA3D_EGL_PLATFORMS = drm
156 endif
157 ifeq ($(BR2_PACKAGE_WAYLAND),y)
158 MESA3D_DEPENDENCIES += wayland
159 MESA3D_EGL_PLATFORMS += wayland
160 endif
161 ifeq ($(BR2_PACKAGE_XORG7),y)
162 MESA3D_EGL_PLATFORMS += x11
163 endif
164 MESA3D_CONF_OPTS += \
165         --enable-gbm \
166         --enable-egl \
167         --with-egl-platforms=$(subst $(space),$(comma),$(MESA3D_EGL_PLATFORMS))
168 else
169 MESA3D_CONF_OPTS += \
170         --disable-egl
171 endif
172
173 ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_ES),y)
174 MESA3D_PROVIDES += libgles
175 MESA3D_CONF_OPTS += --enable-gles1 --enable-gles2
176 else
177 MESA3D_CONF_OPTS += --disable-gles1 --disable-gles2
178 endif
179
180 # Avoid automatic search of llvm-config
181 MESA3D_CONF_OPTS += --with-llvm-prefix=$(STAGING_DIR)/usr/bin
182
183 $(eval $(autotools-package))