| Summary: |
--cflags request incomplete if the var. PKG_CONFIG_SYSROOT_DIR is set |
| Product: |
pkg-config
|
Reporter: |
Giorgio <iw3gtf> |
| Component: |
src | Assignee: |
Tollef Fog Heen <tfheen> |
| Status: |
RESOLVED
FIXED
|
QA Contact: |
|
| Severity: |
normal
|
|
|
| Priority: |
medium
|
CC: |
amery, jon.dufresne
|
| Version: |
unspecified | |
|
| Hardware: |
All | |
|
| OS: |
All | |
|
| Whiteboard: |
|
|
i915 platform:
|
|
i915 features:
|
|
| Attachments: |
patch to fix bug
|
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.
Take a xtrans.pc file like: prefix=/usr exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: XTrans Description: Abstract network code for X Version: 1.2.1 Cflags: -I${includedir} -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT and call pkg-config from a bash like (all on one line): PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_PATH=/sources/emb_prj/dest/usr/lib/pkgconfig PKG_CONFIG_SYSROOT_DIR=/sources/emb_prj/dest pkg-config --cflags "xtrans" than all I get is: -I/sources/emb_prj/dest/usr/include instead of the expected: -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/sources/emb_prj/dest/usr/include The three preprocessor variable defs are missing. The problem does NOT occur if the env. var. PKG_CONFIG_SYSROOT_DIR is not defined. I could trace down the bug in the function 'string_list_to_string()' defined in pkg.c: static char * string_list_to_string (GSList *list) { GSList *tmp; GString *str = g_string_new (""); char *retval; tmp = list; while (tmp != NULL) { char *tmpstr = (char*) tmp->data; if (pcsysrootdir != NULL) { if (tmpstr[0] == '-' && (tmpstr[1] == 'I' || tmpstr[1] == 'L')) { g_string_append_c (str, '-'); g_string_append_c (str, tmpstr[1]); g_string_append (str, pcsysrootdir); g_string_append (str, tmpstr+2); } } else { g_string_append (str, tmpstr); } g_string_append_c (str, ' '); tmp = g_slist_next (tmp); } retval = str->str; g_string_free (str, FALSE); return retval; } If the var. 'pcsysrootdir' is not NULL *and* the 'tmpstr' does not start with '-I' or '-L' then the string 'tmpstr' won't be appended to the result 'str'.