Upgrading Wine with a Patch

If you have the Wine source code, as opposed to a binary distribution, you have the option of applying patches to the source tree to fix bugs and add experimental features. Perhaps you've found a bug, reported it to the Wine mailing list, and received a patch file to fix the bug. You can apply the patch with the patch command, which takes a streamed patch from stdin:

$ cd wine
$ patch -p0 < ../patch_to_apply.diff
      

To remove the patch, use the -R option:

$ patch -p0 -R < ../patch_to_apply.diff
      

If you want to do a test run to see if the patch will apply successfully (e.g., if the patch was created from an older or newer version of the tree), you can use the --dry-run parameter to run the patch without writing to any files:

$ patch -p0 --dry-run < ../patch_to_apply.diff
      

patch is pretty smart about extracting patches from the middle of a file, so if you save an email with an inlined patch to a file on your hard drive, you can invoke patch on it without stripping out the email headers and other text. patch ignores everything that doesn't look like a patch.

FIXME: Go into more depth about the -p0 option...