Ensure -isystem Cflags not compressed like -I

Treat -isystem specially like -idirafter so that multiple arguments
retain the preceding -isystem.

Freedesktop #72584 (https://bugs.freedesktop.org/show_bug.cgi?id=72584)
This commit is contained in:
Dan Nicholson 2013-12-14 09:24:51 -08:00
parent 860cab9a3e
commit abdbaba3e0
3 changed files with 9 additions and 7 deletions

View file

@ -4,7 +4,7 @@ set -e
. ${srcdir}/common
RESULT="-idirafter /after1 -idirafter /after2 -I/foo -I/bar"
RESULT="-isystem /system1 -idirafter /after1 -idirafter /after2 -isystem /system2 -I/foo -I/bar"
run_test --cflags special-flags
RESULT="-framework Foo -lsimple -framework Bar"

View file

@ -8,4 +8,4 @@ Description: Dummy pkgconfig test package for testing pkgconfig
Version: 1.0.0
Requires:
Libs: -framework Foo -lsimple -framework Bar
Cflags: -I/foo -idirafter /after1 -I/bar -idirafter /after2
Cflags: -I/foo -isystem /system1 -idirafter /after1 -I/bar -idirafter /after2 -isystem /system2

12
parse.c
View file

@ -851,17 +851,19 @@ parse_cflags (Package *pkg, const char *str, const char *path)
flag->arg = g_strconcat ("-I", p, NULL);
pkg->cflags = g_list_prepend (pkg->cflags, flag);
}
else if (strcmp("-idirafter", arg) == 0 && i+1 < argc)
else if ((strcmp ("-idirafter", arg) == 0 ||
strcmp ("-isystem", arg) == 0) &&
i+1 < argc)
{
char *dirafter, *tmp;
char *option, *tmp;
tmp = trim_string (argv[i+1]);
dirafter = strdup_escape_shell (tmp);
option = strdup_escape_shell (tmp);
flag->type = CFLAGS_OTHER;
flag->arg = g_strconcat (arg, " ", dirafter, NULL);
flag->arg = g_strconcat (arg, " ", option, NULL);
pkg->cflags = g_list_prepend (pkg->cflags, flag);
i++;
g_free (dirafter);
g_free (option);
g_free (tmp);
}
else if (*arg != '\0')