[PATH] sysroot handling
malet jean-luc alias cityhunter
jlm_devel at laposte.net
Fri Sep 16 09:12:04 PDT 2005
you patch faster than I reply ^_^
I'll test it.... I think this is a good addition... that should be in
next pkg-config release!
Enrico Weigelt a écrit :
>Hi folks,
>
>i've a little patch to handle sysroot environments properly.
>It simply adds $SYSROOT to library and include pathes if set.
>
>cu
>
>
>------------------------------------------------------------------------
>
>diff -ruN pkg-config-0.18.1.orig/pkg.c pkg-config-0.18.1/pkg.c
>--- pkg-config-0.18.1.orig/pkg.c Sat Aug 27 22:18:14 2005
>+++ pkg-config-0.18.1/pkg.c Sat Aug 27 22:38:30 2005
>@@ -886,6 +886,31 @@
> iter = iter->next;
> }
>
>+ /* special handling for SYSROOT */
>+ const char* sysroot = getenv("SYSROOT");
>+
>+ if (sysroot)
>+ {
>+ iter = pkg->I_cflags;
>+ while (iter != NULL)
>+ {
>+ gint offset = 0;
>+ /* we put things in canonical -I/usr/include (vs. -I /usr/include) format,
>+ * but if someone changes it later we may as well be robust
>+ */
>+ if (strncmp(iter->data,"-I/", 3)==0)
>+ {
>+ char buffer[4096];
>+ strcpy(buffer,"-I");
>+ strcat(buffer,sysroot);
>+ strcat(buffer,(iter->data)+2);
>+ free(iter->data);
>+ iter->data = strdup(buffer);
>+ }
>+ iter = iter->next;
>+ }
>+ }
>+
> while (count)
> {
> pkg->I_cflags = g_slist_remove (pkg->I_cflags, NULL);
>@@ -920,6 +945,26 @@
> iter = iter->next;
> }
> #undef SYSTEM_LIBDIR
>+
>+ /* --- special handling for sysroot --- */
>+ if (sysroot)
>+ {
>+ debug_spew("Special handling for SYSROOT ...\n");
>+ iter = pkg->L_libs;
>+ while (iter != NULL)
>+ {
>+ char buffer[4096] = "\0";
>+ if (strncmp(iter->data, "-L/", 3)==0)
>+ {
>+ strcpy(buffer,"-L");
>+ strcat(buffer,sysroot);
>+ strcat(buffer,(iter->data)+2);
>+ free(iter->data);
>+ iter->data = strdup(buffer);
>+ }
>+ iter = iter->next;
>+ }
>+ }
>
> while (count)
> {
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>pkg-config mailing list
>pkg-config at lists.freedesktop.org
>http://lists.freedesktop.org/mailman/listinfo/pkg-config
>
>
More information about the pkg-config
mailing list