Create the Patch
The haikuporter program will apply the patch in the directory where the source package was extracted. For this to work, you need to create the patch like this:
- Place the directory (for example, named xyz-1.0.0) containing the original sources in a directory of your liking
- Place the directory containing the patched sources in the same directory. You'll need to rename it first, of course (say xyz-1.0.0-haiku
- Now create the patch with
diff -Naur xyz-1.0.0/ xyz-1.0.0-haiku/ > xyz-1.0.0.patch
Don't forget to clean your sources directories first (make distclean, for example).
- In the svn tree, create a directory named patches in the directory where the .bep is, and copy your new patch to this patches directory.
Congratulations! The generated patch is haikuporter compatible.
Note: when creating a patch from a svn or a similar repository, the developers of that software package will typically prefer it to be created from the top-most directory. However, haikuorter currently requires the patch to be created in the parent of that top-most directory.
As example, image we wish to create a patch of Haiku's OptionalPackage? file. Yes, I realize this is a horrible example.
cd /path/haiku/ cd ../ svn diff haiku/build/jam/OptionalPackages > ~/OptionalPackage-<new-pkg>.patch
Cleaning your patch
When making a patch, be sure to check it over for stray files, you should verify that it only contains files you modified and not files that were generated during the build process. Examples of files that shouldn't be in a patch: config.guess, config.sub, acinclude.m4, aclocal.m4, etc.
One sure way to make a clean patch is to keep track of which files you modified. Say you modified main.c, Makefile.in and configure.in, create a new folder on your desktop and copy these three files you modified into it. Then extract the original source archive you downloaded into a fresh directory, and then right click it and create a duplicate of it. Now rename that duplicate to change the " copy" part to "-haiku". Now copy those 3 files you save earlier into that new "-haiku" directory, making sure to put them into the correct directories inside that "-haiku" one. Then create your patch from the parent directory that contains the original and the "-haiku" directories:
> ls xyz-1.2.3 xyz-1.2.3-haiku > diff -Naur xyz-1.2.3 xyz-1.2.3-haiku > xyz-1.2.3.patch
Then check your newly created patch, it should only contain the three files you modified, in this case main.c, Makefile.in and configure.in.