Commit bcca86af30967d7d93590f2241b84d02f083d54e

Werner Lemberg 2013-02-08T12:49:41

Fix Savannah bug #38235. * builds/unix/configure.raw: Don't generate `freetype-config' and `freetype.pc'. * builds/unix/unix-def.in (FT2_EXTRA_LIBS, LIBBZ2, LIBZ, build_libtool_libs, ft_version): New variables to be substituted. (freetype-config, freetype.pc): New rules to generate those files. * builds/unix/freetype-config.in: Remove code for handling `rpath'. The use of $rpath has been accidentally removed in a patch from 2009-12-22, and apparently noone has missed it since. Use `%' instead of `@' as a variable substitution marker. Use quotes. * builds/unix/freetype.in: Use `%' instead of `@' as a variable substitution marker. Use quotes.

diff --git a/ChangeLog b/ChangeLog
index b42df16..fad4a8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2013-02-02  Werner Lemberg  <wl@gnu.org>
+
+	Fix Savannah bug #38235.
+
+	* builds/unix/configure.raw: Don't generate `freetype-config' and
+	`freetype.pc'.
+
+	* builds/unix/unix-def.in (FT2_EXTRA_LIBS, LIBBZ2, LIBZ,
+	build_libtool_libs, ft_version): New variables to be substituted.
+	(freetype-config, freetype.pc): New rules to generate those files.
+
+	* builds/unix/freetype-config.in: Remove code for handling `rpath'.
+	The use of $rpath has been accidentally removed in a patch from
+	2009-12-22, and apparently noone has missed it since.
+	Use `%' instead of `@' as a variable substitution marker.
+	Use quotes.
+
+	* builds/unix/freetype.in: Use `%' instead of `@' as a variable
+	substitution marker.
+	Use quotes.
+
 2013-02-07  Werner Lemberg  <wl@gnu.org>
 
 	* src/truetype/ttobjs.c (tt_size_run_prep): Reset more GS variables.
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index bf26061..5ddedc3 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -2,7 +2,7 @@
 #
 # Process this file with autoconf to produce a configure script.
 #
-# Copyright 2001-2012 by
+# Copyright 2001-2013 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -727,9 +727,7 @@ AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
 # and `builds/unix/unix-cc.mk' that will be used by the build system
 #
 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
-                 unix-def.mk:unix-def.in
-                 freetype-config
-                 freetype2.pc:freetype2.in])
+                 unix-def.mk:unix-def.in])
 
 # re-generate the Jamfile to use libtool now
 #
diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in
index 1c0cc07..2edcd11 100644
--- a/builds/unix/freetype-config.in
+++ b/builds/unix/freetype-config.in
@@ -12,14 +12,12 @@
 LC_ALL=C
 export LC_ALL
 
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-exec_prefix_set=no
-includedir=@includedir@
-libdir=@libdir@
-enable_shared=@build_libtool_libs@
-wl=@wl@
-hardcode_libdir_flag_spec='@hardcode_libdir_flag_spec@'
+prefix="%prefix%"
+exec_prefix="%exec_prefix%"
+exec_prefix_set="no"
+includedir="%includedir%"
+libdir="%libdir%"
+enable_shared="%build_libtool_libs%"
 
 usage()
 {
@@ -75,7 +73,7 @@ while test $# -gt 0 ; do
     echo_exec_prefix=yes
     ;;
   --version)
-    echo @ft_version@
+    echo %ft_version%
     exit 0
     ;;
   --ftversion)
@@ -143,12 +141,9 @@ if test "$echo_cflags" = "yes" ; then
 fi
 
 if test "$echo_libs" = "yes" ; then
-  rpath=
-  if test "$enable_shared" = "yes" ; then
-    eval "rpath=\"$hardcode_libdir_flag_spec\""
-  fi
-  libs="-lfreetype @LIBZ@ @LIBBZ2@ @FT2_EXTRA_LIBS@"
-  if test "${SYSROOT}$libdir" != "/usr/lib" && test "${SYSROOT}$libdir" != "/usr/lib64"; then
+  libs="-lfreetype %LIBZ% %LIBBZ2% %FT2_EXTRA_LIBS%"
+  if test "${SYSROOT}$libdir" != "/usr/lib"  &&
+     test "${SYSROOT}$libdir" != "/usr/lib64"; then
     echo -L${SYSROOT}$libdir $libs
   else
     echo $libs
diff --git a/builds/unix/freetype2.in b/builds/unix/freetype2.in
index b731800..c5c3027 100644
--- a/builds/unix/freetype2.in
+++ b/builds/unix/freetype2.in
@@ -1,12 +1,12 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix="%prefix%"
+exec_prefix="%exec_prefix%"
+libdir="%libdir%"
+includedir="%includedir%"
 
 Name: FreeType 2
 Description: A free, high-quality, and portable font engine.
-Version: @ft_version@
+Version: %ft_version%
 Requires:
 Libs: -L${libdir} -lfreetype
-Libs.private: @LIBZ@ @LIBBZ2@ @FT2_EXTRA_LIBS@
+Libs.private: %LIBZ% %LIBBZ2% %FT2_EXTRA_LIBS%
 Cflags: -I${includedir}/freetype2 -I${includedir}
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index d3ebc8b..9c5e941 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2002, 2004, 2006, 2008 by
+# Copyright 1996-2000, 2002, 2004, 2006, 2008, 2013 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -15,10 +15,10 @@
 
 TOP_DIR := $(shell cd $(TOP_DIR); pwd)
 
-DELETE    := rm -f
-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)
@@ -57,6 +57,13 @@ datadir      := @datadir@
 
 version_info := @version_info@
 
+# Variables needed for `freetype-config' and `freetype.pc'.
+#
+FT2_EXTRA_LIBS     := @FT2_EXTRA_LIBS@
+LIBBZ2             := @LIBBZ2@
+LIBZ               := @LIBZ@
+build_libtool_libs := @build_libtool_libs@
+ft_version         := @ft_version@
 
 # The directory where all library files are placed.
 #
@@ -82,4 +89,48 @@ 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|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \
+	    -e 's|%LIBBZ2%|$(LIBBZ2)|' \
+	    -e 's|%LIBZ%|$(LIBZ)|' \
+	    -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 $@
+
+$(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in
+	rm -f $@ $@.tmp
+	sed -e 's|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \
+	    -e 's|%LIBBZ2%|$(LIBBZ2)|' \
+	    -e 's|%LIBZ%|$(LIBZ)|' \
+	    -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 $@
+
+all: $(OBJ_BUILD)/freetype-config \
+     $(OBJ_BUILD)/freetype2.pc
+
 # EOF