56274cb436c8d1751b1f97d5647982bf0a38bf68
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / freetype / freetype.mk
1 ################################################################################
2 #
3 # freetype
4 #
5 ################################################################################
6
7 FREETYPE_VERSION = 2.5.5
8 FREETYPE_SOURCE = freetype-$(FREETYPE_VERSION).tar.bz2
9 FREETYPE_SITE = http://downloads.sourceforge.net/project/freetype/freetype2/$(FREETYPE_VERSION)
10 FREETYPE_INSTALL_STAGING = YES
11 FREETYPE_MAKE_OPTS = CCexe="$(HOSTCC)"
12 FREETYPE_LICENSE = Dual FTL/GPLv2+
13 FREETYPE_LICENSE_FILES = docs/FTL.TXT docs/GPLv2.TXT
14 FREETYPE_DEPENDENCIES = host-pkgconf
15 FREETYPE_CONFIG_SCRIPTS = freetype-config
16
17 HOST_FREETYPE_DEPENDENCIES = host-pkgconf
18 HOST_FREETYPE_CONF_OPTS = --without-zlib --without-bzip2 --without-png
19
20 # Regen required because the tarball ships with an experimental ltmain.sh
21 # that can't be patched by our infra.
22 # autogen.sh is because autotools stuff lives in other directories and
23 # even AUTORECONF with _OPTS doesn't do it properly.
24 # POST_PATCH is because we still need to patch libtool after the regen.
25 define FREETYPE_RUN_AUTOGEN
26         cd $(@D) && PATH=$(BR_PATH) ./autogen.sh
27 endef
28 FREETYPE_POST_PATCH_HOOKS += FREETYPE_RUN_AUTOGEN
29 HOST_FREETYPE_POST_PATCH_HOOKS += FREETYPE_RUN_AUTOGEN
30 FREETYPE_DEPENDENCIES += host-automake host-autoconf host-libtool
31 HOST_FREETYPE_DEPENDENCIES += host-automake host-autoconf host-libtool
32
33 ifeq ($(BR2_PACKAGE_ZLIB),y)
34 FREETYPE_DEPENDENCIES += zlib
35 FREETYPE_CONF_OPTS += --with-zlib
36 else
37 FREETYPE_CONF_OPTS += --without-zlib
38 endif
39
40 ifeq ($(BR2_PACKAGE_BZIP2),y)
41 FREETYPE_DEPENDENCIES += bzip2
42 FREETYPE_CONF_OPTS += --with-bzip2
43 else
44 FREETYPE_CONF_OPTS += --without-bzip2
45 endif
46
47 ifeq ($(BR2_PACKAGE_LIBPNG),y)
48 FREETYPE_DEPENDENCIES += libpng
49 FREETYPE_CONF_OPTS += LIBPNG_CFLAGS="`$(STAGING_DIR)/usr/bin/libpng-config --cflags`" \
50         LIBPNG_LDFLAGS="`$(STAGING_DIR)/usr/bin/libpng-config --ldflags`"
51 FREETYPE_LIBPNG_LIBS = "`$(STAGING_DIR)/usr/bin/libpng-config --libs`"
52 else
53 FREETYPE_CONF_OPTS += --without-png
54 endif
55
56 # Extra fixing since includedir and libdir are expanded from configure values
57 define FREETYPE_FIX_CONFIG_FILE
58         $(SED) 's:^includedir=.*:includedir="$${prefix}/include":' \
59                 -e 's:^libdir=.*:libdir="$${exec_prefix}/lib":' \
60                 $(STAGING_DIR)/usr/bin/freetype-config
61 endef
62 FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_CONFIG_FILE
63
64 # libpng isn't included in freetype-config & freetype2.pc :-/
65 define FREETYPE_FIX_CONFIG_FILE_LIBS
66         $(SED) "s,^Libs.private:,& $(FREETYPE_LIBPNG_LIBS)," \
67                 $(STAGING_DIR)/usr/lib/pkgconfig/freetype2.pc
68         $(SED) "s,-lfreetype,& $(FREETYPE_LIBPNG_LIBS)," \
69                 $(STAGING_DIR)/usr/bin/freetype-config
70 endef
71 FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_CONFIG_FILE_LIBS
72
73 # Version 2.5.1 reorganized headers out of freetype2/freetype.
74 # It is unexpected for some packages so symlink it until it spreads
75 # upstream. Note that we also have to remove the symlink prior to the
76 # installation process, because the installation process of freetype
77 # removes usr/include/Freetype2/freetype/config, before installing
78 # something in usr/include/Freetype2/config/ which no longer exists
79 # due to the symbolic link.
80 define FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
81         $(RM) -f $(STAGING_DIR)/usr/include/freetype2/freetype
82 endef
83 FREETYPE_PRE_INSTALL_STAGING_HOOKS += FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
84 define FREETYPE_FIX_FREETYPE_INCLUDE
85         ln -sf . $(STAGING_DIR)/usr/include/freetype2/freetype
86 endef
87 FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_FREETYPE_INCLUDE
88
89 define HOST_FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
90         $(RM) -f $(HOST_DIR)/usr/include/freetype2/freetype
91 endef
92 HOST_FREETYPE_PRE_INSTALL_HOOKS += HOST_FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
93 define HOST_FREETYPE_FIX_FREETYPE_INCLUDE
94         ln -sf . $(HOST_DIR)/usr/include/freetype2/freetype
95 endef
96 HOST_FREETYPE_POST_INSTALL_HOOKS += HOST_FREETYPE_FIX_FREETYPE_INCLUDE
97
98 $(eval $(autotools-package))
99 $(eval $(host-autotools-package))
100
101 # freetype-patch and host-freetype-patch use autogen.sh so add
102 # host-automake as a order-only-prerequisite because it is a phony
103 # target.
104 $(FREETYPE_TARGET_PATCH) $(HOST_FREETYPE_TARGET_PATCH): | host-automake