Making patch files


Assume you have a library X, version 1.2.3, extracted in libX-1.2.3/ and that you have to integrate some fix in the build process. You would create a patch file that is applied before building that library. But how do you make the patch files depend on how you apply them.

To start, you save the libX-1.2.3/ directory in its current state (with existing patches applied) to say libX-1.2.3.orig using for example, rsync.

The easiest is to use diff -urN libX-1.2.3.orig/ libX-1.2.3/ > correction.patch
That patch file can later be used with patch -p1 < correction.patch

If the build process uses patch -p0, one has to create the patch file with
cd libX-1.2.3 && diff -urN ../libX-1.2.3.orig/ ./ > ../correction.patch

Share

Les commentaires sont fermés.