+2008-01-16 Tollef Fog Heen <tfheen@err.no>
+
+ * pkg.h, pkg.c (string_list_to_string), pkg-config.1, main.c
+ (main): Add sysroot support and document same. Triggered by
+ setting PKG_CONFIG_SYSROOT_DIR in the environment.
+
2007-12-29 Tollef Fog Heen <tfheen@err.no>
* pkg.c (internal_get_package): Don't add the internal-only
static int want_debug_spew = 0;
static int want_verbose_errors = 0;
static int want_stdout_errors = 0;
+char *pcsysrootdir = NULL;
void
debug_spew (const char *format, ...)
}
#endif
+ pcsysrootdir = getenv ("PKG_CONFIG_SYSROOT_DIR");
+ if (pcsysrootdir)
+ {
+ define_global_variable ("pc_sysrootdir", pcsysrootdir);
+ }
+ else
+ {
+ define_global_variable ("pc_sysrootdir", "/");
+ }
+
pcbuilddir = getenv ("PKG_CONFIG_TOP_BUILD_DIR");
if (pcbuilddir)
{
.I "PKG_CONFIG_ALLOW_SYSTEM_LIBS"
Don't strip -L/usr/lib out of libs
+.TP
+.I "PKG_CONFIG_SYSROOT_DIR"
+Modify -I and -L to use the directories located in target sysroot.
+this option is usefull when crosscompiling package that use pkg-config
+to determine CFLAGS anf LDFLAGS. -I and -L are modified to point to
+the new system root. this means that a -I/usr/include/libfoo will
+become -I/var/target/usr/include/libfoo with a PKG_CONFIG_SYSROOT_DIR
+equal to /var/target (same rule apply to -L)
+
.TP
.I "PKG_CONFIG_LIBDIR"
Replaces the default \fIpkg-config\fP search directory.
tmp = list;
while (tmp != NULL)
{
- g_string_append (str, tmp->data);
+ 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);
/* If TRUE, do not automatically prefer uninstalled versions */
extern gboolean disable_uninstalled;
+extern char *pcsysrootdir;
+
#ifdef G_OS_WIN32
/* If TRUE, do not automatically define "prefix" while
* parsing each .pc file */