f87ae1709aec774570be507ebfe525eee3ea469c
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / dmalloc / dmalloc.mk
1 ################################################################################
2 #
3 # dmalloc
4 #
5 ################################################################################
6
7 DMALLOC_VERSION = 5.5.2
8 DMALLOC_SOURCE = dmalloc-$(DMALLOC_VERSION).tgz
9 DMALLOC_SITE = http://dmalloc.com/releases
10
11 DMALLOC_LICENSE = MIT-like
12 # license is in each file, dmalloc.h.1 is the smallest one
13 DMALLOC_LICENSE_FILES = dmalloc.h.1
14
15 DMALLOC_INSTALL_STAGING = YES
16 DMALLOC_CONF_OPTS = --enable-shlib
17 DMALLOC_CFLAGS = $(TARGET_CFLAGS)
18
19 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
20 DMALLOC_CONF_OPTS += --enable-cxx
21 else
22 DMALLOC_CONF_OPTS += --disable-cxx
23 endif
24
25 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
26 DMALLOC_CONF_OPTS += --enable-threads
27 else
28 DMALLOC_CONF_OPTS += --disable-threads
29 endif
30
31 # dmalloc has some assembly function that are not present in thumb1 mode:
32 # Error: lo register required -- `str lr,[sp,#4]'
33 # so, we desactivate thumb mode
34 ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
35 DMALLOC_CFLAGS += -marm
36 endif
37
38 DMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)"
39
40 define DMALLOC_POST_PATCH
41         $(SED) 's/^ac_cv_page_size=0$$/ac_cv_page_size=12/' $(@D)/configure
42         $(SED) 's/(ld -/($${LD-ld} -/' $(@D)/configure
43         $(SED) 's/'\''ld -/"$${LD-ld}"'\'' -/' $(@D)/configure
44         $(SED) 's/ar cr/$$(AR) cr/' $(@D)/Makefile.in
45 endef
46
47 DMALLOC_POST_PATCH_HOOKS += DMALLOC_POST_PATCH
48
49 # both DESTDIR and PREFIX are ignored..
50 define DMALLOC_INSTALL_STAGING_CMDS
51         $(MAKE) includedir="$(STAGING_DIR)/usr/include" \
52                 bindir="$(STAGING_DIR)/usr/bin" \
53                 libdir="$(STAGING_DIR)/usr/lib" \
54                 shlibdir="$(STAGING_DIR)/usr/lib" \
55                 infodir="$(STAGING_DIR)/usr/share/info/" \
56                 -C $(@D) install
57 endef
58
59 define DMALLOC_INSTALL_TARGET_CMDS
60         cp -dpf $(STAGING_DIR)/usr/lib/libdmalloc*.so $(TARGET_DIR)/usr/lib
61         cp -dpf $(STAGING_DIR)/usr/bin/dmalloc $(TARGET_DIR)/usr/bin/dmalloc
62 endef
63
64 $(eval $(autotools-package))