Fix Savannah bug #38235. Work around a bug in pkg-config version 0.28 and earlier: If a variable value gets surrounded by doublequotes (in particular values for the `prefix' variable), the prefix override mechanism fails. * builds/unix/freetype2.in: Don't use doublequotes. * builds/unix/unix-def.in (freetype.pc): Escape spaces in directory names with backslashes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff --git a/ChangeLog b/ChangeLog
index 0874f93..d903984 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-03-27 Werner Lemberg <wl@gnu.org>
+
+ Fix Savannah bug #38235.
+
+ Work around a bug in pkg-config version 0.28 and earlier: If a
+ variable value gets surrounded by doublequotes (in particular values
+ for the `prefix' variable), the prefix override mechanism fails.
+
+ * builds/unix/freetype2.in: Don't use doublequotes.
+ * builds/unix/unix-def.in (freetype.pc): Escape spaces in directory
+ names with backslashes.
+
2014-03-24 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #41946.
diff --git a/builds/unix/freetype2.in b/builds/unix/freetype2.in
index 6e7fb10..a488d96 100644
--- a/builds/unix/freetype2.in
+++ b/builds/unix/freetype2.in
@@ -1,7 +1,7 @@
-prefix="%prefix%"
-exec_prefix="%exec_prefix%"
-libdir="%libdir%"
-includedir="%includedir%/freetype2"
+prefix=%prefix%
+exec_prefix=%exec_prefix%
+libdir=%libdir%
+includedir=%includedir%/freetype2
Name: FreeType 2
URL: http://freetype.org
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index 6a4eef6..4c06a05 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -114,16 +114,29 @@ $(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in
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)|' \
+ -e 's|%exec_prefix%|$(exec_prefix_x)|' \
-e 's|%ft_version%|$(ft_version)|' \
- -e 's|%includedir%|$(includedir)|' \
- -e 's|%libdir%|$(libdir)|' \
- -e 's|%prefix%|$(prefix)|' \
+ -e 's|%includedir%|$(includedir_x)|' \
+ -e 's|%libdir%|$(libdir_x)|' \
+ -e 's|%prefix%|$(prefix_x)|' \
$< \
> $@.tmp
chmod a-w $@.tmp