]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Convert argument to '--sysroot' option to relative path
authorMathias De Maré <mathias.de_mare@nokia.com>
Mon, 19 Sep 2016 08:38:13 +0000 (10:38 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 25 Sep 2016 18:48:06 +0000 (20:48 +0200)
Previously, only the argument to '--sysroot=' was converted.
This changeset adds support for '--sysroot'.

ccache.c

index 8ffadccc164ea11929801b87cec9c110bda8014c..76139b93571865c34306f14920aefb3d825b96b1 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -2407,6 +2407,21 @@ cc_process_args(struct args *args, struct args **preprocessor_args,
                        free(option);
                        continue;
                }
+               // Alternate form of specifying sysroot without =
+               if (str_eq(argv[i], "--sysroot")) {
+                       if (i == argc-1) {
+                               cc_log("Missing argument to %s", argv[i]);
+                               stats_update(STATS_ARGS);
+                               result = false;
+                               goto out;
+                       }
+                       args_add(stripped_args, argv[i]);
+                       char *relpath = make_relative_path(x_strdup(argv[i+1]));
+                       args_add(stripped_args, relpath);
+                       i++;
+                       free(relpath);
+                       continue;
+               }
                if (str_startswith(argv[i], "-Wp,")) {
                        if (str_eq(argv[i], "-Wp,-P")
                            || strstr(argv[i], ",-P,")