[ccache] Win32 support.

Ramiro Polla ramiro.polla at gmail.com
Mon May 10 15:05:02 MDT 2010


Hi,

Bad timing, I know, since 3.0pre1 has just been announced, but here it
goes anyways. This series of patches adds Win32 support for ccache.
Tested with mingw32. Compiling FFmpeg went from 5m13s (first run) to
45s (direct mode). Impressive!

The first 8 patches clean code up to simplify adding win32 support,
which comes in the last patch.
0001 Creates an x_fmmap function that opens, stats, and mmap()s a file.
0002 gzclose() opened file so it's not left open.
0003 Don't overwrite a file that is currently opened, windows doesn't
allow that.
0004 Split a function that will be reused on its own by win32 code.
0005 Simplify basename().
0006 Close more files before moving them (windows doesn't allow moving
opened files).
0007 Open files in binary mode.
0008 #include sys/wait.h under proper ifdefs.
0009 The core of the win32 stuff.

Windows >= XP is expected, I have no intention of getting it to work
with < XP, and I don't think anyone will care. Some things are still
hackish in the final patch, so I'd appreciate the other people that
have implemented their own win32 versions of ccache to review and
comment.

There is one other patch that I use to make sure the tests work. It
takes care of some remaining issues:
- getopt_long() gets compiled internally, but it's already available
in libmingwex.a, so there is a linking error. any autofoo experts to
take care of that?
- sed_in_place doesn't work in windows (can't write to a file currently open)
- the stdout test fails because echo is not a program
- there is no /dev/null in Windows, but there is NUL. It's a matter of
letting the test script know it's running under Windows and use the
proper name.
- some basedir tests don't work since mingw gcc transforms the file
names from msys to win32 by turning them into absolute paths.

It might be a better idea to create a branch for win32 for now so as
to not interfere with 3.0.

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Introduce-and-use-x_fmmap.patch
Type: application/octet-stream
Size: 6835 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Don-t-dup-fd-for-zlib-and-gzclose-gzdopen-d-file.patch
Type: application/octet-stream
Size: 742 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Don-t-overwrite-a-file-that-is-currently-opened.patch
Type: application/octet-stream
Size: 1565 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Split-find_executable_in_path-out-of-find_executab.patch
Type: application/octet-stream
Size: 1641 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Simplify-basename.patch
Type: application/octet-stream
Size: 697 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Close-manifest-files-before-moving-them.patch
Type: application/octet-stream
Size: 788 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Open-files-in-binary-mode.patch
Type: application/octet-stream
Size: 1095 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008--include-sys-wait.h-under-proper-ifdefs.patch
Type: application/octet-stream
Size: 580 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment-0007.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-Win32-support.patch
Type: application/octet-stream
Size: 11251 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment-0008.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32_tests.diff
Type: application/octet-stream
Size: 2496 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/ccache/attachments/20100510/c4518464/attachment-0009.obj>


More information about the ccache mailing list