endef
FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_CONFIG_FILE_LIBS
-# Version 2.5.1 reorganized headers out of freetype2/freetype
-# It's unexpected for some packages so symlink it until it spreads upstream
+# Version 2.5.1 reorganized headers out of freetype2/freetype.
+# It is unexpected for some packages so symlink it until it spreads
+# upstream. Note that we also have to remove the symlink prior to the
+# installation process, because the installation process of freetype
+# removes usr/include/Freetype2/freetype/config, before installing
+# something in usr/include/Freetype2/config/ which no longer exists
+# due to the symbolic link.
+define FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
+ $(RM) -f $(STAGING_DIR)/usr/include/freetype2/freetype
+endef
+FREETYPE_PRE_INSTALL_STAGING_HOOKS += FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
define FREETYPE_FIX_FREETYPE_INCLUDE
ln -sf . $(STAGING_DIR)/usr/include/freetype2/freetype
endef
FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_FREETYPE_INCLUDE
+
+define HOST_FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
+ $(RM) -f $(HOST_DIR)/usr/include/freetype2/freetype
+endef
+HOST_FREETYPE_PRE_INSTALL_HOOKS += FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
define HOST_FREETYPE_FIX_FREETYPE_INCLUDE
ln -sf . $(HOST_DIR)/usr/include/freetype2/freetype
endef