Bug 8359

Summary: Are dbl quoted variables supported ?
Product: pkg-config Reporter: John Tytgat <John.Tytgat>
Component: srcAssignee: Tollef Fog Heen <tfheen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Proposed patch to deal with dbl quoted variables

Description John Tytgat 2006-09-19 14:46:06 UTC
[ Started as a mail 
http://lists.freedesktop.org/archives/pkg-config/2006-September/000134.html ]

I've a question whether dbl quoted variables definitions are supported in
pkg-config.

The reason is that one of the Debian patches for the xft package
<URL:http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=349318>
is introducing the freetypelibs/freetypecflags and xrenderlibs variables
in the xft.pc file and those variables have their values quoted.

Patch:
--8<--
Index: xft/xft.pc.in
===================================================================
--- xft.orig/xft.pc.in  2006-02-04 17:59:59.000000000 -0500
+++ xft/xft.pc.in       2006-02-05 12:58:35.000000000 -0500
@@ -2,11 +2,14 @@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@includedir@
+freetypelibs="@FREETYPE_LIBS@"
+freetypecflags="@FREETYPE_CFLAGS@"
+xrenderlibs="@XRENDER_LIBS@"
 
 Name: Xft
 Description: X FreeType library
 Version: @VERSION@
-Requires: xproto, xrender, fontconfig, freetype2
-Requires.private: xrender, fontconfig, freetype2
-Cflags: -I${includedir}
+Requires: xproto, fontconfig
+Cflags: -I${includedir} ${freetypecflags}
 Libs: -L${libdir} -lXft
+Libs.private: -lX11 ${xrenderlibs} ${freetypelibs}
--8<--

So you end up with an xft.pc file like e.g.:

--8<--
prefix=/home/john/gccsdk/riscos/env
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
freetypelibs="-L/home/john/gccsdk/riscos/env/lib -lfreetype  "
freetypecflags="-I/home/john/gccsdk/riscos/env/include/freetype2 -I/home/john/gccsdk/riscos/env/include  "
xrenderlibs="-L/home/john/gccsdk/riscos/env/lib -lXrender -lX11 -lXau -lXdmcp  "

Name: Xft
Description: X FreeType library
Version: 2.1.8.2
Requires: fontconfig
Cflags: -I${includedir} ${freetypecflags}
Libs: -L${libdir} -lXft
Libs.private: -lX11 ${xrenderlibs} ${freetypelibs}
--8<--

When using pkg-config v0.20/v0.21 I'm getting a result which I don't expect
because several libraries are missing:

$ pkg-config --static --libs xft
-L/home/john/gccsdk/riscos/env/lib -lXft -lX11 -lfontconfig

When I remove the dbl quotes from the xft.pc file for the freetypelibs,
freetypecflags and xrenderlibs variables:

--8<--
prefix=/home/john/gccsdk/riscos/env
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
freetypelibs=-L/home/john/gccsdk/riscos/env/lib -lfreetype  
freetypecflags=-I/home/john/gccsdk/riscos/env/include/freetype2 -I/home/john/gccsdk/riscos/env/include  
xrenderlibs=-L/home/john/gccsdk/riscos/env/lib -lXrender -lX11 -lXau -lXdmcp

Name: Xft
Description: X FreeType library
Version: 2.1.8.2
Requires: fontconfig
Cflags: -I${includedir} ${freetypecflags}
Libs: -L${libdir} -lXft
Libs.private: -lX11 ${xrenderlibs} ${freetypelibs}
--8<--

Then I guess the result which I expect:

$ pkg-config --static --libs xft
-L/home/john/gccsdk/riscos/env/lib -lXft -lXrender -lX11 -lXau -lXdmcp -lfreetype -lfontconfig  

So is this something which isn't supported in pkg-config or may the Debian
patch for xft.pc.in not use dbl quotes for their variable definitions ?
Comment 1 John Tytgat 2006-09-19 14:48:57 UTC
Created attachment 7082 [details] [review]
Proposed patch to deal with dbl quoted variables

I'm attaching a patch I made to deal with the dbl quoted variables.  Feel free
to include this in next pkg-config version.
Comment 2 Daniel Macks 2006-09-19 15:05:03 UTC
I second this need to handle whitespace and quoting here. Shouldn't variable
values set by some-pkg.pc and used by some-other-program just be opaque blobs
from the perspective of pkg-config, which is just a conduit between the supplier
and consumer? See also bug #3571
Comment 3 Tollef Fog Heen 2010-05-27 14:02:36 UTC
This is really a dupe of 3571 which was fixed with the release of 0.24, so marking this as fixed too.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.