summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck/check-special-flags2
-rwxr-xr-xcheck/check-sysroot2
-rw-r--r--parse.c4
-rw-r--r--pkg.c27
4 files changed, 26 insertions, 9 deletions
diff --git a/check/check-special-flags b/check/check-special-flags
index 35b56e6..78e6341 100755
--- a/check/check-special-flags
+++ b/check/check-special-flags
@@ -4,7 +4,7 @@ set -e
. ${srcdir}/common
-RESULT="-g -isystem /system1 -idirafter /after1 -ffoo -idirafter /after2 -isystem /system2 -I/foo -I/bar"
+RESULT="-g -ffoo -I/foo -isystem /system1 -idirafter /after1 -I/bar -idirafter /after2 -isystem /system2"
run_test --cflags special-flags
RESULT="-L/foo -L/bar -framework Foo -lsimple -framework Bar -Wl,-framework -Wl,Baz"
diff --git a/check/check-sysroot b/check/check-sysroot
index 43d0b5b..7da415f 100755
--- a/check/check-sysroot
+++ b/check/check-sysroot
@@ -31,7 +31,7 @@ run_test --cflags public-dep
RESULT="-L$root/sysroot/public-dep/lib -lpublic-dep"
run_test --libs public-dep
-RESULT="-g -isystem /system1 -idirafter /after1 -ffoo -idirafter /after2 -isystem /system2 -I$root/sysroot/foo -I$root/sysroot/bar"
+RESULT="-g -ffoo -I$root/sysroot/foo -isystem $root/sysroot/system1 -idirafter $root/sysroot/after1 -I$root/sysroot/bar -idirafter $root/sysroot/after2 -isystem $root/sysroot/system2"
run_test --cflags special-flags
RESULT="-L$root/sysroot/foo -L$root/sysroot/bar -framework Foo -lsimple -framework Bar -Wl,-framework -Wl,Baz"
diff --git a/parse.c b/parse.c
index 229d6f2..7bb666d 100644
--- a/parse.c
+++ b/parse.c
@@ -861,7 +861,9 @@ parse_cflags (Package *pkg, const char *str, const char *path)
tmp = trim_string (argv[i+1]);
option = strdup_escape_shell (tmp);
- flag->type = CFLAGS_OTHER;
+
+ /* These are -I flags since they control the search path */
+ flag->type = CFLAGS_I;
flag->arg = g_strconcat (arg, " ", option, NULL);
pkg->cflags = g_list_prepend (pkg->cflags, flag);
i++;
diff --git a/pkg.c b/pkg.c
index bff5c42..ae630c4 100644
--- a/pkg.c
+++ b/pkg.c
@@ -434,10 +434,21 @@ flag_list_to_string (GList *list)
char *tmpstr = flag->arg;
if (pcsysrootdir != NULL && flag->type & (CFLAGS_I | LIBS_L)) {
- g_string_append_c (str, '-');
- g_string_append_c (str, tmpstr[1]);
- g_string_append (str, pcsysrootdir);
- g_string_append (str, tmpstr+2);
+ /* Handle non-I Cflags like -isystem */
+ if (flag->type & CFLAGS_I && strncmp (tmpstr, "-I", 2) != 0) {
+ char *space = strchr (tmpstr, ' ');
+
+ /* Ensure this has a separate arg */
+ g_assert (space != NULL && space[1] != '\0');
+ g_string_append_len (str, tmpstr, space - tmpstr + 1);
+ g_string_append (str, pcsysrootdir);
+ g_string_append (str, space + 1);
+ } else {
+ 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);
}
@@ -772,8 +783,12 @@ verify_package (Package *pkg)
if (!(flag->type & CFLAGS_I))
continue;
- /* 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
+ /* Handle the system cflags. 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.
+ *
+ * Note that the -i* flags are left out of this handling since
+ * they're intended to adjust the system cflags behavior.
*/
if (((strncmp (flag->arg, "-I", 2) == 0) && (offset = 2))||
((strncmp (flag->arg, "-I ", 3) == 0) && (offset = 3)))