# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../pkgconfig/pkg-config-0.25-sysroot.patch # Copyright (C) 2010 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- Description: pkg-config is not taking care if PKG_CONFIG_SYSROOT_DIR environment variable was set, always prefering its defaults Bug-URL: http://bugs.freedesktop.org/show_bug.cgi?id=28264 This patch was directly taken from the freedesktop bug-tracker: see comment: http://bugs.freedesktop.org/show_bug.cgi?id=28264#c2 http://bugs.freedesktop.org/attachment.cgi?id=36074 diff -ru a/pkg.c b/pkg.c --- a/pkg.c 2010-05-08 21:14:17.000000000 +0100 +++ b/pkg.c 2010-06-05 12:32:08.006581822 +0100 @@ -751,13 +751,9 @@ { GSList *requires = NULL; GSList *conflicts = NULL; - GSList *system_directories = NULL; GSList *iter; GSList *requires_iter; GSList *conflicts_iter; - GSList *system_dir_iter = NULL; - int count; - const gchar *c_include_path; /* Be sure we have the required fields */ @@ -865,107 +861,6 @@ } g_slist_free (requires); - - /* We make a list of system directories that gcc expects so we can remove - * them. - */ -#ifndef G_OS_WIN32 - system_directories = g_slist_append (NULL, g_strdup ("/usr/include")); -#endif - - c_include_path = g_getenv ("C_INCLUDE_PATH"); - if (c_include_path != NULL) - { - system_directories = add_env_variable_to_list (system_directories, c_include_path); - } - - c_include_path = g_getenv ("CPLUS_INCLUDE_PATH"); - if (c_include_path != NULL) - { - system_directories = add_env_variable_to_list (system_directories, c_include_path); - } - - count = 0; - 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", 2) == 0) && (offset = 2))|| - ((strncmp (iter->data, "-I ", 3) == 0) && (offset = 3))) - { - if (offset == 0) - { - iter = iter->next; - continue; - } - - system_dir_iter = system_directories; - while (system_dir_iter != NULL) - { - if (strcmp (system_dir_iter->data, - ((char*)iter->data) + offset) == 0) - { - debug_spew ("Package %s has %s in Cflags\n", - pkg->name, (gchar *)iter->data); - if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS") == NULL) - { - debug_spew ("Removing %s from cflags for %s\n", iter->data, pkg->key); - ++count; - iter->data = NULL; - - break; - } - } - system_dir_iter = system_dir_iter->next; - } - } - - iter = iter->next; - } - - while (count) - { - pkg->I_cflags = g_slist_remove (pkg->I_cflags, NULL); - --count; - } - - g_slist_foreach (system_directories, (GFunc) g_free, NULL); - g_slist_free (system_directories); - -#ifdef PREFER_LIB64 -#define SYSTEM_LIBDIR "/usr/lib64" -#else -#define SYSTEM_LIBDIR "/usr/lib" -#endif - count = 0; - iter = pkg->L_libs; - while (iter != NULL) - { - if (strcmp (iter->data, "-L" SYSTEM_LIBDIR) == 0 || - strcmp (iter->data, "-L " SYSTEM_LIBDIR) == 0) - { - debug_spew ("Package %s has -L" SYSTEM_LIBDIR " in Libs\n", - pkg->name); - if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_LIBS") == NULL) - { - iter->data = NULL; - ++count; - debug_spew ("Removing -L" SYSTEM_LIBDIR " from libs for %s\n", pkg->key); - } - } - - iter = iter->next; - } -#undef SYSTEM_LIBDIR - - while (count) - { - pkg->L_libs = g_slist_remove (pkg->L_libs, NULL); - --count; - } } static char*