summaryrefslogtreecommitdiff
path: root/package/sunxi-mali/sunxi-mali.mk
blob: c6900c8e77d485cf5b6d2833d13ad97363446556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
################################################################################
#
# sunxi-mali
#
################################################################################

SUNXI_MALI_VERSION = c2491fe952354ba44538064e534ed7c731cedb1e
SUNXI_MALI_SITE = $(call github,linux-sunxi,sunxi-mali,$(SUNXI_MALI_VERSION))

SUNXI_MALI_INSTALL_STAGING = YES
SUNXI_MALI_DEPENDENCIES = sunxi-mali-prop
SUNXI_MALI_PROVIDES = libegl libgles

# The options below must be provided in the environment.  Providing these
# through options overrides the value and prevents the makefiles from
# appending to these variables.  This is used throughout the sunxi-mali build
# system.
#
# Furthermore, the -lm -dl -lpthread options are included due to a possible bug
# in the way the linaro 2013.06 toolchain handles shared libraries.
SUNXI_MALI_MAKE_ENV = \
	CC="$(TARGET_CC)" \
	CFLAGS="$(TARGET_CFLAGS) -lm -ldl -lpthread" \
	$(TARGET_MAKE_ENV)

ifeq ($(BR2_ARM_EABIHF),y)
SUNXI_MALI_MAKE_OPTS += ABI=armhf
else
SUNXI_MALI_MAKE_OPTS += ABI=armel
endif

SUNXI_MALI_MAKE_OPTS += EGL_TYPE=framebuffer

ifeq ($(BR2_PACKAGE_SUNXI_MALI_R2P4),y)
SUNXI_MALI_MAKE_OPTS += VERSION=r2p4
endif
ifeq ($(BR2_PACKAGE_SUNXI_MALI_R3P0),y)
SUNXI_MALI_MAKE_OPTS += VERSION=r3p0
endif
ifeq ($(BR2_PACKAGE_SUNXI_MALI_R3P1),y)
SUNXI_MALI_MAKE_OPTS += VERSION=r3p1
endif

define SUNXI_MALI_GIT_SUBMODULE_FIXUP
	rm -rf $(@D)/lib/mali
	cp -rf $(SUNXI_MALI_PROP_SRCDIR) $(@D)/lib/mali
endef

SUNXI_MALI_PRE_CONFIGURE_HOOKS += SUNXI_MALI_GIT_SUBMODULE_FIXUP

define SUNXI_MALI_BUILD_CMDS
	$(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) $(SUNXI_MALI_MAKE_OPTS) all
	$(TARGET_CC) $(TARGET_CFLAGS) -o $(@D)/version/version \
		$(@D)/version/version.c
endef

define SUNXI_MALI_INSTALL_STAGING_CMDS
	$(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) \
		$(SUNXI_MALI_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
	# test must be built after install because it depends on headers that are
	# generated during the install above.
	$(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D) $(SUNXI_MALI_MAKE_OPTS) test
	$(INSTALL) -D -m 0644 package/sunxi-mali/egl.pc \
		$(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
	$(INSTALL) -D -m 0644 package/sunxi-mali/glesv2.pc \
		$(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
endef

define SUNXI_MALI_INSTALL_TARGET_CMDS
	$(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D)/lib \
		$(SUNXI_MALI_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
	$(if $(BR2_PACKAGE_SUNXI_MALI_DBG),
		$(INSTALL) -m 755 $(@D)/version/version $(TARGET_DIR)/usr/bin/maliver; \
		$(INSTALL) -m 755 $(@D)/test/test $(TARGET_DIR)/usr/bin/malitest
	)
endef

define SUNXI_MALI_INSTALL_INIT_SYSV
	$(INSTALL) -D -m 0755 package/sunxi-mali/S80mali \
		$(TARGET_DIR)/etc/init.d/S80mali
endef

$(eval $(generic-package))