PatchingIn the preparation of the port, files that have been added or
- changed can be picked up with a recursive &man.diff.1;
- for later feeding to &man.patch.1;. Each set of patches you
- wish to apply should be collected into a file named
+ changed can be picked up with a &man.diff.1;
+ for later feeding to &man.patch.1;. Each patch you
+ wish to apply should be saved into a file named
patch-* where
* indicates
- the pathnames of the files that are patched,
+ the pathname of the file that is patched,
such as patch-Imakefile or
patch-src-config.h. These files should
- be stored in PATCHDIR, from where they will be
+ be stored in PATCHDIR
+ (usually files/, from where they will be
automatically applied. All patches must be relative to
WRKSRC (generally the directory your port's
tarball unpacks itself into, that being where the build is done).
@@ -673,6 +674,21 @@ PLIST_DIRS= lib/X11/oneko
lines!); define USE_AUTOTOOLS=autoconf:253 and take the
diffs of configure.in.
+ If you had to delete a file, then you can do it in the
+ post-extract target rather than as part of
+ the patch.
+
+ Simple replacements can be performed directly from the port
+ Makefile using the in-place mode of
+ &man.sed.1;. This is very useful when you need to patch in
+ a variable value. Example:
+
+ USE_REINPLACE= yes
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|for Linux|for FreeBSD|g' ${WRKSRC}/README
+ @${REINPLACE_CMD} -e 's|-pthread|${PTHREAD_LIBS}|' ${WRKSRC}/configure
+
Quite often, there is a situation when the software being
ported, especially if it is primarily developed on &windows;, uses
the CR/LF convention for most of its source files. This may cause
@@ -691,11 +707,6 @@ post-extract:
above can be omitted. Be aware that this
piece of code will strip all trailing control characters from each
line of processed file (except \n).
-
- Also, if you had to delete a file, then you can do it in the
- post-extract target rather than as part of
- the patch. Once you are happy with the resulting diff, please split
- it up into one source file per patch file.