c6900c8e77d485cf5b6d2833d13ad97363446556
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / sunxi-mali / sunxi-mali.mk
1 ################################################################################
2 #
3 # sunxi-mali
4 #
5 ################################################################################
6
7 SUNXI_MALI_VERSION = c2491fe952354ba44538064e534ed7c731cedb1e
8 SUNXI_MALI_SITE = $(call github,linux-sunxi,sunxi-mali,$(SUNXI_MALI_VERSION))
9
10 SUNXI_MALI_INSTALL_STAGING = YES
11 SUNXI_MALI_DEPENDENCIES = sunxi-mali-prop
12 SUNXI_MALI_PROVIDES = libegl libgles
13
14 # The options below must be provided in the environment.  Providing these
15 # through options overrides the value and prevents the makefiles from
16 # appending to these variables.  This is used throughout the sunxi-mali build
17 # system.
18 #
19 # Furthermore, the -lm -dl -lpthread options are included due to a possible bug
20 # in the way the linaro 2013.06 toolchain handles shared libraries.
21 SUNXI_MALI_MAKE_ENV = \
22         CC="$(TARGET_CC)" \
23         CFLAGS="$(TARGET_CFLAGS) -lm -ldl -lpthread" \
24         $(TARGET_MAKE_ENV)
25
26 ifeq ($(BR2_ARM_EABIHF),y)
27 SUNXI_MALI_MAKE_OPTS += ABI=armhf
28 else
29 SUNXI_MALI_MAKE_OPTS += ABI=armel
30 endif
31
32 SUNXI_MALI_MAKE_OPTS += EGL_TYPE=framebuffer
33
34 ifeq ($(BR2_PACKAGE_SUNXI_MALI_R2P4),y)
35 SUNXI_MALI_MAKE_OPTS += VERSION=r2p4
36 endif
37 ifeq ($(BR2_PACKAGE_SUNXI_MALI_R3P0),y)
38 SUNXI_MALI_MAKE_OPTS += VERSION=r3p0
39 endif
40 ifeq ($(BR2_PACKAGE_SUNXI_MALI_R3P1),y)
41 SUNXI_MALI_MAKE_OPTS += VERSION=r3p1
42 endif
43
44 define SUNXI_MALI_GIT_SUBMODULE_FIXUP
45         rm -rf $(@D)/lib/mali
46         cp -rf $(SUNXI_MALI_PROP_SRCDIR) $(@D)/lib/mali
47 endef
48
49 SUNXI_MALI_PRE_CONFIGURE_HOOKS += SUNXI_MALI_GIT_SUBMODULE_FIXUP
50
51 define SUNXI_MALI_BUILD_CMDS
52         $(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) $(SUNXI_MALI_MAKE_OPTS) all
53         $(TARGET_CC) $(TARGET_CFLAGS) -o $(@D)/version/version \
54                 $(@D)/version/version.c
55 endef
56
57 define SUNXI_MALI_INSTALL_STAGING_CMDS
58         $(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) \
59                 $(SUNXI_MALI_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
60         # test must be built after install because it depends on headers that are
61         # generated during the install above.
62         $(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) $(SUNXI_MALI_MAKE_OPTS) test
63         $(INSTALL) -D -m 0644 package/sunxi-mali/egl.pc \
64                 $(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
65         $(INSTALL) -D -m 0644 package/sunxi-mali/glesv2.pc \
66                 $(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
67 endef
68
69 define SUNXI_MALI_INSTALL_TARGET_CMDS
70         $(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D)/lib \
71                 $(SUNXI_MALI_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
72         $(if $(BR2_PACKAGE_SUNXI_MALI_DBG),
73                 $(INSTALL) -m 755 $(@D)/version/version $(TARGET_DIR)/usr/bin/maliver; \
74                 $(INSTALL) -m 755 $(@D)/test/test $(TARGET_DIR)/usr/bin/malitest
75         )
76 endef
77
78 define SUNXI_MALI_INSTALL_INIT_SYSV
79         $(INSTALL) -D -m 0755 package/sunxi-mali/S80mali \
80                 $(TARGET_DIR)/etc/init.d/S80mali
81 endef
82
83 $(eval $(generic-package))