tizen 2.3.1 release
[framework/graphics/freetype.git] / builds / unix / unix-def.in
index e0a7a3a..4c06a05 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2002, 2004, 2006, 2008 by
+# Copyright 1996-2000, 2002, 2004, 2006, 2008, 2013, 2014 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # indicate that you have read the license and understand and accept it
 # fully.
 
+SHELL := @SHELL@
 
 TOP_DIR := $(shell cd $(TOP_DIR); pwd)
 
-DELETE    := @RMF@
-DELDIR    := @RMDIR@
-CAT       := cat
-SEP       := /
+DELETE := rm -f
+DELDIR := @RMDIR@
+CAT    := cat
+SEP    := /
 
 # this is used for `make distclean' and `make install'
 OBJ_BUILD ?= $(BUILD_DIR)
@@ -33,15 +34,16 @@ INSTALL_PROGRAM := @INSTALL_PROGRAM@
 INSTALL_SCRIPT  := @INSTALL_SCRIPT@
 MKINSTALLDIRS   := $(BUILD_DIR)/mkinstalldirs
 
-DISTCLEAN += $(OBJ_BUILD)/config.cache    \
-             $(OBJ_BUILD)/config.log      \
-             $(OBJ_BUILD)/config.status   \
-             $(OBJ_BUILD)/unix-def.mk     \
-             $(OBJ_BUILD)/unix-cc.mk      \
-             $(OBJ_BUILD)/ftconfig.h      \
-             $(OBJ_BUILD)/freetype-config \
-             $(OBJ_BUILD)/freetype2.pc    \
-             $(LIBTOOL)                   \
+CLEAN += $(OBJ_BUILD)/freetype-config \
+         $(OBJ_BUILD)/freetype2.pc
+
+DISTCLEAN += $(OBJ_BUILD)/config.cache  \
+             $(OBJ_BUILD)/config.log    \
+             $(OBJ_BUILD)/config.status \
+             $(OBJ_BUILD)/unix-def.mk   \
+             $(OBJ_BUILD)/unix-cc.mk    \
+             $(OBJ_BUILD)/ftconfig.h    \
+             $(LIBTOOL)                 \
              $(OBJ_BUILD)/Makefile
 
 
@@ -54,9 +56,17 @@ bindir       := @bindir@
 includedir   := @includedir@
 datarootdir  := @datarootdir@
 datadir      := @datadir@
+mandir       := @mandir@
 
 version_info := @version_info@
 
+# Variables needed for `freetype-config' and `freetype.pc'.
+#
+REQUIRES_PRIVATE   := @REQUIRES_PRIVATE@
+LIBS_PRIVATE       := @LIBS_PRIVATE@
+LIBSSTATIC_CONFIG  := @LIBSSTATIC_CONFIG@
+build_libtool_libs := @build_libtool_libs@
+ft_version         := @ft_version@
 
 # The directory where all library files are placed.
 #
@@ -82,4 +92,57 @@ SYSTEM_ZLIB := @SYSTEM_ZLIB@
 NO_OUTPUT := 2> /dev/null
 
 
+# To support calls like
+#
+#   configure --includedir='${libdir}'/freetype2/include
+#
+# we generate `freetype-config' and `freetype.pc' at compile time so that
+# those variables are properly expanded.
+
+$(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in
+       rm -f $@ $@.tmp
+       sed -e 's|%LIBSSTATIC_CONFIG%|$(LIBSSTATIC_CONFIG)|'   \
+           -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
+           -e 's|%exec_prefix%|$(exec_prefix)|'               \
+           -e 's|%ft_version%|$(ft_version)|'                 \
+           -e 's|%includedir%|$(includedir)|'                 \
+           -e 's|%libdir%|$(libdir)|'                         \
+           -e 's|%prefix%|$(prefix)|'                         \
+           $<                                                 \
+           > $@.tmp
+       chmod +x $@.tmp
+       chmod a-w $@.tmp
+       mv $@.tmp $@
+
+# To support directory names with spaces (as might easily happen on Windows
+# platforms), the right solution would be to surround the pkg-variables in
+# `freetype2.pc' with double quotes.  However, doing so ironically disables
+# the prefix override mechanism especially written for Windows.  This is a
+# bug in pkg-config version 0.28 and earlier.
+#
+# For this reason, we escape spaces with backslashes.
+
+exec_prefix_x := $(subst $(space),\\$(space),$(exec_prefix))
+includedir_x  := $(subst $(space),\\$(space),$(includedir))
+libdir_x      := $(subst $(space),\\$(space),$(libdir))
+prefix_x      := $(subst $(space),\\$(space),$(prefix))
+
+$(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in
+       rm -f $@ $@.tmp
+       sed -e 's|%REQUIRES_PRIVATE%|$(REQUIRES_PRIVATE)|'     \
+           -e 's|%LIBS_PRIVATE%|$(LIBS_PRIVATE)|'             \
+           -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
+           -e 's|%exec_prefix%|$(exec_prefix_x)|'             \
+           -e 's|%ft_version%|$(ft_version)|'                 \
+           -e 's|%includedir%|$(includedir_x)|'               \
+           -e 's|%libdir%|$(libdir_x)|'                       \
+           -e 's|%prefix%|$(prefix_x)|'                       \
+           $<                                                 \
+           > $@.tmp
+       chmod a-w $@.tmp
+       mv $@.tmp $@
+
+all: $(OBJ_BUILD)/freetype-config \
+     $(OBJ_BUILD)/freetype2.pc
+
 # EOF