[ccache] [PATCH] Some patches for Xcode support

Bernhard Bauer bauerb at google.com
Mon May 17 06:27:12 MDT 2010


On Sunday, May 16, 2010, Joel Rosdahl  wrote:
> On 2010-05-12 15:52, Bernhard Bauer wrote:
>> attached are some patches needed to make compiling under Mac OS X with
>> Xcode/distcc work.
>
> Thanks!
>
>> 0001-Add-Objective-C-to-the-mapping-from-source-files-to-.patch
>
> Sure. Applied.
>
>> 0002-Add-fpreprocessed-option-for-compiling-preprocessed-.patch
>
> Is this needed because GCC doesn't add -fpreprocessed implicitly like it
> does for .i/.ii/.mi files?
>
> The patch looks OK, except that it seems that -fpreprocessed was added
> in GCC 3.0, so GCC 2.95 wouldn't be supported anymore if we add the flag
> unconditionally. I don't know if anyone still uses GCC 2.95, but maybe
> we could do it like this instead:
>
> --- a/ccache.c
> +++ b/ccache.c
> @@ -497,6 +497,14 @@ static void to_cache(ARGS *args)
>         putenv("DEPENDENCIES_OUTPUT");
>
>         if (compile_preprocessed_source_code) {
> +               char *p = strrchr(i_tmpfile, '.');
> +               if (p && strcmp(p, ".mii") == 0) {
> +                       /*
> +                        * GCC doesn't add -fpreprocessed implicitly for .mii
> +                        * files, so we have to add it ourselves.
> +                        */
> +                       args_add(args, "-fpreprocessed");
> +               }
>                 args_add(args, i_tmpfile);
>         } else {
>                 args_add(args, input_file);
>
> What do you think?

Or maybe it got confused by the -x option added by xcodebuild (for
which I used Dirk Best's preliminary patch, so I didn't repeat it
here). I'll find out which one is the case.

>> 0003-Fix-a-bug-where-a-compiler-invocation-with-distcc-di.patch
>
> I'm don't think that's a good idea, since the executable flag can be set
> on source code files as well, either by mistake or because the file
> system (for instance vfat) may display all files as executable.
>
> Maybe you set CCACHE_PREFIX to distcc instead? See
> .

The problem is that distcc is called directly by xcodebuild, so I'm
masquerading ccache as distcc via a symlink. Maybe the proper way here
is to change the command line parsing so that it can cope with an
additional argument when called as distcc.

Bernhard.

> ccache mailing list
> ccache at lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache
>


More information about the ccache mailing list